How can I remove configuration in Run/Debug Configuration panel programmingly?

for now, I use the following code to remove a configuration. when I use it In Run/Debug Configuration panel, it still works but nothing updates in panel (remove the configuration from toolbarDecorator), and it will be removed from the left panel until I reopen the Run/Debug Configuration panel.

 

RunManagerImpl manager = RunManagerImpl.getInstanceImpl(project);
RunnerAndConfigurationSettings old = manager.findConfigurationByName(task.name);
if (old != null) {
    manager.removeConfiguration(old);
}

So, how can I remove a configuration so that the Run/Debug Configuration panel will auto refresh to show?

2 comments

Toolbar action does an activity that is not supposed to be part of API. Actually all this UI operates with a snapshot from real RunManager's model that wouldn't be applied back to real model until user pressed OK/Apply. There is an API for providing some new types of run configuration as well as corresponding editors, but definitely not for extending toolbar.

Why do you need this 'special remove' action? Probably you need your own popup or dialog to manage tasks. Old 'temporary' run configurations should be removed automatically as we have a special limit (5 by default) for their number.

Do your 'old tasks' have 'temporary' status?

0

Thanks for your answer.

'old task' is the task which has the wrong configuration(sorry for the naming...). I put a check method in my configuration class(extends ModuleBasedConfiguration) constructor and when I click the configuration, it will call check method to check the task source file is valid or not, and if not, I will delete the configuration.

It seems '.ignore' Plugin can repaint the panel, how it works? and can I simulate the 'remove operation' in UI?

0

Please sign in to leave a comment.