Пример #1
0
  private void updateMarkers(BuildContext context, IProgressMonitor monitor) {
    final IFile file = context.getFile();
    final Map<String, Collection<IProblem>> itemsByType = context.getProblems();
    if (CollectionsUtil.isEmpty(itemsByType)) {
      return;
    }
    // Performance fix: schedules the error handling as a single workspace update so that we don't
    // trigger a
    // bunch of resource updated events while problem markers are being added to the file.
    IWorkspaceRunnable runnable =
        new IWorkspaceRunnable() {
          public void run(IProgressMonitor monitor) {
            updateMarkers(file, itemsByType, monitor);
          }
        };

    try {
      ResourcesPlugin.getWorkspace()
          .run(runnable, getMarkerRule(file), IWorkspace.AVOID_UPDATE, monitor);
    } catch (CoreException e) {
      IdeLog.logError(BuildPathCorePlugin.getDefault(), "Error updating markers", e); // $NON-NLS-1$
    }
  }