예제 #1
0
 /*
  * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#run(org.eclipse.jface.text.ITextSelection)
  */
 @Override
 public void run(ITextSelection selection) {
   try {
     final IType type = SelectionConverter.getTypeAtOffset(fEditor);
     if (type != null) {
       if (!ElementValidator.check(type, getShell(), getDialogTitle(), false)
           || !ActionUtil.isEditable(fEditor, getShell(), type)) {
         notifyResult(false);
         return;
       }
       if (type.isAnnotation()) {
         MessageDialog.openInformation(
             getShell(),
             getDialogTitle(),
             ActionMessages.OverrideMethodsAction_annotation_not_applicable);
         notifyResult(false);
         return;
       }
       if (type.isInterface()) {
         MessageDialog.openInformation(
             getShell(),
             getDialogTitle(),
             ActionMessages.OverrideMethodsAction_interface_not_applicable);
         notifyResult(false);
         return;
       }
       run(getShell(), type);
     } else {
       MessageDialog.openInformation(
           getShell(), getDialogTitle(), ActionMessages.OverrideMethodsAction_not_applicable);
     }
   } catch (JavaModelException e) {
     ExceptionHandler.handle(e, getShell(), getDialogTitle(), null);
   } catch (CoreException e) {
     ExceptionHandler.handle(
         e, getShell(), getDialogTitle(), ActionMessages.OverrideMethodsAction_error_actionfailed);
   }
 }
예제 #2
0
 private boolean checkEnabledEditor() {
   return fEditor != null && SelectionConverter.canOperateOn(fEditor);
 }