Exemplo n.º 1
0
  /**
   * 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;
    try {
      strategy = EvaluationStrategyManager.getInstance().getEvaluationStrategy(project);
    } catch (FeatureModelNotFoundException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
      return;
    }
    // cannot check anything without a strategy
    if (strategy == null) return;

    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();
  }
Exemplo n.º 2
0
 protected void clearEvaluationStrategyCache(IProject project) {
   IEvaluationStrategy strategy;
   try {
     IFeatureModel featureModel = FeatureModelManager.getInstance().getFeatureModel(project);
     strategy = EvaluationStrategyManager.getInstance().getEvaluationStrategy(project);
     strategy.clearCache(featureModel);
   } catch (FeatureModelNotFoundException e1) {
     // TODO Auto-generated catch block
     e1.printStackTrace();
     return;
   }
 }
 public ColoredSourceFile getSourceFile() {
   ITypeRoot java = getInputJavaElement();
   assert java != null;
   assert java.getResource() instanceof IFile;
   IFile file = (IFile) java.getResource();
   if (file != null) {
     IFeatureModel featureModel;
     try {
       featureModel = FeatureModelManager.getInstance().getFeatureModel(file.getProject());
     } catch (FeatureModelNotFoundException e) {
       e.printStackTrace();
       assert false : e;
       return null;
     }
     return ColoredSourceFile.getColoredSourceFile(file, featureModel);
   }
   return null;
 }