Java 类com.intellij.psi.ExternalChangeAction 实例源码

项目:consulo    文件:FileDocumentManagerImpl.java   
@Override
public void documentChanged(DocumentEvent e) {
  final Document document = e.getDocument();
  if (!ApplicationManager.getApplication().hasWriteAction(ExternalChangeAction.ExternalDocumentChange.class)) {
    myUnsavedDocuments.add(document);
  }
  final Runnable currentCommand = CommandProcessor.getInstance().getCurrentCommand();
  Project project = currentCommand == null ? null : CommandProcessor.getInstance().getCurrentCommandProject();
  if (project == null)
    project = ProjectUtil.guessProjectForFile(getFile(document));
  String lineSeparator = CodeStyleFacade.getInstance(project).getLineSeparator();
  document.putUserData(LINE_SEPARATOR_KEY, lineSeparator);

  // avoid documents piling up during batch processing
  if (areTooManyDocumentsInTheQueue(myUnsavedDocuments)) {
    saveAllDocumentsLater();
  }
}
项目:intellij-ce-playground    文件:AndroidModuleBuilder.java   
private void createActivityAndSetupManifest(final AndroidFacet facet, final PsiDirectory sourceDir) {
  if (myPackageName != null) {
    CommandProcessor.getInstance().executeCommand(facet.getModule().getProject(), new ExternalChangeAction() {
      @Override
      public void run() {
        Runnable action = new Runnable() {
          @Override
          public void run() {
            PsiDirectory packageDir = createPackageIfPossible(sourceDir, myPackageName);
            if (packageDir == null) return;
            final Manifest manifest = facet.getManifest();
            if (manifest != null) {
              manifest.getPackage().setValue(myPackageName);
              final Module module = facet.getModule();
              final Project project = module.getProject();
              StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
                @Override
                public void run() {
                  FileDocumentManager.getInstance().saveAllDocuments();
                }
              });

              assignApplicationName(facet);

              Sdk sdk = getAndroidSdkForModule(module);
              if (sdk != null) {
                final AndroidPlatform platform = AndroidPlatform.parse(sdk);
                if (platform != null) {
                  configureManifest(facet, platform.getTarget());
                }
              }
            }
          }
        };
        ApplicationManager.getApplication().runWriteAction(action);
      }
    }, AndroidBundle.message("build.android.module.process.title"), null);
  }
}
项目:intellij-ce-playground    文件:UndoManagerImpl.java   
public static boolean isRefresh() {
  return ApplicationManager.getApplication().hasWriteAction(ExternalChangeAction.class);
}
项目:tools-idea    文件:UndoManagerImpl.java   
public static boolean isRefresh() {
  return ApplicationManager.getApplication().hasWriteAction(ExternalChangeAction.class);
}
项目:consulo    文件:UndoManagerImpl.java   
public static boolean isRefresh() {
  return ApplicationManager.getApplication().hasWriteAction(ExternalChangeAction.class);
}