Difference between revisions of "FAQ How do I use property pages?"

From Eclipsepedia

Jump to: navigation, search
 
m
 
Line 1: Line 1:
The workbench provides two facilities for presenting the properties  
+
The workbench provides two facilities for presenting the properties of an object: the Property dialog and the Properties view.  
of an object: the Property dialog and the Properties view.  
+
  
The Property dialog
+
The Property dialog is invoked by selecting an object and pressing Alt+Enter or by selecting '''File &gt; Properties'''.  The workbench provides an action, <tt>PropertyDialogAction</tt>, that you can add to your own view&#146;s menu for opening the Property dialog.  The Property dialog contains pages contributed by the <tt>org.eclipse.ui.propertyPages</tt> extension point.  Plug-ins can contribute pages in this way for any type of domain object.  
is invoked by selecting an object and pressing Alt+Enter or by selecting  
+
'''File &gt; Properties'''.  The workbench provides an action,
+
<tt>PropertyDialogAction</tt>, that you can add to your own view&#146;s menu
+
for opening the Property dialog.  The Property dialog contains pages contributed
+
by the <tt>org.eclipse.ui.propertyPages</tt> extension point.  Plug-ins can  
+
contribute pages in this way for any type of domain object.  
+
  
 
+
The Properties view, also known as the property sheet, is not populated using an extension point but  is activated through API, by the PDE editors, or manually, through '''Window &gt; Show View'''. This view, like the Outline view, asks the active workbench part to contribute its contents.   When a part becomes active, the property sheet asks it to adapt to <tt>IPropertySheetPage</tt>, using the <tt>IAdaptable</tt> mechanism:
The Properties view, also known as the property sheet, is not populated
+
using an extension point but  is activated through
+
API, by the PDE editors, or manually, through
+
'''Window &gt; Show View'''.
+
This view, like the Outline view, asks the active
+
workbench part to contribute its contents.  
+
When a part becomes active,
+
the property sheet asks it to adapt to <tt>IPropertySheetPage</tt>, using
+
the <tt>IAdaptable</tt> mechanism:
+
 
<pre>
 
<pre>
 
   IWorkbenchPart.getAdapter(IPropertySheetPage.class);
 
   IWorkbenchPart.getAdapter(IPropertySheetPage.class);
 
</pre>
 
</pre>
  
If it wants a completely customized property page, the part can
+
If it wants a completely customized property page, the part can respond to this request and provide its own page.  If the part does not provide a page, the property sheet presents a default page that solicits key/value pairs from the active part&#146;s selection.  This again uses the <tt>IAdaptable</tt> mechanism to ask the selected element whether it wants to contribute properties.  This time it asks the element for an implementation of <tt>IPropertySource</tt>.  The property source is responsible for providing its keys and values, changing values, and restoring default values.
respond to this request and provide its own page.  If the part does not
+
provide a page, the property sheet presents a default page that solicits
+
key/value pairs from the active part&#146;s selection.  This again uses
+
the <tt>IAdaptable</tt> mechanism to ask the selected element
+
whether it wants to contribute properties.  This time it asks the element
+
for an implementation of <tt>IPropertySource</tt>.  The property
+
source is responsible for providing its keys and values, changing
+
values, and restoring default values.
+
 
+
  
 
== See Also: ==
 
== See Also: ==
 +
*[[FAQ How do I use IAdaptable and IAdapterFactory?]]
 +
*[[FAQ How do I store extra properties on a resource?]]
 +
*Property pages (See '''Platform Plug-in Developer's Guide''')
 +
*Eclipse online articles
 +
**[http://www.eclipse.org/articles/Article-Properties-View/properties-view.html "Take control of your properties"]
 +
**[http://www.eclipse.org/articles/Article-Field-Editors/field_editors.html "Simplifying Preference Pages with Field Editors"]
 +
**[http://www.eclipse.org/articles/Article-Mutatis-mutandis/overlay-pages.html "Mutatis mutandis - Using Preference Pages as Property Pages"]
  
[[FAQ_How_do_I_use_%3Ctt%3EIAdaptable%3C%2Ftt%3E_and_%3Ctt%3EIAdapterFactory%3C%2Ftt%3E%3F]]
+
{{Template:FAQ_Tagline}}
 
+
[[FAQ_How_do_I_store_extra_properties_on_a_resource%3F]]
+
 
+
Property pages (See '''Platform Plug-in Developer's Guide''')
+
 
+
Eclipse online article &#147;Take control of your properties&#148;
+
 
+
Simplifying Preference Pages with Field Editors,
+
Eclipse online article &#147;Mutatis mutandis - Using Preference Pages as Property Pages&#148;
+
 
+
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
+

Latest revision as of 23:37, 18 June 2006

The workbench provides two facilities for presenting the properties of an object: the Property dialog and the Properties view.

The Property dialog is invoked by selecting an object and pressing Alt+Enter or by selecting File > Properties. The workbench provides an action, PropertyDialogAction, that you can add to your own view’s menu for opening the Property dialog. The Property dialog contains pages contributed by the org.eclipse.ui.propertyPages extension point. Plug-ins can contribute pages in this way for any type of domain object.

The Properties view, also known as the property sheet, is not populated using an extension point but is activated through API, by the PDE editors, or manually, through Window > Show View. This view, like the Outline view, asks the active workbench part to contribute its contents. When a part becomes active, the property sheet asks it to adapt to IPropertySheetPage, using the IAdaptable mechanism:

   IWorkbenchPart.getAdapter(IPropertySheetPage.class);

If it wants a completely customized property page, the part can respond to this request and provide its own page. If the part does not provide a page, the property sheet presents a default page that solicits key/value pairs from the active part’s selection. This again uses the IAdaptable mechanism to ask the selected element whether it wants to contribute properties. This time it asks the element for an implementation of IPropertySource. The property source is responsible for providing its keys and values, changing values, and restoring default values.

[edit] See Also:


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.