Howto hide a preference page in an eclipse RCP

Hannes Niederhausen picture Hannes Niederhausen · Sep 22, 2009 · Viewed 7.5k times · Source

I have an eclipse rcp and want to hide the security and help prerence pages. How can I do that?

Answer

Stefan picture Stefan · Nov 23, 2009

I was looking for the same thing and found the solution in this link:

http://sourceforge.net/apps/trac/fable/wiki/Preferences

Cheers. Stefan


Disable help preferences

Put the following code into your subclass of org.eclipse.ui.application.WorkbenchAdvisor, and it removes the "Help" group from RCP preference dialog:

public void postStartup() {
    PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager( );
    pm.remove( "org.eclipse.help.ui.browsersPreferencePage" );
}

"org.eclipse.help.ui.browsersPreferencePage" is the ID for the preferences extension point.
Add Perspective preferences ¶

Remark : to find plugin id preferences, select Window-->show view--> PDE Runtime--> Plugin Registry ..... and try to find what you are looking for .....
For example, for "Workbench preferences", have a look in fable.eclipse.ui.ide and extension org.eclipse.ui.preferencePages: id="org.eclipse.ui.preferencePages.Workbench"

If you want to add only perspective (for example) preferences, add a preference extension in MANIFEST.XML :

id : org.eclipse.ui.preferencePages.Perspectives
name:perspective(fable)
class:org.eclipse.ui.internal.ide.dialogs.IDEPerspectivesPreferencePage

//Add : org.eclipse.ui.ide in your Dependencies

In ApplicationWorkBenchAdvisor :

public void postStartup() {
    PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager( );

    pm.remove( ""org.eclipse.ui.preferencePages.Workbench"browsersPreferencePage" );
}

public String getInitialWindowPerspectiveId() {
    IPreferenceStore pref = Activator.getDefault().getPreferenceStore();
    String ret = pref.getDefaultString(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);
    ret=(ret==null || ret.equals(""))?"yourDefaultPerspectiveID":ret;
    return ret;
}//