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