X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram.profile%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fprofile%2Fview%2FResourcePairLabelRule.java;h=3e07a9e01b988f716fbc0120070137d4a0e89605;hb=08dc7080753f3ea35985e76e9effb9d3ff92c3b5;hp=bc41f09e7cdbe819411a6635dd35efb3e671ef48;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ResourcePairLabelRule.java b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ResourcePairLabelRule.java index bc41f09e7..3e07a9e01 100644 --- a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ResourcePairLabelRule.java +++ b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ResourcePairLabelRule.java @@ -1,30 +1,30 @@ -package org.simantics.diagram.profile.view; - -import java.util.Collections; -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.common.utils.NameUtils; -import org.simantics.db.exception.DatabaseException; - -public class ResourcePairLabelRule implements LabelRule { - - public static final ResourcePairLabelRule INSTANCE = new ResourcePairLabelRule(); - - public ResourcePairLabelRule() { - } - - @Override - public boolean isCompatible(Class contentType) { - return contentType.equals(ResourcePair.class); - } - - @Override - public Map getLabel(ReadGraph graph, Object content) throws DatabaseException { - return Collections.singletonMap(ColumnKeys.SINGLE, - NameUtils.getSafeLabel(graph, ((ResourcePair)content).getSecond()) - ); - } -} +package org.simantics.diagram.profile.view; + +import java.util.Collections; +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.common.utils.NameUtils; +import org.simantics.db.exception.DatabaseException; + +public class ResourcePairLabelRule implements LabelRule { + + public static final ResourcePairLabelRule INSTANCE = new ResourcePairLabelRule(); + + public ResourcePairLabelRule() { + } + + @Override + public boolean isCompatible(Class contentType) { + return contentType.equals(ProfileTuple.class); + } + + @Override + public Map getLabel(ReadGraph graph, Object content) throws DatabaseException { + return Collections.singletonMap(ColumnKeys.SINGLE, + NameUtils.getSafeLabel(graph, ((ProfileTuple)content).getEntry()) + ); + } +}