コード例 #1
0
ファイル: TypingManager.java プロジェクト: csytang/Loong_de
  /**
   * called from within a job
   *
   * @param monitor
   */
  public void evaluateChecks(
      Collection<ITypingCheck> checks, IProject project, IProgressMonitor monitor) {
    SubProgressMonitor monitor2 = new SubProgressMonitor(monitor, 1);
    monitor2.beginTask("Evaluating type checks...", checks.size() + 10);

    // called from within a job!
    IEvaluationStrategy strategy = null;

    try {
      strategy = EvaluationStrategyManager.getInstance().getEvaluationStrategy(project);
      // cannot check anything without a strategy
      if (strategy == null) return;
    } catch (FeatureModelNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    monitor2.worked(10);

    int i = 0;
    for (ITypingCheck check : checks) {
      i++;
      if (i % 25 == 0) {
        monitor2.subTask("Evaluating type check " + i + "/" + checks.size());
        monitor2.worked(25);
      }

      boolean isWelltyped = check.evaluate(strategy);

      if (!isWelltyped) markIlltyped(check);
      else markWelltyped(check);
    }

    monitor2.done();
  }
コード例 #2
0
ファイル: TypingManager.java プロジェクト: csytang/Loong_de
 private void markWelltyped(ITypingCheck check) {
   // remove marker in case one exists (can happen during reevaluation)
   assert check.getFile() != null;
   if (markerIds.containsKey(check)) {
     long markerId = markerIds.remove(check);
     IMarker marker = check.getFile().getResource().getMarker(markerId);
     if (marker.exists())
       try {
         marker.delete();
       } catch (CoreException e) {
         e.printStackTrace();
       }
   }
 }
コード例 #3
0
ファイル: TypingManager.java プロジェクト: csytang/Loong_de
  private void markIlltyped(ITypingCheck check) {

    try {
      if (markerIds.containsKey(check)) {
        long markerId = markerIds.get(check);
        IMarker marker = check.getFile().getResource().getMarker(markerId);
        if (marker.exists()) {
          new TypingMarkerFactory().updateErrorMarker(marker, check);
          return;
        }
      }
      IMarker marker = new TypingMarkerFactory().createErrorMarker(check);
      markerIds.put(check, marker.getId());
    } catch (CoreException e) {
      e.printStackTrace();
    }
  }