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