void updateMenuActions() { if (selectedMenuBarItem != null) { return; } List<Action> newMenuVisibleActions = new ArrayList<>(); expandActionGroup(IdeActions.GROUP_MAIN_MENU, newMenuVisibleActions, actionManager); if (!newMenuVisibleActions.equals(menuVisibleActions)) { removeAll(); for (final Action action : newMenuVisibleActions) { add(action, presentationFactory); } menuVisibleActions = newMenuVisibleActions; } List<Action> newLeftVisibleActions = new ArrayList<>(); expandActionGroup(IdeActions.GROUP_LEFT_MAIN_MENU, newLeftVisibleActions, actionManager); if (!newLeftVisibleActions.equals(leftVisibleActions)) { leftPanel.clear(); for (Action action : newLeftVisibleActions) { addToPanel(leftPanel, action, presentationFactory); } leftVisibleActions = newLeftVisibleActions; } }
/** * Open Popup Menu. * * @param item popup menu item. */ public void openPopupMenu(MenuBarItem item) { if (lockLayer == null) { int top = getAbsoluteTop() + getOffsetHeight(); lockLayer = new MenuLockLayer(this, top); } item.openPopupMenu(lockLayer); }
@Override public void run() { updateMenuActions(); } }.scheduleRepeating(1000);
private void expandActionGroup( String actionGroupId, final List<Action> newVisibleActions, ActionManager actionManager) { final ActionGroup mainActionGroup = (ActionGroup) actionManager.getAction(actionGroupId); if (mainActionGroup == null) return; expandActionGroup(newVisibleActions, actionManager, mainActionGroup); }
if (selectedMenuBarItem != null && item != selectedMenuBarItem) { if (item.onMouseDown()) { openPopupMenu(item); openPopupMenu(item);
/** Create new {@link MainMenuViewImpl} */ @Inject public MainMenuViewImpl( MenuResources resources, ActionManager actionManager, KeyBindingAgent keyBindingAgent, Provider<PerspectiveManager> managerProvider, CommandToolbarPresenter toolbarPresenter) { this.resources = resources; this.actionManager = actionManager; this.keyBindingAgent = keyBindingAgent; this.managerProvider = managerProvider; initWidget(rootPanel); disableTextSelection(rootPanel.getElement(), true); rootPanel.setStyleName(resources.menuCss().menuBar()); leftPanel.addStyleName(resources.menuCss().leftPanel()); table.setStyleName(resources.menuCss().menuBarTable()); table.setCellPadding(0); table.setCellSpacing(0); final DivElement triangleSeparator = Elements.createDivElement(resources.menuCss().triangleSeparator()); rightPanel.addStyleName(resources.menuCss().rightPanel()); rightPanel.addStyleName(resources.menuCss().commandToolbar()); rootPanel.add(leftPanel); rootPanel.add(table); rootPanel.getElement().appendChild((Element) triangleSeparator); rootPanel.add(rightPanel); toolbarPresenter.go(rightPanel::add); }