How to get run and debug configuration list which didn't exist like "run configuration" popup
see my screencast https://www.youtube.com/watch?v=TidljhHusRY&feature=youtu.be, there is "Ex" in popup, but when i use following, i can't get "Ex" // Plugin.groovy
package ro.test
import com.intellij.execution.RunManager
import com.intellij.execution.impl.RunManagerImpl
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
/**
* Created by roroco on 4/6/15.
*/
class Plugin extends AnAction {
@Override
void actionPerformed(AnActionEvent e) {
RunManagerImpl rm = RunManager.getInstance(e.getProject())
def l = rm.getConfigurationsList(rm.getConfigurationType("Application"))
l
}
}
Please sign in to leave a comment.
See the ChooseRunConfigurationPopup.populateWithDynamicRunners() method.
My idea version is 141.178, I didn't see populateWithDynamicRunners, which version will add this method?
This is a private method. Please check its source code, it shows how to accomplish what you need.
I fix, i find the simplest way is following
void actionPerformed(AnActionEvent e) {super.actionPerformed(e)
ConfigurationContext ctx = ConfigurationContext.getFromContext(e.dataContext)
List<ConfigurationFromContext> cfs = PreferredProducerFind.getConfigurationsFromContext(ctx.location, ctx, false)}
By the way, you can use RunManager.getInstance(event.getProject()).setSelectedConfiguration(s) to change default selected configuraiton in toolbar