2020import org .eclipse .core .runtime .Assert ;
2121import org .eclipse .jface .resource .ImageDescriptor ;
2222import org .eclipse .jface .resource .ImageRegistry ;
23+ import org .eclipse .swt .SWT ;
2324import org .eclipse .swt .graphics .Image ;
2425import org .eclipse .ui .ISharedImages ;
2526import org .eclipse .ui .PlatformUI ;
7172
7273 private static final String PATH_ETOOL = ICONS_PATH + "etool16/" ; // Enabled toolbar icons.//$NON-NLS-1$
7374
74- private static final String PATH_DTOOL = ICONS_PATH + "dtool16/" ; // Disabled toolbar icons.//$NON-NLS-1$
75-
7675 private static final String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/" ; // Enabled local toolbar icons.//$NON-NLS-1$
7776
78- private static final String PATH_DLOCALTOOL = ICONS_PATH + "dlcl16/" ; // Disabled local toolbar icons.//$NON-NLS-1$
79-
8077 private static final String PATH_EVIEW = ICONS_PATH + "eview16/" ; // View icons//$NON-NLS-1$
8178
8279 private static final String PATH_OVERLAY = ICONS_PATH + "ovr16/" ; //$NON-NLS-1$
10198 * <code>false</code> if this is not a shared image
10299 */
103100 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 ));
106107 declareImage (key , desc , shared );
108+ if (disabledKey != null ) {
109+ ImageDescriptor disabledImageDescriptor = ImageDescriptor .createWithFlags (desc , SWT .IMAGE_DISABLE );
110+ declareImage (disabledKey , disabledImageDescriptor , shared );
111+ }
107112 }
108113
109114 /**
@@ -117,91 +122,90 @@ private static final void declareImages() {
117122 declareImage (ISharedImages .IMG_DEC_FIELD_WARNING , PATH_OVERLAY + "warning_ovr.svg" , true ); //$NON-NLS-1$
118123
119124 // Pinning
120- declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_PIN_EDITOR , PATH_ETOOL + "pin_editor.svg" , 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.svg " , false ); //$NON-NLS-1$
122127
123128 // 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$
124131
125- declareImage (ISharedImages .IMG_ETOOL_SAVE_EDIT , PATH_ETOOL + "save_edit.svg" , 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.svg" , 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.svg" , true ); //$NON-NLS-1$
130134
131- declareImage (ISharedImages .IMG_ETOOL_SAVEALL_EDIT , PATH_ETOOL + "saveall_edit.svg" , 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.svg " , true ); //$NON-NLS-1$
133137
134- declareImage (ISharedImages .IMG_TOOL_UNDO , PATH_ETOOL + "undo_edit.svg" , 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 , //
139+ PATH_ETOOL + "undo_edit.svg " , true ); //$NON-NLS-1$
136140
137- declareImage (ISharedImages .IMG_TOOL_REDO , PATH_ETOOL + "redo_edit.svg" , 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 , //
142+ PATH_ETOOL + "redo_edit.svg " , true ); //$NON-NLS-1$
139143
140- declareImage (ISharedImages .IMG_TOOL_CUT , PATH_ETOOL + "cut_edit.svg" , 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 , //
145+ PATH_ETOOL + "cut_edit.svg " , true ); //$NON-NLS-1$
142146
143- declareImage (ISharedImages .IMG_TOOL_COPY , PATH_ETOOL + "copy_edit.svg" , 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 , //
148+ PATH_ETOOL + "copy_edit.svg " , true ); //$NON-NLS-1$
145149
146- declareImage (ISharedImages .IMG_TOOL_PASTE , PATH_ETOOL + "paste_edit.svg" , 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 , //
151+ PATH_ETOOL + "paste_edit.svg " , true ); //$NON-NLS-1$
148152
149- declareImage (ISharedImages .IMG_TOOL_DELETE , PATH_ETOOL + "delete_edit.svg" , 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.svg " , true ); //$NON-NLS-1$
151155
152- declareImage (ISharedImages .IMG_ETOOL_DELETE , PATH_ETOOL + "delete.svg" , 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 , //
157+ PATH_ETOOL + "delete.svg " , true ); //$NON-NLS-1$
154158
155- declareImage (ISharedImages .IMG_ETOOL_CLEAR , PATH_ETOOL + "clear.svg" , 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 , //
160+ PATH_ETOOL + "clear.svg " , true ); //$NON-NLS-1$
157161
158- declareImage (ISharedImages .IMG_TOOL_NEW_WIZARD , PATH_ETOOL + "new_wiz.svg" , 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.svg " , true ); //$NON-NLS-1$
160164
161- declareImage (ISharedImages .IMG_ETOOL_PRINT_EDIT , PATH_ETOOL + "print_edit.svg" , 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.svg " , true ); //$NON-NLS-1$
163167
164168 declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_HELP_CONTENTS , PATH_ETOOL + "help_contents.svg" , true ); //$NON-NLS-1$
165169 declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_HELP_SEARCH , PATH_ETOOL + "help_search.svg" , true ); //$NON-NLS-1$
166170 declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_TIPS_AND_TRICKS , PATH_ETOOL + "tricks.svg" , true ); //$NON-NLS-1$
167171
168- declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_NEW_FASTVIEW , PATH_ETOOL + "new_fastview.svg" , 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.svg " , true ); //$NON-NLS-1$
170174
171175 declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_RESTORE_TRIMPART , PATH_ETOOL + "fastview_restore.svg" , true ); //$NON-NLS-1$
172176 declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_EDITOR_TRIMPART , PATH_ETOOL + "editor_area.svg" , true ); //$NON-NLS-1$
173177
174- declareImage (ISharedImages .IMG_TOOL_FORWARD , PATH_ELOCALTOOL + "forward_nav.svg" , 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.svg " , true ); //$NON-NLS-1$
176180
177- declareImage (ISharedImages .IMG_TOOL_BACK , PATH_ELOCALTOOL + "backward_nav.svg" , 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.svg " , true ); //$NON-NLS-1$
179183
180- declareImage (ISharedImages .IMG_TOOL_UP , PATH_ELOCALTOOL + "up_nav.svg" , 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 , //
185+ PATH_ELOCALTOOL + "up_nav.svg " , true ); //$NON-NLS-1$
182186
183- declareImage (ISharedImages .IMG_ELCL_SYNCED , PATH_ELOCALTOOL + "synced.svg" , true ); //$NON-NLS-1$
184- declareImage ( ISharedImages . IMG_ELCL_SYNCED_DISABLED , PATH_DLOCALTOOL + "synced.png " , true ); //$NON-NLS-1$
187+ declareImage (ISharedImages .IMG_ELCL_SYNCED , ISharedImages . IMG_ELCL_SYNCED_DISABLED , //
188+ PATH_ELOCALTOOL + "synced.svg " , true ); //$NON-NLS-1$
185189
186- declareImage (ISharedImages .IMG_ELCL_COLLAPSEALL , PATH_ELOCALTOOL + "collapseall.svg" , true ); //$NON-NLS-1$
187- declareImage ( ISharedImages . IMG_ELCL_COLLAPSEALL_DISABLED , PATH_DLOCALTOOL + "collapseall.png " , true ); //$NON-NLS-1$
190+ declareImage (ISharedImages .IMG_ELCL_COLLAPSEALL , ISharedImages . IMG_ELCL_COLLAPSEALL_DISABLED , //
191+ PATH_ELOCALTOOL + "collapseall.svg " , true ); //$NON-NLS-1$
188192
189- declareImage (ISharedImages .IMG_ELCL_REMOVE , PATH_ELOCALTOOL + "remove.svg" , true ); //$NON-NLS-1$
190- declareImage ( ISharedImages . IMG_ELCL_REMOVE_DISABLED , PATH_DLOCALTOOL + "remove.png " , true ); //$NON-NLS-1$
193+ declareImage (ISharedImages .IMG_ELCL_REMOVE , ISharedImages . IMG_ELCL_REMOVE_DISABLED , //
194+ PATH_ELOCALTOOL + "remove.svg " , true ); //$NON-NLS-1$
191195
192- declareImage (ISharedImages .IMG_ELCL_REMOVEALL , PATH_ELOCALTOOL + "removeall.svg" , true ); //$NON-NLS-1$
193- declareImage ( ISharedImages . IMG_ELCL_REMOVEALL_DISABLED , PATH_DLOCALTOOL + "removeall.png " , true ); //$NON-NLS-1$
196+ declareImage (ISharedImages .IMG_ELCL_REMOVEALL , ISharedImages . IMG_ELCL_REMOVEALL_DISABLED , //
197+ PATH_ELOCALTOOL + "removeall.svg " , true ); //$NON-NLS-1$
194198
195- declareImage (ISharedImages .IMG_ELCL_COLLAPSEALL , PATH_ELOCALTOOL + "collapseall.svg" , true ); //$NON-NLS-1$
196- declareImage ( ISharedImages . IMG_ELCL_COLLAPSEALL_DISABLED , PATH_DLOCALTOOL + "collapseall.png " , true ); //$NON-NLS-1$
199+ declareImage (ISharedImages .IMG_ELCL_COLLAPSEALL , ISharedImages . IMG_ELCL_COLLAPSEALL_DISABLED , //
200+ PATH_ELOCALTOOL + "collapseall.svg " , true ); //$NON-NLS-1$
197201
198- declareImage (ISharedImages .IMG_ELCL_STOP , PATH_ELOCALTOOL + "stop.svg" , true ); //$NON-NLS-1$
199- declareImage ( ISharedImages . IMG_ELCL_STOP_DISABLED , PATH_DLOCALTOOL + "stop.png " , true ); //$NON-NLS-1$
202+ declareImage (ISharedImages .IMG_ELCL_STOP , ISharedImages . IMG_ELCL_STOP_DISABLED , //
203+ PATH_ELOCALTOOL + "stop.svg " , true ); //$NON-NLS-1$
200204
201205 declareImage (IWorkbenchGraphicConstants .IMG_ETOOL_NEW_PAGE , PATH_EVIEW + "new_persp.svg" , false ); //$NON-NLS-1$
202206
203- declareImage (ISharedImages .IMG_ETOOL_HOME_NAV , PATH_ELOCALTOOL + "home_nav.svg" , true ); //$NON-NLS-1$
204- declareImage ( ISharedImages . IMG_ETOOL_HOME_NAV_DISABLED , PATH_DLOCALTOOL + "home_nav.png " , true ); //$NON-NLS-1$
207+ declareImage (ISharedImages .IMG_ETOOL_HOME_NAV , ISharedImages . IMG_ETOOL_HOME_NAV_DISABLED , //
208+ PATH_ELOCALTOOL + "home_nav.svg " , true ); //$NON-NLS-1$
205209
206210 declareImage (ISharedImages .IMG_ETOOL_DEF_PERSPECTIVE , PATH_EVIEW + "default_persp.svg" , true ); //$NON-NLS-1$
207211
0 commit comments