gotoCurrentMarker();
}
private void gotoCurrentMarker() {
if (fMarkers.size() > 0) {
Match marker = getCurrentMarker();
Control focusControl = getShell().getDisplay().getFocusControl();
try {
selectEntry(marker);
ITextEditor editor = null;
if (NewSearchUI.reuseEditor())
editor = openEditorReuse(marker);
else
editor = openEditorNoReuse(marker);
Position p = InternalSearchUI.getInstance().getPositionTracker().getCurrentPosition(marker);
if (p != null)
editor.selectAndReveal(p.getOffset(), p.getLength());
else
editor.selectAndReveal(marker.getOffset(), marker.getLength());
if (focusControl != null && !focusControl.isDisposed())
focusControl.setFocus();
} catch (PartInitException e) {
String message = Messages.format(SearchMessages.ReplaceDialog_error_unable_to_open_text_editor,
((IFile) marker.getElement()).getName());
MessageDialog.openError(getParentShell(), getDialogTitle(), message);
}
}
}