Programmatically adding a BeforeRunTask to existing RunConfigurations
Hello,
I am trying to add a custom BeforeRunTask to existing RunConfigurations when I project is opened. So I added this bit of code to the projectOpened method of my ProjectComponent.
for (RunConfiguration runConfiguration : runManager.getAllConfigurationsList()) {
List<BeforeRunTask> beforeRunTasks = runManager.getBeforeRunTasks(runConfiguration);
beforeRunTasks.add(new MyBeforeRunTask(providerID));
runManager.setBeforeRunTasks(runConfiguration, beforeRunTasks, true);
}
I also extended the stepsBeforeRunProvider extension point with this extension:
<stepsBeforeRunProvider implementation="my.package.MyBeforeRunTaskProvider"></stepsBeforeRunProvider>
However, when I run my plugin, the steps are not added to the existing configs. I can go and manually add them, they appear in the dropdown list. And the provider gets called just fine after I add them manually.
I believe I am missing a step here. Any ideas?
Thanks,
-Caius
请先登录再写评论。
In case anyone else finds this post looking for answers, you also need to enable the tasks before adding them to the list: