Search in sources :

Example 6 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project xtext-eclipse by eclipse.

the class CompositeSearchQuery method run.

@Override
public IStatus run(IProgressMonitor monitor) throws OperationCanceledException {
    SubMonitor progress = SubMonitor.convert(monitor, children.size());
    MultiStatus multiStatus = new MultiStatus(getPluginId(), IStatus.OK, "Composite search state", null);
    for (ISearchQuery child : children) {
        IStatus status = child.run(progress.newChild(1));
        multiStatus.add(status);
        if (progress.isCanceled()) {
            return Status.CANCEL_STATUS;
        }
    }
    return multiStatus;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) SubMonitor(org.eclipse.core.runtime.SubMonitor) MultiStatus(org.eclipse.core.runtime.MultiStatus) ISearchQuery(org.eclipse.search.ui.ISearchQuery)

Example 7 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project eclipse.platform.text by eclipse.

the class EditorsPlugin method logErrorStatus.

public static void logErrorStatus(String message, IStatus status) {
    if (status == null) {
        logErrorMessage(message);
        return;
    }
    MultiStatus multi = new MultiStatus(EditorsUI.PLUGIN_ID, IEditorsStatusConstants.INTERNAL_ERROR, message, null);
    multi.add(status);
    log(multi);
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus)

Example 8 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project eclipse.platform.text by eclipse.

the class FileDocumentProvider method doValidateState.

@Override
protected void doValidateState(Object element, Object computationContext) throws CoreException {
    if (element instanceof IFileEditorInput) {
        IFileEditorInput input = (IFileEditorInput) element;
        FileInfo info = (FileInfo) getElementInfo(input);
        if (info != null) {
            IFile file = input.getFile();
            if (file.isReadOnly()) {
                // do not use cached state here
                IWorkspace workspace = file.getWorkspace();
                info.fStatus = workspace.validateEdit(new IFile[] { file }, computationContext);
            }
            if (isDerived(file)) {
                IStatus status = new Status(IStatus.WARNING, EditorsUI.PLUGIN_ID, EditorsUI.DERIVED_FILE, TextEditorMessages.FileDocumentProvider_warning_fileIsDerived, null);
                if (info.fStatus == null || info.fStatus.isOK())
                    info.fStatus = status;
                else
                    info.fStatus = new MultiStatus(EditorsUI.PLUGIN_ID, EditorsUI.STATE_VALIDATION_FAILED, new IStatus[] { info.fStatus, status }, TextEditorMessages.FileDocumentProvider_stateValidationFailed, null);
            }
        }
    }
    super.doValidateState(element, computationContext);
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IResourceStatus(org.eclipse.core.resources.IResourceStatus) IStatus(org.eclipse.core.runtime.IStatus) IFile(org.eclipse.core.resources.IFile) IFileEditorInput(org.eclipse.ui.IFileEditorInput) IWorkspace(org.eclipse.core.resources.IWorkspace) MultiStatus(org.eclipse.core.runtime.MultiStatus)

Example 9 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project linuxtools by eclipse.

the class MassifLaunchDelegate method abort.

/**
 * Throws a core exception with an error status object built from the given
 * message, lower level exception, and error code.
 *
 * @param message
 *            the status message
 * @param exception
 *            lower level exception associated with the error, or
 *            <code>null</code> if none
 * @param code
 *            error code
 */
private void abort(String message, Throwable exception, int code) throws CoreException {
    IStatus status;
    if (exception != null) {
        MultiStatus multiStatus = new MultiStatus(MassifPlugin.PLUGIN_ID, code, message, exception);
        multiStatus.add(new Status(IStatus.ERROR, MassifPlugin.PLUGIN_ID, code, exception.getLocalizedMessage(), exception));
        status = multiStatus;
    } else {
        status = new Status(IStatus.ERROR, MassifPlugin.PLUGIN_ID, code, message, null);
    }
    throw new CoreException(status);
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) IStatus(org.eclipse.core.runtime.IStatus) CoreException(org.eclipse.core.runtime.CoreException) MultiStatus(org.eclipse.core.runtime.MultiStatus)

Example 10 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project linuxtools by eclipse.

the class CachegrindLaunchDelegate method abort.

/**
 * Throws a core exception with an error status object built from the given
 * message, lower level exception, and error code.
 *
 * @param message
 *            the status message
 * @param exception
 *            lower level exception associated with the error, or
 *            <code>null</code> if none
 * @param code
 *            error code
 */
private void abort(String message, Throwable exception, int code) throws CoreException {
    IStatus status;
    if (exception != null) {
        MultiStatus multiStatus = new MultiStatus(CachegrindPlugin.PLUGIN_ID, code, message, exception);
        multiStatus.add(new Status(IStatus.ERROR, CachegrindPlugin.PLUGIN_ID, code, exception.getLocalizedMessage(), exception));
        status = multiStatus;
    } else {
        status = new Status(IStatus.ERROR, CachegrindPlugin.PLUGIN_ID, code, message, null);
    }
    throw new CoreException(status);
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) IStatus(org.eclipse.core.runtime.IStatus) CoreException(org.eclipse.core.runtime.CoreException) MultiStatus(org.eclipse.core.runtime.MultiStatus)

Aggregations

MultiStatus (org.eclipse.core.runtime.MultiStatus)140 IStatus (org.eclipse.core.runtime.IStatus)98 Status (org.eclipse.core.runtime.Status)60 CoreException (org.eclipse.core.runtime.CoreException)41 ArrayList (java.util.ArrayList)29 File (java.io.File)24 SubMonitor (org.eclipse.core.runtime.SubMonitor)24 IOException (java.io.IOException)14 InvocationTargetException (java.lang.reflect.InvocationTargetException)13 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)13 List (java.util.List)11 HashMap (java.util.HashMap)10 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)10 IPath (org.eclipse.core.runtime.IPath)8 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)8 FileNotFoundException (java.io.FileNotFoundException)7 HashSet (java.util.HashSet)7 IProject (org.eclipse.core.resources.IProject)7 IContainer (org.eclipse.core.resources.IContainer)6 URI (java.net.URI)5