Skip to content

Use on-the-fly disabled icons in several bundles #2945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ public static void setLocalImageDescriptors(IAction action, String iconName) {
//---- Helper methods to access icons on the file system --------------------------------------

private static void setImageDescriptors(IAction action, String type, String relPath) {
ImageDescriptor id= create("d" + type, relPath, false); //$NON-NLS-1$
if (id != null)
action.setDisabledImageDescriptor(id);

ImageDescriptor descriptor= create("e" + type, relPath, true); //$NON-NLS-1$
action.setImageDescriptor(descriptor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ private static ImageDescriptor create(String prefix, String name, boolean useMis
public static void setImageDescriptors(IAction action, String type, String relPath) {
relPath= relPath.substring(NAME_PREFIX_LENGTH);

action.setDisabledImageDescriptor(create("d" + type, relPath, false)); //$NON-NLS-1$

ImageDescriptor desc= create("e" + type, relPath, true); //$NON-NLS-1$
action.setImageDescriptor(desc);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,52 +702,34 @@ protected static void setWorkspaceNameDefault() {
protected void declareWorkbenchImages() {

final String ICONS_PATH = "$nl$/icons/full/";//$NON-NLS-1$
final String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/"; // Enabled //$NON-NLS-1$

// toolbar
// icons.
final String PATH_DLOCALTOOL = ICONS_PATH + "dlcl16/"; // Disabled //$NON-NLS-1$
// //$NON-NLS-1$
// toolbar
// icons.
final String PATH_ETOOL = ICONS_PATH + "etool16/"; // Enabled toolbar //$NON-NLS-1$
// //$NON-NLS-1$
// icons.
final String PATH_DTOOL = ICONS_PATH + "dtool16/"; // Disabled toolbar //$NON-NLS-1$
// //$NON-NLS-1$
// icons.
final String PATH_OBJECT = ICONS_PATH + "obj16/"; // Model object //$NON-NLS-1$
// //$NON-NLS-1$
// icons
final String PATH_WIZBAN = ICONS_PATH + "wizban/"; // Wizard //$NON-NLS-1$
// //$NON-NLS-1$
// icons

// Local toolbar icons
final String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/"; //$NON-NLS-1$
// Toolbar icons
final String PATH_ETOOL = ICONS_PATH + "etool16/"; //$NON-NLS-1$
// Model objects
final String PATH_OBJECT = ICONS_PATH + "obj16/"; //$NON-NLS-1$
// Wizard icons
final String PATH_WIZBAN = ICONS_PATH + "wizban/"; //$NON-NLS-1$
// View icons
final String PATH_EVIEW= ICONS_PATH + "eview16/"; //$NON-NLS-1$


Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH);

declareWorkbenchImage(ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC, PATH_ETOOL
+ "build_exec.svg", false); //$NON-NLS-1$
declareWorkbenchImage(ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_HOVER,
PATH_ETOOL + "build_exec.svg", false); //$NON-NLS-1$
declareWorkbenchImage(ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_DISABLED,
PATH_DTOOL + "build_exec.png", false); //$NON-NLS-1$
PATH_ETOOL + "build_exec.svg", false); //$NON-NLS-1$

declareWorkbenchImage(ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC, PATH_ETOOL
+ "search_src.svg", false); //$NON-NLS-1$
declareWorkbenchImage(ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_HOVER,
PATH_ETOOL + "search_src.svg", false); //$NON-NLS-1$
declareWorkbenchImage(ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_DISABLED,
PATH_DTOOL + "search_src.png", false); //$NON-NLS-1$
PATH_ETOOL + "search_src.svg", false); //$NON-NLS-1$

declareWorkbenchImage(ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_NEXT_NAV, PATH_ETOOL
Expand Down Expand Up @@ -812,11 +794,8 @@ protected void declareWorkbenchImages() {
// Quick fix icons
declareWorkbenchImage(ideBundle,
IDEInternalWorkbenchImages.IMG_ELCL_QUICK_FIX_ENABLED,
PATH_ELOCALTOOL + "smartmode_co.svg", true); //$NON-NLS-1$

declareWorkbenchImage(ideBundle,
IDEInternalWorkbenchImages.IMG_DLCL_QUICK_FIX_DISABLED,
PATH_DLOCALTOOL + "smartmode_co.png", true); //$NON-NLS-1$
PATH_ELOCALTOOL + "smartmode_co.svg", true); //$NON-NLS-1$

declareWorkbenchImage(ideBundle,
IDEInternalWorkbenchImages.IMG_OBJS_FIXABLE_WARNING,
Expand Down Expand Up @@ -904,9 +883,18 @@ protected void declareWorkbenchImages() {
*/
protected void declareWorkbenchImage(Bundle ideBundle, String symbolicName,
String path, boolean shared) {
declareWorkbenchImage(ideBundle, symbolicName, null, path, shared);
}

private void declareWorkbenchImage(Bundle ideBundle, String symbolicName, String disabledSymbolicName, String path,
boolean shared) {
URL url = FileLocator.find(ideBundle, IPath.fromOSString(path), null);
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
getWorkbenchConfigurer().declareImage(symbolicName, desc, shared);
if (disabledSymbolicName != null) {
ImageDescriptor disabledDescriptor = ImageDescriptor.createWithFlags(desc, SWT.IMAGE_DISABLE);
getWorkbenchConfigurer().declareImage(disabledSymbolicName, disabledDescriptor, shared);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,6 @@ public void run() {
if (id != null) {
filterAction.setImageDescriptor(id);
}
id = IDEWorkbenchPlugin.getIDEImageDescriptor("/dlcl16/filter_ps.png"); //$NON-NLS-1$
if (id != null) {
filterAction.setDisabledImageDescriptor(id);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
job.schedule();
}
};
refreshAction.setDisabledImageDescriptor(getImageDescriptor("dlcl16/refresh_nav.png"));//$NON-NLS-1$
refreshAction.setImageDescriptor(getImageDescriptor("elcl16/refresh_nav.svg"));//$NON-NLS-1$
refreshAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_REFRESH);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.ui.tests.views.properties.tabbed;singleton:=true
Bundle-Version: 3.8.400.qualifier
Bundle-Version: 3.8.500.qualifier
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public void run() {
};
staticAction.setToolTipText(staticText);
staticAction.setImageDescriptor(imageDescriptor);
staticAction.setDisabledImageDescriptor(imageDescriptor);

dynamicSectionsAction = new Action(dynamicSectionsText,
IAction.AS_CHECK_BOX) {
Expand All @@ -178,7 +177,6 @@ public void run() {
};
dynamicSectionsAction.setToolTipText(dynamicSectionsText);
dynamicSectionsAction.setImageDescriptor(imageDescriptor);
dynamicSectionsAction.setDisabledImageDescriptor(imageDescriptor);

dynamicTabsAction = new Action(dynamicTabsText, IAction.AS_CHECK_BOX) {
@Override
Expand Down
Loading