String contentName = scriptFile.getName();
ScriptMonkeyToolWindow toolWindow = scriptMonkeyPlugin.getToolWindow();
Content content = toolWindow.getContentManager().findContent(contentName);
ScriptShellPanel panel;
if (content == null) {
RerunScriptAction rerunAction = new RerunScriptAction();
StopScriptAction stopScriptAction = new StopScriptAction();
CloseScriptConsoleAction closeAction = new CloseScriptConsoleAction(contentName);
OpenHelpAction openHelpAction = new OpenHelpAction();
AnAction scriptConsoleActions[] = {rerunAction, stopScriptAction, closeAction, openHelpAction};
panel = new ScriptShellPanel(commandProcessor, scriptConsoleActions);
content = toolWindow.addContentPanel(contentName, panel);
} else {
ScriptShellTabContent tabContent = (ScriptShellTabContent) content.getComponent();
panel = tabContent.getScriptShellPanel();
panel.toggleActions();
}
commandProcessor.addGlobalVariable("window", panel);
panel.clear();