StructuredSelection selection = (StructuredSelection) event.getSelection();
QueryResult data = (QueryResult) selection.getFirstElement();
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart activeEditor = page.getActiveEditor();
if (activeEditor instanceof AnnotationEditor) {
AnnotationEditor ae = (AnnotationEditor) activeEditor;
IEditorInput editorInput = ae.getEditorInput();
if (editorInput instanceof FileEditorInput) {
FileEditorInput fei = (FileEditorInput) editorInput;
IFile file = fei.getFile();
if (data != null && file.getLocationURI().equals(data.getFile().toURI())) {
int begin = data.getBegin();
int end = data.getEnd();
ae.selectAndReveal(begin, end - begin);
}
}
}
}
}