Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.MultiStatus


      return entry;
    } else if (status.isMultiStatus()) {
      ((MultiStatus) status).add(entry);
      return status;
    } else {
      MultiStatus result = new MultiStatus(VisualSwingPlugin.getPluginID(), VALIDATE_EDIT_CHANGED_CONTENT, Messages.JAVA_UTIL_MODIFIED_RESOURCE, null);
      result.add(status);
      result.add(entry);
      return result;
    }
  }
View Full Code Here


   */
  public void testExpectedWarnings() throws Exception {
    migrateModelOnly();

    // expected to be multistatus
    MultiStatus status = (MultiStatus) this.resultStatus;
   
    // get the warnings from a text file
    String[] warnings = XmlTestCase.readFile(getExpectedWarningsFile()).split("\n");
    List<String> expected = new ArrayList<String>();
    for (String w : warnings) {
      expected.add(w.trim());
    }
   
    for (IStatus i : status.getChildren()) {
      String message = i.getMessage().trim();
     
      // does it exist?
      if (!expected.contains(message)) {
        for (IStatus w : status.getChildren()) {
          System.err.println(w.getMessage());
        }
      }
      assertTrue("Does not contain message '" + message + "': " + expected, expected.contains(message));

View Full Code Here

    // count of images exported
    int exported = 0;
   
    // we collect up all uninitialisable diagrams, so we can
    // quickly see which ones were unable to open
    MultiStatus errorResult = new MultiStatus(DocToolsPlugin.PLUGIN_ID, Status.ERROR, "Could not export example images: multiple errors occured", null);
   
    for (EClass cls : classes) {
      monitor.beginTask("Exporting class " + cls.getName(), 105);
     
      monitor.subTask("Finding file for class " + cls.getName());
      IFile file = getFileFor(cls);
      if (getFileFor(cls) == null
        continue;    // skip
     
      monitor.worked(10);
     
      InitialiseDiagram init = new InitialiseDiagram();
      IFile diagram;
      try {
        diagram = init.initialize(project, file, true /* open new diagram */, new SubProgressMonitor(monitor, 50));
      } catch (InitializeDiagramException e) {
        // if we couldn't initialise it, skip it
        errorResult.add(errorStatus("Class '" + cls.getName() + "'", e));
        continue;
      }
     
      // the diagram should now be opened
      monitor.subTask("Exporting root image");
     
      // get the active workbench editor part
      // based on IamlDiagramEditorUtil#openDiagram()
      IWorkbenchPage page = PlatformUI.getWorkbench()
        .getActiveWorkbenchWindow().getActivePage();
      DiagramDocumentEditor editor = (DiagramDocumentEditor) page.getActiveEditor();
     
      // export only one image
      exportDiagramThenClose(cls, editor, new SubProgressMonitor(monitor, 40));
     
      // finally, delete the diagram file
      monitor.subTask("Deleting diagram file");
      diagram.delete(true, new SubProgressMonitor(monitor, 5));
      monitor.done();
     
      exported++;

    }
   
    // any errors in initialising?
    if (errorResult.getChildren().length != 0) {
      return errorResult;
    }
   
    // done
    if (exported == 0) {
View Full Code Here

      return Status.OK_STATUS;
    if (errors.size() == 1)
      return errors.get(0);
   
    // otherwise create a multi status
    IStatus multi = new MultiStatus(PLUGIN_ID,
        Status.ERROR,
        errors.toArray(new IStatus[]{}),
        getMultiErrorMessage(),
        null);
    return multi;
View Full Code Here

      return Status.OK_STATUS;
    if (warnings.size() == 1)
      return errors.get(0);
   
    // otherwise create a multi status
    IStatus multi = new MultiStatus(PLUGIN_ID,
        Status.WARNING,
        warnings.toArray(new IStatus[]{}),
        getMultiWarningMessage(),
        null);
    return multi;
View Full Code Here

            IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1 * scale);
           
          final IStatus status = execute(individual, subMonitor);
          if (!status.isOK()) {
            // make a status to wrap it around
            IStatus multi = new MultiStatus(
                PLUGIN_ID,
                Status.ERROR,
                new IStatus[] { status },
                getErrorMessage(individual, status.getMessage()),
                status.getException());
View Full Code Here

   */
  public void testExpectedWarnings() throws Exception {
    migrateModelOnly();

    // expected to be multistatus
    MultiStatus status = (MultiStatus) this.resultStatus;
   
    // get the warnings from a text file
    String[] warnings = XmlTestCase.readFile(getExpectedWarningsFile()).split("\n");
    List<String> expected = new ArrayList<String>();
    for (String w : warnings) {
      expected.add(w.trim());
    }
   
    for (IStatus i : status.getChildren()) {
      String message = i.getMessage().trim();
     
      // does it exist?
      if (!expected.contains(message)) {
        System.err.println("All warnings found in " + getModel() + ":");
        for (IStatus w : status.getChildren()) {
          System.err.println(w.getMessage());
        }
      }
      assertTrue("Does not contain message '" + message + "': " + expected, expected.contains(message));

View Full Code Here

            if (errors.isEmpty()) {
              return Status.OK_STATUS;
            }
           
            // compile a multi status
            MultiStatus s = new MultiStatus(PLUGIN_ID, Status.WARNING, errors.size() + " problems occured when migrating model", null);
            for (ExpectedMigrationException e : errors) {
              s.add( new Status(Status.WARNING, PLUGIN_ID, e.getMessage(), e) );
            }
           
            monitor.done();

            return s;
View Full Code Here

        throw new RuntimeException(status.getMessage(), status.getException());
      }
     
      if (status.isMultiStatus()) {
        // build up the message to alert the developer
        MultiStatus ms = (MultiStatus) status;
        StringBuffer msg = new StringBuffer();
        msg.append("Status was not OK: [" + status.getPlugin() + "] " + status.getMessage());
        for (IStatus s : ms.getChildren()) {
          msg.append("\n").append(s.getMessage());
        }
        fail(msg.toString());
      }
     
View Full Code Here

  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);
  }
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.