--- /dev/null
+package org.simantics.plant3d.actions;
+
+import org.eclipse.jface.action.Action;
+import org.simantics.g3d.scenegraph.base.INode;
+import org.simantics.g3d.vtk.common.VTKNodeMap;
+import org.simantics.plant3d.Activator;
+import org.simantics.plant3d.scenegraph.PipeRun;
+import org.simantics.plant3d.scenegraph.controlpoint.PipingRules;
+
+public class ReversePipeRunAction extends Action{
+
+ private VTKNodeMap<?, ? extends INode> nodeMap;
+ PipeRun run;
+
+ public ReversePipeRunAction(VTKNodeMap<?, ? extends INode> nodeMap) {
+ setText("Reverse");
+ setImageDescriptor(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_refresh.png"));
+ this.nodeMap = nodeMap;
+ }
+
+ public void setNode(INode node) {
+ if (node instanceof PipeRun) {
+ run = (PipeRun)node;
+ setEnabled(true);
+ } else {
+ setEnabled(false);
+ }
+
+ }
+
+ @Override
+ public void run() {
+ PipingRules.reverse(run);
+ nodeMap.commit("Reverse run " + run.getName());
+ }
+
+}
import org.simantics.g3d.vtk.common.NodeSelectionProvider2;
import org.simantics.g3d.vtk.common.VTKContentOutlinePage;
import org.simantics.plant3d.Activator;
+import org.simantics.plant3d.ontology.Plant3D;
import org.simantics.plant3d.scenegraph.EndComponent;
import org.simantics.plant3d.scenegraph.Equipment;
import org.simantics.plant3d.scenegraph.Nozzle;
}
+ @Override
+ public void propertyChanged(INode node, String id) {
+ // TODO Auto-generated method stub
+ if (node instanceof PipelineComponent) {
+ if (Plant3D.URIs.HasNext.equals(id) || Plant3D.URIs.HasPrevious.equals(id)) {
+ refershViewer(node.getParent());
+ return;
+ }
+ }
+ super.propertyChanged(node, id);
+ }
+
@Override
public void dispose() {
manager.dispose();
import org.simantics.plant3d.actions.AddEquipmentAction;
import org.simantics.plant3d.actions.AddNozzleAction;
import org.simantics.plant3d.actions.RemoveAndSplitAction;
+import org.simantics.plant3d.actions.ReversePipeRunAction;
import org.simantics.plant3d.actions.RoutePipeAction;
import org.simantics.plant3d.actions.TranslateFreeVariableLengthAction;
import org.simantics.plant3d.actions.TranslateInlineAction;
import org.simantics.plant3d.scenegraph.InlineComponent;
import org.simantics.plant3d.scenegraph.Nozzle;
import org.simantics.plant3d.scenegraph.P3DRootNode;
+import org.simantics.plant3d.scenegraph.PipeRun;
import org.simantics.plant3d.scenegraph.PipelineComponent;
import org.simantics.plant3d.scenegraph.SchemaBuilder;
import org.simantics.plant3d.scenegraph.TurnComponent;
protected RemoveAndSplitAction removeSplitAction;
protected RoutePipeAction routePipeAction;
protected AddComponentAction addComponentAction;
+ protected ReversePipeRunAction reversePipeRunAction;
private P3DNodeMap nodeMap;
removeSplitAction = new RemoveAndSplitAction(nodeMap);
routePipeAction = new RoutePipeAction(panel,rootNode);
addComponentAction = new AddComponentAction(panel, rootNode, getLibraryUri());
+ reversePipeRunAction = new ReversePipeRunAction(nodeMap);
}
public void populate() {
m.add(removeAction);
m.add(removeSplitAction);
removeSplitAction.setNode(node);
+ } else if (node instanceof PipeRun) {
+ m.add(reversePipeRunAction);
+ m.add(removeAction);
+ reversePipeRunAction.setNode(node);
} else {
m.add(removeAction);
}