Search code examples
eclipse-plugineclipse-rcp

Modify Project Explorer in Eclipse RCP - Package/Project Presentation


I have a Eclipse RCP project I'm working on which uses the Project Explorer as default Navigator. For this Project Explorer I want to set the Project and also the Package Presentation hirarchical as the default value. Is there any Method or Extension Point so set these values for start up?


Solution

  • I found a solution by settin the preferences for the providing plugins:

    IEclipsePreferences workbenchPrefs = InstanceScope.INSTANCE.getNode("org.eclipse.ui.workbench");
        workbench.putBoolean("org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState", true);
    
        IEclipsePreferences jdtPrefs = InstanceScope.INSTANCE.getNode("org.eclipse.jdt.ui");
        jdtPrefs.putInt("org.eclipse.jdt.internal.ui.navigator.layout", 1);
    

    With this set both, the package and the project presentation, changed to hirarchical on startup.