Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-scripting-dev] Running on UI Thread

> When trying to run the script from https://git.eclipse.org/c/e4/org.eclipse.e4.scripting.git/tree/Plugins/engines/org.eclipse.ease.lang._javascript_.examples/samples/scripts/Hello__Ward.js

A script to accomplish this would currently look like this:

loadModule('/System/UI');
showInfoDialog("Title", "Hello world");

>That script's code comments mention * This script need to be run into the UI (see Thread metadata).}
>So my question is: where can I see the Thread metadata  :)

The script metadata is located in the script header comment. One of them is "Thread: UI" which indicates this script to be executed in the context of the UI thread. While the framework in principle supports this feature, it is extremely dangerous and therefore currently disabled. When running in UI there is no means to stop the script, so a wild running or stalled script would kill your running eclipse instance.

Therefore we tried to do all UI related stuff from the java modules by using Display.getDefault().[a]syncExec():

see https://git.eclipse.org/c/e4/org.eclipse.e4.scripting.git/tree/Plugins/modules/org.eclipse.ease.module.platform/src/org/eclipse/ease/module/platform/UIModule.java

Christian


Back to the top