|How to Run an invisible Workbench [message #991904]
||Thu, 20 December 2012 13:02
| Kivanc Muslu
Registered: November 2010
Hi all, |
In my headless application (IApplication), at the beginning of the code, I would like to initialize a workbench (for later access to the jdt.ui and ui libraries), running the following code:
final Display display = PlatformUI.createDisplay();
PlatformUI.createAndRunWorkbench(display, new HeadlessAdvisor());
where HeadlessAdvisor is defined as:
public class HeadlessAdvisor extends WorkbenchAdvisor
// It turns out that we have to override this method, as it normally does a lot of work in the
// actual implementation (WorkbenchAdsivor). It would create a full-fledged workbench and then
// return some boolean representing whether the workbench creation was successful or not.
// However, in our case, returning 'true' just represents that for our purposes the workbench
// creation was successful, and we don't create anything.
public boolean openWindows()
public void postStartup()
// close(..) is the call that actually closes the workbench.
public void postShutdown()
// This method is called by close(..) after it completes executing, so it is the perfect
// place to put the notification back to the client.
Conceptually, I would expect this code to momentarily (very short amount of time) open a workbench and close it even before the user notices it (due to PlatformUI.getWorkbench().close()). However, for some reason, the workbench does not get closed at a zombie-like workbench is created by my application. For reference I have attached a screenshot.
So, my questions are:
1- Is there a proper way to create a headless workbench?
2- What is the logical problem in my code / understanding?
Thank you, best regards,
Powered by FUDForum
. Page generated in 0.01627 seconds