Is there any way to trigger(start) Run/Debug configuration programmatically?

When use my plugin, I want to do some works before launch my program.

 

So I created a Run configuration, in there, I make some source code that i want to do..

My Run configuration is extension of application launch process, so in the end of my Run configuration I want to trigger(start) Run configuration those are commonly use (eg. Jara main() run / Application launch in android studio / etc...)

  1. (user click run/debug button with my Run configuration)
  2. In my Run configuration, show any dialog, make a file, etc...
  3. Finally, I want to trigger Android launch process(or any other run configuration)

 

1. Is there way to list-up Run configurations programmatically? 

2. If 1. is available, is there way to start a Run configuration of them?

 

Thank you for your reply in advance..

3 comments
Comment actions Permalink

I found RunManager class and I can list-up run configurations!!!

 

So,.... Question #2 remains........

0
Comment actions Permalink

Maybe using com.intellij.execution.BeforeRunTaskProvider is an easier and more flexible solution? So you can add your "before the main run configuration starts, I want to perform X" tasks to *any* kind of run configuration

0
Comment actions Permalink

ExecutionEnvironmentBuilder builder = ExecutionEnvironmentBuilder.createOrNull(DefaultRunExecutor.getRunExecutorInstance(), settings);
if (builder != null) {
ExecutionManager.getInstance(project).restartRunProfile(builder.build());
}

see https://github.com/JetBrains/intellij-community/blob/ac1016dc32993314a866b22c6261e5c058b07684/python/src/com/jetbrains/python/actions/PyRunFileInConsoleAction.java

0

Please sign in to leave a comment.