Search in sources :

Example 1 with Terminal

use of com.jediterm.terminal.Terminal in project freeline by alibaba.

the class FreelineTerminal method initTerminal.

public void initTerminal(final ToolWindow toolWindow) {
    toolWindow.setToHideOnEmptyContent(true);
    LocalTerminalDirectRunner terminalRunner = LocalTerminalDirectRunner.createTerminalRunner(myProject);
    toolWindow.setStripeTitle("Freeline");
    Content content = createTerminalInContentPanel(terminalRunner, toolWindow);
    toolWindow.getContentManager().addContent(content);
    toolWindow.setShowStripeButton(true);
    toolWindow.setTitle("Console");
    ((ToolWindowManagerEx) ToolWindowManager.getInstance(this.myProject)).addToolWindowManagerListener(new ToolWindowManagerListener() {

        @Override
        public void toolWindowRegistered(@NotNull String s) {
        }

        @Override
        public void stateChanged() {
            ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(FreelineToolWindowFactory.TOOL_WINDOW_ID);
            if (window != null) {
                boolean visible = window.isVisible();
                if (visible && toolWindow.getContentManager().getContentCount() == 0) {
                    initTerminal(window);
                }
            }
        }
    });
    toolWindow.show(null);
    JBTabbedTerminalWidget terminalWidget = getTerminalWidget(toolWindow);
    if (terminalWidget != null && terminalWidget.getCurrentSession() != null) {
        Terminal terminal = terminalWidget.getCurrentSession().getTerminal();
        if (terminal != null) {
            terminal.setCursorVisible(false);
        }
    }
}
Also used : ToolWindowManagerListener(com.intellij.openapi.wm.ex.ToolWindowManagerListener) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) LocalTerminalDirectRunner(org.jetbrains.plugins.terminal.LocalTerminalDirectRunner) JBTabbedTerminalWidget(org.jetbrains.plugins.terminal.JBTabbedTerminalWidget) Terminal(com.jediterm.terminal.Terminal) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Aggregations

ToolWindow (com.intellij.openapi.wm.ToolWindow)1 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)1 ToolWindowManagerListener (com.intellij.openapi.wm.ex.ToolWindowManagerListener)1 Content (com.intellij.ui.content.Content)1 Terminal (com.jediterm.terminal.Terminal)1 JBTabbedTerminalWidget (org.jetbrains.plugins.terminal.JBTabbedTerminalWidget)1 LocalTerminalDirectRunner (org.jetbrains.plugins.terminal.LocalTerminalDirectRunner)1