@NotNull
  private static RunContentDescriptor getConsoleView(@NotNull Project project,
                                                     @NotNull VirtualFile file,
                                                     @NotNull IdeScriptEngineManager.EngineInfo engineInfo) {
    for (RunContentDescriptor existing : RunContentManager.getInstance(project).getAllDescriptors()) {
      Content content = existing.getAttachedContent();
      if (content == null) continue;
      Trinity<IdeScriptEngine, IdeScriptEngineManager.EngineInfo, VirtualFile> data = content.getUserData(SCRIPT_ENGINE_KEY);
      if (data == null) continue;
      if (!Comparing.equal(file, data.third)) continue;
      if (!Comparing.equal(engineInfo, data.second)) continue;
      return existing;
    }

    ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();

    DefaultActionGroup toolbarActions = new DefaultActionGroup();
    JComponent panel = new JPanel(new BorderLayout());
    panel.add(consoleView.getComponent(), BorderLayout.CENTER);
    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("RunIdeConsole", toolbarActions, false);
    toolbar.setTargetComponent(consoleView.getComponent());
    panel.add(toolbar.getComponent(), BorderLayout.WEST);

    RunContentDescriptor descriptor = new RunContentDescriptor(consoleView, null, panel, file.getName()) {
      @Override
      public boolean isContentReuseProhibited() {
        return true;
      }
    };
    Executor executor = DefaultRunExecutor.getRunExecutorInstance();
    toolbarActions.addAll(consoleView.createConsoleActions());
    toolbarActions.add(new CloseAction(executor, descriptor, project));
    RunContentManager.getInstance(project).showRunContent(executor, descriptor);

    return descriptor;
  }
@NotNull
  private static RunContentDescriptor getConsoleView(@NotNull Project project,
                                                     @NotNull VirtualFile file,
                                                     @NotNull IdeScriptEngineManager.EngineInfo engineInfo)