From 98ff2aa8d6b8487c882e3e24fd73ce80284ecc53 Mon Sep 17 00:00:00 2001 From: Matthias Becker Date: Tue, 29 Oct 2024 10:28:52 +0100 Subject: [PATCH] CSS: Allow Color And Font Definitions To Be Marked As Not Editable Color and Fonts can be defined as not editable if done via the extensions point. Provide the same possibility if they are defined via CSS. --- bundles/org.eclipse.e4.ui.css.swt/plugin.xml | 1 + .../CSSPropertyThemeElementDefinitionHandler.java | 6 ++++++ .../swt/definition/IThemeElementDefinitionOverridable.java | 2 ++ .../org/eclipse/ui/internal/themes/ColorDefinition.java | 6 ++++++ .../org/eclipse/ui/internal/themes/FontDefinition.java | 6 ++++++ 5 files changed, 21 insertions(+) diff --git a/bundles/org.eclipse.e4.ui.css.swt/plugin.xml b/bundles/org.eclipse.e4.ui.css.swt/plugin.xml index 5a16ca7c001..1ad4315b24f 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/plugin.xml +++ b/bundles/org.eclipse.e4.ui.css.swt/plugin.xml @@ -494,6 +494,7 @@ + bundleToResourceBundles = new WeakHashMap<>(); @Override @@ -65,6 +67,10 @@ public boolean applyCSSProperty(Object element, String property, case DESCRIPTION_PROP: definition.setDescription(getLabel(value)); break; + case EDITABLE_PROP: + Boolean editable = (Boolean) engine.convert(value, Boolean.class, null); + definition.setEditable(editable); + break; default: return false; } diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/definition/IThemeElementDefinitionOverridable.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/definition/IThemeElementDefinitionOverridable.java index 2d7c5424930..37c041e471d 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/definition/IThemeElementDefinitionOverridable.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/definition/IThemeElementDefinitionOverridable.java @@ -27,4 +27,6 @@ public interface IThemeElementDefinitionOverridable { void setName(String name); void setDescription(String description); + + void setEditable(Boolean editable); } diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/themes/ColorDefinition.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/themes/ColorDefinition.java index 3a5fcb2b7a8..35e00089bc6 100644 --- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/themes/ColorDefinition.java +++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/themes/ColorDefinition.java @@ -155,4 +155,10 @@ public void setValue(RGB data) { appendState(State.OVERRIDDEN); } } + + @Override + public void setEditable(Boolean editable) { + isEditable = editable; + } + } diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/themes/FontDefinition.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/themes/FontDefinition.java index 71c92d402a8..a1d1b077198 100644 --- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/themes/FontDefinition.java +++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/themes/FontDefinition.java @@ -138,4 +138,10 @@ public void setValue(FontData[] data) { appendState(State.OVERRIDDEN); } } + + @Override + public void setEditable(Boolean editable) { + isEditable = editable; + } + }