]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Add component did not work properly for nozzles. 99/3099/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Tue, 13 Aug 2019 15:49:37 +0000 (18:49 +0300)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Tue, 13 Aug 2019 15:49:37 +0000 (18:49 +0300)
gitlab #25

Change-Id: Ib176f957a256a396d59d096d8d8246fe334d9756

org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java

index 18087b68ce17387fe4394ce7010a0f439847ed68..60f95215250409cfb382c42474e1926f857fd417 100644 (file)
@@ -17,6 +17,7 @@ import org.simantics.plant3d.Activator;
 import org.simantics.plant3d.dialog.ComponentSelectionDialog;
 import org.simantics.plant3d.gizmo.TerminalSelectionGizmo;
 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;
@@ -58,14 +59,20 @@ public class AddComponentAction extends vtkSwtAction {
                this.component = component;
                
                allowed.clear();
-               if (component.getNext() == null) {
-                       allowed.add(PositionType.NEXT);
-               }
-               if (component.getPrevious() == null) {
-                       allowed.add(PositionType.PREVIOUS);
-               }
-               if (component instanceof InlineComponent && !component.getControlPoint().isFixed()){
-                       allowed.add(PositionType.SPLIT);
+               if (component instanceof Nozzle) {
+                   if (component.getNext() == null && component.getPrevious() == null) {
+                   allowed.add(PositionType.NEXT);
+               }  
+               } else {
+               if (component.getNext() == null) {
+                       allowed.add(PositionType.NEXT);
+               }
+               if (component.getPrevious() == null) {
+                       allowed.add(PositionType.PREVIOUS);
+               }
+               if (component instanceof InlineComponent && !component.getControlPoint().isFixed()){
+                       allowed.add(PositionType.SPLIT);
+               }
                }
                setEnabled(allowed.size() > 0);
        }