private void initConsoleUI(Process process) {
    // Init console view
    myConsoleView = createConsoleView();
    myConsoleView.setBorder(new SideBorder(UIUtil.getBorderColor(), SideBorder.LEFT));

    myProcessHandler = createProcessHandler(process, myProvider.getCommandLineString());

    myConsoleExecuteActionHandler = createConsoleExecuteActionHandler();

    ProcessTerminatedListener.attach(myProcessHandler);

    myProcessHandler.addProcessListener(
        new ProcessAdapter() {
          @Override
          public void processTerminated(ProcessEvent event) {
            finishConsole();
          }
        });

    // Attach to process
    myConsoleView.attachToProcess(myProcessHandler);

    // Runner creating
    final Executor defaultExecutor =
        ExecutorRegistry.getInstance().getExecutorById(DefaultRunExecutor.EXECUTOR_ID);
    final DefaultActionGroup toolbarActions = new DefaultActionGroup();
    final ActionToolbar actionToolbar =
        ActionManager.getInstance()
            .createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false);

    // Runner creating
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(actionToolbar.getComponent(), BorderLayout.WEST);
    panel.add(myConsoleView.getComponent(), BorderLayout.CENTER);

    actionToolbar.setTargetComponent(panel);

    final RunContentDescriptor contentDescriptor =
        new RunContentDescriptor(
            myConsoleView, myProcessHandler, panel, constructConsoleTitle(myConsoleTitle));

    // tool bar actions
    final List<AnAction> actions =
        fillToolBarActions(toolbarActions, defaultExecutor, contentDescriptor);
    registerActionShortcuts(actions, getLanguageConsole().getConsoleEditor().getComponent());
    registerActionShortcuts(actions, panel);
    panel.updateUI();
    showConsole(defaultExecutor, contentDescriptor);

    // Run
    myProcessHandler.startNotify();
  }
 @Override
 public void actionPerformed(AnActionEvent e) {
   final DataContext dataContext = e.getDataContext();
   final Project project = CommonDataKeys.PROJECT.getData(dataContext);
   LOG.assertTrue(project != null);
   final T configuration = (T) RunConfiguration.DATA_KEY.getData(dataContext);
   LOG.assertTrue(configuration != null);
   final GlobalSearchScope searchScope = configuration.getConfigurationModule().getSearchScope();
   final AbstractTestProxy testProxy = AbstractTestProxy.DATA_KEY.getData(dataContext);
   LOG.assertTrue(testProxy != null);
   final String qualifiedName =
       ((PsiClass) testProxy.getLocation(project, searchScope).getPsiElement()).getQualifiedName();
   getPattern(configuration).remove(qualifiedName);
 }
  /** should be invoked in read action */
  private DefaultTreeModel buildModel() {
    final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
    final Ref<Integer> count = new Ref<Integer>(0);
    final FactoryMap<MemberChooserObject, ParentNode> map =
        new FactoryMap<MemberChooserObject, ParentNode>() {
          @Override
          protected ParentNode create(final MemberChooserObject key) {
            ParentNode node = null;
            DefaultMutableTreeNode parentNode = rootNode;

            if (supportsNestedContainers() && key instanceof ClassMember) {
              MemberChooserObject parentNodeDelegate = ((ClassMember) key).getParentNodeDelegate();

              if (parentNodeDelegate != null) {
                parentNode = get(parentNodeDelegate);
              }
            }
            if (isContainerNode(key)) {
              final ContainerNode containerNode = new ContainerNode(parentNode, key, count);
              node = containerNode;
              myContainerNodes.add(containerNode);
            }
            if (node == null) {
              node = new ParentNode(parentNode, key, count);
            }
            return node;
          }
        };

    for (T object : myElements) {
      final ParentNode parentNode = map.get(object.getParentNodeDelegate());
      final MemberNode elementNode = createMemberNode(count, object, parentNode);
      myNodeToParentMap.put(elementNode, parentNode);
      myElementToNodeMap.put(object, elementNode);
    }
    return new DefaultTreeModel(rootNode);
  }
 public LanguageConsoleImpl getLanguageConsole() {
   return myConsoleView.getConsole();
 }
 protected void finishConsole() {
   myConsoleView.getConsole().setEditable(false);
 }