Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLSP-1371: Introduce event for focus changes #380

Merged
merged 1 commit into from
Jul 17, 2024
Merged

Conversation

tortmayr
Copy link
Contributor

What it does

How to test

Follow-ups

Changelog

  • This PR should be mentioned in the changelog
  • This PR introduces a breaking change (if yes, provide more details below for the changelog and the migration guide)

- Add `onFocusChanged` event to focus tracker and also expose it via EditorContextService
- Update documentation on `EditorContextService`. Also expose `onSelectionChanged` event via `EditorContextService` => `EditorContextService` becomes the central component to register for (most) GLSP event listeners
Part of eclipse-glsp/glsp#1371
tortmayr added a commit to eclipse-glsp/glsp-theia-integration that referenced this pull request Jul 17, 2024
Switch from `onDidChangeActiveWidget` event to `onFoucsChanged` event for restoring the diagram selection.
Reason: The `TheiaSelectionForwarder` is bound once per diagram widget.
By using the `onDidChangeActiveWidget` event we notified and updated all forwarders of all widgets. As a consequence a wrong i.e. currently inactive widget could set the last selection in the selection service

With using the `onFocusChanged` event we can now only update the selection if the diagram currently has focus.

Requires eclipse-glsp/glsp-client#380

Fixes eclipse-glsp/glsp#1371
tortmayr added a commit to eclipse-glsp/glsp-theia-integration that referenced this pull request Jul 17, 2024
Switch from `onDidChangeActiveWidget` event to `onFoucsChanged` event for restoring the diagram selection.
Reason: The `TheiaSelectionForwarder` is bound once per diagram widget.
By using the `onDidChangeActiveWidget` event we notified and updated all forwarders of all widgets. As a consequence a wrong i.e. currently inactive widget could set the last selection in the selection service

With using the `onFocusChanged` event we can now only update the selection if the diagram currently has focus.

Requires eclipse-glsp/glsp-client#380

Fixes eclipse-glsp/glsp#1371
tortmayr added a commit to eclipse-glsp/glsp-theia-integration that referenced this pull request Jul 17, 2024
Switch from `onDidChangeActiveWidget` event to `onFoucsChanged` event for restoring the diagram selection.
Reason: The `TheiaSelectionForwarder` is bound once per diagram widget.
By using the `onDidChangeActiveWidget` event we notified and updated all forwarders of all widgets. As a consequence a wrong i.e. currently inactive widget could set the last selection in the selection service

With using the `onFocusChanged` event we can now only update the selection if the diagram currently has focus.

Requires eclipse-glsp/glsp-client#380

Fixes eclipse-glsp/glsp#1371
@tortmayr tortmayr requested a review from planger July 17, 2024 16:07
@tortmayr tortmayr merged commit 89dfe80 into master Jul 17, 2024
6 checks passed
@tortmayr tortmayr deleted the tortmayr/issues/1371 branch July 17, 2024 21:55
tortmayr added a commit to eclipse-glsp/glsp-theia-integration that referenced this pull request Jul 17, 2024
Switch from `onDidChangeActiveWidget` event to `onFoucsChanged` event for restoring the diagram selection.
Reason: The `TheiaSelectionForwarder` is bound once per diagram widget.
By using the `onDidChangeActiveWidget` event we notified and updated all forwarders of all widgets. As a consequence a wrong i.e. currently inactive widget could set the last selection in the selection service

With using the `onFocusChanged` event we can now only update the selection if the diagram currently has focus.

Requires eclipse-glsp/glsp-client#380

Fixes eclipse-glsp/glsp#1371
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants