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());
}
}
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);
}
}
}
}
}
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;
}
}
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();
}
}
}
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);
}
Aggregations