Disable "Activate tool window" option for run configurations by default?
In my plugin I have run configurations which represent a REPL. This opens a toolwindow on the right hand side (since for a REPL a vertical orientation is preferable to a horizontal one). I control the REPL process, and I send stdout/stderr output to the REPL window too.
For these run configurations I'd like to either disable the opening of the Run toolwindow altogether, or disable the "Activate tool window" option by default for them so at least it's hidden. The standard output console is not useful since I've redirected everything to the REPL pane. I've been digging through the code but I can't see a way to achieve this. I can't prevent the console being added altogether without implementing my own ProgramRunner (which looks pretty complex and would involve copy/pasting a lot), and I can't seem to see a good point to call setActivateToolWindowBeforeRun() on a RunnerAndConfigurationSettings anywhere either - ideally I would do that in the template run config somehow.
Is there a good option for achieving this?
请先登录再写评论。
Cannot call it "good option" but still:
Thanks Vassiliy, let's call it a "good enough option" :-). So I would do this on project startup, looks like?
Indeed, in plugin.xml there should be
and the code would be like this:
public class RCTemplateInitializer implements StartupActivity, DumbAware {@Override
public void runActivity(@NotNull Project project) {
RunManager runManager = RunManager.getInstance(project);
ConfigurationType type = runManager.getConfigurationType("Repl");//Just an example ID
runManager.getConfigurationTemplate(type.getConfigurationFactories()[0]).setActivateToolWindowBeforeRun(false);
}
}
Great, thanks Vassiliy, I tried this today (but with a ProjectComponent, I'll switch that tomorrow to a startup activity) and it worked great. Thanks!