Skip to content

Style workspace selection dialog with default theme setting#3855

Open
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:style-workspace-launcher-theme
Open

Style workspace selection dialog with default theme setting#3855
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:style-workspace-launcher-theme

Conversation

@vogella
Copy link
Copy Markdown
Contributor

@vogella vogella commented Apr 2, 2026

This PR implements the option to style the workspace selection dialog using the default theme setting.

It includes:

  • Early theme initialization in IDEApplication.start()
  • Automatic shell styling for all shells shown via a Display listener
  • Explicit styling for ChooseWorkspaceDialog in IDEApplication

@vogella vogella force-pushed the style-workspace-launcher-theme branch 2 times, most recently from ff02108 to 2e637fb Compare April 2, 2026 13:06
Job.getJobManager().suspend();

Display display = createDisplay();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please once done, extract into a protected method, so whoever extends this (non API, I know) application can overwrite the code if needed.

@vogella vogella force-pushed the style-workspace-launcher-theme branch from 2e637fb to 61773fa Compare April 2, 2026 13:19
@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Apr 2, 2026

Fixed a crash introduced in the previous version of this commit.

The original code called PartRenderingEngine.initializeStyling() before the workspace picker is shown. That method internally accesses InstanceScope preferences, which requires the workspace location to be set — causing an IllegalStateException.

The fix uses IThemeManager.getEngineForDisplay() + IThemeEngine.setTheme() directly instead (the same pattern used by BootstrapTheme3x). This activates the CSS theme engine without touching instance-scoped preferences, so it works safely before workspace selection.

Also fixed: OSGi service reference now released via ungetService() in a finally block, and the org.eclipse.e4.ui.workbench.swt bundle dependency (which exposed internal API) is removed.

@vogella vogella force-pushed the style-workspace-launcher-theme branch from 61773fa to aa8df91 Compare April 2, 2026 13:43
@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Apr 2, 2026

Updated approach: dropped the CSS theme engine for the workspace dialog entirely.

The dark theme CSS uses symbolic color variables (#org-eclipse-ui-workbench-DARK_BACKGROUND etc.) that are resolved via ColorAndFontProviderImpl, which calls Workbench.getInstance().getThemeManager(). Since Workbench.getInstance() is null before the workbench starts, these colors can never resolve at this stage — so CSS styling of the pre-workspace dialog is not feasible.

New approach: if the configured theme ID contains "dark", directly set SWT colors on the dialog's widget tree using the literal RGB values from the dark theme CSS (#48484c background, #eeeeee foreground). Colors are allocated once on the shell and disposed via a DisposeListener.

@vogella vogella force-pushed the style-workspace-launcher-theme branch from aa8df91 to 175f350 Compare April 2, 2026 13:45
@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Apr 2, 2026

First iteration:

image

@vogella vogella force-pushed the style-workspace-launcher-theme branch from 175f350 to ae04fe3 Compare April 2, 2026 13:59
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Test Results

   852 files  ±0     852 suites  ±0   54m 32s ⏱️ - 5m 29s
 7 894 tests ±0   7 651 ✅ ±0  243 💤 ±0  0 ❌ ±0 
20 184 runs  ±0  19 529 ✅ ±0  655 💤 ±0  0 ❌ ±0 

Results for commit 02754cf. ± Comparison against base commit f22f75c.

♻️ This comment has been updated with latest results.

@vogella vogella force-pushed the style-workspace-launcher-theme branch from ae04fe3 to 9388e35 Compare April 2, 2026 16:37
@vogella vogella force-pushed the style-workspace-launcher-theme branch from 9388e35 to f8d5fb0 Compare April 2, 2026 16:44
@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Apr 2, 2026

Getter better:

image

@vogella vogella force-pushed the style-workspace-launcher-theme branch 3 times, most recently from 4dd9659 to 9df0418 Compare April 8, 2026 07:44
@vogella vogella force-pushed the style-workspace-launcher-theme branch 2 times, most recently from 8a5381a to d5a9ae8 Compare April 12, 2026 18:09
@vogella vogella marked this pull request as ready for review April 12, 2026 18:10
@vogella vogella force-pushed the style-workspace-launcher-theme branch 4 times, most recently from 27ca452 to f0f8ff3 Compare April 13, 2026 16:02
Read the default theme from UserScope, scoped by product or application
ID
(falling back to the base node for backwards compatibility), to
determine
whether dark mode should be applied before the workbench starts.

Apply dark styling to the workspace selection dialog
(ChooseWorkspaceDialog
and ChooseWorkspaceWithSettingsDialog) by setting shell
background/foreground
colors and propagating them recursively to child controls. Link
foreground
is set via JFaceColors.getHyperlinkText() for correct theme-aware
coloring.

The ExpandableComposite title bar foreground is explicitly set to match
the
parent composite foreground so it remains readable in both light and
dark themes.

After the workspace selection dialog reset early dark theme styling
before the workbench starts the ThemeEngine will apply the correct theme
from here on.
@vogella vogella force-pushed the style-workspace-launcher-theme branch from f0f8ff3 to 02754cf Compare April 13, 2026 17:35
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