Summary: | EditingSession.closeEditor() should work even when called from a non-UI thread | ||
---|---|---|---|
Product: | [Modeling] Sirius | Reporter: | Arthur Daussy <arthur.daussy> |
Component: | Core | Assignee: | Project inbox <sirius.core-inbox> |
Status: | NEW --- | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | arthur.daussy_ssii, laurent.fasani, pierre-charles.david |
Version: | 4.0.0 | Keywords: | triaged |
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
See Also: | https://git.eclipse.org/r/76617 | ||
Whiteboard: |
Description
Arthur Daussy
2016-06-23 12:02:40 EDT
I could effectively add a guard condition to avoid the NPE but it would be interesting to understand the what is done i the context of your scenario to check that everything is handled correctly. It seems to be the a use case close to the one in Bug 496667 and here too I would be grateful if you could provide the elements (scenario or/and data) to reproduce this bug so that I can check the fix and create a junit test. (In reply to Laurent Fasani from comment #1) > I could effectively add a guard condition to avoid the NPE We don't want as simple guard, at least not in the sense "if (inUIthread()) {...}". We would avoid the NPE, but if it means not doing what the method is expected to do and returning silently as if everything was fine, its worse than the NPE. Depending on the calling context, either the client code should be in the UI thread or (more probably given the stack visible above), actually make sure what needs to be called in the UI thread is called in the UI thread. In the standard (non-fallback) case, we do DialectUIManager.INSTANCE.closeEditor(editor, save), which ends up calling org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.close(boolean), which ensures the final getSite().getPage().closeEditor() call is done in the UI thread. We should do something similar in our fallback case. See https://git.eclipse.org/r/#/c/76617/ for a completly untested draft. New Gerrit change created: https://git.eclipse.org/r/76617 |