Package org.eclipse.jdt.core.dom.rewrite

Examples of org.eclipse.jdt.core.dom.rewrite.ImportRewrite.rewriteImports()


        try
        {
            ImportRewrite rewrite = CodeStyleConfiguration.createImportRewrite(
                fCompilationUnit, true);
            rewrite.addImport(result.getClassName());
            JavaModelUtil.applyEdit(fCompilationUnit, rewrite.rewriteImports(null),
                false, null);
        }
        catch (CoreException e)
        {
            SigilCore.error("Failed to add import", e);
View Full Code Here


        if (!success)
          return null;
        removeRemovedComponent(root, monitor, unit, type);
        createPreferredLnf(root, monitor, type, imports);
        if (success) {
          TextEdit edit = imports.rewriteImports(monitor);
          JavaUtil.applyEdit(copy, edit, true, monitor);
        }
        if (copy.isWorkingCopy()) {
          copy.commitWorkingCopy(true, monitor);
          copy.discardWorkingCopy();
View Full Code Here

   
    TextEdit importEdits = null;
    if (importDeclaration != null) {
      ImportRewrite importRewrite = ImportRewrite.create(compilationUnit, true);
      importRewrite.addImport(importDeclaration.getName().getFullyQualifiedName());
      importEdits = importRewrite.rewriteImports(null);
    }
   
    Map options = compilationUnit.getJavaProject().getOptions(true);
    TextEdit edits = rewrite.rewriteAST(document, options);
   
View Full Code Here

   
    TextEdit importEdits = null;
    if (importDeclaration != null) {
      ImportRewrite importRewrite = ImportRewrite.create(compilationUnit, true);
      importRewrite.addImport(importDeclaration.getName().getFullyQualifiedName());
      importEdits = importRewrite.rewriteImports(null);
    }
   
    Map options = compilationUnit.getJavaProject().getOptions(true);
    TextEdit edits = rewrite.rewriteAST(document, options);
   
View Full Code Here

    maintainValuesProperty(normalAnnotation, memberValues, ast, rewrite);

    TextEdit importEdits = null;
    ImportRewrite importRewrite = ImportRewrite.create(compilationUnit, true);
    importRewrite.addImport(importDeclaration.getName().getFullyQualifiedName());
    importEdits = importRewrite.rewriteImports(null);
   
    Map options = compilationUnit.getJavaProject().getOptions(true);
    TextEdit edits = rewrite.rewriteAST(document, options);
   
    // computation of the new source code
View Full Code Here

    maintainValuesProperty(normalAnnotation, memberValues, ast, rewrite);

    TextEdit importEdits = null;
    ImportRewrite importRewrite = ImportRewrite.create(compilationUnit, true);
    importRewrite.addImport(importDeclaration.getName().getFullyQualifiedName());
    importEdits = importRewrite.rewriteImports(null);
   
    Map options = compilationUnit.getJavaProject().getOptions(true);
    TextEdit edits = rewrite.rewriteAST(document, options);
   
    // computation of the new source code
View Full Code Here

        MultiTextEdit edit = new MultiTextEdit();
        ImportRewrite imports = StubUtility.createImportRewrite(cu, true);
        imports.addStaticImport("org.junit.Assert", "*", false);
        imports.addImport(JUnitCorePlugin.JUNIT4_ANNOTATION_NAME);
        edit.addChild(imports.rewriteImports(null));

        AST ast = cu.getAST();
        ASTRewrite astRewrite = ASTRewrite.create(ast);
        ASTNode node = cu.findDeclaringNode(typeBinding);
        ChildListPropertyDescriptor property = ((AbstractTypeDeclaration)node)
View Full Code Here

      String res = importRewrite.addImport(type, context);
      if (type.equals(res)){
        return CodeGenerationMessages.AddImportsOperation_error_importclash;
      }

      TextEdit rewrite = importRewrite.rewriteImports(null);
      edits.addChild(rewrite);
      JavaModelUtil.applyEdit(src, edits, true, null);

    }else{
      ChooseImport query = new ChooseImport(project, type);
View Full Code Here

    try {
      IImportDeclaration requestMappingDecl = cu.getImport(importTypeNString);
      if (requestMappingDecl == null || !requestMappingDecl.exists()) {
        ImportRewrite importRewrite = StubUtility.createImportRewrite(cu, true);
        importRewrite.addImport(importTypeNString);
        return importRewrite.rewriteImports(null);
      }

    }
    catch (JavaModelException e) {
      // TODO Auto-generated catch block
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.