X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.common%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fcommon%2Futils%2FVersions.java;h=58894674506013b2b9835dd4450b9a63e7001737;hb=159d04234f7fbf7554910a154b29a5dd7bbc6068;hp=d022a251e7b2a7df25b986fd4cc27fd482fe918a;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/Versions.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/Versions.java index d022a251e..588946745 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/Versions.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/Versions.java @@ -114,15 +114,16 @@ public class Versions { String name = graph.getPossibleRelatedValue(r, L0.HasName, Bindings.STRING); if(name != null) { VersionInfo versions = graph.syncRequest(new VersionInfoRequest(r)); - if(versions.versions.size() != 1) { - int pos = name.lastIndexOf('@'); - if(pos == -1) return name + " [No version]"; - String base = name.substring(0, pos); - String version = name.substring(pos+1); + int nVersions = versions.versions.size(); + // No version display, if "A", "1" or "" is the only version present + if ("".equals(versions.version)) + return nVersions == 1 ? name : name + " [No version]"; + String base = versions.baseName; + String version = versions.version; + if (("A".equals(version) || "1".equals(version)) && nVersions == 1) + return base; + else return base + " [Version " + version + "]"; - } else { - return versions.baseName; - } } // Fallback logic return NameUtils.getSafeName(graph, r);