/*******************************************************************************
- * 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
*
* 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;
}
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);
}
}