1 package org.simantics.plant3d.actions;
3 import org.eclipse.jface.action.Action;
4 import org.simantics.plant3d.scenegraph.Equipment;
5 import org.simantics.plant3d.scenegraph.P3DRootNode;
6 import org.simantics.plant3d.utils.ComponentUtils;
7 import org.simantics.plant3d.utils.Item;
8 import org.simantics.utils.ui.ExceptionUtils;
11 * Action that creates given Equipment.
16 public class AddEquipmentAction2 extends Action {
20 private Item nozzleItem;
22 public AddEquipmentAction2(P3DRootNode root, Item item) {
23 this(root, item, null);
26 public AddEquipmentAction2(P3DRootNode root, Item item, Item nozzleItem) {
29 this.nozzleItem = nozzleItem;
30 setText("Add " + item.getName());
36 Equipment equipment = null;
37 if (nozzleItem == null)
38 equipment = ComponentUtils.createEquipment(root, item);
40 equipment = ComponentUtils.createEquipmentWithNozzles(root, item, nozzleItem);
41 root.getNodeMap().commit("Add equipment " + equipment.getName());
42 } catch (Exception e) {
43 ExceptionUtils.logAndShowError("Cannot create equipment",e);