Eclipse Platform
Release 3.0

org.eclipse.ui.views.properties
Class PropertySheetEntry

java.lang.Object
  extended byorg.eclipse.ui.views.properties.PropertySheetEntry
All Implemented Interfaces:
IPropertySheetEntry

public class PropertySheetEntry
extends Object
implements IPropertySheetEntry

PropertySheetEntry is an implementation of IPropertySheetEntry which uses IPropertySource and IPropertyDescriptor to interact with domain model objects.

Every property sheet entry has a single descriptor (except the root entry which has none). This descriptor determines what property of its objects it will display/edit.

Entries do not listen for changes in their objects. Since there is no restriction on properties being independent, a change in one property may affect other properties. The value of a parent's property may also change. As a result we are forced to refresh the entire entry tree when a property changes value.

Since:
3.0 (was previously internal)

Field Summary
 
Fields inherited from interface org.eclipse.ui.views.properties.IPropertySheetEntry
FILTER_ID_EXPERT
 
Constructor Summary
PropertySheetEntry()
           
 
Method Summary
 void addPropertySheetEntryListener(IPropertySheetEntryListener listener)
          Adds the given listener to this entry's collection of listeners.
 void applyEditorValue()
          Apply the current cell editor value.
 void dispose()
          Called when the entry is no longer needed
 String getCategory()
          Returns the entry's category.
 IPropertySheetEntry[] getChildEntries()
          Returns the child entries for this entry.
 String getDescription()
          Return a short description of the property sheet entry.
 String getDisplayName()
          Returns the name used to display the property.
 CellEditor getEditor(Composite parent)
          Return the CellEditor used to edit the property.
protected  Object getEditValue(int index)
          Returns the edit value for the object at the given index.
 String getErrorText()
          Returns the error text to display if the value is invalid.
 String[] getFilters()
          Return the filter ids used to group entries into levels such as Expert.
 Object getHelpContextIds()
          Returns the help context id for this entry, or null if this entry has no help context id.
 Image getImage()
          Returns the image for the property value, if there is one.
 String getValueAsString()
          Returns the value of the objects expressed as a String.
 boolean hasChildEntries()
          Returns true if the entry has children.
 void removePropertySheetEntryListener(IPropertySheetEntryListener listener)
          Removes the given listener from this entry's collection of listeners.
 void resetPropertyValue()
          Resets the property value to its default value if it has been changed.
 void setPropertySourceProvider(IPropertySourceProvider provider)
          Sets a property source provider for this entry.
 void setValues(Object[] objects)
          The PropertySheetEntry implmentation of this method declared onIPropertySheetEntry will obtain an editable value for the given objects and update the child entries.
protected  void valueChanged(PropertySheetEntry child)
          The value of the given child entry has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertySheetEntry

public PropertySheetEntry()
Method Detail

addPropertySheetEntryListener

public void addPropertySheetEntryListener(IPropertySheetEntryListener listener)
Description copied from interface: IPropertySheetEntry
Adds the given listener to this entry's collection of listeners.

Specified by:
addPropertySheetEntryListener in interface IPropertySheetEntry
Parameters:
listener - the listener to add

applyEditorValue

public void applyEditorValue()
Description copied from interface: IPropertySheetEntry
Apply the current cell editor value.

Specified by:
applyEditorValue in interface IPropertySheetEntry

dispose

public void dispose()
Description copied from interface: IPropertySheetEntry
Called when the entry is no longer needed

Specified by:
dispose in interface IPropertySheetEntry

getCategory

public String getCategory()
Description copied from interface: IPropertySheetEntry
Returns the entry's category.

Specified by:
getCategory in interface IPropertySheetEntry
Returns:
the entry's category

getChildEntries

public IPropertySheetEntry[] getChildEntries()
Description copied from interface: IPropertySheetEntry
Returns the child entries for this entry.

Specified by:
getChildEntries in interface IPropertySheetEntry
Returns:
the child entries for this entry

getDescription

public String getDescription()
Description copied from interface: IPropertySheetEntry
Return a short description of the property sheet entry. Typically this description is shown in a status line when the entry is selected.

Specified by:
getDescription in interface IPropertySheetEntry
Returns:
the entry's description

getDisplayName

public String getDisplayName()
Description copied from interface: IPropertySheetEntry
Returns the name used to display the property.

Specified by:
getDisplayName in interface IPropertySheetEntry
Returns:
the name used to display the property

getEditor

public CellEditor getEditor(Composite parent)
Description copied from interface: IPropertySheetEntry
Return the CellEditor used to edit the property.

Specified by:
getEditor in interface IPropertySheetEntry
Parameters:
parent - the parent widget for the editor
Returns:
the CellEditor used to edit the property

getEditValue

protected Object getEditValue(int index)
Returns the edit value for the object at the given index.

Parameters:
index - the value object index
Returns:
the edit value for the object at the given index

getErrorText

public String getErrorText()
Description copied from interface: IPropertySheetEntry
Returns the error text to display if the value is invalid.

Specified by:
getErrorText in interface IPropertySheetEntry
Returns:
the error text to display when the value is invalid or null

getFilters

public String[] getFilters()
Description copied from interface: IPropertySheetEntry
Return the filter ids used to group entries into levels such as Expert. Valid values are defined as constants on this interface.

Specified by:
getFilters in interface IPropertySheetEntry
Returns:
the filter ids used to group entries into levels such as Expert.

getHelpContextIds

public Object getHelpContextIds()
Description copied from interface: IPropertySheetEntry
Returns the help context id for this entry, or null if this entry has no help context id.

NOTE: Help support system API's changed since 2.0 and arrays of contexts are no longer supported.

Thus the only valid non- null return type for this method is a String representing a context id. The previously valid return types are deprecated. The plural name for this method is unfortunate.

Specified by:
getHelpContextIds in interface IPropertySheetEntry
Returns:
the help context id for this entry

getImage

public Image getImage()
Description copied from interface: IPropertySheetEntry
Returns the image for the property value, if there is one. This image is managed by the entry it came from. Callers of this method must never dispose the returned image.

Specified by:
getImage in interface IPropertySheetEntry
Returns:
the image for this property value or null

getValueAsString

public String getValueAsString()
Description copied from interface: IPropertySheetEntry
Returns the value of the objects expressed as a String.

Specified by:
getValueAsString in interface IPropertySheetEntry
Returns:
the value of the objects expressed as a String

hasChildEntries

public boolean hasChildEntries()
Description copied from interface: IPropertySheetEntry
Returns true if the entry has children.

Specified by:
hasChildEntries in interface IPropertySheetEntry
Returns:
true if the entry has children

removePropertySheetEntryListener

public void removePropertySheetEntryListener(IPropertySheetEntryListener listener)
Description copied from interface: IPropertySheetEntry
Removes the given listener from this entry's collection of listeners.

Specified by:
removePropertySheetEntryListener in interface IPropertySheetEntry
Parameters:
listener - the listener to remove

resetPropertyValue

public void resetPropertyValue()
Description copied from interface: IPropertySheetEntry
Resets the property value to its default value if it has been changed.

Does nothing if the notion of a default value is not meaningful for the property.

Specified by:
resetPropertyValue in interface IPropertySheetEntry

setPropertySourceProvider

public void setPropertySourceProvider(IPropertySourceProvider provider)
Sets a property source provider for this entry. This provider is used to obtain an IPropertySource for each of this entries objects. If no provider is set then a default provider is used.

Parameters:
provider - IPropertySourceProvider

setValues

public void setValues(Object[] objects)
The PropertySheetEntry implmentation of this method declared onIPropertySheetEntry will obtain an editable value for the given objects and update the child entries.

Updating the child entries will typically call this method on the child entries and thus the entire entry tree is updated

Specified by:
setValues in interface IPropertySheetEntry
Parameters:
objects - the new values for this entry

valueChanged

protected void valueChanged(PropertySheetEntry child)
The value of the given child entry has changed. Therefore we must set this change into our value objects.

We must inform our parent so that it can update its value objects

Subclasses may override to set the property value in some custom way.

Parameters:
child - the child entry that changed its value

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.