Skip to content

Resolve CSS color and font definitions without the workbench - #4449

Open
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:lv/color-font-provider-npe
Open

vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:lv/color-font-provider-npe

Conversation

@vogella

@vogella vogella commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

The CSS engine resolved color and font definition references ('#org-eclipse-...') only through a DS service in org.eclipse.ui.workbench that read the current workbench theme. In e4 applications that have that bundle on the runtime but no Workbench, for example through the E4 spies, every such CSS value failed with a NullPointerException, filling the log with hundreds of "Failed to apply CSS property" entries during startup. This change moves the lookup into org.eclipse.e4.ui.css.swt, backed by the JFace color and font registries, which the workbench already keeps in sync with its current theme, so the IDE resolves the same values as before and pure e4 applications can resolve definitions they register in JFace. A definition that cannot be resolved is now treated like unset, so the widget keeps its default color instead of turning black. This is also a step toward using the IDE themes in RCP applications.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

   864 files  ± 0     864 suites  ±0   48m 38s ⏱️ +11s
 8 418 tests +15   8 176 ✅ +15  242 💤 ±0  0 ❌ ±0 
21 123 runs  +45  20 446 ✅ +45  677 💤 ±0  0 ❌ ±0 

Results for commit 572b025. ± Comparison against base commit cdf21e3.

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unregistered override services remain cached, preventing restoration of the JFace-backed fallback.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Moves CSS color/font resolution from the workbench to JFace-backed CSS infrastructure, enabling pure e4 applications.

Changes:

  • Adds a JFace registry-backed default provider.
  • Treats unresolved color definitions like unset.
  • Adds coverage for theme resolution and unresolved colors.
File Description
JFaceThemeTest.java Tests current-theme registry resolution.
ColorDefinitionTest.java Tests unresolved color behavior.
org.eclipse.ui.workbench/​META-INF/​MANIFEST.MF Removes the workbench provider component.
JFaceColorAndFontProvider.java Implements JFace-backed resolution.
ColorAndFontUtil.java Adds default-provider fallback.
CSSValueSWTColorConverterImpl.java Returns null for unresolved definitions.
CSSSWTColorHelper.java Detects unresolved color definitions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@vogella
vogella force-pushed the lv/color-font-provider-npe branch from 01269d7 to 9c3bdda Compare October 7, 2026 09:30
@vogella
vogella requested a balanced review from Copilot October 7, 2026 09:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The moved implementation incorrectly removes its original IBM copyright and contributor attribution.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@vogella
vogella force-pushed the lv/color-font-provider-npe branch 7 times, most recently from 14662dc to 28e3686 Compare October 7, 2026 12:26
@vogella
vogella requested a balanced review from Copilot October 7, 2026 12:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Some custom color handlers retain stale styling when the converter returns an unresolved value.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

Comment on lines +47 to +49
if (CSSSWTColorHelper.isUnresolvedColorDefinition(value)) {
// treated like unset, so the widget keeps its default color instead of black
return null;
@vogella
vogella force-pushed the lv/color-font-provider-npe branch from 28e3686 to 4b91688 Compare October 8, 2026 09:41
The IColorAndFontProvider used by the CSS engine was a DS service in
org.eclipse.ui.workbench that read the current workbench theme. In e4
applications that have org.eclipse.ui.workbench on the runtime but no
Workbench, for example through the E4 spies, every CSS value referencing
a color or font definition failed with a NullPointerException. Without
that bundle, no provider existed at all.

The CSS engine now falls back to the JFace color and font registries,
which the workbench keeps in sync with its current theme, so the
workbench service is no longer needed. The workbench updates the JFace
registries before it notifies theme listeners, so they see the new
theme's values.

A color, font or gradient definition that cannot be resolved is treated
like unset, so the widget keeps its own color and font instead of
turning black, switching to the default font or failing to paint.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@vogella
vogella force-pushed the lv/color-font-provider-npe branch from 4b91688 to 572b025 Compare October 8, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants