use of org.eclipse.che.ide.api.action.Action in project che by eclipse.
the class CommandProducerActionManager method createActionsForMachine.
/**
* Creates actions for that {@link CommandProducer}s
* which are applicable for the given machine's type.
*/
private void createActionsForMachine(Machine machine) {
for (CommandProducer commandProducer : commandProducers) {
if (commandProducer.getMachineTypes().contains(machine.getConfig().getType())) {
CommandProducerAction machineAction = commandProducerActionFactory.create(machine.getConfig().getName(), commandProducer, machine);
List<Action> actionList = actionsByMachines.get(machine);
if (actionList == null) {
actionList = new ArrayList<>();
actionsByMachines.put(machine, actionList);
}
actionList.add(machineAction);
actionManager.registerAction(machine.getConfig().getName(), machineAction);
DefaultActionGroup actionGroup = producersToActionGroups.get(commandProducer);
if (actionGroup != null) {
actionGroup.add(machineAction);
actionsToActionGroups.put(machineAction, actionGroup);
}
}
}
}
use of org.eclipse.che.ide.api.action.Action in project che by eclipse.
the class CommandProducerActionManager method createActionsForProducer.
/** Creates actions for the given {@link CommandProducer}. */
private void createActionsForProducer(CommandProducer producer) {
Action action;
if (producer.getMachineTypes().isEmpty()) {
action = commandProducerActionFactory.create(producer.getName(), producer, appContext.getDevMachine().getDescriptor());
actionManager.registerAction(producer.getName(), action);
} else {
action = new DefaultActionGroup(producer.getName(), true, actionManager);
producersToActionGroups.put(producer, (DefaultActionGroup) action);
actionManager.registerAction(producer.getName(), action);
for (Machine machine : machines) {
createActionsForMachine(machine);
}
}
commandActionsPopUpGroup.add(action);
}
use of org.eclipse.che.ide.api.action.Action in project che by eclipse.
the class EditorPartStackPresenter method initializePaneMenu.
private void initializePaneMenu() {
paneMenuTabItemHandler = new PaneMenuTabItemHandler();
paneMenuActionItemHandler = new PaneMenuActionItemHandler();
final EditorPaneMenuItem<Action> closePaneItemWidget = editorPaneMenuItemFactory.createMenuItem(closePaneAction);
closePaneItemWidget.setDelegate(paneMenuActionItemHandler);
editorPaneMenu.addItem(closePaneItemWidget);
final EditorPaneMenuItem<Action> closeAllTabsItemWidget = editorPaneMenuItemFactory.createMenuItem(closeAllTabsPaneAction);
closeAllTabsItemWidget.setDelegate(paneMenuActionItemHandler);
editorPaneMenu.addItem(closeAllTabsItemWidget, true);
final Action splitHorizontallyAction = actionManager.getAction(SPLIT_HORIZONTALLY);
final EditorPaneMenuItem<Action> splitHorizontallyItemWidget = editorPaneMenuItemFactory.createMenuItem(splitHorizontallyAction);
splitHorizontallyItemWidget.setDelegate(paneMenuActionItemHandler);
editorPaneMenu.addItem(splitHorizontallyItemWidget);
final Action splitVerticallyAction = actionManager.getAction(SPLIT_VERTICALLY);
final EditorPaneMenuItem<Action> splitVerticallyItemWidget = editorPaneMenuItemFactory.createMenuItem(splitVerticallyAction);
splitVerticallyItemWidget.setDelegate(paneMenuActionItemHandler);
editorPaneMenu.addItem(splitVerticallyItemWidget);
}
use of org.eclipse.che.ide.api.action.Action 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.Action in project che by eclipse.
the class EmptyEditorsPanel method render.
private void render(String title, Map<String, Action> actions) {
this.title.setInnerText(title);
container.removeAllChildren();
Element listElement = Elements.createElement("ul", new String[] { style.list() });
for (Map.Entry<String, Action> pair : actions.entrySet()) {
LIElement liElement = Elements.createLiElement();
liElement.appendChild(renderAction(pair.getKey(), pair.getValue()));
listElement.appendChild(liElement);
}
container.appendChild((com.google.gwt.dom.client.Node) listElement);
}
Aggregations