예제 #1
0
  private void buildFile(
      BuildContext context, List<IBuildParticipant> participants, IProgressMonitor monitor)
      throws CoreException {
    if (CollectionsUtil.isEmpty(participants)) {
      return;
    }

    SubMonitor sub = SubMonitor.convert(monitor, 2 * participants.size());
    for (IBuildParticipant participant : participants) {
      long startTime = System.nanoTime();
      participant.buildFile(context, sub.newChild(1));
      if (traceParticipantsEnabled) {
        double endTime = ((double) System.nanoTime() - startTime) / 1000000;
        IdeLog.logTrace(
            BuildPathCorePlugin.getDefault(),
            MessageFormat.format(
                "Executed build participant ''{0}'' on ''{1}'' in {2} ms.",
                participant.getName(), context.getURI(), endTime),
            IDebugScopes.BUILDER_PARTICIPANTS); // $NON-NLS-1$
      }

      // stop building if it has been canceled
      if (sub.isCanceled()) {
        break;
      }
    }
    updateMarkers(context, sub.newChild(participants.size()));
    sub.done();
  }
예제 #2
0
  public void buildFile(BuildContext context, IProgressMonitor monitor) {
    String contents = null;
    String uri = context.getName();
    try {
      contents = context.getContents();

      RubyParseState parseState = new RubyParseState(contents, uri, 1, version);
      uri = context.getURI().toString();
      context.getAST(parseState);
    } catch (CoreException e) {
      // ignore, just forcing a parse
    }

    Collection<IProblem> problems = new ArrayList<IProblem>();
    for (IParseError parseError : context.getParseErrors()) {
      int severity = parseError.getSeverity().intValue();
      int line = -1;
      if (contents != null) {
        line = getLineNumber(parseError.getOffset(), contents);
      }
      problems.add(
          new Problem(
              severity,
              parseError.getMessage(),
              parseError.getOffset(),
              parseError.getLength(),
              line,
              uri));
    }
    context.putProblems(IMarker.PROBLEM, problems);
  }
예제 #3
0
  public void buildFile(BuildContext context, IProgressMonitor monitor) {
    if (context == null) {
      return;
    }

    List<IProblem> problems = new ArrayList<IProblem>();

    String source = context.getContents();
    URI uri = context.getURI();
    String path = uri.toString();

    String report = getReport(source, uri);
    List<String> filters = getFilters();
    processErrorsInReport(report, path, problems, filters);
    processWarningsInReport(report, path, problems, filters);

    context.putProblems(ICSSConstants.W3C_PROBLEM, problems);
  }