Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Preference page
Preference page [message #333692] Tue, 23 December 2008 17:41 Go to next message
Anand is currently offline AnandFriend
Messages: 1
Registered: July 2009
Junior Member
I want to display only Editors under General in preference page.
How would I do this?
Re: Preference page [message #333697 is a reply to message #333692] Wed, 24 December 2008 01:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fakemail.xyz.de

Anand schrieb:
> I want to display only Editors under General in preference page.
> How would I do this?
>


My way to do that (only showing some of the Contributed Preference
Pages) was implementing a handler that opens a preference dialog that
only shows the IDs of the preference pages I want
Opening the dialog yourself you can by providing a String[] instance to
control which preference pages are shown.


public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window =
HandlerUtil.getActiveWorkbenchWindowChecked(event);

PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
window.getShell(), null, getValidPreferenceIDs(), null);

dialog.open();

return null;
}


May be there is a better solution... though this one worked for me just
fine.

Christian
Re: Preference page [message #333698 is a reply to message #333697] Wed, 24 December 2008 04:35 Go to previous messageGo to next message
Anand Kumar Gupta is currently offline Anand Kumar GuptaFriend
Messages: 14
Registered: July 2009
Junior Member
How the above will be implemented?
Re: Preference page [message #333706 is a reply to message #333698] Wed, 24 December 2008 12:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fakemail.xyz.de

Anand Kumar Gupta schrieb:
> How the above will be implemented?
>

extend an abstract Handler ... and implement the method as seen above..

example for getting the String array:
/**
* remove the unwanted preferences..
*/
private static String[] getValidPreferenceIDs() {
List<String> validIds = new ArrayList<String>();
IConfigurationElement[] ce=
Platform.getExtensionRegistry().getConfigurationElementsFor( "org.eclipse.ui.preferencePages");
for (IConfigurationElement cele:ce) {
String s= cele.getAttribute("id");
validIds.add(s);
}
validIds.remove("org.eclipse.help.ui.browsersPreferencePage ");
validIds.remove("org.eclipse.help.ui.contentPreferencePage");

validIds.remove(" org.eclipse.update.internal.ui.preferences.MainPreferencePag e ");

return validIds.toArray(new String[0]);
}



Define a command in the plugin.xml. Ans use this handler as a default
handler.

Now you can either add the command to some menu or programmtically call it.

Christian
Re: Preference page [message #333712 is a reply to message #333706] Wed, 24 December 2008 19:05 Go to previous messageGo to next message
Anand Kumar Gupta is currently offline Anand Kumar GuptaFriend
Messages: 14
Registered: July 2009
Junior Member
As I am very new to plugin development, I am not able to understand the
solution.
Could you please explain more, or please tell step by steps.
Re: Preference page [message #333715 is a reply to message #333712] Thu, 25 December 2008 13:42 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33204
Registered: July 2009
Senior Member
Anand,

You'll really need to take some more initiative and go learn the
background information.


Anand Kumar Gupta wrote:
> As I am very new to plugin development, I am not able to understand
> the solution.
> Could you please explain more, or please tell step by steps.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Form problems.
Next Topic:Path in problem view
Goto Forum:
  


Current Time: Fri Aug 30 02:17:21 GMT 2024

Powered by FUDForum. Page generated in 0.03852 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top