Skip to content
Open
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
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.ui.workbench.renderers.swt;singleton:=true
Bundle-Version: 0.17.0.qualifier
Bundle-Version: 0.17.100.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.swt.util.ISWTResourceUtilities;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.IMenuCreator;
Expand Down Expand Up @@ -211,6 +212,9 @@ protected void updateIcons() {
}

private String getDisabledIconURI(MItem toolItem) {
if (ActionContributionItem.getIgnoreDisabledIcons()) {
return ""; //$NON-NLS-1$
}
Object obj = toolItem.getTransientData().get(IPresentationEngine.DISABLED_ICON_IMAGE_KEY);
return obj instanceof String s ? s : ""; //$NON-NLS-1$
}
Expand Down
2 changes: 1 addition & 1 deletion bundles/org.eclipse.jface/META-INF/MANIFEST.MF
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: %pluginName
Bundle-SymbolicName: org.eclipse.jface;singleton:=true
Bundle-Version: 3.39.0.qualifier
Bundle-Version: 3.40.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,33 @@ public static void setUseColorIconsInToolbars(boolean useColorIcons) {
USE_COLOR_ICONS = useColorIcons;
}

private static boolean IGNORE_DISABLED_ICONS = false;

/**
* Returns whether explicitly defined disabled icons should be ignored, such
* that all disabled icons are generated on-the-fly.
*
* @return <code>true</code> if disabled icons set to tool items should be
* ignored, <code>false</code> otherwise
* @since 3.40
*/
public static boolean getIgnoreDisabledIcons() {
return IGNORE_DISABLED_ICONS;
}

/**
* Sets whether explicitly defined disabled icons should be ignored, such that
* all disabled icons are generated on-the-fly.
*
* @param ignoreDisabledIcons <code>true</code> if disabled icons set to tool
* items should be ignored, <code>false</code>
* otherwise
* @since 3.40
*/
public static void setIgnoreDisabledIcons(boolean ignoreDisabledIcons) {
IGNORE_DISABLED_ICONS = ignoreDisabledIcons;
}

/**
* The presentation mode.
*/
Expand Down Expand Up @@ -988,7 +1015,10 @@ private boolean updateImages(boolean forceImage) {
if (widget instanceof ToolItem) {
ImageDescriptor image = action.getImageDescriptor();
ImageDescriptor hoverImage = action.getHoverImageDescriptor();
ImageDescriptor disabledImage = action.getDisabledImageDescriptor();
ImageDescriptor disabledImage = null;
if (!getIgnoreDisabledIcons()) {
disabledImage = action.getDisabledImageDescriptor();
}
// Make sure there is a valid image in case images are forced.
if (image == null && forceImage) {
image = ImageDescriptor.getMissingImageDescriptor();
Expand Down
2 changes: 1 addition & 1 deletion bundles/org.eclipse.ui.workbench/META-INF/MANIFEST.MF
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: %pluginName
Bundle-SymbolicName: org.eclipse.ui.workbench; singleton:=true
Bundle-Version: 3.138.100.qualifier
Bundle-Version: 3.139.0.qualifier
Bundle-Activator: org.eclipse.ui.internal.WorkbenchPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -721,4 +721,25 @@ public interface IWorkbenchPreferenceConstants {
* @since 3.134
*/
String RESCALING_AT_RUNTIME = "monitorSpecificScaling"; //$NON-NLS-1$

/**
* <p>
* Whether explicitly defined disabled icons shall be ignored in favor of using
* on-the-fly generated disabled icons.
* </p>
*
* @since 3.139
*/
String IGNORE_DISABLED_ICONS = "ignoreDisabledIcons"; //$NON-NLS-1$

/**
* <p>
* Whether to use a different algorithm for generating disabled icons that
* desaturates the icons rather than making them completely grayscaled.
* </p>
*
* @since 3.139
*/
String USE_DESATURATED_DISABLED_ICONS = "desaturatedDisabledIcons"; //$NON-NLS-1$

}
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,11 @@ public class WorkbenchMessages extends NLS {
public static String ViewsPreference_viewTabs_icons_and_titles_label;
public static String ViewsPreference_showFullTextForViewTabs;
public static String ViewsPreference_hideIconsForViewTabs;
public static String ViewsPreference_disabledIcons_description;
public static String ViewsPreference_ignoreDisabledIcons;
public static String ViewsPreference_ignoreDisabledIcons_tooltip;
public static String ViewsPreference_useDesaturatedDisabledIcons;
public static String ViewsPreference_useDesaturatedDisabledIcons_tooltip;
public static String ToggleFullScreenMode_ActivationPopup_Description;
public static String ToggleFullScreenMode_ActivationPopup_Description_NoKeybinding;
public static String ToggleFullScreenMode_ActivationPopup_DoNotShowAgain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ public class ViewsPreferencePage extends PreferencePage implements IWorkbenchPre

private Button themingEnabled;
private Button rescaleAtRuntime;
private Button ignoreDisabledIcons;
private Button useDesaturatedDisabledIcons;

private Button hideIconsForViewTabs;
private Button showFullTextForViewTabs;
Expand All @@ -140,6 +142,7 @@ protected Control createContents(Composite parent) {
layout.horizontalSpacing = 10;
comp.setLayout(layout);
createThemeIndependentComposits(comp);
createDisabledIconsButtons(comp);
createRescaleAtRuntimeCheckButton(comp);
return comp;
}
Expand Down Expand Up @@ -184,6 +187,7 @@ protected Control createContents(Composite parent) {
createHideIconsForViewTabs(comp);
createDependency(showFullTextForViewTabs, hideIconsForViewTabs);

createDisabledIconsButtons(comp);
createRescaleAtRuntimeCheckButton(comp);

if (currentTheme != null) {
Expand Down Expand Up @@ -235,6 +239,24 @@ private void createRescaleAtRuntimeCheckButton(Composite parent) {
}
}

private void createDisabledIconsButtons(Composite parent) {
createLabel(parent, ""); //$NON-NLS-1$
createLabel(parent, WorkbenchMessages.ViewsPreference_disabledIcons_description);

boolean initialStateIgnoreDisabledIcons = PrefUtil.getAPIPreferenceStore()
.getBoolean(IWorkbenchPreferenceConstants.IGNORE_DISABLED_ICONS);
ignoreDisabledIcons = createCheckButton(parent, WorkbenchMessages.ViewsPreference_ignoreDisabledIcons,
initialStateIgnoreDisabledIcons);
ignoreDisabledIcons.setToolTipText(WorkbenchMessages.ViewsPreference_ignoreDisabledIcons_tooltip);

boolean initialStateDesaturatedDisabledIcons = PrefUtil.getAPIPreferenceStore()
.getBoolean(IWorkbenchPreferenceConstants.USE_DESATURATED_DISABLED_ICONS);
useDesaturatedDisabledIcons = createCheckButton(parent,
WorkbenchMessages.ViewsPreference_useDesaturatedDisabledIcons, initialStateDesaturatedDisabledIcons);
useDesaturatedDisabledIcons
.setToolTipText(WorkbenchMessages.ViewsPreference_useDesaturatedDisabledIcons_tooltip);
}

private void createThemeIndependentComposits(Composite comp) {
createUseRoundTabs(comp);
createColoredLabelsPref(comp);
Expand Down Expand Up @@ -364,6 +386,10 @@ public boolean performOk() {
.getSelection();
prefs.putBoolean(PartRenderingEngine.ENABLED_THEME_KEY, themingEnabled.getSelection());
}
PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.IGNORE_DISABLED_ICONS,
ignoreDisabledIcons.getSelection());
PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.USE_DESATURATED_DISABLED_ICONS,
useDesaturatedDisabledIcons.getSelection());

boolean isRescaleAtRuntimeChanged = false;
if (rescaleAtRuntime != null) {
Expand Down Expand Up @@ -467,6 +493,10 @@ protected void performDefaults() {
}
IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore();
useColoredLabels.setSelection(apiStore.getDefaultBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS));
ignoreDisabledIcons
.setSelection(apiStore.getDefaultBoolean(IWorkbenchPreferenceConstants.IGNORE_DISABLED_ICONS));
useDesaturatedDisabledIcons
.setSelection(apiStore.getDefaultBoolean(IWorkbenchPreferenceConstants.USE_DESATURATED_DISABLED_ICONS));

useRoundTabs.setSelection(
defaultPrefs.getBoolean(CTabRendering.USE_ROUND_TABS, CTabRendering.USE_ROUND_TABS_DEFAULT));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,12 @@ ViewsPreference_enableMRU = Show &most recently used tabs
ViewsPreference_showFullTextForViewTabs = Always show full titles
ViewsPreference_hideIconsForViewTabs = Hide icons
ViewsPreference_viewTabs_icons_and_titles_label = Tab icons and titles in view areas:
ViewsPreference_disabledIcons_description = Icons for disabled actions:
ViewsPreference_ignoreDisabledIcons = Ignore pre-generated disabled icons
ViewsPreference_ignoreDisabledIcons_tooltip = When enabled ignores pre-generated disabled icons in favor of generating consistently styled disabled icons on the fly
ViewsPreference_useDesaturatedDisabledIcons = Use desaturated instead of grayscaled disabled icons
ViewsPreference_useDesaturatedDisabledIcons_tooltip = Changes the styling of disabled icons to use a desaturated icon version instead of a grayscaled one

ToggleFullScreenMode_ActivationPopup_Description=You have gone full screen. Use the Toggle Full Screen command ({0}) to deactivate.
ToggleFullScreenMode_ActivationPopup_Description_NoKeybinding=You have gone full screen. Use the Toggle Full Screen command to deactivate.
ToggleFullScreenMode_ActivationPopup_DoNotShowAgain=Do not show again
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.IMenuListener2;
Expand Down Expand Up @@ -892,7 +893,9 @@ private void updateIcons() {
localResourceManager = m;
} else if (widget instanceof ToolItem item) {
LocalResourceManager m = new LocalResourceManager(JFaceResources.getResources());
item.setDisabledImage(disabledIcon == null ? null : m.create(disabledIcon));
if (!ActionContributionItem.getIgnoreDisabledIcons()) {
item.setDisabledImage(disabledIcon == null ? null : m.create(disabledIcon));
}
item.setHotImage(hoverIcon == null ? null : m.create(hoverIcon));
item.setImage(icon == null ? null : m.create(icon));
disposeOldImages();
Expand Down
17 changes: 17 additions & 0 deletions bundles/org.eclipse.ui/src/org/eclipse/ui/internal/UIPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
package org.eclipse.ui.internal;

import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.eclipse.ui.internal.util.PrefUtil;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
Expand Down Expand Up @@ -95,8 +97,23 @@

@Override
public void savePreferences() {
UIPlugin.this.savePluginPreferences();

Check warning on line 100 in bundles/org.eclipse.ui/src/org/eclipse/ui/internal/UIPlugin.java

View check run for this annotation

Jenkins - Eclipse Platform / Compiler

Deprecation

NORMAL: The method savePluginPreferences() from the type Plugin is deprecated
}
});
initializeIconConfigurations();
}

private void initializeIconConfigurations() {
// configure disabled icons appearance
boolean ignoreDisabledIcons = PrefUtil.getAPIPreferenceStore()
.getBoolean(IWorkbenchPreferenceConstants.IGNORE_DISABLED_ICONS);
ActionContributionItem.setIgnoreDisabledIcons(ignoreDisabledIcons);

boolean useDesaturatedDisabledIcons = PrefUtil.getAPIPreferenceStore()
.getBoolean(IWorkbenchPreferenceConstants.USE_DESATURATED_DISABLED_ICONS);
if (useDesaturatedDisabledIcons) {
System.setProperty("org.eclipse.swt.image.disablement", "desaturated"); //$NON-NLS-1$ //$NON-NLS-2$
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public void initializeDefaultPreferences() {
false);

node.putBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS, true);
node.putBoolean(IWorkbenchPreferenceConstants.IGNORE_DISABLED_ICONS, true);
node.putBoolean(IWorkbenchPreferenceConstants.USE_DESATURATED_DISABLED_ICONS, true);
node.putBoolean(
IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR,
false);
Expand Down
2 changes: 1 addition & 1 deletion tests/org.eclipse.jface.tests/META-INF/MANIFEST.MF
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: %Bundle-Name
Bundle-SymbolicName: org.eclipse.jface.tests
Bundle-Version: 1.5.0.qualifier
Bundle-Version: 1.5.100.qualifier
Automatic-Module-Name: org.eclipse.jface.tests
Bundle-RequiredExecutionEnvironment: JavaSE-21
Require-Bundle: org.eclipse.jface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ protected Control createControl(Composite parent) {
@Test
public void testDefaultImageIsGray() {
boolean oldState = ActionContributionItem.getUseColorIconsInToolbars();
boolean oldStateIgnoreDisabled = ActionContributionItem.getIgnoreDisabledIcons();
try {
ActionContributionItem.setUseColorIconsInToolbars(false);
ActionContributionItem.setIgnoreDisabledIcons(false);
ToolBarManager manager = new ToolBarManager();
Action action = new Action("Button with Hover") {
};
Expand All @@ -165,14 +167,17 @@ public void testDefaultImageIsGray() {
assertImageEqualsDescriptor(ImageDescriptor.createWithFlags(descriptor, SWT.IMAGE_GRAY), item.getImage());
} finally {
ActionContributionItem.setUseColorIconsInToolbars(oldState);
ActionContributionItem.setIgnoreDisabledIcons(oldStateIgnoreDisabled);
}
}

@Test
public void testActionImagesAreSet() {
boolean oldState = ActionContributionItem.getUseColorIconsInToolbars();
boolean oldStateIgnoreDisabled = ActionContributionItem.getIgnoreDisabledIcons();
try {
ActionContributionItem.setUseColorIconsInToolbars(true);
ActionContributionItem.setIgnoreDisabledIcons(false);
ToolBarManager manager = new ToolBarManager();
Action action = new Action("Button with Hover") {
};
Expand All @@ -195,6 +200,7 @@ public void testActionImagesAreSet() {
assertImageEqualsDescriptor(disabledDescriptor, item.getDisabledImage());
} finally {
ActionContributionItem.setUseColorIconsInToolbars(oldState);
ActionContributionItem.setIgnoreDisabledIcons(oldStateIgnoreDisabled);
}
}

Expand Down
Loading