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