Skip to content

Commit b1591e8

Browse files
committed
Use on-the-fly disabled icons in several bundles
This replaces the usage of pre-generated disabled icons in different bundles. Most of the images / image descriptors were not reused anyway, so setting them at different actions is simply removes. Some shared image descriptors are adapted to generate the disabled version of the shared icon programmatically.
1 parent 6bb99bb commit b1591e8

File tree

6 files changed

+20
-45
lines changed

6 files changed

+20
-45
lines changed

bundles/org.eclipse.ltk.ui.refactoring/src/org/eclipse/ltk/internal/ui/refactoring/RefactoringPluginImages.java

-4
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,6 @@ public static void setLocalImageDescriptors(IAction action, String iconName) {
140140
//---- Helper methods to access icons on the file system --------------------------------------
141141

142142
private static void setImageDescriptors(IAction action, String type, String relPath) {
143-
ImageDescriptor id= create("d" + type, relPath, false); //$NON-NLS-1$
144-
if (id != null)
145-
action.setDisabledImageDescriptor(id);
146-
147143
ImageDescriptor descriptor= create("e" + type, relPath, true); //$NON-NLS-1$
148144
action.setImageDescriptor(descriptor);
149145
}

bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java

-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ private static ImageDescriptor create(String prefix, String name, boolean useMis
109109
public static void setImageDescriptors(IAction action, String type, String relPath) {
110110
relPath= relPath.substring(NAME_PREFIX_LENGTH);
111111

112-
action.setDisabledImageDescriptor(create("d" + type, relPath, false)); //$NON-NLS-1$
113-
114112
ImageDescriptor desc= create("e" + type, relPath, true); //$NON-NLS-1$
115113
action.setImageDescriptor(desc);
116114
}

bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchAdvisor.java

+20-32
Original file line numberDiff line numberDiff line change
@@ -702,52 +702,34 @@ protected static void setWorkspaceNameDefault() {
702702
protected void declareWorkbenchImages() {
703703

704704
final String ICONS_PATH = "$nl$/icons/full/";//$NON-NLS-1$
705-
final String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/"; // Enabled //$NON-NLS-1$
706-
707-
// toolbar
708-
// icons.
709-
final String PATH_DLOCALTOOL = ICONS_PATH + "dlcl16/"; // Disabled //$NON-NLS-1$
710-
// //$NON-NLS-1$
711-
// toolbar
712-
// icons.
713-
final String PATH_ETOOL = ICONS_PATH + "etool16/"; // Enabled toolbar //$NON-NLS-1$
714-
// //$NON-NLS-1$
715-
// icons.
716-
final String PATH_DTOOL = ICONS_PATH + "dtool16/"; // Disabled toolbar //$NON-NLS-1$
717-
// //$NON-NLS-1$
718-
// icons.
719-
final String PATH_OBJECT = ICONS_PATH + "obj16/"; // Model object //$NON-NLS-1$
720-
// //$NON-NLS-1$
721-
// icons
722-
final String PATH_WIZBAN = ICONS_PATH + "wizban/"; // Wizard //$NON-NLS-1$
723-
// //$NON-NLS-1$
724-
// icons
725-
705+
// Local toolbar icons
706+
final String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/"; //$NON-NLS-1$
707+
// Toolbar icons
708+
final String PATH_ETOOL = ICONS_PATH + "etool16/"; //$NON-NLS-1$
709+
// Model objects
710+
final String PATH_OBJECT = ICONS_PATH + "obj16/"; //$NON-NLS-1$
711+
// Wizard icons
712+
final String PATH_WIZBAN = ICONS_PATH + "wizban/"; //$NON-NLS-1$
726713
// View icons
727714
final String PATH_EVIEW= ICONS_PATH + "eview16/"; //$NON-NLS-1$
728715

729-
730716
Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH);
731717

732718
declareWorkbenchImage(ideBundle,
733719
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC, PATH_ETOOL
734720
+ "build_exec.svg", false); //$NON-NLS-1$
735721
declareWorkbenchImage(ideBundle,
736722
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_HOVER,
737-
PATH_ETOOL + "build_exec.svg", false); //$NON-NLS-1$
738-
declareWorkbenchImage(ideBundle,
739723
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_DISABLED,
740-
PATH_DTOOL + "build_exec.png", false); //$NON-NLS-1$
724+
PATH_ETOOL + "build_exec.svg", false); //$NON-NLS-1$
741725

742726
declareWorkbenchImage(ideBundle,
743727
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC, PATH_ETOOL
744728
+ "search_src.svg", false); //$NON-NLS-1$
745729
declareWorkbenchImage(ideBundle,
746730
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_HOVER,
747-
PATH_ETOOL + "search_src.svg", false); //$NON-NLS-1$
748-
declareWorkbenchImage(ideBundle,
749731
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_DISABLED,
750-
PATH_DTOOL + "search_src.png", false); //$NON-NLS-1$
732+
PATH_ETOOL + "search_src.svg", false); //$NON-NLS-1$
751733

752734
declareWorkbenchImage(ideBundle,
753735
IDEInternalWorkbenchImages.IMG_ETOOL_NEXT_NAV, PATH_ETOOL
@@ -812,11 +794,8 @@ protected void declareWorkbenchImages() {
812794
// Quick fix icons
813795
declareWorkbenchImage(ideBundle,
814796
IDEInternalWorkbenchImages.IMG_ELCL_QUICK_FIX_ENABLED,
815-
PATH_ELOCALTOOL + "smartmode_co.svg", true); //$NON-NLS-1$
816-
817-
declareWorkbenchImage(ideBundle,
818797
IDEInternalWorkbenchImages.IMG_DLCL_QUICK_FIX_DISABLED,
819-
PATH_DLOCALTOOL + "smartmode_co.png", true); //$NON-NLS-1$
798+
PATH_ELOCALTOOL + "smartmode_co.svg", true); //$NON-NLS-1$
820799

821800
declareWorkbenchImage(ideBundle,
822801
IDEInternalWorkbenchImages.IMG_OBJS_FIXABLE_WARNING,
@@ -904,9 +883,18 @@ protected void declareWorkbenchImages() {
904883
*/
905884
protected void declareWorkbenchImage(Bundle ideBundle, String symbolicName,
906885
String path, boolean shared) {
886+
declareWorkbenchImage(ideBundle, symbolicName, null, path, shared);
887+
}
888+
889+
private void declareWorkbenchImage(Bundle ideBundle, String symbolicName, String disabledSymbolicName, String path,
890+
boolean shared) {
907891
URL url = FileLocator.find(ideBundle, IPath.fromOSString(path), null);
908892
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
909893
getWorkbenchConfigurer().declareImage(symbolicName, desc, shared);
894+
if (disabledSymbolicName != null) {
895+
ImageDescriptor disabledDescriptor = ImageDescriptor.createWithFlags(desc, SWT.IMAGE_DISABLE);
896+
getWorkbenchConfigurer().declareImage(disabledSymbolicName, disabledDescriptor, shared);
897+
}
910898
}
911899

912900
@Override

bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/ExtendedMarkersView.java

-4
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,6 @@ public void run() {
367367
if (id != null) {
368368
filterAction.setImageDescriptor(id);
369369
}
370-
id = IDEWorkbenchPlugin.getIDEImageDescriptor("/dlcl16/filter_ps.png"); //$NON-NLS-1$
371-
if (id != null) {
372-
filterAction.setDisabledImageDescriptor(id);
373-
}
374370
}
375371

376372
/**

bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmtActionProvider.java

-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
251251
job.schedule();
252252
}
253253
};
254-
refreshAction.setDisabledImageDescriptor(getImageDescriptor("dlcl16/refresh_nav.png"));//$NON-NLS-1$
255254
refreshAction.setImageDescriptor(getImageDescriptor("elcl16/refresh_nav.svg"));//$NON-NLS-1$
256255
refreshAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_REFRESH);
257256

tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsView.java

-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ public void run() {
161161
};
162162
staticAction.setToolTipText(staticText);
163163
staticAction.setImageDescriptor(imageDescriptor);
164-
staticAction.setDisabledImageDescriptor(imageDescriptor);
165164

166165
dynamicSectionsAction = new Action(dynamicSectionsText,
167166
IAction.AS_CHECK_BOX) {
@@ -178,7 +177,6 @@ public void run() {
178177
};
179178
dynamicSectionsAction.setToolTipText(dynamicSectionsText);
180179
dynamicSectionsAction.setImageDescriptor(imageDescriptor);
181-
dynamicSectionsAction.setDisabledImageDescriptor(imageDescriptor);
182180

183181
dynamicTabsAction = new Action(dynamicTabsText, IAction.AS_CHECK_BOX) {
184182
@Override

0 commit comments

Comments
 (0)