initial contribution
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / preferences / TeamImages.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpeclipse.wiki.preferences;
12
13 import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin;
14
15 import org.eclipse.core.runtime.IExtension;
16 import org.eclipse.jface.resource.ImageDescriptor;
17 import org.eclipse.ui.ISharedImages;
18
19 /**
20  * TeamImages provides convenience methods for accessing shared images
21  * provided by the <i>org.eclipse.team.ui</i> plug-in.
22  * <p>
23  * This class provides <code>ImageDescriptor</code>s for each named image in 
24  * {@link ISharedImages}.  All <code>Image</code> objects created from the 
25  * provided descriptors are managed the caller and must be disposed appropriately. 
26  * </p>
27  * @since 2.0
28  */
29 public class TeamImages {
30         /**
31          * Returns the image descriptor for the given image ID.
32          * Returns <code>null</code> if there is no such image.
33          * 
34          * @param id  the identifier for the image to retrieve
35          * @return the image descriptor associated with the given ID
36          */
37         public static ImageDescriptor getImageDescriptor(String id) {
38                 return WikiEditorPlugin.getImageDescriptor(id);
39         }       
40         /**
41          * Convenience method to get an image descriptor for an extension.
42          * 
43          * @param extension  the extension declaring the image
44          * @param subdirectoryAndFilename the path to the image
45          * @return the image descriptor for the extension
46          */
47         public static ImageDescriptor getImageDescriptorFromExtension(IExtension extension, String subdirectoryAndFilename) {
48                 return WikiEditorPlugin.getImageDescriptorFromExtension(extension, subdirectoryAndFilename);
49         }
50 }