Execute code when Eclipse workbench loads
I'm writing an Eclipse plug-in and I've bumped into an issue. Amongst others I'm creating a new custom perspective. I need to execute some code when the workbench loads. I'm using a WorkbenchAdvisor and putting the code in the initialize method. However as it is now it's not being called...
Apparently I need to call thi开发者_如何学Pythons PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor();
but I don't know where to put this... I can't put it in the createInitialLayout
of the perspective because this is only called when the perspective is created for the first time.
Any ideas please? Thanks and regards, Krt_Malta
You can use the startup extension point to run code before your plugin is loaded. You should place the extension in an seperate plugin, as all code inside the plugin with the startup extension is loaded after the workbench is started.
The interface to look for is org.eclipse.ui.IStartup.
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_startup.html
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IStartup.html
精彩评论