Launch a Run/Debug Configuration setting dialog
Answered
Per Creating a Run Configuration from Context, I am trying to launch the settings editor for the appropriate run configuration every time it is created:
override fun onFirstRun(
configuration: ConfigurationFromContext,
context: ConfigurationContext,
startRunnable: Runnable
) {
(configuration.configuration as PlaybookRunConfiguration).let {
val editor = it.configurationEditor
// TODO: Launch editor and apply user input to configuration.
}
super.onFirstRun(configuration, context, startRunnable)
}
How do I launch a run configuration dialog window for the given editor instance?
Please sign in to leave a comment.
Hi Michael,
Could you please descibe your use case?
I have a plugin that provides run configurations for executing Ansible tasks: https://github.com/mdklatt/idea-ansible-plugin
I want add the ability to create a run configuration by right-clicking on a YAML file in the Project view. Additional information will be required from the user for this, so I want to reuse the existing settings editors for the run configurations. Basically, I want a context menu action that will work just like creating a new configuration from a template: https://www.jetbrains.com/help/idea/run-debug-configuration.html#createExplicitly.
Per https://intellij-support.jetbrains.com/hc/en-us/community/posts/16990298341138-Context-menu-display-name-for-Run-Configuration-Producer?page=1#community_comment_17018411165586, I am pivoting away from using RunConfigurationProducer.onRun() and will be implementing this as part of a custom action. In either case, I think launching the settings editor would work the same way.
Hi Michael,
I found two approaches (I didn't test it, so adjustments may be required):
1. You can use
editor.component
inDialogWrapper
:2. Using
com.intellij.execution.impl.EditConfigurationsDialog
. Please note that this class may be considered as internal API (it is a part of a*-impl
module and is located in animpl
package):