@Override
public boolean acceptPatternMatch(
final TextSearchMatchAccess matchAccess)
throws CoreException {
IFile file = matchAccess.getFile();
TextFileChange change = (TextFileChange) changes.get(file);
if (change == null) {
// an other participant already modified that file?
TextChange textChange = getTextChange(file);
if (textChange != null) {
return false; // don't try to merge changes
}
change = new TextFileChange(file.getName(), file);
change.setEdit(new MultiTextEdit());
changes.put(file, change);
}
ReplaceEdit edit = new ReplaceEdit(
matchAccess.getMatchOffset(),
matchAccess.getMatchLength(), newFullyQualifiedName);
change.addEdit(edit);
change.addTextEditGroup(new TextEditGroup(
"Update type reference", edit)); //$NON-NLS-1$
return true;
}
};
TextSearchEngine.create().search(scope, collector, pattern, pm);