Examples of IScanner


Examples of com.subgraph.vega.api.scanner.IScanner

import com.subgraph.vega.ui.scanner.wizards.NewWizardDialog;

public class ScanExecutor {
 
  public String runScan(Shell shell, String target) {
    final IScanner scanner = Activator.getDefault().getScanner();
    final IScan scan = scanner.createScan();
    final Collection<IIdentity> identities = Activator.getDefault().getModel().getCurrentWorkspace().getIdentityModel().getAllIdentities();

    NewScanWizard wizard = new NewScanWizard(target, identities, scan.getModuleList(), scan.getConfig().getDefaultExcludedParameterNames());
    WizardDialog dialog = new NewWizardDialog(shell, wizard);
    if(dialog.open() == IDialogConstants.OK_ID) {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.compiler.IScanner

    this.lineCommentEndOffsets= new LineCommentEndOffsets(comments);
  }
   
  final TokenScanner getScanner() {
    if (this.tokenScanner == null) {
      IScanner scanner= ToolFactory.createScanner(true, false, false, false);
      scanner.setSource(this.content);
      this.tokenScanner= new TokenScanner(scanner);
    }
    return this.tokenScanner;
  }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.compiler.IScanner

    buf = compilationUnit.getBuffer();
  }
  final int start= range.getOffset();
  final int length= range.getLength();
  if (length > 0 && buf.getChar(start) == '/') {
    IScanner scanner= ToolFactory.createScanner(true, false, false, false);
    scanner.setSource(buf.getText(start, length).toCharArray());
    try {
      int docOffset= -1;
      int docEnd= -1;
     
      int terminal= scanner.getNextToken();
      loop: while (true) {
        switch(terminal) {
          case ITerminalSymbols.TokenNameCOMMENT_JAVADOC :
            docOffset= scanner.getCurrentTokenStartPosition();
            docEnd= scanner.getCurrentTokenEndPosition() + 1;
            terminal= scanner.getNextToken();
            break;
          case ITerminalSymbols.TokenNameCOMMENT_LINE :
          case ITerminalSymbols.TokenNameCOMMENT_BLOCK :
            terminal= scanner.getNextToken();
            continue loop;
          default :
            break loop;
        }
      }
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IScanner

  /**
   * @param template Generated comment
   * @return Is `template' a valid comment?
   */
  protected boolean isValidComment(String template) {
    IScanner scanner = ToolFactory.createScanner(true, false, false, false);
    scanner.setSource(template.toCharArray());
    try {
      int next = scanner.getNextToken();
      while (TokenScanner.isComment(next)) {
        next = scanner.getNextToken();
      }
      return next == ITerminalSymbols.TokenNameEOF;
    } catch (InvalidInputException e) {
    }
    return false;
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IScanner

        return null;

    }

    private boolean isValidComment(String template) {
        IScanner scanner = ToolFactory.createScanner(true, false, false, false);
        scanner.setSource(template.toCharArray());
        try {
            int next = scanner.getNextToken();
            while (TokenScanner.isComment(next)) {
                next = scanner.getNextToken();
            }
            return next == ITerminalSymbols.TokenNameEOF;
        } catch (InvalidInputException e) {}
        return false;
    }
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IScanner

        return null;

    }

    private boolean isValidComment(String template) {
        IScanner scanner = ToolFactory.createScanner(true, false, false, false);
        scanner.setSource(template.toCharArray());
        try {
            int next = scanner.getNextToken();
            while (TokenScanner.isComment(next)) {
                next = scanner.getNextToken();
            }
            return next == ITerminalSymbols.TokenNameEOF;
        } catch (InvalidInputException e) {}
        return false;
    }
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IScanner

    public ISourceRange findIdentifier(ICompilationUnit theCU, int offset, int length) throws JavaModelException {
        return findTokenOfType(theCU, ITerminalSymbols.TokenNameIdentifier, offset, length);
    }
   
    public ISourceRange findTokenOfType(ICompilationUnit theCU, int tokenType, int offset, int length) throws JavaModelException {
        IScanner scanner = ToolFactory.createScanner(false, false, false, false);
        scanner.setSource(theCU.getSource().toCharArray());
        scanner.resetTo(offset, offset + length);
        int token;
        try {
            while ((token = scanner.getNextToken()) != ITerminalSymbols.TokenNameEOF) {
                if (token == tokenType) {
                    return new SourceRange(scanner.getCurrentTokenStartPosition(),
                                           scanner.getCurrentTokenEndPosition() + 1 - scanner.getCurrentTokenStartPosition());
                }
            }
        } catch (InvalidInputException e) {
            throw new RuntimeException("Error finding token: "+e.getMessage(), e);
        }
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IScanner

    public static interface FoundToken {
        void found(int tokenType, int offset, int length);
    }
   
    public void scanTokens(ICompilationUnit theCU, int offset, int length, FoundToken callback) throws JavaModelException {
        IScanner scanner = ToolFactory.createScanner(false, false, false, false);
        scanner.setSource(theCU.getSource().toCharArray());
        scanner.resetTo(offset, offset + length);
        int token;
        try {
            while ((token = scanner.getNextToken()) != ITerminalSymbols.TokenNameEOF) {
                callback.found(token, scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition() + 1 - scanner.getCurrentTokenStartPosition());
            }
        } catch (InvalidInputException e) {
            throw new RuntimeException("Error finding token: "+e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IScanner

    }

    private int calculateNumberOfLines(String source) {
      String sourceToAnalyze = source.trim();
      Set<Integer> lineSet = new HashSet<Integer>();
      IScanner scanner = ToolFactory.createScanner(false, false, true,
          true);
      scanner.setSource(sourceToAnalyze.toCharArray());
      try {
        while (true) {
          int token = scanner.getNextToken();
          if (token == ITerminalSymbols.TokenNameEOF)
            break;
          int startPosition = scanner.getCurrentTokenStartPosition();
          int lineNumber = scanner.getLineNumber(startPosition);
          lineSet.add(Integer.valueOf(lineNumber));
        }
      } catch (InvalidInputException e) {
        e.printStackTrace();
      }
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IScanner

      try {
        String sourceText = getSource(source).trim();
        Set<Integer> lineSet = new HashSet<Integer>();
        int commentLines = 0;
        int totalLines = 0;
        IScanner scanner = ToolFactory.createScanner(true, false, true,
            true);
        scanner.setSource(sourceText.toCharArray());
        try {
          while (true) {
            int token = scanner.getNextToken();
            if (token == ITerminalSymbols.TokenNameEOF) {
              int startPosition = scanner
                  .getCurrentTokenStartPosition();
              totalLines = scanner.getLineNumber(startPosition);
              break;
            }

            if ((token == ITerminalSymbols.TokenNameCOMMENT_LINE)
                || (token == ITerminalSymbols.TokenNameCOMMENT_BLOCK)
                || (token == ITerminalSymbols.TokenNameCOMMENT_JAVADOC)) {
              commentLines++;
            } else {
              int startPosition = scanner
                  .getCurrentTokenStartPosition();
              int lineNumber = scanner
                  .getLineNumber(startPosition);
              lineSet.add(Integer.valueOf(lineNumber));
            }
          }
        } catch (InvalidInputException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.