01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal;
11:
12: import org.eclipse.jface.resource.ImageDescriptor;
13: import org.eclipse.swt.graphics.Image;
14: import org.eclipse.ui.ISharedImages;
15:
16: /**
17: * Common images used by the workbench which may be useful to other plug-ins.
18: */
19: public class SharedImages implements ISharedImages {
20: /**
21: * Retrieves the specified image from the workbench plugin's image registry.
22: *
23: * @see ISharedImages
24: */
25: public Image getImage(String symbolicName) {
26: Image image = WorkbenchImages.getImage(symbolicName);
27: if (image != null) {
28: return image;
29: }
30:
31: //if there is a descriptor for it, add the image to the registry.
32: ImageDescriptor desc = WorkbenchImages
33: .getImageDescriptor(symbolicName);
34: if (desc != null) {
35: WorkbenchImages.getImageRegistry().put(symbolicName, desc);
36: return WorkbenchImages.getImageRegistry().get(symbolicName);
37: }
38: return null;
39: }
40:
41: /**
42: * Retrieves the specified image descriptor from the workbench plugin's image registry.
43: *
44: * @see ISharedImages
45: */
46: public ImageDescriptor getImageDescriptor(String symbolicName) {
47: return WorkbenchImages.getImageDescriptor(symbolicName);
48: }
49: }
|