protected void updateTasksFor(SourceFile sourceFile, CompilationResult result)
      throws CoreException {
    IMarker[] markers = JavaBuilder.getTasksFor(sourceFile.resource);
    CategorizedProblem[] tasks = result.getTasks();
    if (tasks == null && markers.length == 0) return;

    JavaBuilder.removeTasksFor(sourceFile.resource);
    storeTasksFor(sourceFile, tasks);
  }