Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Howto hide a preference page in an eclipse RCP

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

like image 469
Hannes Niederhausen Avatar asked Sep 22 '09 15:09

Hannes Niederhausen


People also ask

Where are Eclipse preferences stored?

Preferences are stored in the workspace of your application in the . metadata/. plugins/org. eclipse.


1 Answers

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;
}//
like image 104
Stefan Avatar answered Oct 12 '22 07:10

Stefan