From: Tuukka Lehtonen Date: Mon, 3 Jul 2017 15:44:05 +0000 (+0300) Subject: Fixed ResourceEditorSupport.scheduleEditorClose wrong thread invocation X-Git-Tag: v1.31.0~280 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=39f3d69b2eab08207248a4f00ed6159084326fe0 Fixed ResourceEditorSupport.scheduleEditorClose wrong thread invocation Now using safer means to gain access to an editor's containing shell than previously. refs #7349 Change-Id: I0c5ff9711703608fd34a17cc474ed9490e5ab4d5 --- diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorSupport.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorSupport.java index 4075e1e11..80e0393cf 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorSupport.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorSupport.java @@ -311,7 +311,9 @@ public class ResourceEditorSupport implements IAdaptable, ChangeListener { } 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);