]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Fix error in assigment of component name for new components 91/3991/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Thu, 12 Mar 2020 13:50:07 +0000 (15:50 +0200)
committerReino Ruusu <reino.ruusu@semantum.fi>
Thu, 12 Mar 2020 13:50:07 +0000 (15:50 +0200)
gitlab #74

Change-Id: Ie7b4b9b7459763031176039de9b448f54f9f490f

org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java

index a1ac7f82834a5a36551e93bebd42b7aa8e9fa45c..31bdda9e370887c34e3c80959d8a56f275e6697f 100644 (file)
@@ -378,9 +378,6 @@ public class ComponentUtils {
        public static PipelineComponent addComponent(P3DRootNode root, PipelineComponent component,  InsertInstruction inst) throws Exception {
                
                PipelineComponent newComponent = ComponentUtils.createComponent(root, inst.typeUri);
-               if (inst.name != null)
-                       newComponent.setName(inst.name);
-               
                PipeControlPoint newPcp = newComponent.getControlPoint();
                
                PipeControlPoint toPcp = component.getControlPoint();
@@ -471,8 +468,12 @@ public class ComponentUtils {
                        }
                }
                
-               String name = component.getPipeRun().getUniqueName(typeName);
-               newComponent.setName(name);
+               if (inst.name != null) {
+                       newComponent.setName(inst.name);
+               } else {
+                       String name = component.getPipeRun().getUniqueName(typeName);
+                       newComponent.setName(name);
+               }
 
                pipeRun.addChild(newComponent);
                if (newPcp.isSizeChange())