From 9eb877587ade0d3b86b018a91d41ad642d193f69 Mon Sep 17 00:00:00 2001
From: Phillipus
Date: Thu, 12 Sep 2024 15:53:24 +0100
Subject: [PATCH] [GEF] New fix for SWTException "Widget is disposed" when
displaying a Tooltip
- The fix in 42f4319e6b27eed6ad48300e290fea820447353f caused a regression on Linux Wayland
- See https://github.com/archimatetool/archi/issues/1076
- See https://github.com/eclipse/gef-classic/issues/469
---
.../src/org/eclipse/draw2d/PopUpHelper.java | 9 +--------
.../src/org/eclipse/draw2d/SWTEventDispatcher.java | 12 +++++++++++-
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/org.eclipse.draw2d/src/org/eclipse/draw2d/PopUpHelper.java b/org.eclipse.draw2d/src/org/eclipse/draw2d/PopUpHelper.java
index 5e357070e..30f2f597f 100644
--- a/org.eclipse.draw2d/src/org/eclipse/draw2d/PopUpHelper.java
+++ b/org.eclipse.draw2d/src/org/eclipse/draw2d/PopUpHelper.java
@@ -84,14 +84,7 @@ protected LightweightSystem createLightweightSystem() {
* @since 2.0
*/
protected Shell createShell() {
- // Phillipus changed this.
- // If a workbench part is detached and a tooltip is initially displayed, when the part is re-attached
- // the parent Shell is disposed which in turn disposes of the PopupHelper's Shell.
- // This will lead to an SWT Error when the Shell is accessed again.
- // To fix this, create the PopupHelper Shell with the Control's Display instead of its Shell.
-
- //return new Shell(control.getShell(), shellStyle);
- return new Shell(control.getDisplay(), shellStyle);
+ return new Shell(control.getShell(), shellStyle);
}
/**
diff --git a/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTEventDispatcher.java b/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTEventDispatcher.java
index 2a35e2e4e..8134c6c7a 100644
--- a/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTEventDispatcher.java
+++ b/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTEventDispatcher.java
@@ -335,8 +335,18 @@ protected IFigure getCursorTarget() {
* @return the ToolTipHelper
*/
protected ToolTipHelper getToolTipHelper() {
- if (toolTipHelper == null)
+ // Phillipus changed this.
+ // If a workbench part is detached and a tooltip is initially displayed, when the part is re-attached
+ // the parent Shell is disposed which in turn disposes of the PopupHelper's Shell.
+ // This will lead to an SWT Error when the Shell is accessed again.
+ // To fix this, if the ToolTipHelper's shell is disposed return a new one
+
+ //if (toolTipHelper == null)
+ // toolTipHelper = new ToolTipHelper(control);
+
+ if(toolTipHelper == null || (toolTipHelper != null && toolTipHelper.getShell().isDisposed())) {
toolTipHelper = new ToolTipHelper(control);
+ }
return toolTipHelper;
}