parser.setFocalPosition(0); // reduced AST
parser.setResolveBindings(false);
usedAstRoot= (CompilationUnit) parser.createAST(new SubProgressMonitor(monitor, 1));
}
ImportRewriteAnalyzer computer=
new ImportRewriteAnalyzer(
this.compilationUnit,
usedAstRoot,
this.importOrder,
this.importOnDemandThreshold,
this.staticImportOnDemandThreshold,
this.restoreExistingImports,
this.useContextToFilterImplicitImports);
computer.setFilterImplicitImports(this.filterImplicitImports);
if (this.addedImports != null) {
for (int i= 0; i < this.addedImports.size(); i++) {
String curr= (String) this.addedImports.get(i);
computer.addImport(curr.substring(1), STATIC_PREFIX == curr.charAt(0), usedAstRoot, this.restoreExistingImports);
}
}
if (this.removedImports != null) {
for (int i= 0; i < this.removedImports.size(); i++) {
String curr= (String) this.removedImports.get(i);
computer.removeImport(curr.substring(1), STATIC_PREFIX == curr.charAt(0));
}
}
TextEdit result= computer.getResultingEdits(new SubProgressMonitor(monitor, 1));
this.createdImports= computer.getCreatedImports();
this.createdStaticImports= computer.getCreatedStaticImports();
return result;
} finally {
monitor.done();
}
}