/** @see IEditorActionDelegate#run */ public void run(IAction action) { try { clearErrorMessage(); if (editor instanceof JavaEditor) { try { IJavaElement[] editorElements = SelectionConverter.codeResolve((JavaEditor) editor); IJavaElement[] elements = internalSearch(editorElements, getProgressMonitor()); if (elements != null) { if (elements.length == 1) { jumpToElement(elements[0]); } else if (elements.length > 1) { selectElementToJumpTo(elements); } else { showInfoMessage(getNoResultsMessage()); } } } catch (JavaModelException e) { ImplementorsUI.log(e); } } } catch (RuntimeException e) { ImplementorsUI.log(e); } }
private void jumpToElement(IJavaElement element) { if (element != null) { try { IEditorPart methodEditor = ImplementorsUtility.openInEditor(element, true); if (methodEditor != null) { JavaUI.revealInEditor(methodEditor, element); } else { showErrorMessage( ImplementorsMessages.getString( "AbstractGotoActionDelegate.error_opening_editor")); //$NON-NLS-1$ } } catch (JavaModelException e) { ImplementorsUI.log(e); } catch (PartInitException e) { ImplementorsUI.log(e); } } }