1 package org.simantics.diagram.profile.view;
\r
3 import java.util.Collections;
\r
4 import java.util.Map;
\r
6 import org.simantics.browsing.ui.common.ColumnKeys;
\r
7 import org.simantics.browsing.ui.model.labels.LabelRule;
\r
8 import org.simantics.db.ReadGraph;
\r
9 import org.simantics.db.common.utils.NameUtils;
\r
10 import org.simantics.db.exception.DatabaseException;
\r
12 public class ResourcePairLabelRule implements LabelRule {
\r
14 public static final ResourcePairLabelRule INSTANCE = new ResourcePairLabelRule();
\r
16 public ResourcePairLabelRule() {
\r
20 public boolean isCompatible(Class<?> contentType) {
\r
21 return contentType.equals(ResourcePair.class);
\r
25 public Map<String,String> getLabel(ReadGraph graph, Object content) throws DatabaseException {
\r
26 return Collections.singletonMap(ColumnKeys.SINGLE,
\r
27 NameUtils.getSafeLabel(graph, ((ResourcePair)content).getSecond())
\r