Java Code Examples for com.intellij.ui.content.Content#setCloseable()
The following examples show how to use
com.intellij.ui.content.Content#setCloseable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PantsConsoleManager.java From intellij-pants-plugin with Apache License 2.0 | 6 votes |
private static void initializeConsolePanel(Project project, ConsoleView console) { ToolWindow window = ToolWindowManager.getInstance(project).registerToolWindow( PantsConstants.PANTS_CONSOLE_NAME, true, ToolWindowAnchor.BOTTOM, project, true ); window.setIcon(PantsIcons.Icon); PantsConsoleViewPanel pantsConsoleViewPanel = new PantsConsoleViewPanel(project, console); final boolean isLockable = true; final String displayName = ""; Content pantsConsoleContent = ContentFactory.SERVICE.getInstance().createContent(pantsConsoleViewPanel, displayName, isLockable); pantsConsoleContent.setCloseable(false); window.getContentManager().addContent(pantsConsoleContent); }
Example 2
Source File: ANTLRv4PluginController.java From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void createToolWindows() { LOG.info("createToolWindows "+project.getName()); ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); previewPanel = new PreviewPanel(project); ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); Content content = contentFactory.createContent(previewPanel, "", false); content.setCloseable(false); previewWindow = toolWindowManager.registerToolWindow(PREVIEW_WINDOW_ID, true, ToolWindowAnchor.BOTTOM); previewWindow.getContentManager().addContent(content); previewWindow.setIcon(Icons.getToolWindow()); TextConsoleBuilderFactory factory = TextConsoleBuilderFactory.getInstance(); TextConsoleBuilder consoleBuilder = factory.createBuilder(project); this.console = consoleBuilder.getConsole(); JComponent consoleComponent = console.getComponent(); content = contentFactory.createContent(consoleComponent, "", false); content.setCloseable(false); consoleWindow = toolWindowManager.registerToolWindow(CONSOLE_WINDOW_ID, true, ToolWindowAnchor.BOTTOM); consoleWindow.getContentManager().addContent(content); consoleWindow.setIcon(Icons.getToolWindow()); }
Example 3
Source File: XDebugSessionTab.java From consulo with Apache License 2.0 | 6 votes |
private Content createVariablesContent(@Nonnull XDebugSessionImpl session) { XVariablesView variablesView; if (myWatchesInVariables) { variablesView = myWatchesView = new XWatchesViewImpl(session, myWatchesInVariables); } else { variablesView = new XVariablesView(session); } registerView(DebuggerContentInfo.VARIABLES_CONTENT, variablesView); Content result = myUi.createContent(DebuggerContentInfo.VARIABLES_CONTENT, variablesView.getPanel(), XDebuggerBundle.message("debugger.session.tab.variables.title"), AllIcons.Debugger.Value, null); result.setCloseable(false); ActionGroup group = getCustomizedActionGroup(XDebuggerActions.VARIABLES_TREE_TOOLBAR_GROUP); result.setActions(group, ActionPlaces.DEBUGGER_TOOLBAR, variablesView.getTree()); return result; }
Example 4
Source File: BPMNPaletteToolWindowManager.java From intellij-bpmn-editor with GNU General Public License v3.0 | 5 votes |
protected void initToolWindow() { toolWindow = ToolWindowManager.getInstance(myProject) .registerToolWindow("BPMN Palette", false, ToolWindowAnchor.RIGHT, myProject, true); toolWindow.setIcon(AllIcons.Toolwindows.ToolWindowPalette); ContentManager contentManager = toolWindow.getContentManager(); Content content = contentManager.getFactory().createContent(palette, null, false); content.setCloseable(false); content.setPreferredFocusableComponent(palette); contentManager.addContent(content); contentManager.setSelectedContent(content, true); toolWindow.setAvailable(false, null); }
Example 5
Source File: FreelineTerminal.java From freeline with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * 创建Terminal panel * * @param terminalRunner * @param toolWindow * @return */ private Content createTerminalInContentPanel(@NotNull AbstractTerminalRunner terminalRunner, @NotNull final ToolWindow toolWindow) { SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true); Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false); content.setCloseable(true); myTerminalWidget = terminalRunner.createTerminalWidget(content); panel.setContent(myTerminalWidget.getComponent()); panel.addFocusListener(this); ActionToolbar toolbar = createToolbar(terminalRunner, myTerminalWidget, toolWindow); toolbar.setTargetComponent(panel); panel.setToolbar(toolbar.getComponent()); content.setPreferredFocusableComponent(myTerminalWidget.getComponent()); return content; }
Example 6
Source File: BuckToolWindowFactory.java From Buck-IntelliJ-Plugin with Apache License 2.0 | 5 votes |
private Content createConsoleContent(RunnerLayoutUi layoutUi, Project project) { ConsoleView consoleView = BuckUIManager.getInstance(project).getConsoleWindow(project); Content consoleWindowContent = layoutUi.createContent( OUTPUT_WINDOW_CONTENT_ID, consoleView.getComponent(), "Output Logs", null, null); consoleWindowContent.setCloseable(false); return consoleWindowContent; }
Example 7
Source File: CrucibleToolWindowFactory.java From Crucible4IDEA with MIT License | 5 votes |
@Override public void createToolWindowContent(Project project, ToolWindow toolWindow) { final ContentManager contentManager = toolWindow.getContentManager(); final CruciblePanel cruciblePanel = new CruciblePanel(project); final Content content = ContentFactory.SERVICE.getInstance(). createContent(cruciblePanel, CrucibleBundle.message("crucible.main.name"), false); content.setCloseable(false); contentManager.addContent(content); }
Example 8
Source File: BuckToolWindowImpl.java From buck with Apache License 2.0 | 5 votes |
@Override public void addPanel(BuckToolWindowPanel buckToolWindowPanel) { Content content = runnerLayoutUi.createContent( buckToolWindowPanel.getId(), buckToolWindowPanel.getComponent(), buckToolWindowPanel.getTitle(), null, null); content.setCloseable(false); content.setPinnable(false); runnerLayoutUi.addContent(content, 0, PlaceInGrid.center, false); }
Example 9
Source File: XDebugTabLayouter.java From consulo with Apache License 2.0 | 5 votes |
/** * Registers tab for the given {@code console}. * * @param console {@code ExecutionConsole} instance * @param ui {@code RunnerLayoutUi} instance * @return registered {@code Content} instance */ @Nonnull public Content registerConsoleContent(@Nonnull RunnerLayoutUi ui, @Nonnull ExecutionConsole console) { Content content = ui.createContent(DebuggerContentInfo.CONSOLE_CONTENT, console.getComponent(), XDebuggerBundle.message("debugger.session.tab.console.content.name"), AllIcons.Debugger.Console, console.getPreferredFocusableComponent()); content.setCloseable(false); ui.addContent(content, 1, PlaceInGrid.bottom, false); return content; }
Example 10
Source File: XDebugSessionTab.java From consulo with Apache License 2.0 | 5 votes |
private Content createWatchesContent(@Nonnull XDebugSessionImpl session) { myWatchesView = new XWatchesViewImpl(session, myWatchesInVariables); registerView(DebuggerContentInfo.WATCHES_CONTENT, myWatchesView); Content watchesContent = myUi.createContent(DebuggerContentInfo.WATCHES_CONTENT, myWatchesView.getPanel(), XDebuggerBundle.message("debugger.session.tab.watches.title"), AllIcons.Debugger.Watches, null); watchesContent.setCloseable(false); return watchesContent; }
Example 11
Source File: XDebugSessionTab.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private Content createFramesContent() { XFramesView framesView = new XFramesView(myProject); registerView(DebuggerContentInfo.FRAME_CONTENT, framesView); Content framesContent = myUi.createContent(DebuggerContentInfo.FRAME_CONTENT, framesView.getMainPanel(), XDebuggerBundle.message("debugger.session.tab.frames.title"), AllIcons.Debugger.Frame, null); framesContent.setCloseable(false); return framesContent; }
Example 12
Source File: RunContentBuilder.java From consulo with Apache License 2.0 | 5 votes |
public static void buildConsoleUiDefault(RunnerLayoutUi ui, final ExecutionConsole console) { final Content consoleContent = ui.createContent(ExecutionConsole.CONSOLE_CONTENT_ID, console.getComponent(), "Console", AllIcons.Debugger.Console, console.getPreferredFocusableComponent()); consoleContent.setCloseable(false); addAdditionalConsoleEditorActions(console, consoleContent); ui.addContent(consoleContent, 0, PlaceInGrid.bottom, false); }
Example 13
Source File: TodoView.java From consulo with Apache License 2.0 | 5 votes |
public void addCustomTodoView(final TodoTreeBuilderFactory factory, final String title, final TodoPanelSettings settings) { Content content = ContentFactory.SERVICE.getInstance().createContent(null, title, true); final ChangeListTodosPanel panel = new ChangeListTodosPanel(myProject, settings, content) { @Override protected TodoTreeBuilder createTreeBuilder(JTree tree, Project project) { TodoTreeBuilder todoTreeBuilder = factory.createTreeBuilder(tree, project); todoTreeBuilder.init(); return todoTreeBuilder; } }; content.setComponent(panel); Disposer.register(this, panel); if (myContentManager == null) { myNotAddedContent.add(content); } else { myContentManager.addContent(content); } myPanels.add(panel); content.setCloseable(true); content.setDisposer(new Disposable() { @Override public void dispose() { myPanels.remove(panel); } }); }
Example 14
Source File: PreviewView.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void initToolWindow(@NotNull ToolWindow toolWindow) { final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); final ContentManager contentManager = toolWindow.getContentManager(); final Content content = contentFactory.createContent(null, null, false); content.setCloseable(false); windowPanel = new OutlineComponent(this); content.setComponent(windowPanel); windowPanel.setToolbar(widgetEditToolbar.getToolbar().getComponent()); final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(); tree = new OutlineTree(rootNode); tree.setCellRenderer(new OutlineTreeCellRenderer()); tree.expandAll(); initTreePopup(); // Add collapse all, expand all, and show only widgets buttons. if (toolWindow instanceof ToolWindowEx) { final ToolWindowEx toolWindowEx = (ToolWindowEx)toolWindow; final CommonActionsManager actions = CommonActionsManager.getInstance(); final TreeExpander expander = new DefaultTreeExpander(tree); final AnAction expandAllAction = actions.createExpandAllAction(expander, tree); expandAllAction.getTemplatePresentation().setIcon(AllIcons.Actions.Expandall); final AnAction collapseAllAction = actions.createCollapseAllAction(expander, tree); collapseAllAction.getTemplatePresentation().setIcon(AllIcons.Actions.Collapseall); final ShowOnlyWidgetsAction showOnlyWidgetsAction = new ShowOnlyWidgetsAction(); toolWindowEx.setTitleActions(expandAllAction, collapseAllAction, showOnlyWidgetsAction); } new TreeSpeedSearch(tree) { @Override protected String getElementText(Object element) { final TreePath path = (TreePath)element; final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); final Object object = node.getUserObject(); if (object instanceof OutlineObject) { return ((OutlineObject)object).getSpeedSearchString(); } return null; } }; tree.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { final TreePath selectionPath = tree.getSelectionPath(); if (selectionPath != null) { selectPath(selectionPath, true); } } } }); tree.addTreeSelectionListener(treeSelectionListener); scrollPane = ScrollPaneFactory.createScrollPane(tree); content.setPreferredFocusableComponent(tree); contentManager.addContent(content); contentManager.setSelectedContent(content); splitter = new Splitter(true); setSplitterProportion(getState().getSplitterProportion()); getState().addListener(e -> { final float newProportion = getState().getSplitterProportion(); if (splitter.getProportion() != newProportion) { setSplitterProportion(newProportion); } }); //noinspection Convert2Lambda splitter.addPropertyChangeListener("proportion", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (!isSettingSplitterProportion) { getState().setSplitterProportion(splitter.getProportion()); } } }); scrollPane.setMinimumSize(new Dimension(1, 1)); splitter.setFirstComponent(scrollPane); windowPanel.setContent(splitter); }
Example 15
Source File: PreviewView.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void initToolWindow(@NotNull ToolWindow toolWindow) { final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); final ContentManager contentManager = toolWindow.getContentManager(); final Content content = contentFactory.createContent(null, null, false); content.setCloseable(false); windowPanel = new OutlineComponent(this); content.setComponent(windowPanel); windowPanel.setToolbar(widgetEditToolbar.getToolbar().getComponent()); final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(); tree = new OutlineTree(rootNode); tree.setCellRenderer(new OutlineTreeCellRenderer()); tree.expandAll(); initTreePopup(); // Add collapse all, expand all, and show only widgets buttons. if (toolWindow instanceof ToolWindowEx) { final ToolWindowEx toolWindowEx = (ToolWindowEx)toolWindow; final CommonActionsManager actions = CommonActionsManager.getInstance(); final TreeExpander expander = new DefaultTreeExpander(tree); final AnAction expandAllAction = actions.createExpandAllAction(expander, tree); expandAllAction.getTemplatePresentation().setIcon(AllIcons.Actions.Expandall); final AnAction collapseAllAction = actions.createCollapseAllAction(expander, tree); collapseAllAction.getTemplatePresentation().setIcon(AllIcons.Actions.Collapseall); final ShowOnlyWidgetsAction showOnlyWidgetsAction = new ShowOnlyWidgetsAction(); toolWindowEx.setTitleActions(expandAllAction, collapseAllAction, showOnlyWidgetsAction); } new TreeSpeedSearch(tree) { @Override protected String getElementText(Object element) { final TreePath path = (TreePath)element; final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); final Object object = node.getUserObject(); if (object instanceof OutlineObject) { return ((OutlineObject)object).getSpeedSearchString(); } return null; } }; tree.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { final TreePath selectionPath = tree.getSelectionPath(); if (selectionPath != null) { selectPath(selectionPath, true); } } } }); tree.addTreeSelectionListener(treeSelectionListener); scrollPane = ScrollPaneFactory.createScrollPane(tree); content.setPreferredFocusableComponent(tree); contentManager.addContent(content); contentManager.setSelectedContent(content); splitter = new Splitter(true); setSplitterProportion(getState().getSplitterProportion()); getState().addListener(e -> { final float newProportion = getState().getSplitterProportion(); if (splitter.getProportion() != newProportion) { setSplitterProportion(newProportion); } }); //noinspection Convert2Lambda splitter.addPropertyChangeListener("proportion", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (!isSettingSplitterProportion) { getState().setSplitterProportion(splitter.getProportion()); } } }); scrollPane.setMinimumSize(new Dimension(1, 1)); splitter.setFirstComponent(scrollPane); windowPanel.setContent(splitter); }
Example 16
Source File: BlazeConsoleView.java From intellij with Apache License 2.0 | 4 votes |
void createToolWindowContent(ToolWindow toolWindow) { // Create runner UI layout RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(project); RunnerLayoutUi layoutUi = factory.create("", "", "session", project); layoutUi.getOptions().setMoveToGridActionEnabled(false).setMinimizeActionEnabled(false); Content console = layoutUi.createContent( BlazeConsoleToolWindowFactory.ID, consoleView.getComponent(), "", null, null); console.setCloseable(false); layoutUi.addContent(console, 0, PlaceInGrid.right, false); // Adding actions DefaultActionGroup group = new DefaultActionGroup(); layoutUi.getOptions().setLeftToolbar(group, TOOLBAR_ACTION_PLACE); // Initializing prev and next occurrences actions OccurenceNavigator navigator = fromConsoleView(consoleView); CommonActionsManager actionsManager = CommonActionsManager.getInstance(); AnAction prevAction = actionsManager.createPrevOccurenceAction(navigator); prevAction.getTemplatePresentation().setText(navigator.getPreviousOccurenceActionName()); AnAction nextAction = actionsManager.createNextOccurenceAction(navigator); nextAction.getTemplatePresentation().setText(navigator.getNextOccurenceActionName()); group.addAll(prevAction, nextAction); AnAction[] consoleActions = consoleView.createConsoleActions(); for (AnAction action : consoleActions) { if (!shouldIgnoreAction(action)) { group.add(action); } } group.add(new StopAction()); JComponent layoutComponent = layoutUi.getComponent(); layoutComponent.setFocusTraversalPolicyProvider(true); layoutComponent.setFocusTraversalPolicy( new LayoutFocusTraversalPolicy() { @Override public Component getDefaultComponent(Container container) { if (container.equals(layoutComponent)) { return consoleView.getPreferredFocusableComponent(); } return super.getDefaultComponent(container); } }); Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true); content.setCloseable(false); toolWindow.getContentManager().addContent(content); }