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(); }
private static <T extends JComponent> T removeBorder(final T component) { component.setBorder(JBUI.Borders.empty()); return component; }