Example usage for com.intellij.openapi.wm ToolWindowType SLIDING

List of usage examples for com.intellij.openapi.wm ToolWindowType SLIDING

Introduction

In this page you can find the example usage for com.intellij.openapi.wm ToolWindowType SLIDING.

Prototype

ToolWindowType SLIDING

To view the source code for com.intellij.openapi.wm ToolWindowType SLIDING.

Click Source Link

Usage

From source file:brainleg.app.intellij.BLProjectComponent.java

License:Apache License

public void projectOpened() {
    System.out.println("brainleg : project opened: " + myProject);
    if (ApplicationManager.getApplication().isHeadlessEnvironment()) {
        return;/* ww  w  .  j a v a 2 s.  c o  m*/
    }
    StartupManager.getInstance(myProject).registerPostStartupActivity(new DumbAwareRunnable() {
        public void run() {
            //                System.out.println("RESETTING traces: ");
            //                BLSettingsService.getSettings().ignoreFullTracesNoLinesMD5s.clear();

            final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
            if (toolWindowManager != null) {
                myToolWindow = toolWindowManager.registerToolWindow(BL_WINDOW_ID, true, ToolWindowAnchor.RIGHT,
                        myProject, true);
                myToolWindow.setType(ToolWindowType.SLIDING, null);
                setNormalIcon();

                myToolWindow.setAvailable(true, null);

                final ContentManager contentManager = myToolWindow.getContentManager();

                Disposer.register(myProject, new Disposable() {
                    public void dispose() {
                        //                            contentManager.removeContentManagerListener(myContentManagerListener);
                    }
                });

                myContentManager = contentManager;
            }

            final RunContentManager contentManager = ExecutionManager.getInstance(myProject)
                    .getContentManager();
            contentManager.addRunContentListener(new RunContentListener() {
                public void contentSelected(RunContentDescriptor descriptor) {
                    //for some reason sometimes idea calls this lister twice on the same RunContentDescriptor
                    //check if we already registered a filter, otherwise we will have two filters watching the same console
                    if (runContentDescriptors.contains(System.identityHashCode(descriptor))) {
                        System.out.println(
                                "skipping because we already have registered a listener for: " + descriptor);
                        return;
                    }
                    runContentDescriptors.add(System.identityHashCode(descriptor));

                    System.out.println("contentSelected: " + descriptor);
                    ConsoleView view = (ConsoleView) descriptor.getExecutionConsole();
                    view.addMessageFilter(new BLExceptionFilter(myProject, BLProjectComponent.this));
                }

                public void contentRemoved(RunContentDescriptor descriptor) {
                    System.out.println("content removed: " + descriptor);
                }
            });

            BLDefaultPanel defaultPanel = new BLDefaultPanel(); //panel which we display until the first exception

            final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
            myDefaultPanelContent = contentFactory.createContent(defaultPanel.getRootComponent(), "", false);
            myContentManager.addContent(myDefaultPanelContent, 0);

            //                //for some reason this listener gets called only when BL tab is manually clicked on before first exception. Probably idea bug
            //                myToolWindow.getComponent().addFocusListener(new FocusListener() {
            //                    public void focusGained(FocusEvent e) {
            //                        System.out.println("focus on ");
            //                    }
            //
            //                    public void focusLost(FocusEvent e) {
            //                        System.out.println("focus off ");
            //                    }
            //                });
        }
    });
}

From source file:com.intellij.designer.LightToolWindow.java

License:Apache License

private DefaultActionGroup createGearPopupGroup() {
    DefaultActionGroup group = new DefaultActionGroup();

    group.add(myManager.createGearActions());
    group.addSeparator();//from w  w w  .j a  v  a 2 s.  c  o  m

    ToolWindowType type = myManager.getToolWindow().getType();
    if (type == ToolWindowType.DOCKED) {
        group.add(myToggleAutoHideModeAction);
        group.add(myToggleDockModeAction);
        group.add(myToggleFloatingModeAction);
        group.add(myToggleSideModeAction);
    } else if (type == ToolWindowType.FLOATING) {
        group.add(myToggleAutoHideModeAction);
        group.add(myToggleFloatingModeAction);
    } else if (type == ToolWindowType.SLIDING) {
        group.add(myToggleDockModeAction);
        group.add(myToggleFloatingModeAction);
    }

    return group;
}

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 a2s  .  co m
    }
    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:com.intellij.ide.actions.TogglePinnedModeAction.java

License:Apache License

@Override
protected void update(ToolWindow window, Presentation presentation) {
    presentation.setEnabled(window.isAvailable() && ToolWindowType.SLIDING != window.getType());
}

From source file:com.intellij.platform.PlatformProjectOpenProcessor.java

License:Apache License

public static void openProjectToolWindow(final Project project) {
    StartupManager.getInstance(project).registerPostStartupActivity(new DumbAwareRunnable() {
        @Override//from   w  w  w .j a  va  2s  . co  m
        public void run() {
            // ensure the dialog is shown after all startup activities are done
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    ApplicationManager.getApplication().invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            if (project.isDisposed())
                                return;
                            final ToolWindow toolWindow = ToolWindowManager.getInstance(project)
                                    .getToolWindow(ToolWindowId.PROJECT_VIEW);
                            if (toolWindow != null && toolWindow.getType() != ToolWindowType.SLIDING) {
                                toolWindow.activate(null);
                            }
                        }
                    }, ModalityState.NON_MODAL);
                }
            });
        }
    });
}