コード例 #1
0
  /** @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);
    }
  }
コード例 #2
0
 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);
     }
   }
 }