X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram.profile%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fprofile%2Fview%2FResourcePairImageRule.java;h=daf038a3972940a53b06637844ef0aa67b83fcdf;hb=08dc7080753f3ea35985e76e9effb9d3ff92c3b5;hp=99e0b76e61455f8ee70ed9acd9a6b51c97d6ad5c;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ResourcePairImageRule.java b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ResourcePairImageRule.java index 99e0b76e6..daf038a39 100644 --- a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ResourcePairImageRule.java +++ b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ResourcePairImageRule.java @@ -1,39 +1,39 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.diagram.profile.view; - -import java.util.Collections; -import java.util.Map; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.simantics.browsing.ui.common.ColumnKeys; -import org.simantics.browsing.ui.model.images.ImageRule; -import org.simantics.db.ReadGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.ui.icons.ImageDescriptorProvider; - -public class ResourcePairImageRule implements ImageRule { - - @Override - public boolean isCompatible(Class contentType) { - return contentType.equals(ResourcePair.class); - } - - @Override - public Map getImage(ReadGraph graph, Object content) throws DatabaseException { - - ImageDescriptorProvider provider = graph.getPossibleAdapter(((ResourcePair)content).getSecond(), ImageDescriptorProvider.class); - return provider != null ? Collections.singletonMap(ColumnKeys.SINGLE, provider.get()) : null; - - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.profile.view; + +import java.util.Collections; +import java.util.Map; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.simantics.browsing.ui.common.ColumnKeys; +import org.simantics.browsing.ui.model.images.ImageRule; +import org.simantics.db.ReadGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.ui.icons.ImageDescriptorProvider; + +public class ResourcePairImageRule implements ImageRule { + + @Override + public boolean isCompatible(Class contentType) { + return contentType.equals(ProfileTuple.class); + } + + @Override + public Map getImage(ReadGraph graph, Object content) throws DatabaseException { + + ImageDescriptorProvider provider = graph.getPossibleAdapter(((ProfileTuple)content).getEntry(), ImageDescriptorProvider.class); + return provider != null ? Collections.singletonMap(ColumnKeys.SINGLE, provider.get()) : null; + + } + +}