/** * Returns whether the given status indicates an error. Subclasses may override. * * @param status the status to be checked * @return <code>true</code> if the status indicates an error, <code>false</code> otherwise\ * @since 3.0 */ protected boolean isErrorStatus(IStatus status) { return status != null && status.getSeverity() == IStatus.ERROR; }
String getMessageText(IStatus currentStatus) { if (currentStatus == null || currentStatus.isOK()) return getDescription(); if (currentStatus.getSeverity() == IStatus.CANCEL) return ProvUIMessages.ResolutionWizardPage_Canceled; if (currentStatus.getSeverity() == IStatus.ERROR) return ProvUIMessages.ResolutionWizardPage_ErrorStatus; return ProvUIMessages.ResolutionWizardPage_WarningInfoStatus; }
private static int collectStatus(OutputStream stream, ArrayList<IStatus> list) { IStatus status = getStatus(stream); list.add(status); OutputStream destination = getDestination(stream); if (destination == null || !(destination instanceof IStateful)) return status.getSeverity(); int result = collectStatus(destination, list); // TODO greater than test here is a little brittle but it is very unlikely that we will add // a new status severity. return status.getSeverity() > result ? status.getSeverity() : result; }
private void reportStatus(Display display, IStatus status) { String title = (status.getSeverity() >= IStatus.ERROR) ? "Error" : "Warning"; ErrorDialog.openError(null, title, null, status); }
/** * Log the given CoreException in a manner that will include the stacktrace of * the exception in the log. * @param e the exception */ public static void log(CoreException e) { log(e.getStatus().getSeverity(), e.getMessage(), e); }
protected void addToStatus(CoreException ex) { IStatus status= ex.getStatus(); String message= ex.getLocalizedMessage(); if (message == null || message.length() < 1) { message= JarPackagerMessages.JarFileExportOperation_coreErrorDuringExport; status= new Status(status.getSeverity(), status.getPlugin(), status.getCode(), message, ex); } fStatus.add(status); }
public static ConvertLoopFix createConvertIterableLoopToEnhancedFix(CompilationUnit compilationUnit, ForStatement loop) { ConvertIterableLoopOperation loopConverter= new ConvertIterableLoopOperation(loop); IStatus status= loopConverter.satisfiesPreconditions(); if (status.getSeverity() == IStatus.ERROR) return null; return new ConvertLoopFix(FixMessages.Java50Fix_ConvertToEnhancedForLoop_description, compilationUnit, new CompilationUnitRewriteOperation[] {loopConverter}, status); }
public int getRelevance() { IStatus status= fFix.getStatus(); if (status.getSeverity() == IStatus.WARNING) { return super.getRelevance() - 100; } else { return super.getRelevance(); } }
public boolean shouldRecomputePlan(ISelectableIUsPage page) { boolean previouslyWaiting = waitingForOtherJobs; boolean previouslyCanceled = getCurrentStatus().getSeverity() == IStatus.CANCEL; waitingForOtherJobs = ui.hasScheduledOperations(); return waitingForOtherJobs || previouslyWaiting || previouslyCanceled || pageSelectionsHaveChanged(page); }
private void checkArgName() { String fieldName = fField.getElementName(); boolean isStatic = true; try { isStatic = JdtFlags.isStatic(fField); } catch (JavaModelException e) { JavaLanguageServerPlugin.log(e); } if ((isStatic && fArgName.equals(fieldName) && fieldName.equals(fField.getDeclaringType().getElementName())) || JavaConventionsUtil.validateIdentifier(fArgName, fField).getSeverity() == IStatus.ERROR) { fArgName = "_" + fArgName; //$NON-NLS-1$ } }
private boolean shouldRecomputePlan(ISelectableIUsPage page) { boolean previouslyWaiting = waitingForOtherJobs; boolean previouslyCanceled = getCurrentStatus().getSeverity() == IStatus.CANCEL; waitingForOtherJobs = ui.hasScheduledOperations(); return waitingForOtherJobs || previouslyWaiting || previouslyCanceled || pageSelectionsHaveChanged(page) || provisioningContextChanged(); }
@Override public IStatus computeExecutionStatus(IProgressMonitor monitor) { IStatus status = getBasicRedoStatus(); if (status.isOK()) { return super.computeExecutionStatus(monitor); } if (status.getSeverity() == IStatus.ERROR) { markInvalid(); } return status; }
@Override public IStatus computeRedoableStatus(IProgressMonitor monitor) { IStatus status = getBasicRedoStatus(); if (status.isOK()) { return super.computeRedoableStatus(monitor); } if (status.getSeverity() == IStatus.ERROR) { markInvalid(); } return status; }
protected void handleResult(BuildJob job) { IStatus status = job.getStatus(); if (status != null && !status.isOK() && status.getSeverity() != IStatus.CANCEL) { getService().handleResult(AbstractOperation.this, status); } }
@Override public Object getNewElement() { IPackageFragment pack= (IPackageFragment) fCu.getParent(); if (JavaConventionsUtil.validateCompilationUnitName(getNewElementName(), pack).getSeverity() == IStatus.ERROR) { return null; } return pack.getCompilationUnit(getNewElementName()); }
protected boolean isErrorStatus(IStatus status) { if (!super.isErrorStatus(status)) return false; if (!status.isMultiStatus()) return !isReadOnlyLocalStatus(status); IStatus[] childrenStatus= status.getChildren(); for (int i= 0; i < childrenStatus.length; i++) { if (childrenStatus[i].getSeverity() == IStatus.ERROR && !isReadOnlyLocalStatus(childrenStatus[i])) return true; } return false; }
private void reportErrorIfRequired( StartServerJob serverJob ) { IStatus status = serverJob.getStatus(); if( status.getSeverity() == Status.ERROR ) { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); EclipseStatusHandler handler = new EclipseStatusHandler( shell ); handler.reportError( status ); } }
/** * Creates and returns a new Java model exception for this element with the given status. */ public JavaModelException newJavaModelException(IStatus status) { if (status instanceof IJavaModelStatus) return new JavaModelException((IJavaModelStatus) status); else return new JavaModelException(new JavaModelStatus(status.getSeverity(), status.getCode(), status.getMessage())); } /*
private RefactoringStatus checkNewPathValidity() { IContainer c= fType.getCompilationUnit().getResource().getParent(); String notRename= RefactoringCoreMessages.RenameTypeRefactoring_will_not_rename; IStatus status= c.getWorkspace().validateName(getNewElementName(), IResource.FILE); if (status.getSeverity() == IStatus.ERROR) return RefactoringStatus.createWarningStatus(status.getMessage() + ". " + notRename); //$NON-NLS-1$ status= c.getWorkspace().validatePath(createNewPath(getNewElementName()), IResource.FILE); if (status.getSeverity() == IStatus.ERROR) return RefactoringStatus.createWarningStatus(status.getMessage() + ". " + notRename); //$NON-NLS-1$ return new RefactoringStatus(); }
public SerializableStatus(IStatus status) { setSeverity(status.getSeverity()); setPlugin(status.getPlugin()); setCode(status.getCode()); setMessage(status.getMessage()); setException(status.getException()); }