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

0 files   -    852  0 suites   - 852   0s ⏱️ - 57m 37s
0 tests  -  7 894  0 ✅  -  7 649  0 💤  - 243  0 ❌  - 2 
0 runs   - 20 184  0 ✅  - 19 527  0 💤  - 655  0 ❌  - 2 

Results for commit d5a9ae8. ± Comparison against base commit 357b87c.

♻️ 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 from 9df0418 to 8a5381a Compare April 12, 2026 18:07
@vogella vogella force-pushed the style-workspace-launcher-theme branch 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
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