Skip to content

[Draw2D] Introduce a new event listener for toggling redraw events - #1676

Merged
ptziegler merged 1 commit into
eclipse-windowbuilder:masterfrom
ptziegler:draw2d-repaint-canvas2
Oct 31, 2026
Merged

ptziegler merged 1 commit into
eclipse-windowbuilder:masterfrom
ptziegler:draw2d-repaint-canvas2

Conversation

@ptziegler

Copy link
Copy Markdown
Contributor

Rather than relying on the refreshDispose and refreshed events to disable and re-enable redraw events, the canvas lock is now set and released using a generic OSGi EventHandler. Rather than introducing yet another interface, the type of event is instead described via its topic.

The problem with the previous implementation is that the refreshDispose event is fired from within the thread of the Designer, which might be either the SWT UI thread or the Swing Event Dispatcher thread. But changes to the FigureCanvas must always be done in the SWT UI thread. Rather than potentially breaking backwards compatibility by always executing said event in the SWT thread (which might also cause a deadlock when already in the Swing thread), this new event is now fired immediately before disposing the old model.

Rather than relying on the `refreshDispose` and `refreshed` events to
disable and re-enable redraw events, the canvas lock is now set and
released using a generic OSGi `EventHandler`. Rather than introducing
yet another interface, the type of event is instead described via its
topic.

The problem with the previous implementation is that the
`refreshDispose` event is fired from within the thread of the Designer,
which might be either the SWT UI thread or the Swing Event Dispatcher
thread. But changes to the `FigureCanvas` must always be done in the SWT
UI thread. Rather than potentially breaking backwards compatibility by
always executing said event in the SWT thread (which might also cause a
deadlock when already in the Swing thread), this new event is now fired
immediately before disposing the old model.
@github-actions

Copy link
Copy Markdown

Test Results

     4 files  ±0       4 suites  ±0   2h 10m 50s ⏱️ + 1m 47s
 7 022 tests ±0   6 992 ✅ +1  30 💤 ±0  0 ❌ ±0 
23 688 runs  ±0  23 592 ✅ +1  96 💤 ±0  0 ❌ ±0 

Results for commit d27dfa3. ± Comparison against base commit db8d5c7.

@ptziegler
ptziegler merged commit c20182c into eclipse-windowbuilder:master Oct 31, 2026
8 checks passed
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.

1 participant