Headless Eclipse/E4 Applications? [message #1772207] |
Wed, 06 September 2017 11:31  |
Eclipse User |
|
|
|
Hello everyone,
together with two colleagues I'm working on migrating a Java application to OSGI/Equinox. We are interested in also using Eclipse RCP/E4 technology, especially p2 update sites, and reusing some GUI elements like for example the property dialog from eclipse would also be of interest.
One possible problem: Our application can be switched to different modes - an end user application mode with a (currently Swing-based) graphical user interface, but also different background service modes with limited (tray icon) or no visualization.
Now the main idea of Eclipse RCP/E4 obviously is developing graphical applications. Is it also possible to run Eclipse-based Applications without a graphical user interface, or at least to use parts of the framework - like p2 update sites - in applications that come without a workbench etc.? Or are we limited to pure OSGI when working without a GUI?
Thank you very much and best regards,
Nils
|
|
|
|
|
Re: Headless Eclipse/E4 Applications? [message #1773113 is a reply to message #1772980] |
Thu, 21 September 2017 14:11  |
Eclipse User |
|
|
|
Think of the Eclipse IApplication class as a fancy main(): they're just entry points. You can have multiple entry points, and they can do SWT and AWT, providing you respect their threading requirements.
SWT and AWT/Swing can be combined in the same app providing you respect these threading requirements. Both SWT and Swing/AWT require that UI work is done on a particular thread; actions from other threads will result in exceptions. AWT allows you to use any particular thread, whereas SWT usually requires the SWT thread to be the first thread (the "main" thread). One risk of combining SWT and AWT is deadlock, especially if you have callbacks from one trigger work on the other (which is fairly common). Tom Schindl discovered that there's a way to run SWT and AWT on the same thread in Java 8, which greatly helps alleviate that problem.
On the other hand, your p2 work can be run from any thread.
So you could have a single IApplication that does some further dispatch internally.
|
|
|
Powered by
FUDForum. Page generated in 0.30423 seconds