RCP: Remove unwanted preference pages

Veröffentlicht von

In my RCP application some unwanted sections in the preferences showed up:

Unwanted Preferences

How to get rid of them? Thats easy, in the "ApplicationWorkbenchAdvisor" class, override the "postStartup" method:

@Override
public void postStartup(){
      PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager();
      pm.remove("org.eclipse.help.ui.browsersPreferencePage"); //$NON-NLS-1$
      pm.remove("org.eclipse.help.ui.contentPreferencePage"); //$NON-NLS-1$
}

What if you don’t know the id of the preference page? No problem, you can output those with the following code snippet:

@Override
public void postStartup(){
      PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager();
      IPreferenceNode[] arr = pm.getRootSubNodes();

      for(IPreferenceNode pn:arr){
          System.out.println("Label:" + pn.getLabelText() + " ID:" + pn.getId());
      }
}

Kommentar hinterlassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert