Class PropertySheetPage
- java.lang.Object
-
- org.eclipse.ui.part.Page
-
- org.eclipse.ui.views.properties.PropertySheetPage
-
- All Implemented Interfaces:
EventListener
,IAdaptable
,ISelectionListener
,IPage
,IPageBookViewPage
,IPropertySheetPage
public class PropertySheetPage extends Page implements IPropertySheetPage, IAdaptable
The standard implementation of property sheet page which presents a table of property names and values obtained from the current selection in the active workbench part.This page obtains the information about what properties to display from the current selection (which it tracks).
The model for this page is a hierarchy of
IPropertySheetEntry
. The page may be configured with a custom model by setting the root entry.If no root entry is set then a default model is created which uses the
IPropertySource
interface to obtain the properties of the current selection. This requires that the selected objects provide anIPropertySource
adapter (or implementIPropertySource
directly). This restiction can be overcome by providing this page with anIPropertySourceProvider
. If supplied, this provider will be used by the default model to obtain a property source for the current selectionThis class may be instantiated; it is not intended to be subclassed.
- See Also:
IPropertySource
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Field Summary
Fields Modifier and Type Field Description static String
HELP_CONTEXT_PROPERTY_SHEET_PAGE
Help context id (value"org.eclipse.ui.property_sheet_page_help_context"
).
-
Constructor Summary
Constructors Constructor Description PropertySheetPage()
Creates a new property sheet page.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createControl(Composite parent)
Creates the SWT control for this page under the given parent control.void
dispose()
ThePropertySheetPage
implementation of thisIPage
method disposes of this page's entries.<T> T
getAdapter(Class<T> adapter)
ThePropertySheetPage
implementation of thisIAdaptable
method handles theISaveablePart
adapter by delegating to the source part.Control
getControl()
ThePage
implementation of thisIPage
method returnsnull
.protected ISaveablePart
getSaveablePart()
Returns anISaveablePart
that delegates to the source part for the current page if it implementsISaveablePart
, ornull
otherwise.void
handleEntrySelection(ISelection selection)
Handles a selection change in the entry table.protected void
initDragAndDrop()
Adds drag and drop support.void
makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager)
This method exists for backward compatibility.void
refresh()
Updates the model for the viewer.void
selectionChanged(IWorkbenchPart part, ISelection selection)
Notifies this listener that the selection has changed.void
setActionBars(IActionBars actionBars)
ThePropertySheetPage
implementation of thisIPage
method callsmakeContributions
for backwards compatibility with previous versions ofIPage
.void
setFocus()
Sets focus to a part in the page.void
setPropertySourceProvider(IPropertySourceProvider newProvider)
Sets the given property source provider as the property source provider.void
setRootEntry(IPropertySheetEntry entry)
Sets the given entry as the model for the page.protected void
setSorter(PropertySheetSorter sorter)
Sets the sorter used for sorting categories and entries in the viewer of this page.
-
-
-
Field Detail
-
HELP_CONTEXT_PROPERTY_SHEET_PAGE
public static final String HELP_CONTEXT_PROPERTY_SHEET_PAGE
Help context id (value"org.eclipse.ui.property_sheet_page_help_context"
).- See Also:
- Constant Field Values
-
-
Method Detail
-
createControl
public void createControl(Composite parent)
Description copied from interface:IPage
Creates the SWT control for this page under the given parent control.Clients should not call this method (the workbench calls this method when it needs to, which may be never).
- Specified by:
createControl
in interfaceIPage
- Specified by:
createControl
in classPage
- Parameters:
parent
- the parent control
-
dispose
public void dispose()
ThePropertySheetPage
implementation of thisIPage
method disposes of this page's entries.
-
getAdapter
public <T> T getAdapter(Class<T> adapter)
ThePropertySheetPage
implementation of thisIAdaptable
method handles theISaveablePart
adapter by delegating to the source part.- Specified by:
getAdapter
in interfaceIAdaptable
- Type Parameters:
T
- the class type- Parameters:
adapter
- the adapter class to look up- Returns:
- a object of the given class,
or
null
if this object does not have an adapter for the given class - Since:
- 3.2
-
getSaveablePart
protected ISaveablePart getSaveablePart()
Returns anISaveablePart
that delegates to the source part for the current page if it implementsISaveablePart
, ornull
otherwise.- Returns:
- an
ISaveablePart
ornull
- Since:
- 3.2
-
getControl
public Control getControl()
Description copied from class:Page
ThePage
implementation of thisIPage
method returnsnull
. Subclasses must reimplement.- Specified by:
getControl
in interfaceIPage
- Specified by:
getControl
in classPage
- Returns:
- the SWT control for this page, or
null
if this page does not have a control
-
handleEntrySelection
public void handleEntrySelection(ISelection selection)
Handles a selection change in the entry table.- Parameters:
selection
- the new selection
-
initDragAndDrop
protected void initDragAndDrop()
Adds drag and drop support.
-
makeContributions
public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager)
Description copied from class:Page
This method exists for backward compatibility. Subclasses should reimplementinit
.- Overrides:
makeContributions
in classPage
-
refresh
public void refresh()
Updates the model for the viewer.Note that this means ensuring that the model reflects the state of the current viewer input.
-
selectionChanged
public void selectionChanged(IWorkbenchPart part, ISelection selection)
Description copied from interface:ISelectionListener
Notifies this listener that the selection has changed.Note: it is important that this method returns as quickly as possible to avoid UI freezes. For example, do not update the UI if the UI is not visible. See the
SelectionListenerFactory
for listeners that are build for this purpose.This method is called when the selection changes to a
non-null
value, but not when the selection changes tonull
. If there is a requirement to be notified in the latter scenario, implementINullSelectionListener
. The event will be posted through this method.- Specified by:
selectionChanged
in interfaceISelectionListener
- Parameters:
part
- the workbench part containing the selectionselection
- the current selection. This may benull
ifINullSelectionListener
is implemented.- See Also:
SelectionListenerFactory.createVisibleListener(IWorkbenchPart, ISelectionListener)
,SelectionListenerFactory.createVisibleSelfMutedListener(IWorkbenchPart, ISelectionListener)
-
setActionBars
public void setActionBars(IActionBars actionBars)
ThePropertySheetPage
implementation of thisIPage
method callsmakeContributions
for backwards compatibility with previous versions ofIPage
.Subclasses may reimplement.
- Specified by:
setActionBars
in interfaceIPage
- Overrides:
setActionBars
in classPage
- Parameters:
actionBars
- the action bars for this page
-
setFocus
public void setFocus()
Sets focus to a part in the page.
-
setPropertySourceProvider
public void setPropertySourceProvider(IPropertySourceProvider newProvider)
Sets the given property source provider as the property source provider.Calling this method is only valid if you are using this page's default root entry.
- Parameters:
newProvider
- the property source provider
-
setRootEntry
public void setRootEntry(IPropertySheetEntry entry)
Sets the given entry as the model for the page.- Parameters:
entry
- the root entry
-
setSorter
protected void setSorter(PropertySheetSorter sorter)
Sets the sorter used for sorting categories and entries in the viewer of this page.The default sorter sorts categories and entries alphabetically.
- Parameters:
sorter
- the sorter to set (null
will reset to the default sorter)- Since:
- 3.1
-
-