From: Jussi Koskela Date: Tue, 11 Jun 2019 06:24:38 +0000 (+0300) Subject: Remove version identifier from the proposed name X-Git-Tag: v1.43.0~136^2~149 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F2941%2F1;p=simantics%2Fplatform.git Remove version identifier from the proposed name gitlab #301 Change-Id: I7d55a55d4102517011f871a5c8d2d9ed15da5a33 --- 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();