Search in sources :

Example 1 with TextMatch

use of org.eclipse.jdt.ls.core.internal.corext.refactoring.rename.RefactoringScanner.TextMatch in project eclipse.jdt.ls by eclipse.

the class TextMatchUpdater method addTextUpdates.

private void addTextUpdates(ICompilationUnit cu, Set<TextMatch> matches) {
    for (Iterator<TextMatch> resultIter = matches.iterator(); resultIter.hasNext(); ) {
        TextMatch match = resultIter.next();
        if (!match.isQualified() && fOnlyQualified) {
            continue;
        }
        int matchStart = match.getStartPosition();
        ReplaceEdit edit = new ReplaceEdit(matchStart, fCurrentNameLength, fNewName);
        try {
            TextChangeCompatibility.addTextEdit(fManager.get(cu), TEXT_EDIT_LABEL, edit, TEXTUAL_MATCHES);
        } catch (MalformedTreeException e) {
        // conflicting update -> omit text match
        }
    }
}
Also used : ReplaceEdit(org.eclipse.text.edits.ReplaceEdit) MalformedTreeException(org.eclipse.text.edits.MalformedTreeException) TextMatch(org.eclipse.jdt.ls.core.internal.corext.refactoring.rename.RefactoringScanner.TextMatch)

Aggregations

TextMatch (org.eclipse.jdt.ls.core.internal.corext.refactoring.rename.RefactoringScanner.TextMatch)1 MalformedTreeException (org.eclipse.text.edits.MalformedTreeException)1 ReplaceEdit (org.eclipse.text.edits.ReplaceEdit)1