eclipse / epsilon

Epsilon is a family of Java-based scripting languages for automating common model-based software engineering tasks, such as code generation, model-to-model transformation and model validation, that work out of the box with EMF (including Xtext and Sirius), UML (including Cameo/MagicDraw), Simulink, XML and other types of models.
https://eclipse.org/epsilon
Eclipse Public License 2.0
53 stars 11 forks source link

Picto can hang up the Eclipse UI if view takes some time to render #71

Closed agarciadom closed 5 months ago

agarciadom commented 5 months ago

A user reported that Picto would block the Eclipse UI while rendering the view. This is usually not a problem in most cases, as the local neighbourhoods that Picto usually displays shouldn't take long to render, but it can be an issue if the rendering uses an external tool which renders complex images (e.g. by calling the PlantUML libraries, which in turn spawns Graphviz processes).

I was able to reproduce the issue with this EGL script with a Thread.sleep:

[%
  // Simulates a slow EGL script
  var thread = new Native('java.lang.Thread');
  thread.currentThread().sleep(20000);
%]

<ol>
[% for (i in 1.to(10)) { %]
<li>line [%=i%]</li>
[% } %]
</ol>

We should refactor the code so the view rendering takes place mostly in a background job, and we only dip into the UI thread to show the rendered content. We already something like this for the EGX script which computes the tree, but not for EGL: any call to view.getContent() will trigger the execution of the EGL script if it hasn't been run already.