List of usage examples for com.intellij.openapi.actionSystem ActionPlaces EDITOR_TOOLBAR
String EDITOR_TOOLBAR
To view the source code for com.intellij.openapi.actionSystem ActionPlaces EDITOR_TOOLBAR.
Click Source Link
From source file:com.intellij.find.EditorSearchComponent.java
License:Apache License
private void initToolbar() { DefaultActionGroup actionGroup = new DefaultActionGroup("search bar", false); actionGroup.add(new ShowHistoryAction(mySearchFieldGetter, this)); actionGroup.add(new PrevOccurrenceAction(this, mySearchFieldGetter)); actionGroup.add(new NextOccurrenceAction(this, mySearchFieldGetter)); actionGroup.add(new AddOccurrenceAction(this)); actionGroup.add(new RemoveOccurrenceAction(this)); actionGroup.add(new SelectAllAction(this)); actionGroup.add(new FindAllAction(this)); actionGroup.add(new ToggleMultiline(this)); actionGroup.add(new ToggleMatchCase(this)); actionGroup.add(new ToggleRegex(this)); myMatchInfoLabel = new JLabel(); myClickToHighlightLabel = new LinkLabel("Click to highlight", null, new LinkListener() { @Override/* w w w. j av a 2s. c o m*/ public void linkSelected(LinkLabel aSource, Object aLinkData) { setMatchesLimit(Integer.MAX_VALUE); updateResults(true); } }); myClickToHighlightLabel.setVisible(false); myActionsToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, actionGroup, true); myActionsToolbar.setSecondaryActionsTooltip("More Options(" + ShowMoreOptions.SHORT_CUT + ")"); actionGroup.addAction(new ToggleWholeWordsOnlyAction(this)); actionGroup.addAction(new ToggleInCommentsAction(this)).setAsSecondary(true); actionGroup.addAction(new ToggleInLiteralsOnlyAction(this)).setAsSecondary(true); actionGroup.addAction(new ToggleExceptCommentsAction(this)).setAsSecondary(true); actionGroup.addAction(new ToggleExceptLiteralsAction(this)).setAsSecondary(true); actionGroup.addAction(new ToggleExceptCommentsAndLiteralsAction(this)).setAsSecondary(true); actionGroup.addAction(new TogglePreserveCaseAction(this)); actionGroup.addAction(new ToggleSelectionOnlyAction(this)); class MyCustomComponentDoNothingAction extends AnAction implements CustomComponentAction { private final JComponent c; MyCustomComponentDoNothingAction(JComponent c) { this.c = c; c.setBorder(IdeBorderFactory.createEmptyBorder(new Insets(0, 10, 0, 0))); } @Override public void actionPerformed(AnActionEvent e) { } @Override public JComponent createCustomComponent(Presentation presentation) { return c; } } actionGroup.add(new MyCustomComponentDoNothingAction(myMatchInfoLabel)); actionGroup.add(new MyCustomComponentDoNothingAction(myClickToHighlightLabel)); myActionsToolbar.setLayoutPolicy(ActionToolbar.AUTO_LAYOUT_POLICY); myToolbarComponent = myActionsToolbar.getComponent(); myToolbarComponent.setBorder(null); myToolbarComponent.setOpaque(false); }
From source file:com.intellij.lang.jsgraphql.ide.actions.JSGraphQLExecuteEditorActionHandler.java
License:Open Source License
@Override protected void doExecute(Editor editor, @Nullable Caret caret, DataContext dataContext) { final Object file = dataContext.getData(LangDataKeys.PSI_FILE.getName()); if (file instanceof JSGraphQLFile || isQueryVariablesFile(dataContext)) { final InputEvent event = getKeyboardEvent(); if (event != null) { final AnAction executeGraphQLAction = ActionManager.getInstance() .getAction(JSGraphQLExecuteEditorAction.class.getName()); final AnActionEvent actionEvent = AnActionEvent.createFromInputEvent(event, ActionPlaces.EDITOR_TOOLBAR, executeGraphQLAction.getTemplatePresentation(), dataContext); executeGraphQLAction.actionPerformed(actionEvent); return; }//from ww w . ja v a 2 s. co m } myOriginalHandler.execute(editor, caret, dataContext); }
From source file:com.intellij.lang.jsgraphql.ide.project.JSGraphQLLanguageUIProjectService.java
License:Open Source License
private JComponent createToolbar(ActionGroup actionGroup) { final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, actionGroup, true);/* w ww.ja v a2 s . c o m*/ toolbar.setReservePlaceAutoPopupIcon(false); // don't want space after the last button final JComponent component = toolbar.getComponent(); component.setBorder(BorderFactory.createEmptyBorder()); return component; }
From source file:io.ballerina.plugins.idea.webview.diagram.split.SplitEditorToolbar.java
License:Open Source License
@NotNull private static ActionToolbar createToolbarFromGroupId(@NotNull String groupId) { final ActionManager actionManager = ActionManager.getInstance(); if (!actionManager.isGroup(groupId)) { throw new IllegalStateException(groupId + " should have been a group"); }/*from w ww.j a va2 s.c om*/ final ActionGroup group = ((ActionGroup) actionManager.getAction(groupId)); final ActionToolbarImpl editorToolbar = ((ActionToolbarImpl) actionManager .createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, group, true)); editorToolbar.setOpaque(false); editorToolbar.setBorder(new JBEmptyBorder(0, 2, 0, 2)); return editorToolbar; }