[Intellij IDEA Plugin]获取Terminal

ToolWindow terminal = ToolWindowManager.getInstance(anActionEvent.getProject()).getToolWindow("Terminal");
        JComponent root = terminal.getComponent();
        terminal.show(() -> {
            JBTerminalPanel terminalPanel = ((JBTerminalPanel)((JLayeredPane)((JPanel)((JPanel)((JPanel)((JPanel)((JPanel)((JPanel)root.getComponent(0)).getComponent(0)).getComponent(0)).getComponent(0)).getComponent(0)).getComponent(0)).getComponent(0)).getComponent(0));
            //执行history命令
            terminalPanel.getTerminalOutputStream().sendString("history \n");
        });

你可能感兴趣的:([Intellij IDEA Plugin]获取Terminal)