private void navigateAndTranslate(String title) { navigate(title); if (engine.getTitleComparator().compare(title, getSelectedIndexText()) == 0) { translateSelected(); } else { lastNavigated = null; model.translateNotFound(title); } }
private void translateSelected() { if (getSelectedIndex() < 0) { return; } IArticle article = engine.getFinder().get(getSelectedIndex()); model.bookmark(article); model.translate(article); selectAll(); }
public void onDocumentChanged(DocumentEvent event) { if (!isNavigationEnabled) { return; } if (Strings.isEmpty(getSearchText())) { return; } int index = engine.getFinder().indexOfFirstLike(getSearchText()); setSelectedIndex(index); ensureSelectedOnTop(index); }