use of org.eclipse.ui.texteditor.SimpleMarkerAnnotation in project webtools.sourceediting by eclipse.
the class GotoAnnotationAction method updateAnnotationViews.
/**
* Updates the annotation views that show the given annotation.
*
* @param annotation
* the annotation
*/
protected void updateAnnotationViews(Annotation annotation) {
IMarker marker = null;
if (annotation instanceof SimpleMarkerAnnotation)
marker = ((SimpleMarkerAnnotation) annotation).getMarker();
if (marker != null) {
try {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
IViewPart view = null;
if (marker.isSubtypeOf(IMarker.PROBLEM)) {
view = page.findView(IPageLayout.ID_PROBLEM_VIEW);
} else if (marker.isSubtypeOf(IMarker.TASK)) {
view = page.findView(IPageLayout.ID_TASK_LIST);
} else if (marker.isSubtypeOf(IMarker.BOOKMARK)) {
view = page.findView(IPageLayout.ID_BOOKMARKS);
}
if (view == null) {
view = page.findView("org.eclipse.ui.views.AllMarkersView");
}
// interact with it
if (view != null) {
// $NON-NLS-1$
Method method = view.getClass().getMethod("setSelection", new Class[] { IStructuredSelection.class, boolean.class });
if (method != null) {
method.invoke(view, new Object[] { new StructuredSelection(marker), Boolean.TRUE });
page.bringToTop(view);
}
}
}
}
}// statusline
catch (CoreException x) {
//
} catch (NoSuchMethodException x) {
//
} catch (IllegalAccessException x) {
//
} catch (InvocationTargetException x) {
//
}
}
}
Aggregations