Get a list of all running RunProfileStates

Hi,
I'm looking for a way to get a list of all currently running RunProfileState instances. Is this possible? I was able to get a list of running processes via the ExecutionManager but I need to retrieve the RunProfileState instances and the associated RunConfiguration instances.

Thanks,
Janni

1 comment
Comment actions Permalink

Hope you all had great holidays :-)
I still haven't found out a way to retrieve all running RunProfileStates, but if somebody happens to come across this thread looking for a solution here's a hack I'm using now:

When creating the process (in my custom RunningState class):

 OSProcessHandler processHandler = new OSProcessHandler(command.createProcess(), title);
 processHandler.putUserData(MY_RUN_CONFIGURATION_KEY, config);


later:

 ProcessHandler[] runningProcesses = ExecutionManager.getInstance(project).getRunningProcesses();
 for (ProcessHandler process : runningProcesses) {
  if (process instanceof OSProcessHandler) {
    OSProcessHandler oph = (OSProcessHandler) process;
    System.out.println("running process: " + oph.getCommandLine());
    MyRunConfiguration data = process.getUserData(MY_RUN_CONFIGURATION_KEY);
    if (data != null) {
      System.out.println("running project: "+ data.getMyData());
    }
  }
 }


If anybody happens to have a cleaner solution though, let me know, thanks
- Janni
0

Please sign in to leave a comment.