Esempio n. 1
0
  private void createInconsistentBuildMarker(CoreException coreException) throws CoreException {
    String message = null;
    IStatus status = coreException.getStatus();
    if (status.isMultiStatus()) {
      IStatus[] children = status.getChildren();
      if (children != null && children.length > 0) message = children[0].getMessage();
    }
    if (message == null) message = coreException.getMessage();

    IMarker marker = this.currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
    marker.setAttributes(
        new String[] {
          IMarker.MESSAGE, IMarker.SEVERITY, IJavaModelMarker.CATEGORY_ID, IMarker.SOURCE_ID
        },
        new Object[] {
          Messages.bind(Messages.build_inconsistentProject, message),
          new Integer(IMarker.SEVERITY_ERROR),
          new Integer(CategorizedProblem.CAT_BUILDPATH),
          JavaBuilder.SOURCE_ID
        });
  }
 /**
  * Add this exception to the collector. If a log was specified in the constructor then the
  * exception will be output to the log. You can retreive exceptions using <code>getStatus</code>.
  *
  * @param exception the exception to collect
  */
 public void handleException(CoreException exception) {
   // log the exception if we have a log
   if (log != null) {
     log.log(new Status(severity, pluginId, 0, message, exception));
   }
   // Record each status individually to flatten the resulting multi-status
   IStatus exceptionStatus = exception.getStatus();
   // Wrap the exception so the stack trace is not lost.
   IStatus status =
       new Status(
           exceptionStatus.getSeverity(),
           exceptionStatus.getPlugin(),
           exceptionStatus.getCode(),
           exceptionStatus.getMessage(),
           exception);
   recordStatus(status);
   IStatus[] children = status.getChildren();
   for (int i = 0; i < children.length; i++) {
     IStatus status2 = children[i];
     recordStatus(status2);
   }
 }