public static ImportRewrite createImportRewrite(ICompilationUnit cu, boolean restoreExistingImports) throws JavaModelException { return CodeStyleConfiguration.createImportRewrite(cu, restoreExistingImports); }
/** * Returns a {@link ImportRewrite} using {@link ImportRewrite#create(CompilationUnit, boolean)} and * configures the rewriter with the settings as specified in the JDT UI preferences. * * @param astRoot the AST root to create the rewriter on * @param restoreExistingImports specifies if the existing imports should be kept or removed. * @return the new rewriter configured with the settings as specified in the JDT UI preferences. * * @see ImportRewrite#create(CompilationUnit, boolean) */ public static ImportRewrite createImportRewrite(CompilationUnit astRoot, boolean restoreExistingImports) { return configureImportRewrite(ImportRewrite.create(astRoot, restoreExistingImports)); }
/** * Returns a {@link ImportRewrite} using {@link ImportRewrite#create(CompilationUnit, boolean)} and * configures the rewriter with the settings as specified in the JDT UI preferences. * * @param astRoot the AST root to create the rewriter on * @param restoreExistingImports specifies if the existing imports should be kept or removed. * @return the new rewriter configured with the settings as specified in the JDT UI preferences. * * @see ImportRewrite#create(CompilationUnit, boolean) */ public static ImportRewrite createImportRewrite(CompilationUnit astRoot, boolean restoreExistingImports) { return configureImportRewrite(ImportRewrite.create(astRoot, restoreExistingImports)); }
public static ImportRewrite createImportRewrite(ICompilationUnit cu, boolean restoreExistingImports) throws JavaModelException { return CodeStyleConfiguration.createImportRewrite(cu, restoreExistingImports); }
/** * Returns a {@link ImportRewrite} using {@link ImportRewrite#create(ICompilationUnit, boolean)} and * configures the rewriter with the settings as specified in the JDT UI preferences. * <p> * * @param cu the compilation unit to create the rewriter on * @param restoreExistingImports specifies if the existing imports should be kept or removed. * @return the new rewriter configured with the settings as specified in the JDT UI preferences. * @throws JavaModelException thrown when the compilation unit could not be accessed. * * @see ImportRewrite#create(ICompilationUnit, boolean) */ public static ImportRewrite createImportRewrite(ICompilationUnit cu, boolean restoreExistingImports) throws JavaModelException { return configureImportRewrite(ImportRewrite.create(cu, restoreExistingImports)); }
/* package */ ImportsManager(CompilationUnit astRoot) throws CoreException { fImportsRewrite= CodeStyleConfiguration.createImportRewrite(astRoot, true); }
/** * Returns a {@link ImportRewrite} using {@link ImportRewrite#create(ICompilationUnit, boolean)} and * configures the rewriter with the settings as specified in the JDT UI preferences. * <p> * * @param cu the compilation unit to create the rewriter on * @param restoreExistingImports specifies if the existing imports should be kept or removed. * @return the new rewriter configured with the settings as specified in the JDT UI preferences. * @throws JavaModelException thrown when the compilation unit could not be accessed. * * @see ImportRewrite#create(ICompilationUnit, boolean) */ public static ImportRewrite createImportRewrite(ICompilationUnit cu, boolean restoreExistingImports) throws JavaModelException { return configureImportRewrite(ImportRewrite.create(cu, restoreExistingImports)); }
/* package */ ImportsManager(CompilationUnit astRoot) throws CoreException { fImportsRewrite= CodeStyleConfiguration.createImportRewrite(astRoot, true); }
public static ImportRewrite createImportRewrite(CompilationUnit astRoot, boolean restoreExistingImports) { return CodeStyleConfiguration.createImportRewrite(astRoot, restoreExistingImports); }
ImportsManager(ICompilationUnit createdWorkingCopy) throws CoreException { fAddedTypes = new HashSet(); fImportsStructure = CodeStyleConfiguration.createImportRewrite(createdWorkingCopy, true); }
/** * Returns a {@link ImportRewrite} using {@link ImportRewrite#create(CompilationUnit, boolean)} and * configures the rewriter with the settings as specified in the JDT UI preferences. * <p> * This method sets {@link ImportRewrite#setUseContextToFilterImplicitImports(boolean)} to <code>true</code> * iff the given AST has been resolved with bindings. Clients should always supply a context * when they call one of the <code>addImport(...)</code> methods. * </p> * * @param astRoot the AST root to create the rewriter on * @param restoreExistingImports specifies if the existing imports should be kept or removed. * @return the new rewriter configured with the settings as specified in the JDT UI preferences. * * @see ImportRewrite#create(CompilationUnit, boolean) */ public static ImportRewrite createImportRewrite(CompilationUnit astRoot, boolean restoreExistingImports) { ImportRewrite rewrite= CodeStyleConfiguration.createImportRewrite(astRoot, restoreExistingImports); if (astRoot.getAST().hasResolvedBindings()) { rewrite.setUseContextToFilterImplicitImports(true); } return rewrite; }
/** * Creates a new {@link Change} * * @param cu * @param fullyQualifiedName * @return * @throws CoreException */ public static CompilationUnitChange createAddImportChange(ICompilationUnit cu, String fullyQualifiedName) throws CoreException { String[] args = { TextProcessor.process(Signature.getSimpleName(fullyQualifiedName), JAVA_ELEMENT_DELIMITERS), TextProcessor.process(Signature.getQualifier(fullyQualifiedName), JAVA_ELEMENT_DELIMITERS) }; String label = NLS.bind(MarkerMessages.UnknownAnnotationResolution_4, args); CompilationUnitChange cuChange = new CompilationUnitChange(label, cu); ImportRewrite rewrite = CodeStyleConfiguration.createImportRewrite(cu, true); rewrite.setUseContextToFilterImplicitImports(true); rewrite.addImport(fullyQualifiedName); cuChange.setEdit(rewrite.rewriteImports(null)); return cuChange; } }
final ImportRewrite importRewrite= CodeStyleConfiguration.createImportRewrite(context.getASTRoot(), true);