eclipse.platform.ui icon indicating copy to clipboard operation
eclipse.platform.ui copied to clipboard

Fixes to issue #2522 Enable Theming Checkbox

Open mai-tran-03 opened this issue 1 year ago • 3 comments

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

mai-tran-03 avatar Dec 10 '24 05:12 mai-tran-03

@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.

image

My solution is to create separate functions to handle theme-dependent vs independent composites. In eclipse.ui.workbench/.../internal/dialogs/ViewsPreferencePage.java

createContents()

  1. createEnableTheming() - when the user first opens the preference settings page, it should display the above window with the current value of the enabled-theme key themingEnabled (on/off)

  2. createThemeDependentComposite() - group together the elements, such as theme and color combo dropdown and tab icons, that depend on themingEnabled being selected; it will display/hide those elements when user toggles using updateThemingEnablement() (tacking on selectionListener to themingEnabled button)

  • createThemeIdCombo() - move around this code (creating the theme dropdown menu) to encapsulate related functions
image
  1. 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 on themingEnabled being selected
image

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 on themingEnabled, that means disabling themingEnabled is the same as disabling engine
  • The engine is needed to create the theme combo dropdown and other components that depend on the engine to be initialized
  • Resetting twice: (1) initialize engine so it can getThemes(); and (2) apply any other new changes

https://youtu.be/LdVrXZAM8zA?si=wCbBxKsdkJjCTSyg

mai-tran-03 avatar Mar 01 '25 23:03 mai-tran-03

@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 the themeDependentComp section is visible based on the state of themingEnabled.

mai-tran-03 avatar Mar 02 '25 00:03 mai-tran-03

@vogella: Can you provide some input why up to now these two restarts are necessary?

BeckerWdf avatar Mar 04 '25 07:03 BeckerWdf