Saturday, July 28, 2007

How to get a navigator view in RCP

I am struggling with the Common Navigator Framework right now.
After finding a good tutorial on CNF I started hacking away.
The problem was that I needed a navigator view to actually do something with my fancy new CNF.
Creating the view is only half the deal and after some google research I finally found the part that was missing:

In your perspective add the Navigator View

IFolderLayout topLeft= layout.createFolder("topLeft",IPageLayout.LEFT,
0.25f,layout.getEditorArea());
topLeft.addView(IPageLayout.ID_RES_NAV);
And now for the part that I was missing.
In your WorkbenchAdvisor (normally called ApplicationWorkbenchAdvisor if you used the PlugIn wizard) overwrite the preStartup method and add the following line:

WorkbenchAdapterBuilder.registerAdapters();
Uh, I almost forgot about the dependencies:
org.eclipse.ui.navigator
org.eclipse.ui.navigator.resources
org.eclipse.ui.ide
org.eclipse.ui.navigator

No comments: