Skip to content

Fix toolbar items enabled state not updating automatically (#3953)#4073

Open
EdrilanBerisha wants to merge 5 commits into
eclipse-platform:masterfrom
EdrilanBerisha:master
Open

Fix toolbar items enabled state not updating automatically (#3953)#4073
EdrilanBerisha wants to merge 5 commits into
eclipse-platform:masterfrom
EdrilanBerisha:master

Conversation

@EdrilanBerisha

Copy link
Copy Markdown

this PR fixes: #3953

When an AbstractSourceProvider fires fireSourceChanged(), the EvaluationService contextUpdater listener was updating the legacy expression context variable but never sending REQUEST_ENABLEMENT_UPDATE_TOPIC on the event broker.

As a result, ToolBarManagerRenderer (which listens for that topic) was never notified, so toolbar items relying on custom source providers with enabledWhen expressions stayed frozen until a focus change accidentally triggered an update

Fix: send REQUEST_ENABLEMENT_UPDATE_TOPIC after each source change originating from a registered ISourceProvider (both single-variable and multi-variable variants). This makes the toolbar enablement update automatic and consistent with requestEvaluation() and the RAT updater, which already send this event.

Tests: added two regression tests to EvaluationServiceTest:

  • testSourceProviderFiresEnablementUpdateEvent: verifies that a single-variable fireSourceChanged() sends REQUEST_ENABLEMENT_UPDATE_TOPIC
  • testSourceProviderMultiVarFiresEnablementUpdateEvent: verifies the same for the multi-variable (Map) form of the source change

…latform#3953)

When an AbstractSourceProvider fires fireSourceChanged(), the EvaluationService
contextUpdater listener was updating the legacy expression context variable but
never sending REQUEST_ENABLEMENT_UPDATE_TOPIC on the event broker.

As a result, ToolBarManagerRenderer (which listens for that topic) was never
notified, so toolbar items relying on custom source providers with enabledWhen
expressions stayed frozen until a focus change accidentally triggered an update.

Fix: send REQUEST_ENABLEMENT_UPDATE_TOPIC after each source change originating
from a registered ISourceProvider (both single-variable and multi-variable
variants). This makes the toolbar enablement update automatic and consistent
with requestEvaluation() and the RAT updater, which already send this event.

Tests: added two regression tests to EvaluationServiceTest:
- testSourceProviderFiresEnablementUpdateEvent: verifies that a single-variable
  fireSourceChanged() sends REQUEST_ENABLEMENT_UPDATE_TOPIC
- testSourceProviderMultiVarFiresEnablementUpdateEvent: verifies the same for
  the multi-variable (Map) form of the source change

Fixes: eclipse-platform#3953
@eclipse-eca-validation

Copy link
Copy Markdown

Hi @EdrilanBerisha — thank you for your contribution!

The Eclipse Contributor Agreement (ECA) check has failed for this pull request due to one of the following reasons:

  • Committing user must have an Eclipse Account
  • Author must have an Eclipse Account

To resolve this, please:

  1. Sign in or create an Eclipse Foundation account: https://accounts.eclipse.org/user/eca
  2. Ensure your GitHub username is linked to your Eclipse account
  3. Complete and submit the ECA form

Once done, push a new commit (or rebase) to re-trigger the ECA validation.

If you believe you've already completed these steps, please double-check your account settings or report an issue to Eclipse Foundation Helpdesk.

Thanks again for your contribution!

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.

Toolbar items enabled state doesn't change automatically

1 participant