Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to Run an invisible Workbench
How to Run an invisible Workbench [message #991904] Thu, 20 December 2012 13:02
Kivanc Muslu is currently offline Kivanc MusluFriend
Messages: 153
Registered: November 2010
Senior Member
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
{

    public HeadlessAdvisor()
    {}

    @Override
    public @Nullable
    String getInitialWindowPerspectiveId()
    {
        return null;
    }

    // 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.
    @Override
    public boolean openWindows()
    {
        return true;
    }

    @Override
    public void postStartup()
    {
        super.postStartup();
        // close(..) is the call that actually closes the workbench.
        PlatformUI.getWorkbench().close();
    }

    @Override
    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.
        super.postShutdown();
        SolsticeClient.getInstance().workbenchCreated();
    }
}


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,
Previous Topic:disable use of socks proxy in 3.5
Next Topic:Could elicpse run on android device?
Goto Forum:
  


Current Time: Sat Apr 20 02:29:03 GMT 2024

Powered by FUDForum. Page generated in 0.02783 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top