@Override protected void addEdits(IDocument doc, TextEdit root) throws CoreException { super.addEdits(doc, root); // build a full AST CompilationUnit unit= SharedASTProviderCore.getAST(getCompilationUnit(), SharedASTProviderCore.WAIT_YES, null); ASTNode name= NodeFinder.perform(unit, fOffset, fLength); if (name instanceof SimpleName) { SimpleName[] names= LinkedNodeFinder.findByProblems(unit, (SimpleName) name); if (names != null) { for (int i= 0; i < names.length; i++) { SimpleName curr= names[i]; root.addChild(new ReplaceEdit(curr.getStartPosition(), curr.getLength(), fNewName)); } return; } } root.addChild(new ReplaceEdit(fOffset, fLength, fNewName)); } }
@Override protected void addEdits(IDocument doc, TextEdit root) throws CoreException { super.addEdits(doc, root); // build a full AST CompilationUnit unit= SharedASTProvider.getAST(getCompilationUnit(), SharedASTProvider.WAIT_YES, null); ASTNode name= NodeFinder.perform(unit, fOffset, fLength); if (name instanceof SimpleName) { SimpleName[] names= LinkedNodeFinder.findByProblems(unit, (SimpleName) name); if (names != null) { for (int i= 0; i < names.length; i++) { SimpleName curr= names[i]; root.addChild(new ReplaceEdit(curr.getStartPosition(), curr.getLength(), fNewName)); } return; } } root.addChild(new ReplaceEdit(fOffset, fLength, fNewName)); } }