private IStatus getCurrentStatus() { if (accumulatedStatus != null) { // If there is only missing repo to report, use the specific message rather than the generic. if (accumulatedStatus.getChildren().length == 1) return accumulatedStatus.getChildren()[0]; return accumulatedStatus; } return Status.OK_STATUS; }
/** * Returns the status of the reader. * If there were any errors, the result is a status object containing * individual status objects for each error. * If there were no errors, the result is a status object with error code <code>OK</code>. * * @return the status of this operation */ @Override public IStatus getStatus() { if (fWarnings.getChildren().length == 0) return Status.OK_STATUS; else return fWarnings; }
/** * Returns the status of the reader. * If there were any errors, the result is a status object containing * individual status objects for each error. * If there were no errors, the result is a status object with error code <code>OK</code>. * * @return the status of this operation */ @Override public IStatus getStatus() { if (fWarnings.getChildren().length == 0) return Status.OK_STATUS; else return fWarnings; }
@Override public boolean hasChildren(Object element) { if (fInput.containsKey(element) && element instanceof BundleDescription) { return true; } if (element instanceof MultiStatus) { return ((MultiStatus) element).getChildren().length > 0; } return false; }
@Override public Object[] getChildren(Object parentElement) { if (fInput.containsKey(parentElement)) { return (Object[]) fInput.get(parentElement); } if (parentElement instanceof MultiStatus) { return ((MultiStatus) parentElement).getChildren(); } return new Object[0]; }
/** * Returns the status of the reader. * If there were any errors, the result is a status object containing * individual status objects for each error. * If there were no errors, the result is a status object with error code <code>OK</code>. * * @return the status of this operation */ public IStatus getStatus() { if (fWarnings.getChildren().length == 0) return new Status(IStatus.OK, JavaPlugin.getPluginId(), 0, "", null); //$NON-NLS-1$ else return fWarnings; }
private boolean currentStatusHasException() { boolean hasException = false; if (currentStatus.getException() != null) { hasException = true; } if (currentStatus instanceof MultiStatus) { MultiStatus multiStatus = (MultiStatus) currentStatus; for (int i = 0; i < multiStatus.getChildren().length; i++) { IStatus status = multiStatus.getChildren()[i]; if (status.getException() != null) { hasException = true; break; } } } return hasException; }
private boolean currentStatusHasException() { boolean hasException = false; if (currentStatus.getException() != null) { hasException = true; } if (currentStatus instanceof MultiStatus) { MultiStatus multiStatus = (MultiStatus) currentStatus; for (int i = 0; i < multiStatus.getChildren().length; i++) { IStatus status = multiStatus.getChildren()[i]; if (status.getException() != null) { hasException = true; break; } } } return hasException; }
/** * Return a status indicating the result of resolving this * operation. A <code>null</code> return indicates that * resolving has not occurred yet. * * @return the status of the resolution, or <code>null</code> * if resolution has not yet occurred. */ public IStatus getResolutionResult() { if (request == null) { if (noChangeRequest != null) { // If there is only one child message, use the specific message if (noChangeRequest.getChildren().length == 1) return noChangeRequest.getChildren()[0]; return noChangeRequest; } return null; } if (job != null && job.getResolutionResult() != null) return job.getResolutionResult().getSummaryStatus(); return null; }
private static Collection<IProject> getMarkedProjects() { List<IProject> projects = new ArrayList<IProject>(); MultiStatus status = new MultiStatus(DiscoveryActivator.PLUGIN_ID, 0, Messages.UpdateConfigurationStartup_MarkerError, null); for(IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { try { if(project.findMarkers(IMavenConstants.MARKER_LIFECYCLEMAPPING_ID, true, IResource.DEPTH_ONE).length > 0) { projects.add(project); } } catch(CoreException e) { status.add(e.getStatus()); } } if(status.getChildren().length > 0) { StatusManager.getManager().handle(status); } return projects; }
/** * @noreference This method is not intended to be referenced by clients. */ protected void handleStatusException() { if (currentStatus.getException() != null) { logThrowable(currentStatus.getException()); } else if (currentStatus instanceof MultiStatus) { MultiStatus multiStatus = (MultiStatus) currentStatus; for (int i = 0; i < multiStatus.getChildren().length; i++) { IStatus status = multiStatus.getChildren()[i]; if (status.getException() != null) { logThrowable(status.getException()); } } } }
/** * This is called when a Override to provide custom exception handling and * reporting. */ private void handleStatusException() { if (currentStatus.getException() != null) { logThrowable(currentStatus.getException()); } else if (currentStatus instanceof MultiStatus) { MultiStatus multiStatus = (MultiStatus) currentStatus; for (int i = 0; i < multiStatus.getChildren().length; i++) { IStatus status = multiStatus.getChildren()[i]; if (status.getException() != null) { logThrowable(status.getException()); } } } }
@Override public void run() { List<Bundle> bundles = getSelectedBundles(); for (Iterator<Bundle> it = bundles.iterator(); it.hasNext();) { Bundle bundle = it.next(); MultiStatus problems = bundle.diagnose(); Dialog dialog; if ((problems != null) && (problems.getChildren().length > 0)) { dialog = new DiagnosticsDialog(getSite().getShell(), PDERuntimeMessages.RegistryView_diag_dialog_title, null, problems, IStatus.WARNING); dialog.open(); } else { MessageDialog.openInformation(getSite().getShell(), PDERuntimeMessages.RegistryView_diag_dialog_title, PDERuntimeMessages.RegistryView_no_unresolved_constraints); } } } };
/** * @param exceptionStatus * @param proj * @param name */ private void addErrorStatus(IStatus exceptionStatus, String DeployerName, Throwable ex) { Throwable mainCause = null; if (exceptionStatus instanceof MultiStatus) { IStatus[] stati = ((MultiStatus) exceptionStatus).getChildren(); for (int i = 0; 1 < stati.length; i++) { addErrorStatus(stati[i], DeployerName, stati[i].getException()); } } mainCause = (ex.getCause() != null) ? ex.getCause() : ex; //String errorNotes = (mainCause != null && mainCause.getMessage() != null) ? mainCause.getMessage() : ""; String message = J2EEPluginResourceHandler.bind(J2EEPluginResourceHandler.J2EEDeployOperation_3_UI_,DeployerName, ""); //$NON-NLS-1$ IStatus statusLocal = new Status(IStatus.ERROR, J2EEPlugin.getPlugin().getPluginID(), IStatus.ERROR, message, mainCause); //$NON-NLS-1$ getMultiStatus().add(statusLocal); }
/** * Extract the root cause. The root cause is the first severe non-MultiStatus status * containing an exception when searching depth first otherwise null. * @param status * @return root cause */ private static IStatus extractRootCause(IStatus status) { if (status == null) return null; if (!status.isMultiStatus()) return constraintStatus(status); IStatus[] children = ((MultiStatus) status).getChildren(); if (children == null) return constraintStatus(status); for (int i = 0; i < children.length; i++) { IStatus deeper = extractRootCause(children[i]); if (deeper != null) return deeper; } return constraintStatus(status); }
/** * Extract the root cause. The root cause is the first severe non-MultiStatus status * containing an exception when searching depth first otherwise null. * @param status * @return root cause */ private static IStatus extractRootCause(IStatus status) { if (status == null) return null; if (!status.isMultiStatus()) return constraintStatus(status); IStatus[] children = ((MultiStatus) status).getChildren(); if (children == null) return constraintStatus(status); for (int i = 0; i < children.length; i++) { IStatus deeper = extractRootCause(children[i]); if (deeper != null) return deeper; } return constraintStatus(status); }
void makeResolveJob(IProgressMonitor monitor) { noChangeRequest = PlanAnalyzer.getProfileChangeAlteredStatus(); if (session.hasScheduledOperationsFor(profileId)) { noChangeRequest.add(PlanAnalyzer.getStatus(IStatusCodes.OPERATION_ALREADY_IN_PROGRESS, null)); } else { computeProfileChangeRequest(noChangeRequest, monitor); } if (request == null) { if (noChangeRequest.getChildren().length == 0) // No explanation for failure was provided. It shouldn't happen, but... noChangeRequest = new MultiStatus(Activator.ID, IStatusCodes.UNEXPECTED_NOTHING_TO_DO, new IStatus[] {PlanAnalyzer.getStatus(IStatusCodes.UNEXPECTED_NOTHING_TO_DO, null)}, Messages.ProfileChangeOperation_NoProfileChangeRequest, null); return; } createPlannerResolutionJob(); }
void makeResolveJob(IProgressMonitor monitor) { noChangeRequest = PlanAnalyzer.getProfileChangeAlteredStatus(); if (session.hasScheduledOperationsFor(profileId)) { noChangeRequest.add(PlanAnalyzer.getStatus(IStatusCodes.OPERATION_ALREADY_IN_PROGRESS, null)); } else { computeProfileChangeRequest(noChangeRequest, monitor); } if (request == null) { if (noChangeRequest.getChildren().length == 0) // No explanation for failure was provided. It shouldn't happen, but... noChangeRequest = new MultiStatus(Activator.ID, IStatusCodes.UNEXPECTED_NOTHING_TO_DO, new IStatus[] {PlanAnalyzer.getStatus(IStatusCodes.UNEXPECTED_NOTHING_TO_DO, null)}, Messages.ProfileChangeOperation_NoProfileChangeRequest, null); return; } createPlannerResolutionJob(); }
public SerializableMultiStatus(MultiStatus multiStatus) { this(multiStatus.getPlugin(), multiStatus.getCode(), multiStatus.getMessage(), multiStatus.getException()); IStatus[] childs = multiStatus.getChildren(); if (childs != null) { for (int i = 0; i < childs.length; i++) { if (childs[i].isMultiStatus()) { add(new SerializableMultiStatus(childs[i])); } else { add(new SerializableStatus(childs[i])); } } } }
private void handleLoadFailure(ProvisionException e, URI location) { if (shouldAccumulateFailures()) { // Some ProvisionExceptions include an empty multi status with a message. // Since empty multi statuses have a severity OK, The platform status handler doesn't handle // this well. We correct this by recreating a status with error severity // so that the platform status handler does the right thing. IStatus status = e.getStatus(); if (status instanceof MultiStatus && ((MultiStatus) status).getChildren().length == 0) status = new Status(IStatus.ERROR, status.getPlugin(), status.getCode(), status.getMessage(), status.getException()); if (accumulatedStatus == null) { accumulatedStatus = new MultiStatus(ProvUIActivator.PLUGIN_ID, ProvisionException.REPOSITORY_NOT_FOUND, new IStatus[] {status}, ProvUIMessages.LoadMetadataRepositoryJob_SitesMissingError, null); } else { accumulatedStatus.add(status); } ui.getRepositoryTracker().addNotFound(location); // Always log the complete exception so the detailed stack trace is in the log. LogHelper.log(e); } else { tracker.reportLoadFailure(location, e); } }