]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.selectionview/src/org/simantics/selectionview/CategoryNodeLabelRule.java
Revert "Default property editing restores assertions"
[simantics/platform.git] / bundles / org.simantics.selectionview / src / org / simantics / selectionview / CategoryNodeLabelRule.java
1 package org.simantics.selectionview;
2
3 import java.util.Map;
4
5 import org.simantics.browsing.ui.common.ColumnKeys;
6 import org.simantics.browsing.ui.model.labels.LabelRule;
7 import org.simantics.db.ReadGraph;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.utils.datastructures.ArrayMap;
10
11 public class CategoryNodeLabelRule implements LabelRule {
12
13         private static final String[] COLS = new String[] { ColumnKeys.DISPLAY_PROPERTY };
14         
15     @Override
16     public boolean isCompatible(Class<?> contentType) {
17         return contentType.equals(CategoryNode.class);
18     }
19
20     @Override
21     public Map<String, String> getLabel(ReadGraph graph, Object content)
22             throws DatabaseException {
23         
24                 String[] result = new String[] { ((CategoryNode)content).getName() };
25                 return new ArrayMap<String, String>(COLS, result);
26                 
27     }
28
29 }