Class PropertySheetEntry
- java.lang.Object
-
- org.eclipse.core.commands.common.EventManager
-
- org.eclipse.ui.views.properties.PropertySheetEntry
-
- All Implemented Interfaces:
IPropertySheetEntry
public class PropertySheetEntry extends EventManager implements IPropertySheetEntry
PropertySheetEntryis an implementation ofIPropertySheetEntrywhich usesIPropertySourceandIPropertyDescriptorto 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
Constructors Constructor Description PropertySheetEntry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertySheetEntryListener(IPropertySheetEntryListener listener)Adds the given listener to this entry's collection of listeners.voidapplyEditorValue()Apply the current cell editor value.protected PropertySheetEntrycreateChildEntry()Factory method to create a new childPropertySheetEntryinstance.voiddispose()Called when the entry is no longer neededprotected ColorgetBackground()Returns the background color for the entry.StringgetCategory()Returns the entry's category.IPropertySheetEntry[]getChildEntries()Returns the child entries for this entry.StringgetDescription()Return a short description of the property sheet entry.protected IPropertyDescriptorgetDescriptor()Returns the descriptor for this entry.StringgetDisplayName()Returns the name used to display the property.CellEditorgetEditor(Composite parent)Return theCellEditorused to edit the property.protected ObjectgetEditValue(int index)Returns the edit value for the object at the given index.StringgetErrorText()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.protected FontgetFont()Returns the font for the entry.protected ColorgetForeground()Returns the foreground color for the entry.ObjectgetHelpContextIds()Returns the help context id for this entry, ornullif this entry has no help context id.ImagegetImage()Returns the image for the property value, if there is one.protected PropertySheetEntrygetParent()Returns the parent of this entry.protected IPropertySourcegetPropertySource(Object object)Returns an property source for the given object.StringgetValueAsString()Returns the value of the objects expressed as a String.Object[]getValues()Returns the value objects of this entry.booleanhasChildEntries()Returnstrueif the entry has children.protected voidrefreshFromRoot()Refresh the entry tree from the root down.voidremovePropertySheetEntryListener(IPropertySheetEntryListener listener)Removes the given listener from this entry's collection of listeners.voidresetPropertyValue()Resets the property value to its default value if it has been changed.voidsetPropertySourceProvider(IPropertySourceProvider provider)Sets a property source provider for this entry.voidsetValues(Object[] objects)ThePropertySheetEntryimplmentation of this method declared onIPropertySheetEntrywill obtain an editable value for the given objects and update the child entries.protected voidvalueChanged(PropertySheetEntry child)The value of the given child entry has changed.-
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
-
-
-
Method Detail
-
addPropertySheetEntryListener
public void addPropertySheetEntryListener(IPropertySheetEntryListener listener)
Description copied from interface:IPropertySheetEntryAdds the given listener to this entry's collection of listeners.- Specified by:
addPropertySheetEntryListenerin interfaceIPropertySheetEntry- Parameters:
listener- the listener to add
-
applyEditorValue
public void applyEditorValue()
Description copied from interface:IPropertySheetEntryApply the current cell editor value.- Specified by:
applyEditorValuein interfaceIPropertySheetEntry
-
createChildEntry
protected PropertySheetEntry createChildEntry()
Factory method to create a new childPropertySheetEntryinstance.Subclasses may overwrite to create new instances of their own class.
- Returns:
- a new
PropertySheetEntryinstance for the descriptor passed in - Since:
- 3.1
-
dispose
public void dispose()
Description copied from interface:IPropertySheetEntryCalled when the entry is no longer needed- Specified by:
disposein interfaceIPropertySheetEntry
-
getCategory
public String getCategory()
Description copied from interface:IPropertySheetEntryReturns the entry's category.- Specified by:
getCategoryin interfaceIPropertySheetEntry- Returns:
- the entry's category
-
getChildEntries
public IPropertySheetEntry[] getChildEntries()
Description copied from interface:IPropertySheetEntryReturns the child entries for this entry.- Specified by:
getChildEntriesin interfaceIPropertySheetEntry- Returns:
- the child entries for this entry
-
getDescription
public String getDescription()
Description copied from interface:IPropertySheetEntryReturn a short description of the property sheet entry. Typically this description is shown in a status line when the entry is selected.- Specified by:
getDescriptionin interfaceIPropertySheetEntry- Returns:
- the entry's description
-
getDescriptor
protected IPropertyDescriptor getDescriptor()
Returns the descriptor for this entry.- Returns:
- the descriptor for this entry
- Since:
- 3.1 (was previously private)
-
getDisplayName
public String getDisplayName()
Description copied from interface:IPropertySheetEntryReturns the name used to display the property.- Specified by:
getDisplayNamein interfaceIPropertySheetEntry- Returns:
- the name used to display the property
-
getEditor
public CellEditor getEditor(Composite parent)
Description copied from interface:IPropertySheetEntryReturn theCellEditorused to edit the property.- Specified by:
getEditorin interfaceIPropertySheetEntry- Parameters:
parent- the parent widget for the editor- Returns:
- the
CellEditorused 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:IPropertySheetEntryReturns the error text to display if the value is invalid.- Specified by:
getErrorTextin interfaceIPropertySheetEntry- Returns:
- the error text to display when the value is invalid or
null
-
getFilters
public String[] getFilters()
Description copied from interface:IPropertySheetEntryReturn the filter ids used to group entries into levels such as Expert. Valid values are defined as constants on this interface.- Specified by:
getFiltersin interfaceIPropertySheetEntry- Returns:
- the filter ids used to group entries into levels such as Expert.
-
getHelpContextIds
public Object getHelpContextIds()
Description copied from interface:IPropertySheetEntryReturns the help context id for this entry, ornullif 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-
nullreturn type for this method is aStringrepresenting a context id. The previously valid return types are deprecated. The plural name for this method is unfortunate.- Specified by:
getHelpContextIdsin interfaceIPropertySheetEntry- Returns:
- the help context id for this entry
-
getImage
public Image getImage()
Description copied from interface:IPropertySheetEntryReturns 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:
getImagein interfaceIPropertySheetEntry- Returns:
- the image for this property value or
null
-
getParent
protected PropertySheetEntry getParent()
Returns the parent of this entry.- Returns:
- the parent entry, or
nullif it has no parent - Since:
- 3.1
-
getPropertySource
protected IPropertySource getPropertySource(Object object)
Returns an property source for the given object.- Parameters:
object- an object for which to obtain a property source ornullif a property source is not available- Returns:
- an property source for the given object
- Since:
- 3.1 (was previously private)
-
getValueAsString
public String getValueAsString()
Description copied from interface:IPropertySheetEntryReturns the value of the objects expressed as a String.- Specified by:
getValueAsStringin interfaceIPropertySheetEntry- Returns:
- the value of the objects expressed as a String
-
getValues
public Object[] getValues()
Returns the value objects of this entry.- Returns:
- the value objects of this entry
- Since:
- 3.1 (was previously private)
-
hasChildEntries
public boolean hasChildEntries()
Description copied from interface:IPropertySheetEntryReturnstrueif the entry has children.- Specified by:
hasChildEntriesin interfaceIPropertySheetEntry- Returns:
trueif the entry has children
-
refreshFromRoot
protected void refreshFromRoot()
Refresh the entry tree from the root down.- Since:
- 3.1 (was previously private)
-
removePropertySheetEntryListener
public void removePropertySheetEntryListener(IPropertySheetEntryListener listener)
Description copied from interface:IPropertySheetEntryRemoves the given listener from this entry's collection of listeners.- Specified by:
removePropertySheetEntryListenerin interfaceIPropertySheetEntry- Parameters:
listener- the listener to remove
-
resetPropertyValue
public void resetPropertyValue()
Description copied from interface:IPropertySheetEntryResets 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:
resetPropertyValuein interfaceIPropertySheetEntry
-
setPropertySourceProvider
public void setPropertySourceProvider(IPropertySourceProvider provider)
Sets a property source provider for this entry. This provider is used to obtain anIPropertySourcefor 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)
ThePropertySheetEntryimplmentation of this method declared onIPropertySheetEntrywill 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:
setValuesin interfaceIPropertySheetEntry- 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
-
getForeground
protected Color getForeground()
Returns the foreground color for the entry.- Returns:
- the foreground color for the entry, or
nullto use the default foreground color - Since:
- 3.7
-
getBackground
protected Color getBackground()
Returns the background color for the entry.- Returns:
- the background color for the entry, or
nullto use the default background color - Since:
- 3.7
-
getFont
protected Font getFont()
Returns the font for the entry.- Returns:
- the font for the entry, or
nullto use the default font - Since:
- 3.7
-
-