Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
FAQ How do I open a Property dialog?
The Property dialog appears when you select an object in a view and choose Properties... from the context menu or File menu. If you want such an action for your own view or editor, you can simply add an instance of org.eclipse.ui.dialogs.PropertyDialogAction to your view’s context menu. This action will compute what property pages are applicable for the current selection and then open a dialog on those property pages.
You can also open a Property dialog on a set of property pages of your
own choosing. This works exactly like the JFace Preference dialog: You supply the dialog with a PreferenceManager instance
that knows how to build the set of pages to be shown. The only
difference with the Property dialog is that you must also supply
it with the current selection:
ISelection sel = ... obtain the current selection PropertyPage page = new MyPropertyPage(); PreferenceManager mgr = new PreferenceManager(); IPreferenceNode node = new PreferenceNode("1", page); mgr.addToRoot(node); PropertyDialog dialog = new PropertyDialog(shell, mgr, sel); dialog.create(); dialog.setMessage(page.getTitle()); dialog.open();
See Also:
FAQ_How_do_I_launch_the_preference_page_that_belongs_to_my_plug-in?
FAQ_How_do_I_find_out_what_object_is_selected?
This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.