/** * Returns the first message which severity is equal or greater than the * given severity. If more than one entry exists that matches the criteria * the first one is returned. Returns <code>null</code> if no entry matches. * * @param severity the severity to search for. Must be one of <code>FATAL * </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code> * @return the message of the entry that matches the search criteria */ public String getMessageMatchingSeverity(int severity) { RefactoringStatusEntry entry= getEntryMatchingSeverity(severity); if (entry == null) return null; return entry.getMessage(); }
/** * Returns the first message which severity is equal or greater than the * given severity. If more than one entry exists that matches the criteria * the first one is returned. Returns <code>null</code> if no entry matches. * * @param severity the severity to search for. Must be one of <code>FATAL * </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code> * @return the message of the entry that matches the search criteria */ public String getMessageMatchingSeverity(int severity) { RefactoringStatusEntry entry= getEntryMatchingSeverity(severity); if (entry == null) return null; return entry.getMessage(); }
/** * Returns the first message which severity is equal or greater than the * given severity. If more than one entry exists that matches the criteria * the first one is returned. Returns <code>null</code> if no entry matches. * * @param severity the severity to search for. Must be one of <code>FATAL * </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code> * @return the message of the entry that matches the search criteria */ public String getMessageMatchingSeverity(int severity) { RefactoringStatusEntry entry= getEntryMatchingSeverity(severity); if (entry == null) return null; return entry.getMessage(); }
/** * Executes some light weight precondition checking. If the returned status * is an error then the refactoring can't be executed at all. However, * returning an OK status doesn't guarantee that the refactoring can be * executed. It may still fail while performing the exhaustive precondition * checking done inside the methods <code>openDialog</code> or * <code>perform</code>. * * The method is mainly used to determine enable/disablement of actions. * * @return the result of the light weight precondition checking. * * @throws CoreException if an unexpected exception occurs while performing the checking. * * @see #openDialog(Shell) * @see #perform(Shell, IRunnableContext) */ public IStatus preCheck() throws CoreException { //ensureChecked(); if (fPreCheckStatus.hasFatalError()) { return fPreCheckStatus.getEntryMatchingSeverity(RefactoringStatus.FATAL).toStatus(); } else { return Status.OK_STATUS; } }
/** * Executes some light weight precondition checking. If the returned status * is an error then the refactoring can't be executed at all. However, * returning an OK status doesn't guarantee that the refactoring can be * executed. It may still fail while performing the exhaustive precondition * checking done inside the methods <code>openDialog</code> or * <code>perform</code>. * * The method is mainly used to determine enable/disablement of actions. * * @return the result of the light weight precondition checking. * * @throws CoreException if an unexpected exception occurs while performing the checking. * * @see #openDialog(Shell) * @see #perform(Shell, IRunnableContext) */ public IStatus preCheck() throws CoreException { ensureChecked(); if (fPreCheckStatus.hasFatalError()) return fPreCheckStatus.getEntryMatchingSeverity(RefactoringStatus.FATAL).toStatus(); else return Status.OK_STATUS; }
/** * Executes some light weight precondition checking. If the returned status * is an error then the refactoring can't be executed at all. However, * returning an OK status doesn't guarantee that the refactoring can be * executed. It may still fail while performing the exhaustive precondition * checking done inside the methods <code>openDialog</code> or * <code>perform</code>. * * The method is mainly used to determine enable/disablement of actions. * * @return the result of the light weight precondition checking. * * @throws CoreException if an unexpected exception occurs while performing the checking. * * @see #openDialog(Shell) * @see #perform(Shell, IRunnableContext) */ public IStatus preCheck() throws CoreException { ensureChecked(); if (fPreCheckStatus.hasFatalError()) return fPreCheckStatus.getEntryMatchingSeverity(RefactoringStatus.FATAL).toStatus(); else return Status.OK_STATUS; }
/** * Executes some light weight precondition checking. If the returned status * is an error then the refactoring can't be executed at all. However, * returning an OK status doesn't guarantee that the refactoring can be * executed. It may still fail while performing the exhaustive precondition * checking done inside the methods <code>openDialog</code> or * <code>perform</code>. * * The method is mainly used to determine enable/disablement of actions. * * @return the result of the light weight precondition checking. * * @throws CoreException if an unexpected exception occurs while performing the checking. * * @see #openDialog(Shell) * @see #perform(Shell, IRunnableContext) */ public IStatus preCheck() throws CoreException { ensureChecked(); if (fPreCheckStatus.hasFatalError()) return fPreCheckStatus.getEntryMatchingSeverity(RefactoringStatus.FATAL).toStatus(); else return new Status(IStatus.OK, JavaPlugin.getPluginId(), 0, "", null); //$NON-NLS-1$ }
public final boolean activate(final Refactoring ref, final Shell parent, final int saveMode) throws CoreException { final RefactoringStatus status= ref.checkInitialConditions(new NullProgressMonitor()); if (status.hasFatalError()) { final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL); if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) { String message= entry.getMessage(); final Object element= entry.getData(); message= message + RefactoringMessages.RefactoringErrorDialogUtil_okToPerformQuestion; if (element != null && MessageDialog.openQuestion(shell, RefactoringMessages.OpenRefactoringWizardAction_refactoring, message)) { final IStructuredSelection selection= new StructuredSelection(element); // TODO: should not hijack this // ModifiyParametersAction. // The action is set up on an editor, but we use it // as if it were set up on a ViewPart. boolean wasEnabled= action.isEnabled(); action.selectionChanged(selection); if (action.isEnabled()) { action.run(selection); } else { MessageDialog.openInformation(shell, ActionMessages.ModifyParameterAction_problem_title, ActionMessages.ModifyParameterAction_problem_message); } action.setEnabled(wasEnabled); } return false; } } return super.activate(ref, parent, saveMode); } };
final RefactoringStatus status= refactoring.checkInitialConditions(new NullProgressMonitor()); if (status.hasFatalError()) { final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL); if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {
result.merge(fChangeSignatureRefactoring.checkInitialConditions(new SubProgressMonitor(pm, 1))); if (result.hasFatalError()) { RefactoringStatusEntry entry= result.getEntryMatchingSeverity(RefactoringStatus.FATAL); if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {
RefactoringStatus status= refactoring.checkInitialConditions(new NullProgressMonitor()); if (status.hasFatalError()) { RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL); MessageDialog.openInformation(getShell(), getDialogTitle(), entry.getMessage()); if (entry.getContext() instanceof JavaStatusContext && fEditor != null) {
result.merge(fChangeSignatureProcessor.checkInitialConditions(new SubProgressMonitor(pm, 1))); if (result.hasFatalError()) { RefactoringStatusEntry entry= result.getEntryMatchingSeverity(RefactoringStatus.FATAL); if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {
RefactoringStatus status= refactoring.checkInitialConditions(new NullProgressMonitor()); if (status.hasFatalError()) { RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL); MessageDialog.openInformation(getShell(), getDialogTitle(), entry.getMessage()); if (entry.getContext() instanceof JavaStatusContext && fEditor != null) {
final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL); if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) { final Object element= entry.getData();
result.merge(fChangeSignatureProcessor.checkInitialConditions(new SubProgressMonitor(pm, 1))); if (result.hasFatalError()) { RefactoringStatusEntry entry= result.getEntryMatchingSeverity(RefactoringStatus.FATAL); if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {
RefactoringStatus status= processor.checkInitialConditions(new NullProgressMonitor()); if (status.hasFatalError()) { final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL); if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) { Object element= entry.getData();
RefactoringStatus status= processor.checkInitialConditions(new NullProgressMonitor()); if (status.hasFatalError()) { final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL); if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) { Object element= entry.getData();
final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL); if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) { final Object element= entry.getData();
RefactoringStatus status= refactoring.checkInitialConditions(new NullProgressMonitor()); if (status.hasFatalError()) { RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL); MessageDialog.openInformation(getShell(), getDialogTitle(), entry.getMessage()); if (entry.getContext() instanceof JavaStatusContext && fEditor != null) {