Java 类com.intellij.util.ActionRunner 实例源码

项目:intellij-ce-playground    文件:ModuleDependenciesPanel.java   
@Override
public void apply() {
  List<ModuleDependenciesTableItem> items = myModel.getItems();
  final List<BuildFileStatement> dependencies = Lists.newArrayListWithExpectedSize(items.size());
  for (ModuleDependenciesTableItem item : items) {
    dependencies.add(item.getEntry());
  }
  try {
    ActionRunner.runInsideWriteAction(new ActionRunner.InterruptibleRunnable() {
      @Override
      public void run() throws Exception {
        myGradleBuildFile.setValue(BuildFileKey.DEPENDENCIES, dependencies);
      }
    });
  }
  catch (Exception e) {
    LOG.error("Unable to commit dependency changes", e);
  }
  myModel.resetModified();
}
项目:intellij-ce-playground    文件:GenericEditor.java   
@Override
public void apply() throws ConfigurationException {
  CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() {
    @Override
    public void run() {
      try {
        ActionRunner.runInsideWriteAction(new ActionRunner.InterruptibleRunnable() {
          @Override
          public void run() throws Exception {
            myPanel.apply();
          }
        });
      }
      catch (Exception e) {
        LOG.error("Error while applying changes", e);
      }
    }
  });
}
项目:idea-php-typo3-plugin    文件:TYPO3CMSClassicLayoutDirectoryProjectGenerator.java   
@Override
public void generateProject(@NotNull Project project, @NotNull VirtualFile baseDir, @NotNull GithubTagInfo tag, @NotNull Module module) {
    super.generateProject(project, baseDir, tag, module);

    try {
        ActionRunner.runInsideWriteAction(() -> {
            final VirtualFile extDir = VfsUtil.createDirectoryIfMissing(baseDir, "typo3conf/ext");
        });

    } catch (Exception e) {
        Messages.showErrorDialog("There was an error when trying to create additional project files", "Error Creating Additional Files");
    }
}
项目:idea-ebean-enhancer    文件:EbeanEnhancementTask.java   
public void process() {
    try {
        ActionRunner.runInsideWriteAction(
            new ActionRunner.InterruptibleRunnable() {
                @Override
                public void run() throws Exception {
                    doProcess();
                }
            }
        );
    } catch (Exception e) {
        compileContext.addMessage(CompilerMessageCategory.ERROR, e.getClass().getName() + ":" + e.getMessage(), null, -1, -1);
    }
}
项目:intellij-ce-playground    文件:AndroidProjectConfigurable.java   
@Override
public void apply() throws ConfigurationException {
  if (myGradleBuildFile == null) {
    return;
  }
  VirtualFile file = myGradleBuildFile.getFile();
  if (!ReadonlyStatusHandler.ensureFilesWritable(myProject, file)) {
    throw new ConfigurationException(String.format("Build file %1$s is not writable", file.getPath()));
  }

  CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() {
    @Override
    public void run() {
      try {
        ActionRunner.runInsideWriteAction(new ActionRunner.InterruptibleRunnable() {
          @Override
          public void run() throws Exception {
            for (BuildFileKey key : PROJECT_PROPERTIES) {
              if (key == BuildFileKey.GRADLE_WRAPPER_VERSION || !myModifiedKeys.contains(key)) {
                continue;
              }
              Object value = myProjectProperties.get(key);
              if (value != null) {
                myGradleBuildFile.setValue(key, value);
              } else {
                myGradleBuildFile.removeValue(null, key);
              }
            }
            Object wrapperVersion = myProjectProperties.get(BuildFileKey.GRADLE_WRAPPER_VERSION);
            File wrapperPropertiesFile = GradleUtil.findWrapperPropertiesFile(myProject);
            if (wrapperVersion != null && wrapperPropertiesFile != null) {
              boolean updated = GradleUtil.updateGradleDistributionUrl(wrapperVersion.toString(), wrapperPropertiesFile);
              if (updated) {
                VirtualFile virtualFile = VfsUtil.findFileByIoFile(wrapperPropertiesFile, true);
                if (virtualFile != null) {
                  virtualFile.refresh(false, false);
                }
              }
            }
            myModifiedKeys.clear();
          }
        });
      }
      catch (Exception e) {
        LOG.error("Error while applying changes", e);
      }
    }
  });
}