/* * @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); } }
/* * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#run(org.eclipse.jface.viewers.IStructuredSelection) */ @Override public void run(IStructuredSelection selection) { try { final IType type = getSelectedType(selection); if (type == null) { MessageDialog.openInformation( getShell(), getDialogTitle(), ActionMessages.OverrideMethodsAction_not_applicable); notifyResult(false); return; } if (!ElementValidator.check(type, getShell(), getDialogTitle(), false) || !ActionUtil.isEditable(getShell(), type)) { notifyResult(false); return; } run(getShell(), type); } catch (CoreException exception) { ExceptionHandler.handle( exception, getShell(), getDialogTitle(), ActionMessages.OverrideMethodsAction_error_actionfailed); } }