]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Remove version identifier from the proposed name 41/2941/1
authorJussi Koskela <jussi.koskela@semantum.fi>
Tue, 11 Jun 2019 06:24:38 +0000 (09:24 +0300)
committerJussi Koskela <jussi.koskela@semantum.fi>
Tue, 11 Jun 2019 06:26:47 +0000 (09:26 +0300)
gitlab #301

Change-Id: I7d55a55d4102517011f871a5c8d2d9ed15da5a33

bundles/org.simantics.modeling/src/org/simantics/modeling/services/ComponentNamingUtil.java

index 387b3a41a98db39dc506107d9932871f33431dfb..1ac81874e12bd33fcbcc45f417c2a355fc1ad25d 100644 (file)
@@ -22,6 +22,7 @@ import org.simantics.db.Resource;
 import org.simantics.db.common.primitiverequest.PossibleRelatedValueImplied2;
 import org.simantics.db.common.procedure.adapter.TransientCacheListener;
 import org.simantics.db.common.utils.NameUtils;
+import org.simantics.db.common.utils.Versions;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.layer0.Layer0;
 import org.simantics.operation.Layer0X;
@@ -191,9 +192,11 @@ public final class ComponentNamingUtil {
         String componentPrefix = graph.getPossibleRelatedValue(componentType, L0X.HasGeneratedNamePrefix, Bindings.STRING);
         if (componentPrefix == null || "".equals(componentPrefix)) {
             Layer0 L0 = Layer0.getInstance(graph);
-            componentPrefix = graph.getPossibleRelatedValue(componentType, L0.HasName);
-            if (componentPrefix == null)
+            String name = graph.getPossibleRelatedValue(componentType, L0.HasName);
+            if (name == null)
                 componentPrefix = "Entity";
+            else
+                componentPrefix = Versions.getBaseName(name);
         }
         proposition.append(componentPrefix);
         return proposition.toString();