plugin to Execute Multiple Run Configurations

Hi,

I'm trying to write a plugin to implement this feature request: http://youtrack.jetbrains.com/issue/IDEA-64839

Here's the code I've got so far.  Its based on the GarbageCollectionAction sample.

    private static List<String> runConfigs = Arrays.asList("RunConfigName1", "RunConfigName2", "RunConfigName3");

    public void actionPerformed(AnActionEvent event) {

        Project project = event.getData( PlatformDataKeys.PROJECT );
        RunManagerImpl runManager = (RunManagerImpl) RunManager.getInstance(project);

        RunConfiguration[] allConfigurations = runManager.getAllConfigurations();
        for (RunConfiguration config : allConfigurations) {
            if( runConfigs.contains(config.getName()) ) {
                Executor runExecutorInstance = DefaultRunExecutor.getRunExecutorInstance();
                RunnerAndConfigurationSettings settings = runManager.getSettings(config);
                ProgramRunnerUtil.executeConfiguration(project, settings, runExecutorInstance);
            }
        }

    }


When I click the menu item this almost works in that RunConfigName1 starts correctly, I get the log view and everything, but the subsquent configurations don't start.  If I set a break point I can see that ProgramRunnerUtil.executeConfiguration is getting called for each of the run configurations I'm interested in, but something is preventing them from starting.

Any suggestions on how to debug this?

Thanks!
2 comments
Comment actions Permalink

Before you can start another configuration, you must wait for the first run configuration to complete startup. To receive notifications about the startup completion, you can subscribe to the ExecutionManager.EXECUTION_TOPIC. You can find an example of doing that in ExecutorRegistryImpl.initComponent().

0

Please sign in to leave a comment.