]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed ResourceEditorSupport.scheduleEditorClose wrong thread invocation 72/672/2
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 3 Jul 2017 15:44:05 +0000 (18:44 +0300)
committerJani Simomaa <jani.simomaa@semantum.fi>
Mon, 3 Jul 2017 18:47:56 +0000 (21:47 +0300)
Now using safer means to gain access to an editor's containing shell
than previously.

refs #7349

Change-Id: I0c5ff9711703608fd34a17cc474ed9490e5ab4d5

bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorSupport.java

index 4075e1e11efaec0a6b3161db1bf9cf2b3f67bdba..80e0393cf42e6da121ed96f0e016d5cbf4b836b7 100644 (file)
@@ -311,7 +311,9 @@ public class ResourceEditorSupport implements IAdaptable, ChangeListener {
     }
 
     private static void scheduleEditorClose(IEditorPart editorPart) {
     }
 
     private static void scheduleEditorClose(IEditorPart editorPart) {
-        SWTUtils.asyncExec(editorPart.getSite().getShell(), () -> {
+        if (editorPart == null)
+            return;
+        SWTUtils.asyncExec(editorPart.getSite().getWorkbenchWindow().getShell(), () -> {
             // Don't have to check isDisposed since closeEditor
             // will ignore already closed editor parts.
             WorkbenchUtils.closeEditor(editorPart, false);
             // Don't have to check isDisposed since closeEditor
             // will ignore already closed editor parts.
             WorkbenchUtils.closeEditor(editorPart, false);