X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.selectionview%2Fsrc%2Forg%2Fsimantics%2Fselectionview%2FCategoryNodeLabelRule.java;fp=bundles%2Forg.simantics.selectionview%2Fsrc%2Forg%2Fsimantics%2Fselectionview%2FCategoryNodeLabelRule.java;h=5654c01a51cb578bfa8a134f79c559560c22258c;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/CategoryNodeLabelRule.java b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/CategoryNodeLabelRule.java new file mode 100644 index 000000000..5654c01a5 --- /dev/null +++ b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/CategoryNodeLabelRule.java @@ -0,0 +1,29 @@ +package org.simantics.selectionview; + +import java.util.Map; + +import org.simantics.browsing.ui.common.ColumnKeys; +import org.simantics.browsing.ui.model.labels.LabelRule; +import org.simantics.db.ReadGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.utils.datastructures.ArrayMap; + +public class CategoryNodeLabelRule implements LabelRule { + + private static final String[] COLS = new String[] { ColumnKeys.DISPLAY_PROPERTY }; + + @Override + public boolean isCompatible(Class contentType) { + return contentType.equals(CategoryNode.class); + } + + @Override + public Map getLabel(ReadGraph graph, Object content) + throws DatabaseException { + + String[] result = new String[] { ((CategoryNode)content).getName() }; + return new ArrayMap(COLS, result); + + } + +}