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
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)
  • Constructor Details

    • PropertySheetEntry

      public PropertySheetEntry()
  • Method Details

    • 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
    • createChildEntry

      protected PropertySheetEntry createChildEntry()
      Factory method to create a new child PropertySheetEntry instance.

      Subclasses may overwrite to create new instances of their own class.

      Returns:
      a new PropertySheetEntry instance for the descriptor passed in
      Since:
      3.1
    • 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
    • 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: 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
    • getParent

      protected PropertySheetEntry getParent()
      Returns the parent of this entry.
      Returns:
      the parent entry, or null if 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 or null if 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: 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
    • 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: IPropertySheetEntry
      Returns true if the entry has children.
      Specified by:
      hasChildEntries in interface IPropertySheetEntry
      Returns:
      true if 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: 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
    • getForeground

      protected Color getForeground()
      Returns the foreground color for the entry.
      Returns:
      the foreground color for the entry, or null to 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 null to 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 null to use the default font
      Since:
      3.7