Example usage for com.intellij.openapi.wm ToolWindow setType

List of usage examples for com.intellij.openapi.wm ToolWindow setType

Introduction

In this page you can find the example usage for com.intellij.openapi.wm ToolWindow setType.

Prototype

void setType(@NotNull ToolWindowType type, @Nullable Runnable runnable);

Source Link

Usage

From source file:com.intellij.ide.actions.ToggleDockModeAction.java

License:Apache License

public void setSelected(AnActionEvent event, boolean flag) {
    Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
    if (project == null) {
        return;/*from  w  w w.j  a  v a  2s . com*/
    }
    ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
    String id = windowManager.getActiveToolWindowId();
    if (id == null) {
        return;
    }
    ToolWindow toolWindow = windowManager.getToolWindow(id);
    ToolWindowType type = toolWindow.getType();
    if (ToolWindowType.DOCKED == type) {
        toolWindow.setType(ToolWindowType.SLIDING, null);
    } else if (ToolWindowType.SLIDING == type) {
        toolWindow.setType(ToolWindowType.DOCKED, null);
    }
}

From source file:org.evosuite.intellij.ProjectRegistration.java

License:Open Source License

@Override
public void projectOpened() {

    EvoParameters.getInstance().load(project);

    ActionManager am = ActionManager.getInstance();

    //create the tool window, which will appear in the bottom when an EvoSuite run is started
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow toolWindow = toolWindowManager.registerToolWindow("EvoSuite", false, ToolWindowAnchor.BOTTOM);
    toolWindow.setTitle("EvoSuite Console Output");
    toolWindow.setType(ToolWindowType.DOCKED, null);

    //create a console panel
    console = (ConsoleViewImpl) TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    JComponent consolePanel = console.getComponent();

    IntelliJNotifier notifier = IntelliJNotifier.registerNotifier(project, "EvoSuite Plugin", console);

    //create left-toolbar with stop button
    DefaultActionGroup buttonGroup = new DefaultActionGroup();
    buttonGroup.add(new StopEvoAction(notifier));
    ActionToolbar viewToolbar = am.createActionToolbar("EvoSuite.ConsoleToolbar", buttonGroup, false);
    JComponent toolBarPanel = viewToolbar.getComponent();

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(toolBarPanel, BorderLayout.WEST);
    panel.add(consolePanel, BorderLayout.CENTER);

    //Content content = contentFactory.createContent(consolePanel, "", false);
    Content content = contentFactory.createContent(panel, "", false);
    toolWindow.getContentManager().addContent(content);

}

From source file:org.sonarlint.intellij.ui.SonarLintToolWindowFactory.java

License:Open Source License

@Override
public void createToolWindowContent(Project project, ToolWindow toolWindow) {
    addIssuesTab(project, toolWindow);//from www .  ja  v  a2 s  .  c  o m
    addLogTab(project, toolWindow);
    toolWindow.setType(ToolWindowType.DOCKED, null);
}