eclipsesource / eclipsesource/papyrus-gefx
[Viewer] Investigate asynchronous loading of the editor
- Dominant language
- Java
- Stars
- 0
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Unlike SWT, JavaFX supports creating a Node tree outside of the UI Thread. FX Thread is only required when manipulating nodes that already belong to a Scene.
It should be possible to load a diagram in a background thread (While presenting a progress bar in the UI thread), and only attach the diagram to the scene once it's been initialized (i.e. When the initial content part hierarchy has been built). This way, only the initial rendering would freeze the UI, which may be significant for medium/large diagrams.
Early experiments on this topic show that GEF requires the Viewer to be attached to a Scene before it is rendered. However, this is only required because Gestures attach event listeners to the Scene. It is possible to slightly delay Gestures initialization, i.e. replace:
- Attach scene
- Initialize viewer
- Initialize gestures
With:
- Initialize viewer
- Attach scene
- Initialize gestures
However this requires changes in GEF (Or to override/replace the default GEF Viewer and Gestures initialization, but it would probably be better & easier to just patch GEF directly).
A few bugs remain with this approach (Maybe related to the FX-in-SWT integration, or some bugs somewhere in the JavaFX/GEF/PapyrusFX stack - the exceptions were inconsistent), especially in the refreshVisuals() methods. I didn't investigate this much further, but I mostly got it working by skipping refreshVisuals() in the initialization phase, and only calling it after the Viewer is attached to a Scene.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.