Package org.eclipse.jdt.core.dom

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


            }
          });
          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


  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);
  }

 
  public ICompilationUnit generate(WidgetAdapter root, IProgressMonitor monitor) {
View Full Code Here

      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

      e.printStackTrace();
    }
    unit = JavaCore.createCompilationUnitFrom(file);
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(unit);
    cunit = (CompilationUnit) parser.createAST(null);
  }

  @Override
  protected IStatus run(IProgressMonitor monitor) {
    if (componentType != null) {
View Full Code Here

      ICompilationUnit icunit = type.getCompilationUnit();
      String source = icunit.getBuffer().getContents();
      Document document = new Document(source);
      ASTParser parser = ASTParser.newParser(AST.JLS3);
      parser.setSource(icunit);
      CompilationUnit cunit = (CompilationUnit) parser.createAST(null);
      cunit.recordModifications();
      AST ast = cunit.getAST();
      TypeDeclaration typeDec = (TypeDeclaration) cunit.types().get(0);
      List list = typeDec.superInterfaceTypes();
      Name name = ast.newName(cName);
View Full Code Here

    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setProject(javaProject);
    parser.setSource(code.toCharArray());
    parser.setUnitName("/CrystalTest/" + qualifiedCompUnitName);
    parser.setResolveBindings(true);
    node = (CompilationUnit) parser.createAST(null);
   
    Message[] msgs = node.getMessages();
    if(msgs.length > 0) {
      StringBuffer errs = new StringBuffer();
      errs.append("Compiler problems for ");
View Full Code Here

     for(; iter.hasNext() ;) {
       compUnit = iter.next();
        parser = ASTParser.newParser(AST.JLS3);
       parser.setResolveBindings(true);
       parser.setSource(compUnit);
       node = parser.createAST(null);
       parsedCompilationUnits.put(compUnit, node);
     }
     return parsedCompilationUnits;
  }
 
View Full Code Here

  public static ASTNode getASTNodeFromCompilationUnit(ITypeRoot compUnit) {
     ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setResolveBindings(true);
    parser.setSource(compUnit);
    try {
      return parser.createAST(/* passing in monitor messes up previous monitor state */ null);
    } catch (IllegalStateException e) {
      log.log(Level.SEVERE, "could not parse " + compUnit, e);
      throw e;
    }
  }
View Full Code Here

     for(; iter.hasNext() ;) {
       compUnit = iter.next();
        parser = ASTParser.newParser(AST.JLS3);
       parser.setResolveBindings(true);
       parser.setSource(compUnit);
       node = parser.createAST(null);
       parsedCompilationUnits.put(compUnit, node);
     }
     return parsedCompilationUnits;
  }
 
View Full Code Here

   */
  public static ASTNode getASTNodeFromCompilationUnit(ICompilationUnit compUnit) {
     ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setResolveBindings(true);
    parser.setSource(compUnit);
    return parser.createAST(/* passing in monitor messes up previous monitor state */ null);
  }

  /**
   * Given an IType from the model, this method will return the ast node
   * associated with that type, or null if it doesn't exist.
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.