Search in sources :

Example 1 with Action

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

the class FindActionPresenter method show.

public void show() {
    view.show();
    Action action = actionManager.getAction(IdeActions.GROUP_MAIN_MENU);
    collectActions(actionsMap, (ActionGroup) action, action.getTemplatePresentation().getText());
    view.focusOnInput();
    if (view.getName() != null) {
        nameChanged(view.getName(), view.getCheckBoxState());
    }
}
Also used : Action(org.eclipse.che.ide.api.action.Action)

Example 2 with Action

use of org.eclipse.che.ide.api.action.Action 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 3 with Action

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

the class MainMenuViewImpl method updateMenuActions.

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> newRightVisibleActions = new ArrayList<>();
    expandActionGroup(IdeActions.GROUP_RIGHT_MAIN_MENU, newRightVisibleActions, actionManager);
    if (!newRightVisibleActions.equals(rightVisibleActions)) {
        rightPanel.clear();
        for (Action action : newRightVisibleActions) {
            addToPanel(rightPanel, action, presentationFactory);
        }
        rightVisibleActions = newRightVisibleActions;
    }
    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;
    }
}
Also used : CustomComponentAction(org.eclipse.che.ide.api.action.CustomComponentAction) Action(org.eclipse.che.ide.api.action.Action) ArrayList(java.util.ArrayList)

Example 4 with Action

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

the class MainMenuViewImpl method expandActionGroup.

private void expandActionGroup(List<Action> newVisibleActions, ActionManager actionManager, ActionGroup mainActionGroup) {
    final Action[] children = mainActionGroup.getChildren(null);
    for (final Action action : children) {
        final Presentation presentation = presentationFactory.getPresentation(action);
        final ActionEvent e = new ActionEvent(presentation, actionManager, managerProvider.get());
        action.update(e);
        if (presentation.isVisible()) {
            // add only visible items
            newVisibleActions.add(action);
        }
        if (action2barItem.containsKey(action)) {
            action2barItem.get(action).update();
        }
    }
}
Also used : CustomComponentAction(org.eclipse.che.ide.api.action.CustomComponentAction) Action(org.eclipse.che.ide.api.action.Action) ActionEvent(org.eclipse.che.ide.api.action.ActionEvent) Presentation(org.eclipse.che.ide.api.action.Presentation)

Example 5 with Action

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

the class StatusPanelGroupViewImpl method updateMenuActions.

void updateMenuActions() {
    if (selectedMenuBarItem != null) {
        return;
    }
    List<Action> newCenterVisibleActions = new ArrayList<>();
    expandActionGroup(IdeActions.GROUP_CENTER_STATUS_PANEL, newCenterVisibleActions, actionManager);
    if (!newCenterVisibleActions.equals(centerVisibleActions)) {
        centerPanel.clear();
        for (Action action : newCenterVisibleActions) {
            addToPanel(centerPanel, action, presentationFactory);
        }
        centerVisibleActions = newCenterVisibleActions;
    }
    List<Action> newRightVisibleActions = new ArrayList<>();
    expandActionGroup(IdeActions.GROUP_RIGHT_STATUS_PANEL, newRightVisibleActions, actionManager);
    if (!newRightVisibleActions.equals(rightVisibleActions)) {
        rightPanel.clear();
        for (Action action : newRightVisibleActions) {
            addToPanel(rightPanel, action, presentationFactory);
        }
        rightVisibleActions = newRightVisibleActions;
    }
    List<Action> newLeftVisibleActions = new ArrayList<>();
    expandActionGroup(IdeActions.GROUP_LEFT_STATUS_PANEL, newLeftVisibleActions, actionManager);
    if (!newLeftVisibleActions.equals(leftVisibleActions)) {
        leftPanel.clear();
        for (Action action : newLeftVisibleActions) {
            addToPanel(leftPanel, action, presentationFactory);
        }
        leftVisibleActions = newLeftVisibleActions;
    }
    centerPanel.getElement().getStyle().setPropertyPx("marginLeft", rootPanel.getOffsetWidth() / 2 - leftPanel.getOffsetWidth() - centerPanel.getOffsetWidth() / 2);
}
Also used : CustomComponentAction(org.eclipse.che.ide.api.action.CustomComponentAction) Action(org.eclipse.che.ide.api.action.Action) ArrayList(java.util.ArrayList)

Aggregations

Action (org.eclipse.che.ide.api.action.Action)32 ActionEvent (org.eclipse.che.ide.api.action.ActionEvent)10 ActionGroup (org.eclipse.che.ide.api.action.ActionGroup)10 DefaultActionGroup (org.eclipse.che.ide.api.action.DefaultActionGroup)10 Presentation (org.eclipse.che.ide.api.action.Presentation)10 Separator (org.eclipse.che.ide.api.action.Separator)5 ToggleAction (org.eclipse.che.ide.api.action.ToggleAction)5 ArrayList (java.util.ArrayList)4 CustomComponentAction (org.eclipse.che.ide.api.action.CustomComponentAction)4 CreateProjectAction (org.eclipse.che.ide.actions.CreateProjectAction)2 ImportProjectAction (org.eclipse.che.ide.actions.ImportProjectAction)2 PromisableAction (org.eclipse.che.ide.api.action.PromisableAction)2 SplitHorizontallyAction (org.eclipse.che.ide.part.editor.actions.SplitHorizontallyAction)2 SplitVerticallyAction (org.eclipse.che.ide.part.editor.actions.SplitVerticallyAction)2 Test (org.junit.Test)2 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1 DivElement (com.google.gwt.dom.client.DivElement)1 Element (com.google.gwt.dom.client.Element)1 RegExp (com.google.gwt.regexp.shared.RegExp)1