X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.ui%2Fsrc%2Forg%2Fsimantics%2Fui%2Ficons%2FImageUtil.java;h=fca0851d3a2a5d8f4282db511b98d46d21bf2614;hb=refs%2Fchanges%2F38%2F238%2F2;hp=922e20f94c0c179dc26a6654c6b87db26e5948ba;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/icons/ImageUtil.java b/bundles/org.simantics.ui/src/org/simantics/ui/icons/ImageUtil.java index 922e20f94..fca0851d3 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/icons/ImageUtil.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/icons/ImageUtil.java @@ -1,43 +1,43 @@ -/******************************************************************************* - * 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.ui.icons; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.exception.AdaptionException; -import org.simantics.db.exception.DatabaseException; -import org.simantics.utils.datastructures.cache.ProvisionException; - -/** - * @author Tuukka Lehtonen - */ -public final class ImageUtil { - - /** - * @param graph - * @param resource - * @return - * @throws DatabaseException - * @throws ProvisionException if adapted ImageDescriptorProvider fails to - * provide the actual descriptor for some reason - */ - public static ImageDescriptor adaptImageDescriptor(ReadGraph graph, Resource resource) throws DatabaseException { - try { - ImageDescriptorProvider provider = graph.adapt(resource, ImageDescriptorProvider.class); - return provider.get(); - } catch (AdaptionException e) { - return 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.ui.icons; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.exception.AdaptionException; +import org.simantics.db.exception.DatabaseException; +import org.simantics.utils.datastructures.cache.ProvisionException; + +/** + * @author Tuukka Lehtonen + */ +public final class ImageUtil { + + /** + * @param graph + * @param resource + * @return + * @throws DatabaseException + * @throws ProvisionException if adapted ImageDescriptorProvider fails to + * provide the actual descriptor for some reason + */ + public static ImageDescriptor adaptImageDescriptor(ReadGraph graph, Resource resource) throws DatabaseException { + try { + ImageDescriptorProvider provider = graph.adapt(resource, ImageDescriptorProvider.class); + return provider.get(); + } catch (AdaptionException e) { + return null; + } + } + +}