From: Tuukka Lehtonen Date: Wed, 12 Jun 2019 11:37:25 +0000 (+0000) Subject: Merge "Support opening multiple selected objects from same diagram" X-Git-Tag: v1.43.0~136^2~148 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=78e89544a2077001fe3d1486f38a141cda7e10a8;hp=8870162012c3a7346b4a3cf3980348ecef9cc9eb Merge "Support opening multiple selected objects from same diagram" --- diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/services/ComponentNamingUtil.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/services/ComponentNamingUtil.java index 387b3a41a..1ac81874e 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/services/ComponentNamingUtil.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/services/ComponentNamingUtil.java @@ -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();