Пример #1
0
 private void markWholeFileDirty(@NotNull Project project) {
   setDirtyScope(Pass.UPDATE_ALL, WHOLE_FILE_DIRTY_MARKER);
   setDirtyScope(Pass.EXTERNAL_TOOLS, WHOLE_FILE_DIRTY_MARKER);
   setDirtyScope(Pass.LOCAL_INSPECTIONS, WHOLE_FILE_DIRTY_MARKER);
   TextEditorHighlightingPassRegistrarEx registrar =
       (TextEditorHighlightingPassRegistrarEx)
           TextEditorHighlightingPassRegistrar.getInstance(project);
   for (DirtyScopeTrackingHighlightingPassFactory factory :
       registrar.getDirtyScopeTrackingFactories()) {
     setDirtyScope(factory.getPassId(), WHOLE_FILE_DIRTY_MARKER);
   }
 }
  public List<HighlightInfo> runMainPasses(
      @NotNull PsiFile psiFile,
      @NotNull Document document,
      @NotNull final ProgressIndicator progress) {
    final List<HighlightInfo> result = new ArrayList<HighlightInfo>();
    final VirtualFile virtualFile = psiFile.getVirtualFile();
    if (virtualFile != null && !virtualFile.getFileType().isBinary()) {

      final List<TextEditorHighlightingPass> passes =
          TextEditorHighlightingPassRegistrarEx.getInstanceEx(myProject)
              .instantiateMainPasses(psiFile, document);

      Collections.sort(
          passes,
          new Comparator<TextEditorHighlightingPass>() {
            @Override
            public int compare(TextEditorHighlightingPass o1, TextEditorHighlightingPass o2) {
              if (o1 instanceof GeneralHighlightingPass) return -1;
              if (o2 instanceof GeneralHighlightingPass) return 1;
              return 0;
            }
          });

      for (TextEditorHighlightingPass pass : passes) {
        pass.doCollectInformation(progress);
        result.addAll(pass.getInfos());
      }
    }

    return result;
  }