Java Examples for com.intellij.openapi.ui.SimpleToolWindowPanel

The following java examples will help you to understand the usage of com.intellij.openapi.ui.SimpleToolWindowPanel. These source code samples are taken from different open source projects.

Example 1
Project: salesforce-plugin-master  File: DataExplorerToolWindowFactory.java View source code
@Override
public void createToolWindowContent(Project project, ToolWindow toolWindow) {
    SimpleToolWindowPanel panel = new SimpleToolWindowPanel(true, true);
    Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false);
    toolWindow.getContentManager().addContent(content);
    panel.setContent(dataExplorerPanel);
    setupDataSplitPane(project);
    setupToolingDataSplitPane(project);
}
Example 2
Project: intellij-community-master  File: DynamicToolWindowWrapper.java View source code
private JPanel buildBigPanel() {
    myBigPanel = new SimpleToolWindowPanel(true);
    myBigPanel.setBackground(UIUtil.getFieldForegroundColor());
    final JPanel panel = new JPanel(new BorderLayout());
    myBigPanel.add(panel, BorderLayout.CENTER);
    myTreeTablePanel = new JPanel(new BorderLayout());
    rebuildTreePanel();
    panel.add(myTreeTablePanel);
    myBigPanel.setPreferredSize(new Dimension(200, myBigPanel.getHeight()));
    final ActionManager actionManager = ActionManager.getInstance();
    final ActionGroup actionGroup = (ActionGroup) actionManager.getAction("Groovy.Dynamic.Toolbar");
    ActionToolbar actionToolbar = actionManager.createActionToolbar("Groovy.Dynamic.Toolbar", actionGroup, true);
    myBigPanel.setToolbar(actionToolbar.getComponent());
    myBigPanel.revalidate();
    return myBigPanel;
}
Example 3
Project: gerrit-intellij-plugin-master  File: GerritToolWindow.java View source code
public SimpleToolWindowPanel createToolWindowContent(final Project project) {
    changeListPanel.registerChangeListPanel(this);
    changeListPanel.setProject(project);
    diffManager.registerDiffTool(commentsDiffTool);
    SimpleToolWindowPanel panel = new SimpleToolWindowPanel(true, true);
    ActionToolbar toolbar = createToolbar(project);
    toolbar.setTargetComponent(changeListPanel);
    panel.setToolbar(toolbar.getComponent());
    RepositoryChangesBrowser repositoryChangesBrowser = repositoryChangesBrowserProvider.get(project, changeListPanel);
    Splitter detailsSplitter = new Splitter(true, 0.6f);
    detailsSplitter.setShowDividerControls(true);
    changeListPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.RIGHT | SideBorder.BOTTOM));
    detailsSplitter.setFirstComponent(changeListPanel);
    detailsPanel = new GerritChangeDetailsPanel(project);
    changeListPanel.addListSelectionListener(new Consumer<ChangeInfo>() {

        @Override
        public void consume(ChangeInfo changeInfo) {
            changeSelected(changeInfo, project);
        }
    });
    JPanel details = detailsPanel.getComponent();
    details.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.RIGHT));
    detailsSplitter.setSecondComponent(details);
    Splitter horizontalSplitter = new Splitter(false, 0.7f);
    horizontalSplitter.setShowDividerControls(true);
    horizontalSplitter.setFirstComponent(detailsSplitter);
    horizontalSplitter.setSecondComponent(repositoryChangesBrowser);
    panel.setContent(horizontalSplitter);
    reloadChanges(project, false);
    changeListPanel.showSetupHintWhenRequired(project);
    return panel;
}
Example 4
Project: intellij-plugins-master  File: DartPubActionBase.java View source code
private static void showPubOutputConsole(@NotNull final Module module, @NotNull final GeneralCommandLine command, @NotNull final OSProcessHandler processHandler, @NotNull final VirtualFile pubspecYamlFile, @NotNull final String actionTitle) {
    final ConsoleView console;
    PubToolWindowContentInfo info = findExistingInfoForCommand(module.getProject(), command);
    if (info != null) {
        // rerunning the same pub command in the same tool window tab (corresponding tool window action invoked)
        console = info.console;
        console.clear();
    } else {
        console = createConsole(module.getProject(), pubspecYamlFile);
        info = new PubToolWindowContentInfo(module, pubspecYamlFile, command, actionTitle, console);
        final ActionToolbar actionToolbar = createToolWindowActionsBar(info);
        final SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
        toolWindowPanel.setContent(console.getComponent());
        toolWindowPanel.setToolbar(actionToolbar.getComponent());
        final Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel.getComponent(), actionTitle, true);
        content.putUserData(PUB_TOOL_WINDOW_CONTENT_INFO_KEY, info);
        Disposer.register(content, console);
        final ContentManager contentManager = MessageView.SERVICE.getInstance(module.getProject()).getContentManager();
        removeOldTabs(contentManager);
        contentManager.addContent(content);
        contentManager.setSelectedContent(content);
        final ToolWindow toolWindow = ToolWindowManager.getInstance(module.getProject()).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
        toolWindow.activate(null, true);
    }
    info.rerunPubCommandAction.setProcessHandler(processHandler);
    info.stopProcessAction.setProcessHandler(processHandler);
    processHandler.addProcessListener(new ProcessAdapter() {

        @Override
        public void processTerminated(final ProcessEvent event) {
            console.print(IdeBundle.message("finished.with.exit.code.text.message", event.getExitCode()), ConsoleViewContentType.SYSTEM_OUTPUT);
        }
    });
    console.print(DartBundle.message("working.dir.0", FileUtil.toSystemDependentName(pubspecYamlFile.getParent().getPath())) + "\n", ConsoleViewContentType.SYSTEM_OUTPUT);
    console.attachToProcess(processHandler);
    processHandler.startNotify();
}
Example 5
Project: freeline-master  File: FreelineTerminal.java View source code
public JBTabbedTerminalWidget getTerminalWidget(ToolWindow window) {
    window.show(null);
    if (myTerminalWidget == null) {
        JComponent parentPanel = window.getContentManager().getContents()[0].getComponent();
        if (parentPanel instanceof SimpleToolWindowPanel) {
            SimpleToolWindowPanel panel = (SimpleToolWindowPanel) parentPanel;
            JPanel jPanel = (JPanel) panel.getComponents()[0];
            myTerminalWidget = (JBTabbedTerminalWidget) jPanel.getComponents()[0];
        } else {
            NotificationUtils.infoNotification("Wait for Freeline to initialize");
        }
    }
    return myTerminalWidget;
}
Example 6
Project: idea-sbt-plugin-master  File: SbtConsole.java View source code
public void attachToToolWindow(ToolWindow window) {
    // org.jetbrains.idea.maven.embedder.MavenConsoleImpl#ensureAttachedToToolWindow
    SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
    JComponent consoleComponent = consoleView.getComponent();
    toolWindowPanel.setContent(consoleComponent);
    StartSbtAction startSbtAction = new StartSbtAction();
    toolWindowPanel.setToolbar(createToolbar(startSbtAction));
    startSbtAction.registerCustomShortcutSet(CommonShortcuts.getRerun(), consoleComponent);
    Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel, title, true);
    content.putUserData(CONSOLE_KEY, SbtConsole.this);
    window.getContentManager().addContent(content);
    window.getContentManager().setSelectedContent(content);
    removeUnusedTabs(window, content);
}
Example 7
Project: droidtestrec-master  File: ToolsTestsRecorderAction.java View source code
public void actionPerformed(final AnActionEvent event) {
    notifyIfNecessary();
    Project project = (Project) event.getData(PlatformDataKeys.PROJECT);
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    this.toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_ID);
    if (this.toolWindow == null) {
        this.toolWindow = toolWindowManager.registerToolWindow(TOOL_WINDOW_ID, true, com.intellij.openapi.wm.ToolWindowAnchor.RIGHT, false);
        this.toolWindow.setTitle(TOOLWINDOW_TITLE);
        this.toolWindow.setStripeTitle(TOOLWINDOW_TITLE);
        this.toolWindow.setIcon(IconLoader.getIcon("icons/main.png"));
        this.toolWindow.setAutoHide(false);
        panel = new SimpleToolWindowPanel(true);
        final JToolBar toolBar = new JToolBar();
        this.recButton = new JButton(RECORD, IconLoader.getIcon("icons/rec.png"));
        this.recButton.addActionListener(new AbstractAction() {

            public void actionPerformed(ActionEvent e) {
                if (ToolsTestsRecorderAction.this.recButton.getText().equals(RECORD)) {
                    ToolsTestsRecorderAction.this.recButton.setText(STOP);
                    ToolsTestsRecorderAction.this.recButton.setIcon(IconLoader.getIcon("icons/stop.png"));
                    ToolsTestsRecorderAction.this.record(event);
                    panel.remove(label);
                    panel.add(eventsList);
                    panel.repaint();
                } else {
                    ToolsTestsRecorderAction.this.recButton.setText(RECORD);
                    ToolsTestsRecorderAction.this.recButton.setIcon(IconLoader.getIcon("icons/rec.png"));
                    ToolsTestsRecorderAction.this.stop(event);
                }
            }
        });
        toolBar.add(this.recButton);
        ModuleManager moduleManager = ModuleManager.getInstance(project);
        Module[] modules = moduleManager.getModules();
        Module module = null;
        VirtualFile virtualFile = (VirtualFile) event.getData(PlatformDataKeys.VIRTUAL_FILE);
        if (virtualFile != null) {
            module = com.intellij.openapi.roots.ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(virtualFile);
        }
        this.recButton.setEnabled(false);
        this.moduleBoxModel = new ModulesComboBoxModel(modules, module);
        ComboBox modList = new ComboBox(this.moduleBoxModel);
        modList.addActionListener(new AbstractAction() {

            public void actionPerformed(ActionEvent e) {
                ToolsTestsRecorderAction.this.fillActivities((ModulesComboBoxModel.ModuleWrapper) ToolsTestsRecorderAction.this.moduleBoxModel.getSelected());
            }
        });
        if (moduleBoxModel.getSelected() != null) {
            modList.setPrototypeDisplayValue(moduleBoxModel.getSelected());
        }
        JLabel modLabel = new JLabel("Module: ", SwingConstants.RIGHT);
        Border border = modLabel.getBorder();
        Border margin = new EmptyBorder(0, 15, 0, 5);
        modLabel.setBorder(new CompoundBorder(border, margin));
        toolBar.add(modLabel);
        toolBar.add(modList);
        this.activitiesBoxModel = new ActivitiesComboBoxModel(Collections.<Activity>emptyList(), null);
        this.activitiesList = new ComboBox(this.activitiesBoxModel);
        this.activitiesList.addActionListener(new AbstractAction() {

            public void actionPerformed(ActionEvent e) {
                ToolsTestsRecorderAction.this.recButton.setEnabled(ToolsTestsRecorderAction.this.activitiesBoxModel.getSelected() != null);
            }
        });
        final JLabel activityLabel = new JLabel("Activity: ", SwingConstants.RIGHT);
        border = activityLabel.getBorder();
        margin = new EmptyBorder(0, 15, 0, 5);
        activityLabel.setBorder(new CompoundBorder(border, margin));
        toolBar.add(activityLabel);
        toolBar.add(this.activitiesList);
        fillActivities(module == null ? null : new ModulesComboBoxModel.ModuleWrapper(module));
        JButton helpButton = new JButton(IconLoader.getIcon("icons/help.png"));
        helpButton.setToolTipText("Help");
        helpButton.addActionListener(new AbstractAction() {

            public void actionPerformed(ActionEvent e) {
                openHelpWindow();
            }
        });
        toolBar.add(helpButton);
        KeyboardFocusManager keyManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        keyManager.addKeyEventDispatcher(new KeyEventDispatcher() {

            @Override
            public boolean dispatchKeyEvent(KeyEvent e) {
                if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == 112) {
                    // F1
                    if (toolWindow.isActive()) {
                        openHelpWindow();
                        return true;
                    }
                }
                return false;
            }
        });
        panel.setToolbar(toolBar);
        label = new JLabel("Select Module and Activity to start recording.");
        label.setHorizontalAlignment(JLabel.CENTER);
        panel.add(label);
        com.intellij.ui.content.Content toolContent = this.toolWindow.getContentManager().getFactory().createContent(panel, "", false);
        this.toolWindow.getContentManager().addContent(toolContent);
        new CheckNewVersionThread(this).start();
    }
    this.toolWindow.activate(null, true, true);
}
Example 8
Project: consulo-master  File: ChangesViewManager.java View source code
private JComponent createChangeViewComponent() {
    SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);
    EmptyAction.registerWithShortcutSet("ChangesView.Refresh", CommonShortcuts.getRerun(), panel);
    EmptyAction.registerWithShortcutSet("ChangesView.NewChangeList", CommonShortcuts.getNew(), panel);
    EmptyAction.registerWithShortcutSet("ChangesView.RemoveChangeList", CommonShortcuts.getDelete(), panel);
    EmptyAction.registerWithShortcutSet(IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST, CommonShortcuts.getMove(), panel);
    EmptyAction.registerWithShortcutSet("ChangesView.Rename", CommonShortcuts.getRename(), panel);
    EmptyAction.registerWithShortcutSet("ChangesView.SetDefault", new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.ALT_DOWN_MASK | ctrlMask())), panel);
    EmptyAction.registerWithShortcutSet("ChangesView.Diff", CommonShortcuts.getDiff(), panel);
    DefaultActionGroup group = (DefaultActionGroup) ActionManager.getInstance().getAction("ChangesViewToolbar");
    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.CHANGES_VIEW_TOOLBAR, group, false);
    toolbar.setTargetComponent(myView);
    JComponent toolbarComponent = toolbar.getComponent();
    JPanel toolbarPanel = new JPanel(new BorderLayout());
    toolbarPanel.add(toolbarComponent, BorderLayout.WEST);
    DefaultActionGroup visualActionsGroup = new DefaultActionGroup();
    final Expander expander = new Expander();
    visualActionsGroup.add(CommonActionsManager.getInstance().createExpandAllAction(expander, panel));
    visualActionsGroup.add(CommonActionsManager.getInstance().createCollapseAllAction(expander, panel));
    ToggleShowFlattenAction showFlattenAction = new ToggleShowFlattenAction();
    showFlattenAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_P, ctrlMask())), panel);
    visualActionsGroup.add(showFlattenAction);
    visualActionsGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_COPY));
    visualActionsGroup.add(new ToggleShowIgnoredAction());
    visualActionsGroup.add(new IgnoredSettingsAction());
    visualActionsGroup.add(new ToggleDetailsAction());
    visualActionsGroup.add(new ContextHelpAction(ChangesListView.HELP_ID));
    toolbarPanel.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.CHANGES_VIEW_TOOLBAR, visualActionsGroup, false).getComponent(), BorderLayout.CENTER);
    myView.setMenuActions((DefaultActionGroup) ActionManager.getInstance().getAction("ChangesViewPopupMenu"));
    myView.setShowFlatten(myState.myShowFlatten);
    myProgressLabel = new JPanel(new BorderLayout());
    panel.setToolbar(toolbarPanel);
    final JPanel content = new JPanel(new BorderLayout());
    mySplitter = new JBSplitter(false, "ChangesViewManager.DETAILS_SPLITTER_PROPORTION", 0.5f);
    mySplitter.setHonorComponentsMinimumSize(false);
    final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myView);
    final JPanel wrapper = new JPanel(new BorderLayout());
    wrapper.add(scrollPane, BorderLayout.CENTER);
    mySplitter.setFirstComponent(wrapper);
    content.add(mySplitter, BorderLayout.CENTER);
    content.add(myProgressLabel, BorderLayout.SOUTH);
    panel.setContent(content);
    ChangesDnDSupport.install(myProject, myView);
    myView.addTreeSelectionListener(myTsl);
    return panel;
}
Example 9
Project: jenkins-control-plugin-master  File: GuiUtil.java View source code
public static void installActionGroupInToolBar(ActionGroup actionGroup, SimpleToolWindowPanel toolWindowPanel, ActionManager actionManager, String toolBarName) {
    if (actionManager == null) {
        return;
    }
    JComponent actionToolbar = ActionManager.getInstance().createActionToolbar(toolBarName, actionGroup, true).getComponent();
    toolWindowPanel.setToolbar(actionToolbar);
}