use of org.omegat.gui.editor.EditorController in project omegat by omegat-org.
the class ReplaceFilter method replace.
private void replace() {
EditorController ec = (EditorController) Core.getEditor();
// is caret inside match ?
int pos = ec.getCurrentPositionInEntryTranslation();
String str = ec.getCurrentTranslation();
List<SearchMatch> found = getReplacementsForEntry(str);
if (found != null) {
for (SearchMatch m : found) {
if (m.getStart() <= pos && pos <= m.getEnd()) {
// yes - replace
ec.replacePartOfText(m.getReplacement(), m.getStart(), m.getEnd());
break;
}
}
}
// skip to next
skip();
}
Aggregations