]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge "Support opening multiple selected objects from same diagram"
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 12 Jun 2019 11:37:25 +0000 (11:37 +0000)
committerGerrit Code Review <gerrit2@simantics>
Wed, 12 Jun 2019 11:37:25 +0000 (11:37 +0000)
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();