]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/query/FlagTextQuery.java
Changed external reference flag texts to obey current name/label mode
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / query / FlagTextQuery.java
index 0c097c53d49ab75f4f01b40b0ff150317f56d013..3db1089090e2f9a4d57e17e6416d9cb9c002c7fb 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2017 Association for Decentralized Information Management
  * in Industry THTH ry.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -8,15 +8,16 @@
  *
  * Contributors:
  *     VTT Technical Research Centre of Finland - initial API and implementation
+ *     Semantum Oy - #7178 Use NameLabelUtil
  *******************************************************************************/
 package org.simantics.diagram.query;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.simantics.NameLabelUtil;
 import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;
-import org.simantics.db.Statement;
 import org.simantics.db.common.request.ResourceRead;
 import org.simantics.db.common.utils.NameUtils;
 import org.simantics.db.exception.DatabaseException;
@@ -125,16 +126,7 @@ public class FlagTextQuery extends ResourceRead<String[]> {
     }
 
     public static String getSafeLabel(ReadGraph graph, Resource r) throws DatabaseException {
-        Layer0 l0 = Layer0.getInstance(graph);
-        Statement stm = graph.getPossibleStatement(r, l0.HasLabel);
-        if (stm != null) {
-            String label = NameUtils.getSafeLabel(graph, r);
-            if (!label.isEmpty())
-                return label;
-            //if (!stm.isAsserted(r))
-            //    return label;
-        }
-        return NameUtils.getSafeName(graph, r);
+        return NameLabelUtil.modalName(graph, r);
     }
 
 }