Search in sources :

Example 1 with CommandProducer

use of org.eclipse.che.ide.api.command.CommandProducer 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);
            }
        }
    }
}
Also used : CommandProducer(org.eclipse.che.ide.api.command.CommandProducer) Action(org.eclipse.che.ide.api.action.Action) DefaultActionGroup(org.eclipse.che.ide.api.action.DefaultActionGroup)

Aggregations

Action (org.eclipse.che.ide.api.action.Action)1 DefaultActionGroup (org.eclipse.che.ide.api.action.DefaultActionGroup)1 CommandProducer (org.eclipse.che.ide.api.command.CommandProducer)1