Search in sources :

Example 51 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project epp.mpc by eclipse.

the class MarketplaceUnmarshaller method createContentError.

private IStatus createContentError(ByteBuffer peekBuffer, String message, Throwable t) {
    IStatus status = createErrorStatus(message, t);
    if (peekBuffer != null && peekBuffer.hasRemaining()) {
        IStatus contentInfo = createContentInfo(peekBuffer);
        if (contentInfo != null) {
            MultiStatus multiStatus = new MultiStatus(status.getPlugin(), status.getCode(), status.getMessage(), status.getException());
            multiStatus.add(contentInfo);
            status = multiStatus;
        }
    }
    return status;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) MultiStatus(org.eclipse.core.runtime.MultiStatus)

Example 52 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project epp.mpc by eclipse.

the class MarketplaceClientCore method computeStatus.

public static IStatus computeStatus(Throwable e, String message) {
    Throwable cause = e;
    if (e instanceof InvocationTargetException) {
        cause = e.getCause();
    }
    IStatus statusCause = computeWellknownProblemStatus(e);
    if (statusCause == null) {
        if (cause instanceof CoreException) {
            statusCause = ((CoreException) cause).getStatus();
        } else {
            statusCause = new Status(IStatus.ERROR, BUNDLE_ID, cause.getMessage(), cause);
        }
    }
    if (message == null || "".equals(message.trim())) {
        // $NON-NLS-1$
        message = statusCause.getMessage();
    } else if (statusCause.getMessage() != null && !"".equals(statusCause.getMessage().trim())) {
        // $NON-NLS-1$
        message = NLS.bind(Messages.MarketplaceClientCore_message_message2, message, statusCause.getMessage());
    }
    IStatus status = new MultiStatus(BUNDLE_ID, 0, new IStatus[] { statusCause }, message, cause);
    return 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) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 53 with MultiStatus

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

the class OpenShiftPublishController method publishStart.

@Override
public void publishStart(final IProgressMonitor monitor) throws CoreException {
    this.syncDownFailed = false;
    IServer server = getServer();
    this.rsync = createRsync(server, monitor);
    final File localDirectory = getLocalFolder();
    final MultiStatus status = new MultiStatus(OpenShiftCoreActivator.PLUGIN_ID, 0, NLS.bind("Error while publishing server {0}.  Could not sync all pods to folder {1}", server.getName(), localDirectory.getAbsolutePath()), null);
    rsync.syncPodsToDirectory(localDirectory, status, ServerConsoleModel.getDefault().getConsoleWriter());
    if (!status.isOK()) {
        handleSyncDownFailure(status);
    }
    final IProject deployProject = OpenShiftServerUtils.checkedGetDeployProject(server);
    // If the magic project is *also* a module on the server, do nothing
    if (!modulesIncludesMagicProject(getServer(), deployProject)) {
        publishModule(monitor, deployProject, localDirectory);
    }
}
Also used : IServer(org.eclipse.wst.server.core.IServer) MultiStatus(org.eclipse.core.runtime.MultiStatus) File(java.io.File) IProject(org.eclipse.core.resources.IProject)

Example 54 with MultiStatus

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

the class OpenShiftPublishController method syncUp.

protected void syncUp(final File localFolder, final IResource resource) throws CoreException {
    final MultiStatus status = new MultiStatus(OpenShiftCoreActivator.PLUGIN_ID, 0, NLS.bind("Could not sync {0} to all pods running the service {1}", localFolder, resource.getName()), null);
    rsync.syncDirectoryToPods(localFolder, status, ServerConsoleModel.getDefault().getConsoleWriter());
    if (!status.isOK()) {
        throw new CoreException(status);
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) MultiStatus(org.eclipse.core.runtime.MultiStatus)

Example 55 with MultiStatus

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

the class OpenShiftEapModulesController method syncDown.

private MultiStatus syncDown(IProgressMonitor monitor) throws CoreException {
    final RSync rsync = OpenShiftServerUtils.createRSync(getServer(), monitor);
    final File localDeploymentDirectory = new File(getDeploymentOptions().getDeploymentsRootFolder(true));
    final MultiStatus status = new MultiStatus(OpenShiftCoreActivator.PLUGIN_ID, IStatus.OK, NLS.bind("Could not sync all pods to folder {0}.", localDeploymentDirectory.getAbsolutePath()), null);
    rsync.syncPodsToDirectory(localDeploymentDirectory, status, ServerConsoleModel.getDefault().getConsoleWriter());
    return status;
}
Also used : RSync(org.jboss.tools.openshift.core.server.RSync) MultiStatus(org.eclipse.core.runtime.MultiStatus) File(java.io.File)

Aggregations

MultiStatus (org.eclipse.core.runtime.MultiStatus)146 IStatus (org.eclipse.core.runtime.IStatus)102 Status (org.eclipse.core.runtime.Status)62 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