Fixes to issue #2522 Enable Theming Checkbox
I added more functionality when the enableTheming button is selected. It would display the theme-dependent components if selected, otherwise hide them. We need to restart twice when theming is disabled.
Fixes #2522
@IamLRBA Hello,
The issue I'm trying to fix is when the user toggles the "Enable theming" button in Settings > General > Appearance, it should show/hide the selection of themes. It's counterintuitive to have to reset twice to apply the button changes.
My solution is to create separate functions to handle theme-dependent vs independent composites. In eclipse.ui.workbench/.../internal/dialogs/ViewsPreferencePage.java
createContents()
-
createEnableTheming()- when the user first opens the preference settings page, it should display the above window with the current value of the enabled-theme keythemingEnabled(on/off) -
createThemeDependentComposite()- group together the elements, such as theme and color combo dropdown and tab icons, that depend onthemingEnabledbeing selected; it will display/hide those elements when user toggles usingupdateThemingEnablement()(tacking on selectionListener tothemingEnabledbutton)
createThemeIdCombo()- move around this code (creating the theme dropdown menu) to encapsulate related functions
createThemeIndependentComposite()- group together the elements, such as buttons for round tabs, mixed font and color labels, and most recently used tabs, that don't depend onthemingEnabledbeing selected
Below is a video demonstrating how my changes resolved part of the issue:
if engine == null- the page only shows the basic buttons that do not rely onthemingEnabled, that means disablingthemingEnabledis the same as disablingengine- The
engineis needed to create the theme combo dropdown and other components that depend on theengineto be initialized - Resetting twice: (1) initialize
engineso it cangetThemes(); and (2) apply any other new changes
https://youtu.be/LdVrXZAM8zA?si=wCbBxKsdkJjCTSyg
@IamLRBA Thank you for your feedback.
In my most recent commit f241b1b, I removed the private global themeDependentComp variable, instead, I declared and initialized it in the createThemeDependentComposite method. So it is not referenced elsewhere in the class beyond that method.
- The variable is used inside
createThemeDependentComposite, serving as a container for UI elements related to theme-dependent settings. - It affects the UI, in which its visibility and layout depend on
updateThemingEnablement, controlling whether thethemeDependentCompsection is visible based on the state ofthemingEnabled.
@vogella: Can you provide some input why up to now these two restarts are necessary?