Java Code Examples for org.eclipse.core.runtime.MultiStatus#getSeverity()

The following examples show how to use org.eclipse.core.runtime.MultiStatus#getSeverity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeployArtifactsHandler.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected IStatus deployArtifacts(RepositoryAccessor repositoryAccessor,
        Collection<Artifact> artifactsToDeploy,
        Map<String, Object> deployOptions,
        IWizardContainer container) {
    MultiStatus status = new MultiStatus(ApplicationPlugin.PLUGIN_ID, 0, null, null);
    if (!checkDirtyState(container)) {
        return null;
    }
    try {
        container.run(true, true,
                performFinish(repositoryAccessor, artifactsToDeploy, deployOptions, status));
    } catch (InvocationTargetException | InterruptedException e) {
        BonitaStudioLog.error(e);
        return new Status(IStatus.ERROR, ApplicationPlugin.PLUGIN_ID, "Deploy failed",
                e.getCause() != null ? e.getCause() : e);
    }
    if (status.getSeverity() == IStatus.CANCEL) {
        openAbortDialog(Display.getDefault().getActiveShell());
    }
    return status.getSeverity() == IStatus.CANCEL ? null : status;
}
 
Example 2
Source File: MultiStatusDialog.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private static int dialogImageType(MultiStatus status) {
    switch (status.getSeverity()) {
        case IStatus.ERROR:
            return MessageDialog.ERROR;
        case IStatus.WARNING:
            return MessageDialog.WARNING;
        case IStatus.INFO:
        default:
            return MessageDialog.INFORMATION;
    }
}
 
Example 3
Source File: DeployArtifactsHandler.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private IRunnableWithProgress performFinish(RepositoryAccessor repositoryAccessor,
        Collection<Artifact> artifactsToDeploy,
        Map<String, Object> deployOptions,
        MultiStatus status) {
    return monitor -> {
        new IndexingUIDOperation().run(monitor);
        GetApiSessionOperation apiSessionOperation = new GetApiSessionOperation();
        apiSessionOperation.run(monitor);
        try {
            APISession session = apiSessionOperation.getSession();
            DeployTenantResourcesOperation deployTenantResourcesOperation = new DeployTenantResourcesOperation(
                    artifactsToDeploy.stream().filter(TenantArtifact.class::isInstance)
                            .map(TenantArtifact.class::cast).collect(Collectors.toList()),
                    session, deployOptions);
            monitor.beginTask(Messages.deploy, artifactsToDeploy.size());
            deployTenantResourcesOperation.run(monitor);
            addToMultiStatus(deployTenantResourcesOperation.getStatus(), status);
            if ((boolean) deployOptions.get(DeployOptions.RUN_VALIDATION)) {
                ValidateProjectOperation operation = new ValidateProjectOperation(artifactsToDeploy);
                operation.run(monitor);
                status.add(operation.getStatus());
            }
            if (status.getSeverity() != IStatus.ERROR) {
                addToMultiStatus(deploy(artifactsToDeploy, session, monitor), status);
            }
        } finally {
            monitor.done();
            apiSessionOperation.logout();
        }
        if (monitor.isCanceled()) {
            status.add(ValidationStatus.cancel(Messages.abort));
        }
    };
}