Refine search
private void addToStatus(MultiStatus multiStatus, String defaultMessage, CoreException ex) { IStatus status= ex.getStatus(); String message= ex.getLocalizedMessage(); if (message == null || message.length() < 1) status= new Status(status.getSeverity(), status.getPlugin(), status.getCode(), defaultMessage, ex); multiStatus.add(status); } }
private static Status asStatus(CoreException e) { IStatus status = e.getStatus(); return new Status(status.getSeverity(), status.getPlugin(), status.getCode(), status.getMessage(), e); }
static void save() throws CoreException { // save the workspace IWorkspace workspace = ResourcesPlugin.getWorkspace(); boolean full = false; IProgressMonitor monitor = null; IStatus status = workspace.save(full, monitor); if (!status.isOK()) { throw new IllegalStateException(status.getMessage(), status.getException()); } } }
/** * Logs the given status. The status is distributed to the log listeners * installed on this log and then to the log listeners installed on the platform. * * @see Plugin#getLog() */ public void log(final IStatus status) { // Log to the logger logger.log(PlatformLogWriter.getLog(status), PlatformLogWriter.getLevel(status), status.getMessage(), status.getException()); }
/** * Creates a new Status based on the original status, but with a different * message * * @param originalStatus * @param newMessage * @return */ public static IStatus newStatus(IStatus originalStatus, String newMessage) { return new Status(originalStatus.getSeverity(), originalStatus.getPlugin(), originalStatus.getCode(), newMessage, originalStatus.getException()); }
@Override public boolean isNotSynchronizedException(Object element, CoreException ex) { IStatus status= ex.getStatus(); if (status == null || status instanceof MultiStatus) return false; if (status.getException() != null) return false; return status.getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL; }
public static IStatus validateProjectName(String projectName) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IStatus status = workspace.validateName(projectName, IResource.PROJECT); if (!status.isOK()) return status; return OK_STATUS; }
/** * Logs a CoreException */ private void log(CoreException e) { //create a new status to wrap the exception if there is no exception in the status IStatus status = e.getStatus(); if (status.getException() == null) status = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IResourceStatus.FAILED_WRITE_METADATA, "Internal error in history store", e); //$NON-NLS-1$ Policy.log(status); }
public void setBlocked(IStatus reason) { setBlocked (new BasicDiagnostic (reason.getSeverity(), reason.getPlugin(), reason.getCode(), reason.getMessage(), null)); }
static public void printChildren(IStatus status, PrintStream output) { IStatus[] children = status.getChildren(); if (children == null || children.length == 0) return; for (int i = 0; i < children.length; i++) { output.println("Contains: " + children[i].getMessage()); //$NON-NLS-1$ Throwable exception = children[i].getException(); if (exception != null) exception.printStackTrace(output); printChildren(children[i], output); } }
protected void appendLeafs(IStatus status, StringBuilder result) { if (status.isOK()) { return; } result.append(status.getMessage()).append('\n'); IStatus[] children = status.getChildren(); for(IStatus child: children) { appendLeafs(child, result); } }
public SerializableMultiStatus(IStatus status) { this(status.getPlugin(), status.getCode(), status.getMessage(), status.getException()); IStatus[] childs = status.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])); } } } }
/** * Validates the given string as a path for a file in this container. * * @param name path name * @return <code>true</code> if the path is valid <code>false</code> otherwise */ private boolean validateFile(String name) { IContainer container = getContainer(); IPath path = container.getFullPath().append(name); return ResourcesPlugin.getWorkspace().validatePath(path.toOSString(), IResource.FILE).isOK(); }
/** * Handles the given exception, which occurred during edit/save. */ protected void handleException(DebugException e) { Throwable cause = e.getStatus().getException(); if (cause instanceof InvalidTypeException) { IStatus status = new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, cause.getMessage(), null); JDIDebugUIPlugin.statusDialog(ActionMessages.JavaObjectValueEditor_3, status); } else { JDIDebugUIPlugin.statusDialog(e.getStatus()); } }
public void add(IStatus status) { int newSev = status.getSeverity(); if (newSev > getSeverity()) { setMessage(status.getMessage()); setException(status.getException()); } super.add(status); } }
/** * Convenience method for logging a TeamException in such a way that the * stacktrace is logged as well. * @param e */ public static void log(CoreException e) { IStatus status = e.getStatus(); log (status.getSeverity(), status.getMessage(), e); }
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; }
/** * 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 MultiStatus computeGroupResult(List<IStatus> jobResults) { List<IStatus> importantResults = new ArrayList<IStatus>(); for (IStatus jobResult : jobResults) { if (jobResult.getSeverity() != IStatus.OK) importantResults.add(jobResult); } if (importantResults.isEmpty()) return new MultiStatus("org.eclipse.core.jobs", 0, name, null); //$NON-NLS-1$ String pluginId = importantResults.get(0).getPlugin(); IStatus[] groupResults = importantResults.toArray(new IStatus[importantResults.size()]); return new MultiStatus(pluginId, 0, groupResults, name, null); }