Text shown in external reference type diagram flags now obeys the
currently selected Name/Label model that can be controlled using code in
class org.simantics.NameLabelUtil.
Previously the text shown in normal diagram external reference flags was
always preferring to show the Label property of diagrams and related
modules and if labels were not defined, the Name property would be used
instead.
refs #7178
Change-Id: I85efb6e68f92fdb18d1445037da5285700ca5398
(cherry picked from commit
8b94180c57f10788d52eb15b8ef3d73b4461de93)
/*******************************************************************************
/*******************************************************************************
- * 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
* 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
*
* Contributors:
* VTT Technical Research Centre of Finland - initial API and implementation
*
* 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;
*******************************************************************************/
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.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;
import org.simantics.db.common.request.ResourceRead;
import org.simantics.db.common.utils.NameUtils;
import org.simantics.db.exception.DatabaseException;
}
public static String getSafeLabel(ReadGraph graph, Resource r) throws DatabaseException {
}
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);