Style workspace selection dialog with default theme setting#3855
Conversation
ff02108 to
2e637fb
Compare
2e637fb to
61773fa
Compare
|
Fixed a crash introduced in the previous version of this commit. The original code called The fix uses Also fixed: OSGi service reference now released via |
61773fa to
aa8df91
Compare
|
Updated approach: dropped the CSS theme engine for the workspace dialog entirely. The dark theme CSS uses symbolic color variables ( 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 ( |
aa8df91 to
175f350
Compare
175f350 to
ae04fe3
Compare
ae04fe3 to
9388e35
Compare
9388e35 to
f8d5fb0
Compare
4dd9659 to
9df0418
Compare
8a5381a to
d5a9ae8
Compare
02754cf to
37c8419
Compare
37c8419 to
49199aa
Compare
|
Test in a local Eclipse SDK build and I do not see any issues with it. Planning to merge today |
There was a problem hiding this comment.
Pull request overview
This PR adds early/default-theme-aware styling so the workspace selection UI (and other pre-workbench shells) can be styled consistently before the main ThemeEngine takes over.
Changes:
- Initialize and apply a “default theme” (dark) preference early in
IDEApplication.start(), including a temporarySWT.Showlistener to style shells before workbench startup. - Explicitly style
ExpandableCompositeandLinkcontrols in workspace selection dialogs to improve dark-mode appearance. - Update theme engine and bundle manifests to support/enable the behavior (including a newer SWT requirement in the theme bundle).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/ChooseWorkspaceWithSettingsDialog.java | Sets ExpandableComposite title/toggle colors to align with the dialog foreground. |
| bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/ChooseWorkspaceDialog.java | Styles recent-workspaces ExpandableComposite twistie/title colors and sets link foreground. |
| bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java | Adds early theme detection, temporary global shell styling, and explicit styling hook for the workspace dialog. |
| bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF | Adds org.eclipse.ui.forms dependency used by new styling logic. |
| bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java | Updates display dark-preference whenever the theme changes. |
| bundles/org.eclipse.e4.ui.css.swt.theme/META-INF/MANIFEST.MF | Raises the required SWT bundle version range. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| private void applyDarkStyles(Shell shell) { | ||
| Color bg = new Color(shell.getDisplay(), 72, 72, 76); // #48484c |
There was a problem hiding this comment.
Please use "modern" Color constructors like new Color(72, 72, 76)
There was a problem hiding this comment.
| if (productOrAppId != null) { | ||
| defaultThemeId = themeNode.node(productOrAppId).get("themeid", null); //$NON-NLS-1$ | ||
| } | ||
| if (defaultThemeId == null) { |
There was a problem hiding this comment.
should if (defaultThemeId == null) be inside the "else" branch of the product?
Means, if product never defined the theme, now it can change the theme used because some other Eclipse based application defined the theme?
| if (defaultThemeId == null) { | ||
| defaultThemeId = themeNode.get("themeid", null); //$NON-NLS-1$ | ||
| } | ||
| isDark = defaultThemeId != null && defaultThemeId.contains("dark"); //$NON-NLS-1$ |
There was a problem hiding this comment.
defaultThemeId.contains("dark") seem to match only default theme id.
If product defines theme "com.my.product.themeid", there is not necessarily "dark" in the id but the theme can be "dark".
Ideally this could be extracted to a protected boolean isDarkTheme(String themeId)
There was a problem hiding this comment.
That is currently the way the theme engine detects a dark theme. We can make this more flexible here but the rest of theming engine will just look for the "dark" string so that would make this not aligned with the rest of the theming.
There was a problem hiding this comment.
That is currently the way the theme engine detects a dark theme
OMG
There was a problem hiding this comment.
The theming code is a pleasure to look at. Tons of unused abstraction in lots of places and lots of hard coded values in others.
756a862 to
ccb3003
Compare
Given the fact that that "theming" is different on different platforms, it would be good if at least Windows & Mac behavior could be verified for this change upfront. I've checked Linux with no themes and it seem to not break this use case. For the rest I don't have time. |
When the user's preferred theme is dark, apply dark styling to the workspace selection dialog before the workbench and its ThemeEngine start up. This ensures the dialog matches the IDE theme even at first launch. Styling is applied in two passes: - A display-level SWT.Show listener as an early pass when the shell first appears. - In createContents() after all dialog controls are constructed, to catch dynamically created widgets not yet present at SWT.Show time. Color objects use the modern display-free Color(r, g, b) constructor rather than the deprecated Color(Display, r, g, b) form.
ccb3003 to
6ef3929
Compare






This PR applies the user's preferred theme to the workspace selection dialog before the workbench and its ThemeEngine start up, so the dialog matches the IDE theme even at first launch.
Implementation:
initializeDefaultTheme()reads the theme preference scoped to the current product or application ID (with no cross-product fallback — if no product ID is present, the generic preference is used)SWT.Showlistener applies dark styles to any shell as it appearscreateContents()in theChooseWorkspaceDialogsubclass applies styles a second time after all controls are constructed, catching widgets not yet present atSWT.ShowtimeresetEarlyDarkTheme()before the workbench starts so the ThemeEngine manages the theme from that point onColorobjects use the modern display-freeColor(r, g, b)constructor