Examples of ASTParser


Examples of org.eclipse.jdt.core.dom.ASTParser

     
      // create AST
      try
      {
        // use the parser directly, the use of static shared classes don't work with multipage editor
        ASTParser parser = ASTParser.newParser(AST.JLS3);
        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

Examples of org.eclipse.jdt.core.dom.ASTParser

    }
    return completionList;
  }

  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

Examples of org.eclipse.jdt.core.dom.ASTParser

    }
    return completionList;
  }

  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

Examples of org.eclipse.jdt.core.dom.ASTParser

      for (IPackageFragment packageFragment : project
          .getPackageFragments()) {
        if (packageFragment.getKind() == IPackageFragmentRoot.K_SOURCE) {
          for (ICompilationUnit compilationUnit : packageFragment
              .getCompilationUnits()) {
            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

Examples of org.eclipse.jdt.core.dom.ASTParser

      for (IPackageFragment packageFragment : project
          .getPackageFragments()) {
        if (packageFragment.getKind() == IPackageFragmentRoot.K_SOURCE) {
          for (ICompilationUnit compilationUnit : packageFragment
              .getCompilationUnits()) {
            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

Examples of org.eclipse.jdt.core.dom.ASTParser

   *
   * @param unit
   * @return
   */
  public static CompilationUnit parse(ICompilationUnit iUnit) {
    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

Examples of org.eclipse.jdt.core.dom.ASTParser

   * creates a AST tree based on the ICompilationUnit passed in
   * @param iUnit
   * @return a CompilationUnit
   */
  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

Examples of org.eclipse.jdt.core.dom.ASTParser

            public Object doTask() throws Throwable {
              return createBeanFromClass(beanClass);
            }
          });
          WidgetAdapter beanAdapter = ExtensionRegistry.createWidgetAdapter(bean);
          ASTParser parser = ASTParser.newParser(AST.JLS3);
          parser.setSource(unit);
          CompilationUnit cunit = (CompilationUnit) parser.createAST(null);
          parseEventListener(cunit, beanAdapter);
          initDesignedWidget(cunit, bean);
          parsePropertyValue(lnf, cunit, beanAdapter);
          beanAdapter.clearDirty();
          return beanAdapter;
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ASTParser

    IType type = unit.getType(unit_name);
    return type;
  }

  public static ImportRewrite createImportRewrite(ICompilationUnit unit) {
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(unit);
    parser.setResolveBindings(false);
    parser.setFocalPosition(0);
    CompilationUnit cu = (CompilationUnit) parser.createAST(null);
    return CodeStyleConfiguration.createImportRewrite(cu, true);
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ASTParser

          nonExistingFields.add(name);
      }
      for (String nonfield : nonExistingFields) {
        removedNames.remove(nonfield);
      }
      ASTParser astparser = ASTParser.newParser(AST.JLS3);
      astparser.setSource(unit);
      CompilationUnit cunit = (CompilationUnit) astparser.createAST(null);
      List<String> getmethods = new ArrayList<String>();
      for (int i = 0; i < removedNames.size(); i++) {
        String removed_name = removedNames.get(i);
        String getmethod = NamespaceUtil.getGetMethodName(cunit, removed_name);
        getmethods.add(getmethod);
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.