public PostprocessReformattingAspect(
      Project project, PsiManager psiManager, TreeAspect treeAspect) {
    myProject = project;
    myPsiManager = psiManager;
    myTreeAspect = treeAspect;
    PomManager.getModel(psiManager.getProject())
        .registerAspect(
            PostprocessReformattingAspect.class,
            this,
            Collections.singleton((PomModelAspect) treeAspect));

    ApplicationListener applicationListener =
        new ApplicationAdapter() {
          public void writeActionStarted(final Object action) {
            final CommandProcessor processor = CommandProcessor.getInstance();
            if (processor != null) {
              final Project project = processor.getCurrentCommandProject();
              if (project == myProject) {
                myPostponedCounter++;
              }
            }
          }

          public void writeActionFinished(final Object action) {
            final CommandProcessor processor = CommandProcessor.getInstance();
            if (processor != null) {
              final Project project = processor.getCurrentCommandProject();
              if (project == myProject) {
                decrementPostponedCounter();
              }
            }
          }
        };
    ApplicationManager.getApplication().addApplicationListener(applicationListener, this);
  }
Пример #2
0
 public void setPatternAnnotation(@Nullable String patternAnnotation) {
   if (patternAnnotation == null) return;
   myPatternAnnotation = patternAnnotation;
   myPatternAnnotationPair =
       Pair.create(patternAnnotation, Collections.singleton(patternAnnotation));
 }
Пример #3
0
 public void setSubstAnnotation(@Nullable String substAnnotation) {
   if (substAnnotation == null) return;
   mySubstAnnotation = substAnnotation;
   mySubstAnnotationPair = Pair.create(substAnnotation, Collections.singleton(substAnnotation));
 }
Пример #4
0
 public void setLanguageAnnotation(@Nullable String languageAnnotation) {
   if (languageAnnotation == null) return;
   myLanguageAnnotation = languageAnnotation;
   myLanguageAnnotationPair =
       Pair.create(languageAnnotation, Collections.singleton(languageAnnotation));
 }