Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Viewer] Investigate asynchronous loading of the editor #20

Open
CamilleLetavernier opened this issue Oct 12, 2018 · 4 comments
Open

[Viewer] Investigate asynchronous loading of the editor #20

CamilleLetavernier opened this issue Oct 12, 2018 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@CamilleLetavernier
Copy link
Collaborator

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.

@CamilleLetavernier CamilleLetavernier added the enhancement New feature or request label Oct 12, 2018
@CamilleLetavernier
Copy link
Collaborator Author

A ticket has been created for GEF Gestures:

545407: Gestures do not support scene changes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=545407

and a PullRequest has been proposed

Unlike what I tried in my first approach, the Gestures are still initialized with the domain; but they listen to scene changes (And support initial null scenes); which is more convenient & reliable than postponing the initialization of Gestures.

@CamilleLetavernier CamilleLetavernier self-assigned this Mar 18, 2019
@CamilleLetavernier
Copy link
Collaborator Author

The pull request has been accepted & merged to master; it will be available in 2019-06. Once this is done, I can update my branch to integrate this & start the viewer in the background

@CamilleLetavernier
Copy link
Collaborator Author

Performances didn't seem as good as expected (It still took quite some time to attach the diagram to the scene, partially defeating the purpose of background initialization), but this might be caused by https://bugs.openjdk.java.net/browse/JDK-8193445 (https://bugs.openjdk.java.net/browse/JDK-8151756)

Fortunately, the recent version of E(fx)clipse provides a workaround for that (eclipse-efx/efxclipse-rt#340), so we might be able to integrate this for 2019-06

@CamilleLetavernier
Copy link
Collaborator Author

CamilleLetavernier commented Dec 4, 2019

https://bugs.openjdk.java.net/browse/JDK-8193445

A proper performance fix has been pushed on OpenJFX master, and has even been backported on Oracle JDK8 (>= u251):

openjdk/jfx#34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant