Search in sources :

Example 1 with ActionGroup

use of org.eclipse.che.ide.api.action.ActionGroup in project che by eclipse.

the class FindActionPresenter method collectActions.

private void collectActions(Map<Action, String> result, ActionGroup group, final String containingGroupName) {
    final Action[] actions = group.getChildren(null);
    includeGroup(result, group, actions, containingGroupName);
    for (Action action : actions) {
        if (action != null) {
            if (action instanceof ActionGroup) {
                final ActionGroup actionGroup = (ActionGroup) action;
                final String groupName = actionGroup.getTemplatePresentation().getText();
                collectActions(result, actionGroup, StringUtils.isNullOrEmpty(groupName) || !actionGroup.isPopup() ? containingGroupName : groupName);
            } else {
                final String groupName = group.getTemplatePresentation().getText();
                if (result.containsKey(action)) {
                    result.put(action, null);
                } else {
                    result.put(action, StringUtils.isNullOrEmpty(groupName) ? containingGroupName : groupName);
                }
            }
        }
    }
}
Also used : Action(org.eclipse.che.ide.api.action.Action) ActionGroup(org.eclipse.che.ide.api.action.ActionGroup) DefaultActionGroup(org.eclipse.che.ide.api.action.DefaultActionGroup)

Example 2 with ActionGroup

use of org.eclipse.che.ide.api.action.ActionGroup in project che by eclipse.

the class MainMenuViewImpl method add.

/**
     * Create and add new item in menu.
     */
private void add(Action action, PresentationFactory presentationFactory) {
    Presentation presentation = presentationFactory.getPresentation(action);
    if (action instanceof ActionGroup) {
        ActionGroup group = (ActionGroup) action;
        table.setText(0, menuBarItems.size(), presentation.getText());
        Element element = table.getCellFormatter().getElement(0, menuBarItems.size());
        MenuBarItem item = new MenuBarItem(group, actionManager, managerProvider, presentationFactory, element, this, keyBindingAgent, resources.menuCss());
        item.onMouseOut();
        menuBarItems.put(element, item);
        action2barItem.put(group, item);
    } else if (action instanceof CustomComponentAction) {
        Widget widget = ((CustomComponentAction) action).createCustomComponent(presentation);
        table.setWidget(0, menuBarItems.size(), widget);
        Element element = table.getCellFormatter().getElement(0, menuBarItems.size());
        menuBarItems.put(element, null);
    }
}
Also used : CustomComponentAction(org.eclipse.che.ide.api.action.CustomComponentAction) ActionGroup(org.eclipse.che.ide.api.action.ActionGroup) Element(com.google.gwt.dom.client.Element) Widget(com.google.gwt.user.client.ui.Widget) Presentation(org.eclipse.che.ide.api.action.Presentation)

Example 3 with ActionGroup

use of org.eclipse.che.ide.api.action.ActionGroup in project che by eclipse.

the class MainMenuViewImpl method expandActionGroup.

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);
}
Also used : ActionGroup(org.eclipse.che.ide.api.action.ActionGroup)

Example 4 with ActionGroup

use of org.eclipse.che.ide.api.action.ActionGroup in project che by eclipse.

the class EditorTabContextMenu method updateActions.

protected ActionGroup updateActions() {
    final ActionGroup mainActionGroup = (ActionGroup) actionManager.getAction(getGroupMenu());
    if (mainActionGroup == null) {
        return new DefaultActionGroup(actionManager);
    }
    final Action[] children = mainActionGroup.getChildren(null);
    for (final Action action : children) {
        final Presentation presentation = presentationFactory.getPresentation(action);
        //pass into action properties
        presentation.putClientProperty(CURRENT_FILE_PROP, editorTab.getFile());
        presentation.putClientProperty(CURRENT_TAB_PROP, editorTab);
        presentation.putClientProperty(CURRENT_PANE_PROP, editorPartStack);
    }
    return super.updateActions();
}
Also used : Action(org.eclipse.che.ide.api.action.Action) ActionGroup(org.eclipse.che.ide.api.action.ActionGroup) DefaultActionGroup(org.eclipse.che.ide.api.action.DefaultActionGroup) Presentation(org.eclipse.che.ide.api.action.Presentation) DefaultActionGroup(org.eclipse.che.ide.api.action.DefaultActionGroup)

Example 5 with ActionGroup

use of org.eclipse.che.ide.api.action.ActionGroup in project che by eclipse.

the class PopupMenu method onRowHovered.

/**
     * Handling MouseOver event.
     *
     * @param tr
     *         - element to be processed.
     */
protected void onRowHovered(Element tr) {
    if (tr == hoveredTR) {
        return;
    }
    setStyleNormal(hoveredTR);
    if (subPopupAnchor != null) {
        setStyleHovered(subPopupAnchor);
    }
    if (!isRowEnabled(tr)) {
        hoveredTR = null;
        return;
    }
    hoveredTR = tr;
    setStyleHovered(tr);
    int itemIndex = Integer.parseInt(tr.getAttribute("item-index"));
    Action menuItem = list.get(itemIndex);
    openSubPopupTimer.cancel();
    if (menuItem instanceof ActionGroup && !(((ActionGroup) menuItem).canBePerformed() && !Utils.hasVisibleChildren((ActionGroup) menuItem, presentationFactory, actionManager, managerProvider.get()))) {
        openSubPopupTimer.schedule(300);
    } else {
        closeSubPopupTimer.cancel();
        closeSubPopupTimer.schedule(200);
    }
}
Also used : ToggleAction(org.eclipse.che.ide.api.action.ToggleAction) Action(org.eclipse.che.ide.api.action.Action) ActionGroup(org.eclipse.che.ide.api.action.ActionGroup)

Aggregations

ActionGroup (org.eclipse.che.ide.api.action.ActionGroup)14 Action (org.eclipse.che.ide.api.action.Action)10 Presentation (org.eclipse.che.ide.api.action.Presentation)7 ActionEvent (org.eclipse.che.ide.api.action.ActionEvent)5 DefaultActionGroup (org.eclipse.che.ide.api.action.DefaultActionGroup)4 Separator (org.eclipse.che.ide.api.action.Separator)4 ToggleAction (org.eclipse.che.ide.api.action.ToggleAction)4 Element (com.google.gwt.dom.client.Element)2 Widget (com.google.gwt.user.client.ui.Widget)2 CustomComponentAction (org.eclipse.che.ide.api.action.CustomComponentAction)2 Scheduler (com.google.gwt.core.client.Scheduler)1 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 Image (com.google.gwt.user.client.ui.Image)1 Label (com.google.gwt.user.client.ui.Label)1 ArrayList (java.util.ArrayList)1 MenuLockLayer (org.eclipse.che.ide.ui.toolbar.MenuLockLayer)1 PopupMenu (org.eclipse.che.ide.ui.toolbar.PopupMenu)1 SVGImage (org.vectomatic.dom.svg.ui.SVGImage)1