Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.ASTParser.createAST()


      bs
          .append("package snippet;import java.io.PrintWriter;");
      ASTParser newParser = ASTParser.newParser(AST.JLS3);
      newParser.setSource(str.toCharArray());
      StringBuilder bls=new StringBuilder(str);
      CompilationUnit createAST = (CompilationUnit) newParser.createAST(null);
      //ArrayList<String> results = new ArrayList<String>();
      for (Object n : createAST.imports()) {
        ImportDeclaration decl = (ImportDeclaration) n;
        String name = decl.getName().getFullyQualifiedName();
        if (decl.isOnDemand()) {
View Full Code Here


  protected String[] getImports() {
    String snippet = getSourceViewer().getDocument().get();
    ASTParser newParser = ASTParser.newParser(AST.JLS3);
    newParser.setSource(snippet.toCharArray());
    CompilationUnit createAST = (CompilationUnit) newParser.createAST(null);
    ArrayList<String> results = new ArrayList<String>();
    for (Object n : createAST.imports()) {
      ImportDeclaration decl = (ImportDeclaration) n;
      String name = decl.getName().getFullyQualifiedName();
      if (decl.isOnDemand()) {
View Full Code Here

 
  private void goThroughClass(ICompilationUnit ClassContent, final String contextTypeId) {
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(ClassContent);
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    final CompilationUnit cu = (CompilationUnit) parser.createAST(null);
    cu.accept(new ASTVisitor() {
      private boolean parameter = false;
      private String paramName = "";
      public void endVisit(FieldDeclaration node) {
        paramName = "";
View Full Code Here

        parser.setResolveBindings(true);
        parser.setStatementsRecovery(true);
        parser.setBindingsRecovery(true);
        parser.setSource(input);
       
        CompilationUnit astRoot = (CompilationUnit)parser.createAST(monitor);
       
        if (astRoot != null && !monitor.isCanceled()) {
          Object[] listeners;
          synchronized (PartListenerGroup.this) {
            listeners= fAstListeners.getListeners();
View Full Code Here

  private void goThroughClass(String ClassContent) {
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(ClassContent.toCharArray());
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    final CompilationUnit cu = (CompilationUnit) parser.createAST(null);
    cu.accept(new ASTVisitor() {

      private String elNodeName;
      private boolean intoEL;
View Full Code Here

  private void goThroughClass(String ClassContent) {
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(ClassContent.toCharArray());
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    final CompilationUnit cu = (CompilationUnit) parser.createAST(null);
    cu.accept(new ASTVisitor() {

      private String elNodeName;
      private boolean intoEL;
      private boolean definedId;
View Full Code Here

            ASTParser parser = ASTParser.newParser(AST.JLS4);
            parser.setKind(ASTParser.K_COMPILATION_UNIT);
            parser.setSource(compilationUnit);
            // a switch for turning on/off resolve bindings
            parser.setResolveBindings(ifBindings);
            parser.createAST(null).accept(this);
          }
        }
      }
    }
    return all;
View Full Code Here

            ASTParser parser = ASTParser.newParser(AST.JLS4);
            parser.setKind(ASTParser.K_COMPILATION_UNIT);
            parser.setSource(compilationUnit);
            // a switch for turning on/off resolve bindings
            parser.setResolveBindings(ifBindings);
            parser.createAST(null).accept(this);
          }
        }
      }
    }
  }
View Full Code Here

    ASTParser parser = ASTParser.newParser(AST.JLS4);
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setSource(iUnit);
    parser.setResolveBindings(true);
    Visitor visitor = new Visitor();
    CompilationUnit unit = (CompilationUnit) parser.createAST(null);
    unit.accept(visitor);
    return unit; // parse
  }

  /**
 
View Full Code Here

  public static CompilationUnit parse (ICompilationUnit iUnit){
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setSource(iUnit);
    parser.setResolveBindings(true);
    return (CompilationUnit) parser.createAST(null);
  }
}
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.