From: Marko Luukkainen Date: Mon, 11 Nov 2019 17:19:05 +0000 (+0200) Subject: PipeRun reverse action X-Git-Tag: v1.43.0~131 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=e75c2f6a2f0bdef0e8077879664715d99cede843;p=simantics%2F3d.git PipeRun reverse action gitlab #51 Change-Id: Ifcfbfec7f5ca964c50e23a303dc55c767b7ce877 --- diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/actions/ReversePipeRunAction.java b/org.simantics.plant3d/src/org/simantics/plant3d/actions/ReversePipeRunAction.java new file mode 100644 index 00000000..f1c08d65 --- /dev/null +++ b/org.simantics.plant3d/src/org/simantics/plant3d/actions/ReversePipeRunAction.java @@ -0,0 +1,37 @@ +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 nodeMap; + PipeRun run; + + public ReversePipeRunAction(VTKNodeMap 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()); + } + +} diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/editor/P3DContentOutlinePage.java b/org.simantics.plant3d/src/org/simantics/plant3d/editor/P3DContentOutlinePage.java index a4e8bafd..f853a02f 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/editor/P3DContentOutlinePage.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/editor/P3DContentOutlinePage.java @@ -19,6 +19,7 @@ import org.simantics.g3d.scenegraph.base.ParentNode; 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; @@ -117,6 +118,18 @@ public class P3DContentOutlinePage extends VTKContentOutlinePage