void updateMenuActions() { myNewVisibleActions.clear(); if (!myDisabled) { DataContext dataContext = ((DataManagerImpl)myDataManager).getDataContextTest(this); expandActionGroup(dataContext, myNewVisibleActions, myActionManager); } if (!myNewVisibleActions.equals(myVisibleActions)) { // should rebuild UI final boolean changeBarVisibility = myNewVisibleActions.isEmpty() || myVisibleActions.isEmpty(); final List<AnAction> temp = myVisibleActions; myVisibleActions = myNewVisibleActions; myNewVisibleActions = temp; removeAll(); final boolean enableMnemonics = !UISettings.getInstance().DISABLE_MNEMONICS; for (final AnAction action : myVisibleActions) { add(new ActionMenu(null, ActionPlaces.MAIN_MENU, (ActionGroup)action, myPresentationFactory, enableMnemonics, true)); } fixMenuBackground(); updateMnemonicsVisibility(); if (myClockPanel != null) { add(myClockPanel); add(myButton); } validate(); if (changeBarVisibility) { invalidate(); final JFrame frame = (JFrame)SwingUtilities.getAncestorOfClass(JFrame.class, this); if (frame != null) { frame.validate(); } } } }
@Override public void dispose() { if (myDisposeCallback != null) { myDisposeCallback.run(); } ActionMenu.showDescriptionInStatusBar(true, myComponent, null); super.dispose(); }
void updateMenuActions() { myNewVisibleActions.clear(); if (!myDisabled) { DataContext dataContext = ((DataManagerImpl)myDataManager).getDataContextTest(this); expandActionGroup(dataContext, myNewVisibleActions, myActionManager); } if (!myNewVisibleActions.equals(myVisibleActions)) { // should rebuild UI final boolean changeBarVisibility = myNewVisibleActions.isEmpty() || myVisibleActions.isEmpty(); final List<AnAction> temp = myVisibleActions; myVisibleActions = myNewVisibleActions; myNewVisibleActions = temp; removeAll(); final boolean enableMnemonics = !UISettings.getInstance().DISABLE_MNEMONICS; for (final AnAction action : myVisibleActions) { add(new ActionMenu(null, ActionPlaces.MAIN_MENU, (ActionGroup)action, myPresentationFactory, enableMnemonics, true)); } fixMenuBackground(); updateMnemonicsVisibility(); if (myClockPanel != null) { add(myClockPanel); } validate(); if (changeBarVisibility) { invalidate(); final JFrame frame = (JFrame)SwingUtilities.getAncestorOfClass(JFrame.class, this); if (frame != null) { frame.validate(); } } } }
public ActionGroupPopup(final String title, @NotNull ActionGroup actionGroup, @NotNull DataContext dataContext, boolean showNumbers, boolean useAlphaAsNumbers, boolean showDisabledActions, boolean honorActionMnemonics, final Runnable disposeCallback, final int maxRowCount, final Condition<AnAction> preselectActionCondition, @Nullable final String actionPlace) { super(createStep(title, actionGroup, dataContext, showNumbers, useAlphaAsNumbers, showDisabledActions, honorActionMnemonics, preselectActionCondition, actionPlace), maxRowCount); myDisposeCallback = disposeCallback; myComponent = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext); addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { final JList list = (JList)e.getSource(); final ActionItem actionItem = (ActionItem)list.getSelectedValue(); if (actionItem == null) return; AnAction action = actionItem.getAction(); Presentation presentation = new Presentation(); presentation.setDescription(action.getTemplatePresentation().getDescription()); final String actualActionPlace = actionPlace == null ? ActionPlaces.UNKNOWN : actionPlace; action.update(new AnActionEvent(null, DataManager.getInstance().getDataContext(myComponent), actualActionPlace, presentation, ActionManager.getInstance(), 0)); ActionMenu.showDescriptionInStatusBar(true, myComponent, presentation.getDescription()); } }); }
void updateMenuActions() { myNewVisibleActions.clear(); if (!myDisabled) { DataContext dataContext = ((DataManagerImpl)myDataManager).getDataContextTest(this); expandActionGroup(dataContext, myNewVisibleActions, myActionManager); } if (!myNewVisibleActions.equals(myVisibleActions)) { // should rebuild UI final boolean changeBarVisibility = myNewVisibleActions.isEmpty() || myVisibleActions.isEmpty(); final List<AnAction> temp = myVisibleActions; myVisibleActions = myNewVisibleActions; myNewVisibleActions = temp; removeAll(); final boolean enableMnemonics = !UISettings.getInstance().DISABLE_MNEMONICS; for (final AnAction action : myVisibleActions) { add(new ActionMenu(null, ActionPlaces.MAIN_MENU, (ActionGroup)action, myPresentationFactory, enableMnemonics, true)); } updateMnemonicsVisibility(); if (myClockPanel != null) { add(myClockPanel); add(myButton); } validate(); if (changeBarVisibility) { invalidate(); final JFrame frame = (JFrame)SwingUtilities.getAncestorOfClass(JFrame.class, this); if (frame != null) { frame.validate(); } } } }
private void updateMnemonicsVisibility() { final boolean enabled = !UISettings.getInstance().DISABLE_MNEMONICS; for (int i = 0; i < getMenuCount(); i++) { ((ActionMenu)getMenu(i)).setMnemonicEnabled(enabled); } }
@Override public void setDescription(@Nullable String text) { ActionMenu.showDescriptionInStatusBar(true, myComponent, text); }