Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.MultiStatus


        return status.isOK();
    }

    private IStatus generateFolder(String folderPath) {
        MultiStatus status = new MultiStatus(Plugin.PLUGIN_ID, 0, "Errors occurred during exporting.", null);

        File folder = new File(folderPath);
        File bundleFolder = new File(folder, "bundles");

        if (!bundleFolder.exists() && !bundleFolder.mkdirs()) {
            status.add(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Unable to create folder.", null));
            return status;
        }

        ProjectLauncher launcher = null;
        try {
            launcher = bndProject.getProjectLauncher();
        } catch (Exception e) {
            status.add(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error getting project launcher.", e));
            return status;
        }

        // Init classpath and launch JAR
        generateLauncherJar(launcher, folder, status);
View Full Code Here


        return status;
    }

    private IStatus generateJar(String jarPath) {
        MultiStatus status = new MultiStatus(Plugin.PLUGIN_ID, 0, "Errors occurred during exporting.", null);
        try {
            ProjectLauncher launcher = bndProject.getProjectLauncher();
            Jar jar = launcher.executable();
            jar.write(jarPath);
        } catch (Exception e) {
            status.add(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error generating executable JAR.", e));
        }
        return status;
    }
View Full Code Here

    private static void generatePackageInfos(final Collection< ? extends FileVersionTuple> pkgs) throws CoreException {
        final IWorkspaceRunnable wsOperation = new IWorkspaceRunnable() {
            public void run(IProgressMonitor monitor) throws CoreException {
                SubMonitor progress = SubMonitor.convert(monitor, pkgs.size());
                MultiStatus status = new MultiStatus(Plugin.PLUGIN_ID, 0, "Errors occurred while creating packageinfo files.", null);
                for (FileVersionTuple pkg : pkgs) {
                    IContainer[] locations = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(pkg.getFile().toURI());
                    if (locations != null && locations.length > 0) {
                        IFile pkgInfoFile = locations[0].getFile(new Path(PACKAGEINFO));

                        try {
                            ByteArrayInputStream input = new ByteArrayInputStream(pkg.formatVersionSpec().getBytes("UTF-8"));
                            pkgInfoFile.create(input, false, progress.newChild(1, 0));
                        } catch (CoreException e) {
                            status.add(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error creating file " + pkgInfoFile.getFullPath(), e));
                        } catch (UnsupportedEncodingException e) {
                            /* just ignore, should never happen */
                        }
                    }
                }

                if (!status.isOK())
                    throw new CoreException(status);
            }
        };
        IRunnableWithProgress uiOperation = new IRunnableWithProgress() {
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
View Full Code Here

    }

    @Override
    public void run(IProgressMonitor monitor) {

        MultiStatus status = new MultiStatus(Plugin.PLUGIN_ID, 0, Messages.ResolveOperation_errorOverview, null);

        // Start a coordination
        BundleContext bc = Plugin.getDefault().getBundleContext();
        ServiceReference<Coordinator> coordSvcRef = bc.getServiceReference(Coordinator.class);
        Coordinator coordinator = coordSvcRef != null ? (Coordinator) bc.getService(coordSvcRef) : null;
        Coordination coordination = coordinator != null ? coordinator.begin(ResolveOperation.class.getName(), 0) : null;

        // Begin resolve
        ResolveProcess resolve = new ResolveProcess();
        ResolverLogger logger = new ResolverLogger();
        try {
            BndResolver bndResolver = new BndResolver(logger);

            //
            // Make sure we do macro expansion properly
            //

            File resource = model.getBndResource();
            if (model.isProjectFile()) {
                Project project = Central.getProject(resource.getParentFile());
                //
                // run's in projects are based on the project
                // and implicitly the ws
                //
                model.setProject(project);
            } else {
                //
                // run's in bndrun files are the bndrun + workspace
                //
                Run run = new Run(Central.getWorkspace(), resource.getParentFile(), resource);
                model.setProject(run);
            }

            ReporterLogService log = new ReporterLogService(Central.getWorkspace());
            Map<Resource,List<Wire>> wirings = resolve.resolveRequired(model, Central.getWorkspace(), bndResolver, callbacks, log);
            result = new ResolutionResult(Outcome.Resolved, wirings, null, status, logger.getLog());
            if (coordination != null)
                coordination.end();
        } catch (ResolveCancelledException e) {
            result = new ResolutionResult(Outcome.Cancelled, null, null, status, logger.getLog());

            if (coordination != null)
                coordination.fail(e);
        } catch (ResolutionException e) {
            status.add(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, e.getLocalizedMessage(), e));
            result = new ResolutionResult(Outcome.Unresolved, null, e, status, logger.getLog());

            if (coordination != null)
                coordination.fail(e);
        } catch (Exception e) {
            status.add(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Exception during resolution.", e));
            result = new ResolutionResult(Outcome.Error, null, null, status, logger.getLog());

            if (coordination != null)
                coordination.fail(e);
        } finally {
View Full Code Here

            indirectResources = new HashSet<SearchableRepository.ResourceDescriptor>(depsPage.getIndirectResources());
            indirectResources.removeAll(result);
        } else {
            indirectResources = Collections.<ResourceDescriptor> emptySet();
        }
        final MultiStatus status = new MultiStatus(Plugin.PLUGIN_ID, 0, "Errors occurred while processing JPM4J dependencies.", null);
        IRunnableWithProgress runnable = new IRunnableWithProgress() {
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                SubMonitor progress = SubMonitor.convert(monitor, result.size() + indirectResources.size());
                progress.setTaskName("Processing dependencies...");

                // Process all resources (including non-selected ones) into the repository
                for (ResourceDescriptor resource : result)
                    processResource(resource, status, progress.newChild(1));
                for (ResourceDescriptor resource : indirectResources)
                    processResource(resource, status, progress.newChild(1));
            }
        };

        try {
            getContainer().run(true, true, runnable);

            if (!status.isOK())
                ErrorDialog.openError(getShell(), "Errors", null, status);

            return true;
        } catch (InvocationTargetException e) {
            MessageDialog.openError(getShell(), "Error", e.getCause().getMessage());
View Full Code Here

  protected static void throwException(List<IStatus> status, String message) throws CoreException {
    if (status == null || status.size() == 0) {
      return;
    }
    throw new CoreException(new MultiStatus(CloudFoundryPlugin.PLUGIN_ID, 0, status.toArray(new IStatus[0]),
        message, null));
  }
View Full Code Here

    }

    @Override
    public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException
    {
        MultiStatus status = new MultiStatus(SigilCore.PLUGIN_ID, 0,
            "Error resolving Sigil projects", null);

        boolean flush = sigilProjects.size() > 0;

        for (ISigilProjectModel sigilProject : sigilProjects)
        {
            try
            {
                if (isDependent(sigilProject))
                {
                    if (flush)
                        sigilProject.flushDependencyState();
                    sigilProject.rebuildDependencies(monitor);
                }
            }
            catch (CoreException e)
            {
                status.add(e.getStatus());
            }
        }

        return status;
    }
View Full Code Here

       
//        monitor = ProgressUtil.getMonitorFor(monitor); //TODO
        String mainTaskMsg = "Publishing to "+getServer().getName();//NLS.bind(Messages.publishing, getServer().getName());
        monitor.beginTask(mainTaskMsg, size);
       
        MultiStatus tempMulti = new MultiStatus(Activator.PLUGIN_ID, 0, "", null);
       
        if (monitor.isCanceled())
            return Status.CANCEL_STATUS;
       
        try {
            Activator.getDefault().getPluginLogger().trace("Starting publish");
            publishStart(monitor);//ProgressUtil.getSubMonitorFor(monitor, 1000)); //TODO
           
            if (monitor.isCanceled())
                return Status.CANCEL_STATUS;
           
            // execute tasks
            MultiStatus taskStatus = performTasks(tasks, monitor);
            monitor.setTaskName(mainTaskMsg);
            if (taskStatus != null && !taskStatus.isOK())
                tempMulti.addAll(taskStatus);
           
            // execute publishers
            taskStatus = executePublishers(kind, moduleList, deltaKindList, monitor, info3);
            monitor.setTaskName(mainTaskMsg);
            if (taskStatus != null && !taskStatus.isOK())
                tempMulti.addAll(taskStatus);
           
            if (monitor.isCanceled())
                return Status.CANCEL_STATUS;
           
            // publish the server
            publishServer(kind, monitor);//ProgressUtil.getSubMonitorFor(monitor, 1000));//TODO
            monitor.setTaskName(mainTaskMsg);
           
            if (monitor.isCanceled())
                return Status.CANCEL_STATUS;
           
            // publish modules
            publishModules(kind, moduleList, deltaKindList, tempMulti, monitor);
           
            if (monitor.isCanceled())
                return Status.CANCEL_STATUS;
           
            monitor.done();
        } catch (CoreException ce) {
            Activator.getDefault().getPluginLogger().error("CoreException publishing to " + toString(), ce);
            return ce.getStatus();
        } catch (Exception e) {
            Activator.getDefault().getPluginLogger().error( "Error publishing  to " + toString(), e);
            tempMulti.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "Error publishing", e));
        } finally {
            // end the publishing
            try {
                publishFinish(monitor);//ProgressUtil.getSubMonitorFor(monitor, 500));
            } catch (CoreException ce) {
                Activator.getDefault().getPluginLogger().error("CoreException publishing to " + toString(), ce);
                tempMulti.add(ce.getStatus());
            } catch (Exception e) {
                Activator.getDefault().getPluginLogger().error("Error stopping publish to " + toString(), e);
                tempMulti.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "Error publishing", e));
            }
        }
       
        Activator.getDefault().getPluginLogger().trace("--<-- Done publishing --<--");
       
        if (tempMulti.getChildren().length == 1)
            return tempMulti.getChildren()[0];
       
        MultiStatus multi = null;
        if (tempMulti.getSeverity() == IStatus.OK)
            return Status.OK_STATUS;
        else if (tempMulti.getSeverity() == IStatus.INFO)
            multi = new MultiStatus(Activator.PLUGIN_ID, 0, "Publishing completed with information", null);
        else if (tempMulti.getSeverity() == IStatus.WARNING)
            multi = new MultiStatus(Activator.PLUGIN_ID, 0, "Publishing completed with a warning", null);
        else if (tempMulti.getSeverity() == IStatus.ERROR)
            multi = new MultiStatus(Activator.PLUGIN_ID, 0, "Publishing failed", null);
       
        if (multi != null)
            multi.addAll(tempMulti);
       
        return multi;
    }
View Full Code Here

    public static void logErrorStatus(final String message, final IStatus status) {
        if (status == null) {
            logErrorMessage(message);
            return;
        }
        final MultiStatus multi = new MultiStatus(PLUGIN_ID,
                ErlangStatus.INTERNAL_ERROR.getValue(), message, null);
        multi.add(status);
        log(multi);
    }
View Full Code Here

    public void displayMessage(final ErlideMessage emsg) {
        try {
            new UIJob("erlide message") {
                @Override
                public IStatus runInUIThread(final IProgressMonitor monitor) {
                    final MultiStatus msg = new MultiStatus("org.erlide.ui", 0,
                            emsg.getMessage(), null);
                    if (emsg.getDetails() != null) {
                        msg.add(new Status(emsg.getSeverity(), "org.erlide.ui", emsg
                                .getDetails()));
                    }
                    StatusManager.getManager().handle(msg, StatusManager.BLOCK);

                    return Status.OK_STATUS;
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.MultiStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.