From 30bd1111e0aa1b1b8d6e6cffb1f15f51be4a242f Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Thu, 12 Mar 2020 15:50:07 +0200 Subject: [PATCH] Fix error in assigment of component name for new components gitlab #74 Change-Id: Ie7b4b9b7459763031176039de9b448f54f9f490f --- .../org/simantics/plant3d/utils/ComponentUtils.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java b/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java index a1ac7f82..31bdda9e 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java @@ -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()) -- 2.47.1