Project

General

Profile

Download (7.28 KB) Statistics
| Branch: | Tag: | Revision:
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.gef.internal;
12

    
13
import org.eclipse.swt.graphics.Image;
14

    
15
import org.eclipse.jface.resource.ImageDescriptor;
16
import org.eclipse.ui.ISharedImages;
17
import org.eclipse.ui.PlatformUI;
18

    
19
public class InternalImages {
20

    
21
	public static final ImageDescriptor DESC_ZOOM_IN;
22
	public static final ImageDescriptor DESC_ZOOM_OUT;
23

    
24
	public static final ImageDescriptor DESC_MATCH_SIZE;
25
	public static final ImageDescriptor DESC_MATCH_WIDTH;
26
	public static final ImageDescriptor DESC_MATCH_HEIGHT;
27

    
28
	public static final ImageDescriptor DESC_MATCH_SIZE_DIS;
29
	public static final ImageDescriptor DESC_MATCH_WIDTH_DIS;
30
	public static final ImageDescriptor DESC_MATCH_HEIGHT_DIS;
31

    
32
	public static final ImageDescriptor DESC_HORZ_ALIGN_CENTER;
33
	public static final ImageDescriptor DESC_HORZ_ALIGN_LEFT;
34
	public static final ImageDescriptor DESC_HORZ_ALIGN_RIGHT;
35

    
36
	public static final ImageDescriptor DESC_VERT_ALIGN_MIDDLE;
37
	public static final ImageDescriptor DESC_VERT_ALIGN_TOP;
38
	public static final ImageDescriptor DESC_VERT_ALIGN_BOTTOM;
39

    
40
	public static final ImageDescriptor DESC_HORZ_ALIGN_CENTER_DIS;
41
	public static final ImageDescriptor DESC_HORZ_ALIGN_LEFT_DIS;
42
	public static final ImageDescriptor DESC_HORZ_ALIGN_RIGHT_DIS;
43

    
44
	public static final ImageDescriptor DESC_VERT_ALIGN_MIDDLE_DIS;
45
	public static final ImageDescriptor DESC_VERT_ALIGN_TOP_DIS;
46
	public static final ImageDescriptor DESC_VERT_ALIGN_BOTTOM_DIS;
47

    
48
	public static final ImageDescriptor ICON_MATCH_WIDTH;
49
	public static final ImageDescriptor ICON_MATCH_HEIGHT;
50

    
51
	public static final ImageDescriptor DESC_SEPARATOR;
52
	public static final ImageDescriptor DESC_FOLDER_OPEN;
53
	public static final ImageDescriptor DESC_FOLDER_CLOSED;
54

    
55
	public static final ImageDescriptor DESC_BOLD;
56
	public static final ImageDescriptor DESC_ITALIC;
57
	public static final ImageDescriptor DESC_UNDERLINE;
58

    
59
	public static final ImageDescriptor DESC_BLOCK_LTR;
60
	public static final ImageDescriptor DESC_BLOCK_RTL;
61

    
62
	public static final ImageDescriptor DESC_BLOCK_ALIGN_LEFT;
63
	public static final ImageDescriptor DESC_BLOCK_ALIGN_CENTER;
64
	public static final ImageDescriptor DESC_BLOCK_ALIGN_RIGHT;
65

    
66
	public static final ImageDescriptor DESC_PINNED;
67
	public static final ImageDescriptor DESC_UNPINNED;
68

    
69
	public static final ImageDescriptor DESC_PALETTE;
70

    
71
	/**
72
	 * Can be used to access the cached pinned image by using
73
	 * {@link #get(String)}.
74
	 */
75
	public static final String IMG_PINNED = "icons/pinned.gif";//$NON-NLS-1$
76

    
77
	/**
78
	 * Can be used to access the cached pinned image by using
79
	 * {@link #get(String)}.
80
	 */
81
	public static final String IMG_UNPINNED = "icons/unpinned.gif";//$NON-NLS-1$
82

    
83
	/**
84
	 * Can be used to access the cached pinned image by using
85
	 * {@link #get(String)}.
86
	 */
87
	public static final String IMG_PALETTE = "icons/palette_view.gif";//$NON-NLS-1$
88

    
89
	static {
90
		DESC_BOLD = createDescriptor("icons/style_bold.gif"); //$NON-NLS-1$
91
		DESC_ITALIC = createDescriptor("icons/style_italic.gif"); //$NON-NLS-1$
92
		DESC_UNDERLINE = createDescriptor("icons/style_underline.gif"); //$NON-NLS-1$
93

    
94
		DESC_BLOCK_LTR = createDescriptor("icons/style_paragraph_ltr.gif"); //$NON-NLS-1$
95
		DESC_BLOCK_RTL = createDescriptor("icons/style_paragraph_rtl.gif"); //$NON-NLS-1$
96

    
97
		DESC_BLOCK_ALIGN_LEFT = createDescriptor("icons/style_paragraph_left.gif"); //$NON-NLS-1$
98
		DESC_BLOCK_ALIGN_CENTER = createDescriptor("icons/style_paragraph_center.gif"); //$NON-NLS-1$
99
		DESC_BLOCK_ALIGN_RIGHT = createDescriptor("icons/style_paragraph_right.gif"); //$NON-NLS-1$
100

    
101
		DESC_ZOOM_IN = createDescriptor("icons/zoom_in.gif"); //$NON-NLS-1$
102
		DESC_ZOOM_OUT = createDescriptor("icons/zoom_out.gif"); //$NON-NLS-1$
103

    
104
		DESC_MATCH_SIZE = createDescriptor("icons/matchsize.gif"); //$NON-NLS-1$
105
		DESC_MATCH_WIDTH = createDescriptor("icons/matchwidth.gif"); //$NON-NLS-1$
106
		DESC_MATCH_HEIGHT = createDescriptor("icons/matchheight.gif"); //$NON-NLS-1$
107

    
108
		DESC_MATCH_SIZE_DIS = createDescriptor("icons/matchsize_d.gif"); //$NON-NLS-1$
109
		DESC_MATCH_WIDTH_DIS = createDescriptor("icons/matchwidth_d.gif"); //$NON-NLS-1$
110
		DESC_MATCH_HEIGHT_DIS = createDescriptor("icons/matchheight_d.gif"); //$NON-NLS-1$
111

    
112
		DESC_VERT_ALIGN_BOTTOM = createDescriptor("icons/alignbottom.gif"); //$NON-NLS-1$
113
		DESC_HORZ_ALIGN_CENTER = createDescriptor("icons/aligncenter.gif"); //$NON-NLS-1$
114
		DESC_HORZ_ALIGN_LEFT = createDescriptor("icons/alignleft.gif"); //$NON-NLS-1$
115
		DESC_VERT_ALIGN_MIDDLE = createDescriptor("icons/alignmid.gif"); //$NON-NLS-1$
116
		DESC_HORZ_ALIGN_RIGHT = createDescriptor("icons/alignright.gif"); //$NON-NLS-1$
117
		DESC_VERT_ALIGN_TOP = createDescriptor("icons/aligntop.gif"); //$NON-NLS-1$
118

    
119
		DESC_VERT_ALIGN_BOTTOM_DIS = createDescriptor("icons/alignbottom_d.gif"); //$NON-NLS-1$
120
		DESC_HORZ_ALIGN_CENTER_DIS = createDescriptor("icons/aligncenter_d.gif"); //$NON-NLS-1$
121
		DESC_HORZ_ALIGN_LEFT_DIS = createDescriptor("icons/alignleft_d.gif"); //$NON-NLS-1$
122
		DESC_VERT_ALIGN_MIDDLE_DIS = createDescriptor("icons/alignmid_d.gif"); //$NON-NLS-1$
123
		DESC_HORZ_ALIGN_RIGHT_DIS = createDescriptor("icons/alignright_d.gif"); //$NON-NLS-1$
124
		DESC_VERT_ALIGN_TOP_DIS = createDescriptor("icons/aligntop_d.gif"); //$NON-NLS-1$
125

    
126
		DESC_SEPARATOR = createDescriptor("icons/separator.gif"); //$NON-NLS-1$
127
		DESC_FOLDER_OPEN = PlatformUI.getWorkbench().getSharedImages()
128
				.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
129
		DESC_FOLDER_CLOSED = createDescriptor("icons/folder_closed.gif"); //$NON-NLS-1$
130

    
131
		ICON_MATCH_WIDTH = createDescriptor("icons/sizehz.gif"); //$NON-NLS-1$
132
		ICON_MATCH_HEIGHT = createDescriptor("icons/sizevt.gif"); //$NON-NLS-1$
133

    
134
		DESC_PINNED = createAndCache(IMG_PINNED);
135
		DESC_UNPINNED = createAndCache(IMG_UNPINNED);
136

    
137
		DESC_PALETTE = createAndCache(IMG_PALETTE);
138

    
139
	}
140

    
141
	private static ImageDescriptor createDescriptor(String filename) {
142
		return ImageDescriptor.createFromFile(InternalImages.class, filename);
143
	}
144

    
145
	/**
146
	 * Creates the image descriptor from the filename given and caches it in the
147
	 * plugin's image registry.
148
	 * 
149
	 * @param imageName
150
	 *            the full filename of the image
151
	 * @return the new image descriptor
152
	 */
153
	private static ImageDescriptor createAndCache(String imageName) {
154
		ImageDescriptor result = createDescriptor(imageName);
155
		InternalGEFPlugin.getDefault().getImageRegistry()
156
				.put(imageName, result);
157
		return result;
158
	}
159

    
160
	/**
161
	 * Gets an image from the image registry. This image should not be disposed
162
	 * of, that is handled in the image registry. The image descriptor must have
163
	 * previously been cached in the image registry. The cached images for the
164
	 * public image names defined in this file can be retrieved using this
165
	 * method.
166
	 * 
167
	 * @param imageName
168
	 *            the full filename of the image
169
	 * @return the image or null if it has not been cached in the registry
170
	 */
171
	public static Image get(String imageName) {
172
		return InternalGEFPlugin.getDefault().getImageRegistry().get(imageName);
173
	}
174

    
175
}
(4-4/7)