/** * Creates and returns the import rewrite * if imports should be added at all. * * @return the import rewrite or <code>null</code> if no imports can or should be added */ private ImportRewrite createImportRewrite() { if (fCompilationUnit != null && shouldAddImports()) { try { CompilationUnit cu= getASTRoot(fCompilationUnit); if (cu == null) { ImportRewrite rewrite= StubUtility.createImportRewrite(fCompilationUnit, true); fImportContext= null; return rewrite; } else { ImportRewrite rewrite= StubUtility.createImportRewrite(cu, true); fImportContext= new ContextSensitiveImportRewriteContext(cu, fInvocationContext.getInvocationOffset(), rewrite); return rewrite; } } catch (CoreException x) { JavaPlugin.log(x); } } return null; }
/** * Creates and returns the import rewrite * if imports should be added at all. * * @return the import rewrite or <code>null</code> if no imports can or should be added */ private ImportRewrite createImportRewrite() { if (fCompilationUnit != null && shouldAddImports()) { try { CompilationUnit cu= getASTRoot(fCompilationUnit); if (cu == null) { ImportRewrite rewrite= StubUtility.createImportRewrite(fCompilationUnit, true); fImportContext= null; return rewrite; } else { ImportRewrite rewrite= StubUtility.createImportRewrite(cu, true); fImportContext= new ContextSensitiveImportRewriteContext(cu, fInvocationContext.getInvocationOffset(), rewrite); return rewrite; } } catch (CoreException x) { JavaPlugin.log(x); } } return null; }
/** * Creates and returns the import rewrite * if imports should be added at all. * * @return the import rewrite or <code>null</code> if no imports can or should be added */ private ImportRewrite createImportRewrite() { if (fCompilationUnit != null && shouldAddImports()) { try { CompilationUnit cu= getASTRoot(fCompilationUnit); if (cu == null) { ImportRewrite rewrite= StubUtility.createImportRewrite(fCompilationUnit, true); fImportContext= null; return rewrite; } else { ImportRewrite rewrite= StubUtility.createImportRewrite(cu, true); fImportContext= new ContextSensitiveImportRewriteContext(cu, fInvocationContext.getInvocationOffset(), rewrite); return rewrite; } } catch (CoreException x) { JavaPlugin.log(x); } } return null; }