private ActionToolbarImpl createToolbar() { final DefaultActionGroup framesGroup = new DefaultActionGroup(); CommonActionsManager actionsManager = CommonActionsManager.getInstance(); framesGroup.add(actionsManager.createPrevOccurenceAction(getFramesList())); framesGroup.add(actionsManager.createNextOccurenceAction(getFramesList())); framesGroup.addAll(ActionManager.getInstance().getAction(XDebuggerActions.FRAMES_TOP_TOOLBAR_GROUP)); final ActionToolbarImpl toolbar = (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true); toolbar.setReservePlaceAutoPopupIcon(false); toolbar.setAddSeparatorFirst(true); toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0)); return toolbar; }
private static void update() { UISettings.getInstance().fireUISettingsChanged(); EditorFactory.getInstance().refreshAllEditors(); Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); for (Project openProject : openProjects) { FileStatusManager.getInstance(openProject).fileStatusesChanged(); DaemonCodeAnalyzer.getInstance(openProject).restart(); } for (IdeFrame frame : WindowManagerEx.getInstanceEx().getAllProjectFrames()) { if (frame instanceof IdeFrameImpl) { ((IdeFrameImpl)frame).updateView(); } } //Editor[] editors = EditorFactory.getInstance().getAllEditors(); //for (Editor editor : editors) { // ((EditorEx)editor).reinitSettings(); //} ActionToolbarImpl.updateAllToolbarsImmediately(); restart(); //todo[kb] remove when get fixed ToolbarDecorator and toolwindow tabs }
@Override public void apply() throws ConfigurationException { ensureNonEmptyKeymapNames(); ensureUniqueKeymapNames(); final KeymapManagerImpl keymapManager = (KeymapManagerImpl)KeymapManager.getInstance(); keymapManager.removeAllKeymapsExceptUnmodifiable(); for (int i = 0; i < myKeymapListModel.getSize(); i++) { final Keymap modelKeymap = (Keymap)myKeymapListModel.getElementAt(i); if (modelKeymap.canModify()) { final KeymapImpl keymapToAdd = ((KeymapImpl)modelKeymap).copy(true); keymapManager.addKeymap(keymapToAdd); } } keymapManager.setActiveKeymap(mySelectedKeymap); ActionToolbarImpl.updateAllToolbarsImmediately(); }
private ActionToolbar createToolbar(final ActionGroup group) { final ActionToolbarImpl actionToolbar = new ActionToolbarImpl(ActionPlaces.CONTEXT_TOOLBAR, group, true, DataManager.getInstance(), ActionManagerEx.getInstanceEx(), KeymapManagerEx.getInstanceEx()) { @Override protected ActionButton createToolbarButton(final AnAction action, boolean minimalMode, boolean decorateButtons, final String place, final Presentation presentation, final Dimension minimumSize) { final ActionButton result = new ActionButton(action, presentation, place, minimumSize); result.setMinimalMode(minimalMode); result.setDecorateButtons(decorateButtons); return result; } }; actionToolbar.setTargetComponent(myEditor.getContentComponent()); return actionToolbar; }
private static void fireUpdate() { UISettings.getInstance().fireUISettingsChanged(); EditorFactory.getInstance().refreshAllEditors(); Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); for (Project openProject : openProjects) { FileStatusManager.getInstance(openProject).fileStatusesChanged(); DaemonCodeAnalyzer.getInstance(openProject).restart(); } for (IdeFrame frame : WindowManagerEx.getInstanceEx().getAllProjectFrames()) { if (frame instanceof IdeFrameEx) { ((IdeFrameEx)frame).updateView(); } } ActionToolbarImpl.updateAllToolbarsImmediately(); }
private ActionToolbarImpl createToolbar() { final DefaultActionGroup framesGroup = new DefaultActionGroup(); CommonActionsManager actionsManager = CommonActionsManager.getInstance(); framesGroup.add(actionsManager.createPrevOccurenceAction(myFramesList)); framesGroup.add(actionsManager.createNextOccurenceAction(myFramesList)); framesGroup.addAll(ActionManager.getInstance().getAction(XDebuggerActions.FRAMES_TOP_TOOLBAR_GROUP)); final ActionToolbarImpl toolbar = (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true); toolbar.setReservePlaceAutoPopupIcon(false); toolbar.setAddSeparatorFirst(true); toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0)); return toolbar; }
private static ActionToolbar createToolbarFromGroupId(final String groupId) { final ActionManager actionManager = ActionManager.getInstance(); if (!actionManager.isGroup(groupId)) { throw new IllegalStateException(groupId + " should have been a group"); } 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; }
@Override public void apply() throws ConfigurationException { myEditor.ensureNonEmptyNames(KeyMapBundle.message("configuration.all.keymaps.should.have.non.empty.names.error.message")); ensureUniqueKeymapNames(); KeymapManagerImpl keymapManager = (KeymapManagerImpl)KeymapManager.getInstance(); // we must specify the same filter, which was used to get original items keymapManager.setKeymaps(myEditor.apply(), myEditor.getModel().getSelected(), KEYMAP_FILTER); ActionToolbarImpl.updateAllToolbarsImmediately(); }
@NotNull private ActionToolbarImpl createSearchToolbar1(@NotNull DefaultActionGroup group) { ActionToolbarImpl toolbar = createToolbar(group); toolbar.setForceMinimumSize(true); toolbar.setReservePlaceAutoPopupIcon(false); toolbar.setSecondaryButtonPopupStateModifier(mySearchToolbar1PopupStateModifier); toolbar.setSecondaryActionsTooltip("More Options(" + ShowMoreOptions.SHORT_CUT + ")"); new ShowMoreOptions(toolbar, mySearchFieldWrapper); return toolbar; }
@NotNull private ActionToolbarImpl createReplaceToolbar1(@NotNull DefaultActionGroup group) { ActionToolbarImpl toolbar = createToolbar(group); toolbar.setForceMinimumSize(true); toolbar.setReservePlaceAutoPopupIcon(false); return toolbar; }
@NotNull private ActionToolbarImpl tweakToolbar(@NotNull ActionToolbarImpl toolbar) { toolbar.setTargetComponent(this); toolbar.setLayoutPolicy(ActionToolbar.AUTO_LAYOUT_POLICY); toolbar.setBorder(null); toolbar.setOpaque(false); Utils.setSmallerFontForChildren(toolbar); return toolbar; }
private ActionCallback onFocusLost() { final ActionCallback result = new ActionCallback(); //noinspection SSBasedInspection UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { try { if (myCalcThread != null) { myCalcThread.cancel(); //myCalcThread = null; } myAlarm.cancelAllRequests(); if (myBalloon != null && !myBalloon.isDisposed() && myPopup != null && !myPopup.isDisposed()) { myBalloon.cancel(); myPopup.cancel(); } //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ActionToolbarImpl.updateAllToolbarsImmediately(); } }); } finally { result.setDone(); } } }); return result; }
@Override public final void actionPerformed(final AnActionEvent e) { MTConfig.getInstance().setAccentColor(this.getAccentColor()); MTThemeManager.getInstance().applyAccents(true); IconReplacer.replaceIcons(AllIcons.class, "/icons"); ActionToolbarImpl.updateAllToolbarsImmediately(); }
public void updateFileIcons() { ApplicationManager.getApplication().runWriteAction(() -> { final FileTypeManagerEx instanceEx = FileTypeManagerEx.getInstanceEx(); instanceEx.fireFileTypesChanged(); ActionToolbarImpl.updateAllToolbarsImmediately(); }); }
private ActionToolbar createToolbar() { final DefaultActionGroup framesGroup = new DefaultActionGroup(); framesGroup.addSeparator(); CommonActionsManager actionsManager = CommonActionsManager.getInstance(); framesGroup.add(actionsManager.createPrevOccurenceAction(getOccurenceNavigator())); framesGroup.add(actionsManager.createNextOccurenceAction(getOccurenceNavigator())); framesGroup.add(new ShowLibraryFramesAction()); final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true); toolbar.setReservePlaceAutoPopupIcon(false); ((ActionToolbarImpl)toolbar).setAddSeparatorFirst(true); toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0)); return toolbar; }
public void apply() throws ConfigurationException{ ensureNonEmptyKeymapNames(); ensureUniqueKeymapNames(); final KeymapManagerImpl keymapManager = (KeymapManagerImpl)KeymapManager.getInstance(); keymapManager.removeAllKeymapsExceptUnmodifiable(); for(int i = 0; i < myKeymapListModel.getSize(); i++){ final Keymap modelKeymap = (Keymap)myKeymapListModel.getElementAt(i); if(modelKeymap.canModify()) { final KeymapImpl keymapToAdd = ((KeymapImpl)modelKeymap).copy(true); keymapManager.addKeymap(keymapToAdd); } } keymapManager.setActiveKeymap(mySelectedKeymap); ActionToolbarImpl.updateAllToolbarsImmediately(); }
private ActionToolbarImpl createToolbar() { final DefaultActionGroup framesGroup = new DefaultActionGroup(); CommonActionsManager actionsManager = CommonActionsManager.getInstance(); framesGroup.add(actionsManager.createPrevOccurenceAction(getFramesList())); framesGroup.add(actionsManager.createNextOccurenceAction(getFramesList())); final ActionToolbarImpl toolbar = (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true); toolbar.setReservePlaceAutoPopupIcon(false); toolbar.setAddSeparatorFirst(true); toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0)); return toolbar; }
@Override public void actionPerformed(AnActionEvent e) { final ActionButton secondaryActions = ((ActionToolbarImpl)myToolbarComponent).getSecondaryActionsButton(); if (secondaryActions != null) { secondaryActions.click(); } }
@Nonnull private ActionToolbarImpl createSearchToolbar1(@Nonnull DefaultActionGroup group) { ActionToolbarImpl toolbar = createToolbar(group); toolbar.setForceMinimumSize(true); toolbar.setReservePlaceAutoPopupIcon(false); toolbar.setSecondaryButtonPopupStateModifier(mySearchToolbar1PopupStateModifier); toolbar.setSecondaryActionsTooltip("More Options(" + ShowMoreOptions.SHORT_CUT + ")"); new ShowMoreOptions(toolbar, mySearchFieldWrapper); return toolbar; }
@Nonnull private ActionToolbarImpl createReplaceToolbar1(@Nonnull DefaultActionGroup group) { ActionToolbarImpl toolbar = createToolbar(group); toolbar.setForceMinimumSize(true); toolbar.setReservePlaceAutoPopupIcon(false); return toolbar; }
@Nonnull private ActionToolbarImpl tweakToolbar(@Nonnull ActionToolbarImpl toolbar) { toolbar.setTargetComponent(this); toolbar.setLayoutPolicy(ActionToolbar.AUTO_LAYOUT_POLICY); toolbar.setBorder(null); Utils.setSmallerFontForChildren(toolbar); return toolbar; }
public static ActionToolbarImpl createToolbar(AnAction... actions) { ActionToolbarImpl toolbar = (ActionToolbarImpl)ActionManager.getInstance() .createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, new DefaultActionGroup(actions), true); toolbar.setForceMinimumSize(true); toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY); return toolbar; }
protected static void update() { UISettings.getInstance().fireUISettingsChanged(); ActionToolbarImpl.updateAllToolbarsImmediately(); }
public ShowMoreOptions(ActionToolbarImpl toolbarComponent, JComponent shortcutHolder) { this.myToolbarComponent = toolbarComponent; registerCustomShortcutSet(new CustomShortcutSet(SHORT_CUT), shortcutHolder); }
private void updateBindings(@NotNull ActionToolbarImpl toolbar, @NotNull JComponent shortcutHolder) { updateBindings(toolbar.getActions(true), shortcutHolder); }
@NotNull private ActionToolbarImpl createSearchToolbar2(@NotNull DefaultActionGroup group) { return createToolbar(group); }
@NotNull private ActionToolbarImpl createReplaceToolbar2(@NotNull DefaultActionGroup group) { return createToolbar(group); }
@NotNull private ActionToolbarImpl createToolbar(@NotNull ActionGroup group) { return tweakToolbar((ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, group, true)); }
private static Presentation doTest(AnAction action, ActionToolbarImpl toolbar) { TestActionEvent event = new TestActionEvent(toolbar.getPresentation(action)); action.update(event); return event.getPresentation(); }
@Override public final void actionPerformed(final AnActionEvent e) { MTConfig.getInstance().setArrowsStyle(getArrowsStyle()); ActionToolbarImpl.updateAllToolbarsImmediately(); }
public XWatchesViewImpl(@Nonnull XDebugSessionImpl session, boolean watchesInVariables) { super(session); myWatchesInVariables = watchesInVariables; XDebuggerTree tree = getTree(); createNewRootNode(null); DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XNEW_WATCH, tree, myDisposables); DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XREMOVE_WATCH, tree, myDisposables); DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XCOPY_WATCH, tree, myDisposables); DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XEDIT_WATCH, tree, myDisposables); EmptyAction.registerWithShortcutSet(XDebuggerActions.XNEW_WATCH, CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.ADD), tree); EmptyAction.registerWithShortcutSet(XDebuggerActions.XREMOVE_WATCH, CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.REMOVE), tree); DnDManager.getInstance().registerTarget(this, tree); new AnAction() { @Override public void actionPerformed(@Nonnull AnActionEvent e) { Object contents = CopyPasteManager.getInstance().getContents(XWatchTransferable.EXPRESSIONS_FLAVOR); if (contents instanceof List) { for (Object item : ((List)contents)){ if (item instanceof XExpression) { addWatchExpression(((XExpression)item), -1, true); } } } } }.registerCustomShortcutSet(CommonShortcuts.getPaste(), tree, myDisposables); ActionToolbarImpl toolbar = (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar( ActionPlaces.DEBUGGER_TOOLBAR, DebuggerSessionTabBase.getCustomizedActionGroup(XDebuggerActions.WATCHES_TREE_TOOLBAR_GROUP), !myWatchesInVariables); toolbar.setBorder(new CustomLineBorder(CaptionPanel.CNT_ACTIVE_BORDER_COLOR, 0, 0, myWatchesInVariables ? 0 : 1, myWatchesInVariables ? 1 : 0)); toolbar.setTargetComponent(tree); if (!myWatchesInVariables) { getTree().getEmptyText().setText(XDebuggerBundle.message("debugger.no.watches")); } getPanel().add(toolbar.getComponent(), myWatchesInVariables ? BorderLayout.WEST : BorderLayout.NORTH); installEditListeners(); }
private void updateBindings(@Nonnull ActionToolbarImpl toolbar, @Nonnull JComponent shortcutHolder) { updateBindings(toolbar.getActions(true), shortcutHolder); }
@Nonnull private ActionToolbarImpl createSearchToolbar2(@Nonnull DefaultActionGroup group) { return createToolbar(group); }
@Nonnull private ActionToolbarImpl createReplaceToolbar2(@Nonnull DefaultActionGroup group) { return createToolbar(group); }
@Nonnull private ActionToolbarImpl createToolbar(@Nonnull ActionGroup group) { return tweakToolbar((ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, group, true)); }
@SuppressWarnings("SSBasedInspection") private void updatePopup() { check(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { myListModel.update(); myList.revalidate(); myList.repaint(); myRenderer.recalculateWidth(); if (myBalloon == null || myBalloon.isDisposed()) { return; } if (myPopup == null || !myPopup.isVisible()) { final ActionCallback callback = ListDelegationUtil.installKeyboardDelegation(getField().getTextEditor(), myList); JBScrollPane content = new JBScrollPane(myList); content.setMinimumSize(new Dimension(myBalloon.getSize().width, 30)); final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(content, null); myPopup = builder.setRequestFocus(false).setCancelKeyEnabled(false).setCancelCallback(new Computable<Boolean>() { @Override public Boolean compute() { return myBalloon == null || myBalloon.isDisposed() || (!getField().getTextEditor().hasFocus() && !mySkipFocusGain); } }).createPopup(); myPopup.setMinimumSize(new Dimension(myBalloon.getSize().width, 30)); myPopup.getContent().setBorder(new EmptyBorder(0, 0, 0, 0)); Disposer.register(myPopup, new Disposable() { @Override public void dispose() { callback.setDone(); resetFields(); myNonProjectCheckBox.setSelected(false); ActionToolbarImpl.updateAllToolbarsImmediately(); if (myActionEvent != null && myActionEvent.getInputEvent() instanceof MouseEvent) { final Component component = myActionEvent.getInputEvent().getComponent(); if (component != null) { final JLabel label = UIUtil.getParentOfType(JLabel.class, component); if (label != null) { label.setIcon(AllIcons.Actions.FindPlain); } } } myActionEvent = null; } }); myPopup.show(new RelativePoint(getField().getParent(), new Point(0, getField().getParent().getHeight()))); //updatePopupBounds(); ActionManager.getInstance().addAnActionListener(new AnActionListener.Adapter() { @Override public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) { if (action instanceof TextComponentEditorAction) { return; } myPopup.cancel(); } }, myPopup); } else { myList.revalidate(); myList.repaint(); } ScrollingUtil.ensureSelectionExists(myList); if (myList.getModel().getSize() > 0) { updatePopupBounds(); } } }); }