3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.molecular
.handler
;
15 import org
.eclipse
.core
.runtime
.FileLocator
;
16 import org
.eclipse
.core
.runtime
.Path
;
17 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
19 import eu
.etaxonomy
.taxeditor
.molecular
.TaxeditorMolecularPlugin
;
24 * Implements shared functionality for handler implementations using tool bar icons.
29 public class HandlerTools
{ //TODO Move this class or method somewhere else?
30 public static ImageDescriptor
createImageDescriptor(String iconName
) {
31 URL url
= FileLocator
.find(TaxeditorMolecularPlugin
.getDefault().getBundle(),
32 new Path("icons/" + iconName
), null);
34 return ImageDescriptor
.createFromURL(url
);
37 throw new InternalError("Icon \"" + iconName
+ "\" could not be loaded."); //TODO Throw other type of exception?