com.intellij.openapi.actionSystem.ActionToolbar Java Examples
The following examples show how to use
com.intellij.openapi.actionSystem.ActionToolbar.
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: IMPanel.java From SmartIM4IntelliJ with Apache License 2.0 | 6 votes |
private void initUI() { DefaultActionGroup group = new DefaultActionGroup(); group.add(new LoginAction(this)); group.add(new HideContactAction(this)); group.add(new DisconnectAction(this)); createBroadcastAction(group); group.add(new SettingsAction(this)); MockConsoleAction test = new MockConsoleAction(this); //group.add(test); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("SmartQQ", group, false); // toolbar.getComponent().addFocusListener(createFocusListener()); toolbar.setTargetComponent(this); setToolbar(toolbar.getComponent()); left = createContactsUI(); left.onLoadContacts(false); tabbedChat = new ClosableTabHost(this); splitter = new JBSplitter(false); splitter.setSplitterProportionKey("main.splitter.key"); splitter.setFirstComponent(left.getPanel()); splitter.setSecondComponent(tabbedChat); splitter.setProportion(0.3f); setContent(splitter); }
Example #2
Source File: ProjectLevelVcsManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
private Content getOrCreateConsoleContent(final ContentManager contentManager) { final String displayName = VcsBundle.message("vcs.console.toolwindow.display.name"); Content content = contentManager.findContent(displayName); if (content == null) { releaseConsole(); myConsole = TextConsoleBuilderFactory.getInstance().createBuilder(myProject).getConsole(); JPanel panel = new JPanel(new BorderLayout()); panel.add(myConsole.getComponent(), BorderLayout.CENTER); ActionToolbar toolbar = ActionManager.getInstance() .createActionToolbar("VcsManager", new DefaultActionGroup(myConsole.createConsoleActions()), false); panel.add(toolbar.getComponent(), BorderLayout.WEST); content = ContentFactory.getInstance().createContent(panel, displayName, true); content.setDisposer(myConsoleDisposer); contentManager.addContent(content); for (Pair<String, ConsoleViewContentType> pair : myPendingOutput) { printToConsole(pair.first, pair.second); } myPendingOutput.clear(); } return content; }
Example #3
Source File: PropertyEditorPanel.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void initalize( DiagnosticsNode node, EventStream<List<FlutterOutline>> currentOutlines, EventStream<VirtualFile> activeFile ) { this.node = node; this.activeFile = activeFile; currentOutlines.listen(this::outlinesChanged, true); if (showWidgetEditToolbar) { final WidgetEditToolbar widgetEditToolbar = new WidgetEditToolbar(true, currentOutlines, activeFile, project, flutterDartAnalysisService); final ActionToolbar toolbar = widgetEditToolbar.getToolbar(); toolbar.setShowSeparatorTitles(true); setToolbar(toolbar.getComponent()); } rebuildUi(); }
Example #4
Source File: PropertyEditorPanel.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void initalize( DiagnosticsNode node, EventStream<List<FlutterOutline>> currentOutlines, EventStream<VirtualFile> activeFile ) { this.node = node; this.activeFile = activeFile; currentOutlines.listen(this::outlinesChanged, true); if (showWidgetEditToolbar) { final WidgetEditToolbar widgetEditToolbar = new WidgetEditToolbar(true, currentOutlines, activeFile, project, flutterDartAnalysisService); final ActionToolbar toolbar = widgetEditToolbar.getToolbar(); toolbar.setShowSeparatorTitles(true); setToolbar(toolbar.getComponent()); } rebuildUi(); }
Example #5
Source File: ActiveConnectionPanel.java From p4ic4idea with Apache License 2.0 | 6 votes |
private void setup() { root = new JPanel(new BorderLayout()); JScrollPane scroll = new JBScrollPane(); root.add(scroll, BorderLayout.CENTER); connectionTree = new Tree(); scroll.setViewportView(connectionTree); connectionTree.getEmptyText().setText(P4Bundle.getString("connection.tree.initial")); connectionTree.setEditable(false); connectionTreeModel = new DefaultTreeModel(treeNode); connectionTree.setModel(connectionTreeModel); connectionTree.setCellRenderer(new ConnectionTreeCellRenderer()); connectionTree.setRootVisible(false); DefaultTreeSelectionModel selectionModel = new DefaultTreeSelectionModel(); selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); connectionTree.setSelectionModel(selectionModel); ActionGroup actionButtons = createActionGroup(); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("p4.active-connection", actionButtons, false); root.add(toolbar.getComponent(), BorderLayout.WEST); // TODO add context menu support for each selected node type. // TODO add support for navigating to a file if a FilePath is selected. }
Example #6
Source File: RemoteFilePanel.java From consulo with Apache License 2.0 | 5 votes |
private void initToolbar(Project project) { DefaultActionGroup group = new DefaultActionGroup(); group.add(new RefreshRemoteFileAction(myVirtualFile)); for (RemoteFileEditorActionProvider actionProvider : RemoteFileEditorActionProvider.EP_NAME.getExtensions()) { group.addAll(actionProvider.createToolbarActions(project, myVirtualFile)); } final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true); myToolbarPanel.add(actionToolbar.getComponent(), BorderLayout.CENTER); }
Example #7
Source File: IdeBackgroundUtil.java From consulo with Apache License 2.0 | 5 votes |
private static String getComponentType(JComponent component) { return component instanceof JTree ? "tree" : component instanceof JList ? "list" : component instanceof JTable ? "table" : component instanceof JViewport ? "viewport" : component instanceof ActionToolbar ? "toolbar" : component instanceof EditorComponentImpl ? "editor" : component instanceof EditorGutterComponentEx ? "editor" : component instanceof JBLoadingPanel ? "loading" : component instanceof JBTabs ? "tabs" : component instanceof JBPanelWithEmptyText ? "panel" : component instanceof JPanel && ourKnownNames.contains(component.getName()) ? component.getName() : null; }
Example #8
Source File: ToolbarPanel.java From consulo with Apache License 2.0 | 5 votes |
public ToolbarPanel(JComponent contentComponent, ActionGroup actions) { super(new GridBagLayout()); setBorder(new CustomLineBorder(1, 0, 0, 0)); if (contentComponent.getBorder() != null) { contentComponent.setBorder(BorderFactory.createEmptyBorder()); } final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actions, true); add(actionToolbar.getComponent(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); add(contentComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); }
Example #9
Source File: DiffSplitter.java From consulo with Apache License 2.0 | 5 votes |
@javax.annotation.Nullable private static JComponent createActionComponent(@Nullable final AnAction action) { if (action == null) return null; ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("", new DefaultActionGroup(action), true); toolbar.setReservePlaceAutoPopupIcon(false); toolbar.getComponent().setCursor(Cursor.getDefaultCursor()); return toolbar.getComponent(); }
Example #10
Source File: IncomingChangesViewProvider.java From consulo with Apache License 2.0 | 5 votes |
public JComponent initContent() { myBrowser = new CommittedChangesTreeBrowser(myProject, Collections.<CommittedChangeList>emptyList()); myBrowser.getEmptyText().setText(VcsBundle.message("incoming.changes.not.loaded.message")); ActionGroup group = (ActionGroup) ActionManager.getInstance().getAction("IncomingChangesToolbar"); final ActionToolbar toolbar = myBrowser.createGroupFilterToolbar(myProject, group, null, Collections.<AnAction>emptyList()); myBrowser.setToolBar(toolbar.getComponent()); myBrowser.setTableContextMenu(group, Collections.<AnAction>emptyList()); myConnection = myBus.connect(); myConnection.subscribe(CommittedChangesCache.COMMITTED_TOPIC, new MyCommittedChangesListener()); loadChangesToBrowser(false, true); JPanel contentPane = new JPanel(new BorderLayout()); contentPane.add(myBrowser, BorderLayout.CENTER); return contentPane; }
Example #11
Source File: TitleWithToolbar.java From consulo with Apache License 2.0 | 5 votes |
public TitleWithToolbar(@Nonnull String title, @Nonnull String actionGroupId, @Nonnull String place, @Nonnull JComponent targetComponent) { super(new GridBagLayout()); ActionManager actionManager = ActionManager.getInstance(); ActionGroup group = (ActionGroup)actionManager.getAction(actionGroupId); ActionToolbar actionToolbar = actionManager.createActionToolbar(place, group, true); actionToolbar.setTargetComponent(targetComponent); actionToolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY); add(new MyTitleComponent(title), new GridBag().weightx(1).anchor(GridBagConstraints.WEST).fillCellHorizontally()); add(actionToolbar.getComponent(), new GridBag().anchor(GridBagConstraints.CENTER)); }
Example #12
Source File: StatusTextAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public JComponent createCustomComponent(Presentation presentation, String place) { JLabel label = new JLabel(); //noinspection HardCodedStringLiteral label.setText("9888 results"); Dimension size = label.getPreferredSize(); size.height = Math.max(size.height, JBUIScale.scale(ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE.getHeight())); label.setPreferredSize(size); label.setText(null); label.setHorizontalAlignment(SwingConstants.CENTER); return label; }
Example #13
Source File: PantsConsoleViewPanel.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
private JPanel createToolbarPanel() { AnAction closeMessageViewAction = new StopAction(); DefaultActionGroup leftUpdateableActionGroup = new DefaultActionGroup(); leftUpdateableActionGroup.add(closeMessageViewAction); JPanel toolbarPanel = new JPanel(new BorderLayout()); ActionManager actionManager = ActionManager.getInstance(); ActionToolbar leftToolbar = actionManager.createActionToolbar(ActionPlaces.COMPILER_MESSAGES_TOOLBAR, leftUpdateableActionGroup, false); toolbarPanel.add(leftToolbar.getComponent(), BorderLayout.WEST); return toolbarPanel; }
Example #14
Source File: TabFormImpl.java From azure-devops-intellij with MIT License | 5 votes |
/** * Creates the toolbar for top of the tab * * @param actions * @return */ protected ActionToolbar createToolbar(DefaultActionGroup actions) { final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(toolbarLocation, actions, false); toolbar.setOrientation(SwingConstants.HORIZONTAL); toolbar.setTargetComponent(scrollPanel); return toolbar; }
Example #15
Source File: ConsoleLogToolWindowFactory.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 5 votes |
private static ActionToolbar createToolbar(Project project, Editor editor, ConsoleLogConsole console) { DefaultActionGroup group = new DefaultActionGroup(); group.add(new EditNotificationSettings(project)); group.add(new DisplayBalloons()); group.add(new ToggleSoftWraps(editor)); group.add(new ScrollToTheEndToolbarAction(editor)); group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_MARK_ALL_NOTIFICATIONS_AS_READ)); group.add(new ConsoleLogConsole.ClearLogAction(console)); group.add(new ContextHelpAction(ConsoleLog.HELP_ID)); return ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false); }
Example #16
Source File: ConsoleLogToolWindowFactory.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 5 votes |
static void createContent(Project project, ToolWindow toolWindow, ConsoleLogConsole console, String title) { // update default Event Log tab title ContentManager contentManager = toolWindow.getContentManager(); Content generalContent = contentManager.getContent(0); if (generalContent != null && contentManager.getContentCount() == 1) { generalContent.setDisplayName("General"); } final Editor editor = console.getConsoleEditor(); SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true) { @Override public Object getData(@NonNls String dataId) { return PlatformDataKeys.HELP_ID.is(dataId) ? ConsoleLog.HELP_ID : super.getData(dataId); } }; panel.setContent(editor.getComponent()); panel.addAncestorListener(new LogShownTracker(project)); ActionToolbar toolbar = createToolbar(project, editor, console); toolbar.setTargetComponent(editor.getContentComponent()); panel.setToolbar(toolbar.getComponent()); Content content = ContentFactory.SERVICE.getInstance().createContent(panel, title, false); contentManager.addContent(content); contentManager.setSelectedContent(content); }
Example #17
Source File: SlingPluginExplorer.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 5 votes |
private JPanel createToolbarPanel(SlingServerTreeManager treeManager) { ActionManager actionManager = ActionManager.getInstance(); DefaultActionGroup group = new DefaultActionGroup(); group.add(actionManager.getAction("AEM.Toolbar")); treeManager.adjustToolbar(group); final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLBAR, group, true); final JPanel buttonsPanel = new JPanel(new BorderLayout()); buttonsPanel.add(actionToolbar.getComponent(), BorderLayout.CENTER); return buttonsPanel; }
Example #18
Source File: BlazeProblemsViewPanel.java From intellij with Apache License 2.0 | 5 votes |
/** A custom toolbar panel, without most of the irrelevant built-in items. */ private JComponent createToolbarPanel() { DefaultActionGroup group = new DefaultActionGroup(); group.add(new PreviousOccurenceToolbarAction(this)); // NOTYPO group.add(new NextOccurenceToolbarAction(this)); // NOTYPO fillRightToolbarGroup(group); ActionToolbar toolbar = ActionManager.getInstance() .createActionToolbar(ActionPlaces.COMPILER_MESSAGES_TOOLBAR, group, false); return toolbar.getComponent(); }
Example #19
Source File: FreelineTerminal.java From freeline with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * 创建左侧工具栏 * * @param terminalRunner * @param terminal * @param toolWindow * @return */ private ActionToolbar createToolbar(@Nullable AbstractTerminalRunner terminalRunner, @NotNull JBTabbedTerminalWidget terminal, @NotNull ToolWindow toolWindow) { DefaultActionGroup group = new DefaultActionGroup(); if (terminalRunner != null) { group.add(new RunAction(this)); group.add(new StopAction(this)); group.addSeparator(); group.add(new DebugAction(this)); group.add(new ForceAction(this)); group.addSeparator(); group.add(new ClearAction(this)); } return ActionManager.getInstance().createActionToolbar("unknown", group, false); }
Example #20
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 #21
Source File: EsyToolWindowFactory.java From reasonml-idea-plugin with MIT License | 5 votes |
@NotNull private ActionToolbar createToolbar(@NotNull BsConsole console) { DefaultActionGroup group = new DefaultActionGroup(); group.add(new ScrollToTheEndToolbarAction(console.getEditor())); group.add(new ClearLogAction(console)); group.add(new EsyInstallAction()); group.add(new EsyBuildAction()); group.add(new EsyShellAction()); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("left", group, false); toolbar.setTargetComponent(console.getComponent()); return toolbar; }
Example #22
Source File: DuneToolWindowFactory.java From reasonml-idea-plugin with MIT License | 5 votes |
@NotNull private ActionToolbar createToolbar(@NotNull BsConsole console) { DefaultActionGroup group = new DefaultActionGroup(); group.add(new ScrollToTheEndToolbarAction(console.getEditor())); group.add(new ClearLogAction(console)); group.add(new DuneBuildAction()); group.add(new DuneCleanAction()); group.add(new DuneInstallAction()); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("left", group, false); toolbar.setTargetComponent(console.getComponent()); return toolbar; }
Example #23
Source File: DarculaButtonPainter.java From consulo with Apache License 2.0 | 5 votes |
@Override public Insets getBorderInsets(Component c) { if (c.getParent() instanceof ActionToolbar) { return JBUI.insets(4, 16, 4, 16); } if (DarculaButtonUI.isSquare(c)) { return JBUI.insets(2, 0, 2, 0).asUIResource(); } return JBUI.insets(8, 16, 8, 14).asUIResource(); }
Example #24
Source File: BsToolWindowFactory.java From reasonml-idea-plugin with MIT License | 5 votes |
@NotNull private ActionToolbar createToolbar(@NotNull BsConsole console) { DefaultActionGroup group = new DefaultActionGroup(); group.add(new ScrollToTheEndToolbarAction(console.getEditor())); group.add(new ClearLogAction(console)); group.add(new BsMakeAction()); group.add(new BsMakeWorldAction()); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("left", group, false); toolbar.setTargetComponent(console.getComponent()); return toolbar; }
Example #25
Source File: ActionUtil.java From react-native-console with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Create some actions * * @param horizontal is horizontal displayed * @return */ public static ActionToolbar createToolbarWithActions(boolean horizontal, AnAction... actions) { DefaultActionGroup group = new DefaultActionGroup(); if (actions != null) { for (AnAction anAction : actions) { group.add(anAction); } } //group.addSeparator(); return ActionManager.getInstance().createActionToolbar("unknown", group, horizontal);// horizontal }
Example #26
Source File: IMChatConsole.java From SmartIM4IntelliJ with Apache License 2.0 | 5 votes |
protected void initToolBar() { DefaultActionGroup group = new DefaultActionGroup(); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("SmartQQ", group, false); // toolbar.getComponent().addFocusListener(createFocusListener()); toolbar.setTargetComponent(this); setToolbar(toolbar.getComponent()); initToolBar(group); }
Example #27
Source File: DesktopActionToolbarFactory.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override public ActionToolbar createActionToolbar(@NonNls String place, ActionGroup group, boolean horizontal, boolean decorateButtons) { return new ActionToolbarImpl(place, group, horizontal, decorateButtons); }
Example #28
Source File: LineStatusMarkerPopup.java From consulo with Apache License 2.0 | 4 votes |
public void showHintAt(@javax.annotation.Nullable Point mousePosition) { if (!myTracker.isValid()) return; final Disposable disposable = Disposable.newDisposable(); FileType fileType = getFileType(); List<DiffFragment> wordDiff = computeWordDiff(); installMasterEditorHighlighters(wordDiff, disposable); JComponent editorComponent = createEditorComponent(fileType, wordDiff); ActionToolbar toolbar = buildToolbar(mousePosition, disposable); toolbar.updateActionsImmediately(); // we need valid ActionToolbar.getPreferredSize() to calc size of popup toolbar.setReservePlaceAutoPopupIcon(false); PopupPanel popupPanel = new PopupPanel(myEditor, toolbar, editorComponent); LightweightHint hint = new LightweightHint(popupPanel); HintListener closeListener = new HintListener() { public void hintHidden(final EventObject event) { Disposer.dispose(disposable); } }; hint.addHintListener(closeListener); int line = myEditor.getCaretModel().getLogicalPosition().line; Point point = HintManagerImpl.getHintPosition(hint, myEditor, new LogicalPosition(line, 0), HintManager.UNDER); if (mousePosition != null) { // show right after the nearest line int lineHeight = myEditor.getLineHeight(); int delta = (point.y - mousePosition.y) % lineHeight; if (delta < 0) delta += lineHeight; point.y = mousePosition.y + delta; } point.x -= popupPanel.getEditorTextOffset(); // align main editor with the one in popup int flags = HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING; HintManagerImpl.getInstanceImpl().showEditorHint(hint, myEditor, point, flags, -1, false, new HintHint(myEditor, point)); if (!hint.isVisible()) { closeListener.hintHidden(null); } }
Example #29
Source File: LineStatusMarkerPopup.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull protected abstract ActionToolbar buildToolbar(@javax.annotation.Nullable Point mousePosition, @Nonnull Disposable parentDisposable);
Example #30
Source File: IconWithTextAction.java From consulo with Apache License 2.0 | 4 votes |
public static JComponent createCustomComponentImpl(final AnAction action, final Presentation presentation) { return new ActionButtonWithText(action, presentation, ActionPlaces.UNKNOWN, ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE); }