To add the Common Navigator to an RCP application and have it manipulate the workspace resources, do the following:
<extension point="org.eclipse.ui.views"> <view name="View" class="org.eclipse.ui.navigator.CommonNavigator" id="example.view"> </view> </extension>
public void createInitialLayout(IPageLayout layout) { String editorArea = layout.getEditorArea(); layout.setEditorAreaVisible(false); layout.setFixed(true); layout.addStandaloneView("example.view", true /* show title */, IPageLayout.LEFT, 1.0f, editorArea); }
Note that for the moment you need to specify "true" to show title, otherwise the viewer will not render correctly (bug 235171).
<extension point="org.eclipse.ui.navigator.viewer"> <viewerActionBinding viewerId="example.view"> <includes> <actionExtension pattern="org.eclipse.ui.navigator.resources.*" /> </includes> </viewerActionBinding> <viewerContentBinding viewerId="example.view"> <includes> <contentExtension pattern="org.eclipse.ui.navigator.resourceContent" /> <contentExtension pattern="org.eclipse.ui.navigator.resources.filters.*"/> <contentExtension pattern="org.eclipse.ui.navigator.resources.linkHelper"/> <contentExtension pattern="org.eclipse.ui.navigator.resources.workingSets"/> </includes> </viewerContentBinding> </extension>
public IAdaptable getDefaultPageInput() { IWorkspace workspace = ResourcesPlugin.getWorkspace(); return workspace.getRoot(); }
public void initialize(IWorkbenchConfigurer configurer) { WorkbenchAdapterBuilder.registerAdapters(); }
Warning: the WorkbenchAdapterBuilder.registerAdapters() is an internal method and not part of the Eclipse API and is therefore subject to change in a subsequent release. There is an open work item to replace this with similar capability that is part of the API.