20
20
import org .eclipse .core .runtime .Assert ;
21
21
import org .eclipse .jface .resource .ImageDescriptor ;
22
22
import org .eclipse .jface .resource .ImageRegistry ;
23
+ import org .eclipse .swt .SWT ;
23
24
import org .eclipse .swt .graphics .Image ;
24
25
import org .eclipse .ui .ISharedImages ;
25
26
import org .eclipse .ui .PlatformUI ;
71
72
72
73
private static final String PATH_ETOOL = ICONS_PATH + "etool16/" ; // Enabled toolbar icons.//$NON-NLS-1$
73
74
74
- private static final String PATH_DTOOL = ICONS_PATH + "dtool16/" ; // Disabled toolbar icons.//$NON-NLS-1$
75
-
76
75
private static final String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/" ; // Enabled local toolbar icons.//$NON-NLS-1$
77
76
78
- private static final String PATH_DLOCALTOOL = ICONS_PATH + "dlcl16/" ; // Disabled local toolbar icons.//$NON-NLS-1$
79
-
80
77
private static final String PATH_EVIEW = ICONS_PATH + "eview16/" ; // View icons//$NON-NLS-1$
81
78
82
79
private static final String PATH_OVERLAY = ICONS_PATH + "ovr16/" ; //$NON-NLS-1$
101
98
* <code>false</code> if this is not a shared image
102
99
*/
103
100
private static final void declareImage (String key , String path , boolean shared ) {
104
- ImageDescriptor desc = ImageDescriptor
105
- .createFromURLSupplier (true , () -> BundleUtility .find (PlatformUI .PLUGIN_ID , path ));
101
+ declareImage (key , null , path , shared );
102
+ }
103
+
104
+ private static final void declareImage (String key , String disabledKey , String path , boolean shared ) {
105
+ ImageDescriptor desc = ImageDescriptor .createFromURLSupplier (true ,
106
+ () -> BundleUtility .find (PlatformUI .PLUGIN_ID , path ));
106
107
declareImage (key , desc , shared );
108
+ if (disabledKey != null ) {
109
+ ImageDescriptor disabledImageDescriptor = ImageDescriptor .createWithFlags (desc , SWT .IMAGE_DISABLE );
110
+ declareImage (disabledKey , disabledImageDescriptor , shared );
111
+ }
107
112
}
108
113
109
114
/**
@@ -117,91 +122,89 @@ private static final void declareImages() {
117
122
declareImage (ISharedImages .IMG_DEC_FIELD_WARNING , PATH_OVERLAY + "warning_ovr.png" , true ); //$NON-NLS-1$
118
123
119
124
// Pinning
120
- declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_PIN_EDITOR , PATH_ETOOL + "pin_editor.png" , false ); //$NON-NLS-1$
121
- declareImage ( IWorkbenchGraphicConstants .IMG_ETOOL_PIN_EDITOR_DISABLED , PATH_DTOOL + "pin_editor.png" , false ); //$NON-NLS-1$
125
+ declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_PIN_EDITOR ,
126
+ IWorkbenchGraphicConstants .IMG_ETOOL_PIN_EDITOR_DISABLED , PATH_ETOOL + "pin_editor.png" , false ); //$NON-NLS-1$
122
127
123
128
// other toolbar buttons
129
+ declareImage (ISharedImages .IMG_ETOOL_SAVE_EDIT , ISharedImages .IMG_ETOOL_SAVE_EDIT_DISABLED ,
130
+ PATH_ETOOL + "save_edit.png" , true ); //$NON-NLS-1$
124
131
125
- declareImage (ISharedImages .IMG_ETOOL_SAVE_EDIT , PATH_ETOOL + "save_edit.png" , true ); //$NON-NLS-1$
126
- declareImage (ISharedImages .IMG_ETOOL_SAVE_EDIT_DISABLED , PATH_DTOOL + "save_edit.png" , true ); //$NON-NLS-1$
127
-
128
- declareImage (ISharedImages .IMG_ETOOL_SAVEAS_EDIT , PATH_ETOOL + "saveas_edit.png" , true ); //$NON-NLS-1$
129
- declareImage (ISharedImages .IMG_ETOOL_SAVEAS_EDIT_DISABLED , PATH_DTOOL + "saveas_edit.png" , true ); //$NON-NLS-1$
132
+ declareImage (ISharedImages .IMG_ETOOL_SAVEAS_EDIT , ISharedImages .IMG_ETOOL_SAVEAS_EDIT_DISABLED ,
133
+ PATH_ETOOL + "saveas_edit.png" , true ); //$NON-NLS-1$
130
134
131
- declareImage (ISharedImages .IMG_ETOOL_SAVEALL_EDIT , PATH_ETOOL + "saveall_edit.png" , true ); //$NON-NLS-1$
132
- declareImage ( ISharedImages . IMG_ETOOL_SAVEALL_EDIT_DISABLED , PATH_DTOOL + "saveall_edit.png" , true ); //$NON-NLS-1$
135
+ declareImage (ISharedImages .IMG_ETOOL_SAVEALL_EDIT , ISharedImages . IMG_ETOOL_SAVEALL_EDIT_DISABLED ,
136
+ PATH_ETOOL + "saveall_edit.png" , true ); //$NON-NLS-1$
133
137
134
- declareImage (ISharedImages .IMG_TOOL_UNDO , PATH_ETOOL + "undo_edit.png" , true ); //$NON-NLS-1$
135
- declareImage ( ISharedImages . IMG_TOOL_UNDO_DISABLED , PATH_DTOOL + "undo_edit.png" , true ); //$NON-NLS-1$
138
+ declareImage (ISharedImages .IMG_TOOL_UNDO , ISharedImages . IMG_TOOL_UNDO_DISABLED , PATH_ETOOL + "undo_edit.png" , //$NON-NLS-1$
139
+ true );
136
140
137
- declareImage (ISharedImages .IMG_TOOL_REDO , PATH_ETOOL + "redo_edit.png" , true ); //$NON-NLS-1$
138
- declareImage ( ISharedImages . IMG_TOOL_REDO_DISABLED , PATH_DTOOL + "redo_edit.png" , true ); //$NON-NLS-1$
141
+ declareImage (ISharedImages .IMG_TOOL_REDO , ISharedImages . IMG_TOOL_REDO_DISABLED , PATH_ETOOL + "redo_edit.png" , //$NON-NLS-1$
142
+ true );
139
143
140
- declareImage (ISharedImages .IMG_TOOL_CUT , PATH_ETOOL + "cut_edit.png" , true ); //$NON-NLS-1$
141
- declareImage ( ISharedImages . IMG_TOOL_CUT_DISABLED , PATH_DTOOL + "cut_edit.png" , true ); //$NON-NLS-1$
144
+ declareImage (ISharedImages .IMG_TOOL_CUT , ISharedImages . IMG_TOOL_CUT_DISABLED , PATH_ETOOL + "cut_edit.png" , //$NON-NLS-1$
145
+ true );
142
146
143
- declareImage (ISharedImages .IMG_TOOL_COPY , PATH_ETOOL + "copy_edit.png" , true ); //$NON-NLS-1$
144
- declareImage ( ISharedImages . IMG_TOOL_COPY_DISABLED , PATH_DTOOL + "copy_edit.png" , true ); //$NON-NLS-1$
147
+ declareImage (ISharedImages .IMG_TOOL_COPY , ISharedImages . IMG_TOOL_COPY_DISABLED , PATH_ETOOL + "copy_edit.png" , //$NON-NLS-1$
148
+ true );
145
149
146
- declareImage (ISharedImages .IMG_TOOL_PASTE , PATH_ETOOL + "paste_edit.png" , true ); //$NON-NLS-1$
147
- declareImage ( ISharedImages . IMG_TOOL_PASTE_DISABLED , PATH_DTOOL + "paste_edit.png" , true ); //$NON-NLS-1$
150
+ declareImage (ISharedImages .IMG_TOOL_PASTE , ISharedImages . IMG_TOOL_PASTE_DISABLED , PATH_ETOOL + "paste_edit.png" , //$NON-NLS-1$
151
+ true );
148
152
149
- declareImage (ISharedImages .IMG_TOOL_DELETE , PATH_ETOOL + "delete_edit.png" , true ); //$NON-NLS-1$
150
- declareImage ( ISharedImages . IMG_TOOL_DELETE_DISABLED , PATH_DTOOL + "delete_edit.png" , true ); //$NON-NLS-1$
153
+ declareImage (ISharedImages .IMG_TOOL_DELETE , ISharedImages . IMG_TOOL_DELETE_DISABLED ,
154
+ PATH_ETOOL + "delete_edit.png" , true ); //$NON-NLS-1$
151
155
152
- declareImage (ISharedImages .IMG_ETOOL_DELETE , PATH_ETOOL + "delete.png" , true ); //$NON-NLS-1$
153
- declareImage ( ISharedImages . IMG_ETOOL_DELETE_DISABLED , PATH_DTOOL + "delete.png" , true ); //$NON-NLS-1$
156
+ declareImage (ISharedImages .IMG_ETOOL_DELETE , ISharedImages . IMG_ETOOL_DELETE_DISABLED , PATH_ETOOL + "delete.png" , //$NON-NLS-1$
157
+ true );
154
158
155
- declareImage (ISharedImages .IMG_ETOOL_CLEAR , PATH_ETOOL + "clear.png" , true ); //$NON-NLS-1$
156
- declareImage ( ISharedImages . IMG_ETOOL_CLEAR_DISABLED , PATH_DTOOL + "clear.png" , true ); //$NON-NLS-1$
159
+ declareImage (ISharedImages .IMG_ETOOL_CLEAR , ISharedImages . IMG_ETOOL_CLEAR_DISABLED , PATH_ETOOL + "clear.png" , //$NON-NLS-1$
160
+ true );
157
161
158
- declareImage (ISharedImages .IMG_TOOL_NEW_WIZARD , PATH_ETOOL + "new_wiz.png" , true ); //$NON-NLS-1$
159
- declareImage ( ISharedImages . IMG_TOOL_NEW_WIZARD_DISABLED , PATH_DTOOL + "new_wiz.png" , true ); //$NON-NLS-1$
162
+ declareImage (ISharedImages .IMG_TOOL_NEW_WIZARD , ISharedImages . IMG_TOOL_NEW_WIZARD_DISABLED ,
163
+ PATH_ETOOL + "new_wiz.png" , true ); //$NON-NLS-1$
160
164
161
- declareImage (ISharedImages .IMG_ETOOL_PRINT_EDIT , PATH_ETOOL + "print_edit.png" , true ); //$NON-NLS-1$
162
- declareImage ( ISharedImages . IMG_ETOOL_PRINT_EDIT_DISABLED , PATH_DTOOL + "print_edit.png" , true ); //$NON-NLS-1$
165
+ declareImage (ISharedImages .IMG_ETOOL_PRINT_EDIT , ISharedImages . IMG_ETOOL_PRINT_EDIT_DISABLED ,
166
+ PATH_ETOOL + "print_edit.png" , true ); //$NON-NLS-1$
163
167
164
168
declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_HELP_CONTENTS , PATH_ETOOL + "help_contents.png" , true ); //$NON-NLS-1$
165
169
declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_HELP_SEARCH , PATH_ETOOL + "help_search.png" , true ); //$NON-NLS-1$
166
170
declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_TIPS_AND_TRICKS , PATH_ETOOL + "tricks.png" , true ); //$NON-NLS-1$
167
171
168
- declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_NEW_FASTVIEW , PATH_ETOOL + "new_fastview.png" , true ); //$NON-NLS-1$
169
- declareImage ( IWorkbenchGraphicConstants .IMG_DTOOL_NEW_FASTVIEW , PATH_DTOOL + "new_fastview.png" , true ); //$NON-NLS-1$
172
+ declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_NEW_FASTVIEW ,
173
+ IWorkbenchGraphicConstants .IMG_DTOOL_NEW_FASTVIEW , PATH_ETOOL + "new_fastview.png" , true ); //$NON-NLS-1$
170
174
171
175
declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_RESTORE_TRIMPART , PATH_ETOOL + "fastview_restore.png" , true ); //$NON-NLS-1$
172
176
declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_EDITOR_TRIMPART , PATH_ETOOL + "editor_area.png" , true ); //$NON-NLS-1$
173
177
174
- declareImage (ISharedImages .IMG_TOOL_FORWARD , PATH_ELOCALTOOL + "forward_nav.png" , true ); //$NON-NLS-1$
175
- declareImage ( ISharedImages . IMG_TOOL_FORWARD_DISABLED , PATH_DLOCALTOOL + "forward_nav.png" , true ); //$NON-NLS-1$
178
+ declareImage (ISharedImages .IMG_TOOL_FORWARD , ISharedImages . IMG_TOOL_FORWARD_DISABLED ,
179
+ PATH_ELOCALTOOL + "forward_nav.png" , true ); //$NON-NLS-1$
176
180
177
- declareImage (ISharedImages .IMG_TOOL_BACK , PATH_ELOCALTOOL + "backward_nav.png" , true ); //$NON-NLS-1$
178
- declareImage ( ISharedImages . IMG_TOOL_BACK_DISABLED , PATH_DLOCALTOOL + "backward_nav.png" , true ); //$NON-NLS-1$
181
+ declareImage (ISharedImages .IMG_TOOL_BACK , ISharedImages . IMG_TOOL_BACK_DISABLED ,
182
+ PATH_ELOCALTOOL + "backward_nav.png" , true ); //$NON-NLS-1$
179
183
180
- declareImage (ISharedImages .IMG_TOOL_UP , PATH_ELOCALTOOL + "up_nav.png" , true ); //$NON-NLS-1$
181
- declareImage (ISharedImages .IMG_TOOL_UP_DISABLED , PATH_DLOCALTOOL + "up_nav.png" , true ); //$NON-NLS-1$
184
+ declareImage (ISharedImages .IMG_TOOL_UP , ISharedImages .IMG_TOOL_UP_DISABLED , PATH_ELOCALTOOL + "up_nav.png" , true ); //$NON-NLS-1$
182
185
183
- declareImage (ISharedImages .IMG_ELCL_SYNCED , PATH_ELOCALTOOL + "synced.png" , true ); //$NON-NLS-1$
184
- declareImage ( ISharedImages . IMG_ELCL_SYNCED_DISABLED , PATH_DLOCALTOOL + "synced.png" , true ); //$NON-NLS-1$
186
+ declareImage (ISharedImages .IMG_ELCL_SYNCED , ISharedImages . IMG_ELCL_SYNCED_DISABLED ,
187
+ PATH_ELOCALTOOL + "synced.png" , true ); //$NON-NLS-1$
185
188
186
- declareImage (ISharedImages .IMG_ELCL_COLLAPSEALL , PATH_ELOCALTOOL + "collapseall.png" , true ); //$NON-NLS-1$
187
- declareImage ( ISharedImages . IMG_ELCL_COLLAPSEALL_DISABLED , PATH_DLOCALTOOL + "collapseall.png" , true ); //$NON-NLS-1$
189
+ declareImage (ISharedImages .IMG_ELCL_COLLAPSEALL , ISharedImages . IMG_ELCL_COLLAPSEALL_DISABLED ,
190
+ PATH_ELOCALTOOL + "collapseall.png" , true ); //$NON-NLS-1$
188
191
189
- declareImage (ISharedImages .IMG_ELCL_REMOVE , PATH_ELOCALTOOL + "remove.png" , true ); //$NON-NLS-1$
190
- declareImage ( ISharedImages . IMG_ELCL_REMOVE_DISABLED , PATH_DLOCALTOOL + "remove.png" , true ); //$NON-NLS-1$
192
+ declareImage (ISharedImages .IMG_ELCL_REMOVE , ISharedImages . IMG_ELCL_REMOVE_DISABLED ,
193
+ PATH_ELOCALTOOL + "remove.png" , true ); //$NON-NLS-1$
191
194
192
- declareImage (ISharedImages .IMG_ELCL_REMOVEALL , PATH_ELOCALTOOL + "removeall.png" , true ); //$NON-NLS-1$
193
- declareImage ( ISharedImages . IMG_ELCL_REMOVEALL_DISABLED , PATH_DLOCALTOOL + "removeall.png" , true ); //$NON-NLS-1$
195
+ declareImage (ISharedImages .IMG_ELCL_REMOVEALL , ISharedImages . IMG_ELCL_REMOVEALL_DISABLED ,
196
+ PATH_ELOCALTOOL + "removeall.png" , true ); //$NON-NLS-1$
194
197
195
- declareImage (ISharedImages .IMG_ELCL_COLLAPSEALL , PATH_ELOCALTOOL + "collapseall.png" , true ); //$NON-NLS-1$
196
- declareImage ( ISharedImages . IMG_ELCL_COLLAPSEALL_DISABLED , PATH_DLOCALTOOL + "collapseall.png" , true ); //$NON-NLS-1$
198
+ declareImage (ISharedImages .IMG_ELCL_COLLAPSEALL , ISharedImages . IMG_ELCL_COLLAPSEALL_DISABLED ,
199
+ PATH_ELOCALTOOL + "collapseall.png" , true ); //$NON-NLS-1$
197
200
198
- declareImage (ISharedImages .IMG_ELCL_STOP , PATH_ELOCALTOOL + "stop.png" , true ); //$NON-NLS-1$
199
- declareImage ( ISharedImages . IMG_ELCL_STOP_DISABLED , PATH_DLOCALTOOL + "stop.png" , true ); //$NON-NLS-1$
201
+ declareImage (ISharedImages .IMG_ELCL_STOP , ISharedImages . IMG_ELCL_STOP_DISABLED , PATH_ELOCALTOOL + "stop.png" , //$NON-NLS-1$
202
+ true );
200
203
201
204
declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_NEW_PAGE , PATH_EVIEW + "new_persp.png" , false ); //$NON-NLS-1$
202
205
203
- declareImage (ISharedImages .IMG_ETOOL_HOME_NAV , PATH_ELOCALTOOL + "home_nav.png" , true ); //$NON-NLS-1$
204
- declareImage ( ISharedImages . IMG_ETOOL_HOME_NAV_DISABLED , PATH_DLOCALTOOL + "home_nav.png" , true ); //$NON-NLS-1$
206
+ declareImage (ISharedImages .IMG_ETOOL_HOME_NAV , ISharedImages . IMG_ETOOL_HOME_NAV_DISABLED ,
207
+ PATH_ELOCALTOOL + "home_nav.png" , true ); //$NON-NLS-1$
205
208
206
209
declareImage (ISharedImages .IMG_ETOOL_DEF_PERSPECTIVE , PATH_EVIEW + "default_persp.png" , true ); //$NON-NLS-1$
207
210
0 commit comments