org.eclipse.gef.internal.ui.properties
Class PropertySheetEntry

java.lang.Object
  extended byorg.eclipse.gef.internal.ui.properties.PropertySheetEntry
All Implemented Interfaces:
org.eclipse.ui.views.properties.IPropertySheetEntry
Direct Known Subclasses:
UndoablePropertySheetEntry

public class PropertySheetEntry
extends java.lang.Object
implements org.eclipse.ui.views.properties.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.


Field Summary
 
Fields inherited from interface org.eclipse.ui.views.properties.IPropertySheetEntry
FILTER_ID_EXPERT
 
Constructor Summary
PropertySheetEntry()
           
 
Method Summary
 void addPropertySheetEntryListener(org.eclipse.ui.views.properties.IPropertySheetEntryListener listener)
           
 void applyEditorValue()
           
protected  java.util.List computeMergedPropertyDescriptors()
          Return the sorted intersection of all the IPropertyDescriptors for the objects.
protected  PropertySheetEntry[] createChildEntries(int size)
          Return a new array of property sheet entries of the given size
protected  PropertySheetEntry createChildEntry()
          Return a new PropertySheetEntry.
 void dispose()
           
 java.lang.String getCategory()
           
 org.eclipse.ui.views.properties.IPropertySheetEntry[] getChildEntries()
           
 java.lang.String getDescription()
           
protected  org.eclipse.ui.views.properties.IPropertyDescriptor getDescriptor()
          Returns the descriptor for this entry.
 java.lang.String getDisplayName()
           
 org.eclipse.jface.viewers.CellEditor getEditor(org.eclipse.swt.widgets.Composite parent)
           
protected  java.lang.Object getEditValue(int index)
          Returns the edit value for the object at the given index.
 java.lang.String getErrorText()
           
 java.lang.String[] getFilters()
           
 java.lang.Object getHelpContextIds()
           
 org.eclipse.swt.graphics.Image getImage()
           
protected  PropertySheetEntry getParent()
          Returns the parent PropertySheetEntry
protected  org.eclipse.ui.views.properties.IPropertySource getPropertySource(java.lang.Object object)
          Returns an property source for the given object.
 java.lang.String getValueAsString()
           
 java.lang.Object[] getValues()
          Returns the value objects of this entry.
 boolean hasChildEntries()
           
protected  void refreshFromRoot()
          Refresh the entry tree from the root down
 void removePropertySheetEntryListener(org.eclipse.ui.views.properties.IPropertySheetEntryListener listener)
           
 void resetPropertyValue()
           
 void setPropertySourceProvider(org.eclipse.ui.views.properties.IPropertySourceProvider provider)
          Sets a property source provider for this entry.
protected  void setValue(java.lang.Object newValue)
          Set the value for this entry.
 void setValues(java.lang.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(org.eclipse.ui.views.properties.IPropertySheetEntryListener listener)
Specified by:
addPropertySheetEntryListener in interface org.eclipse.ui.views.properties.IPropertySheetEntry

applyEditorValue

public void applyEditorValue()
Specified by:
applyEditorValue in interface org.eclipse.ui.views.properties.IPropertySheetEntry

computeMergedPropertyDescriptors

protected java.util.List computeMergedPropertyDescriptors()
Return the sorted intersection of all the IPropertyDescriptors for the objects. Made protected due to Bug 63383.

Returns:
List

createChildEntries

protected PropertySheetEntry[] createChildEntries(int size)
Return a new array of property sheet entries of the given size

Parameters:
size - size of the new array
Returns:
array of new property sheet entries

createChildEntry

protected PropertySheetEntry createChildEntry()
Return a new PropertySheetEntry.

Returns:
new PropertySheetEntry

dispose

public void dispose()
Specified by:
dispose in interface org.eclipse.ui.views.properties.IPropertySheetEntry

getCategory

public java.lang.String getCategory()
Specified by:
getCategory in interface org.eclipse.ui.views.properties.IPropertySheetEntry

getChildEntries

public org.eclipse.ui.views.properties.IPropertySheetEntry[] getChildEntries()
Specified by:
getChildEntries in interface org.eclipse.ui.views.properties.IPropertySheetEntry

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface org.eclipse.ui.views.properties.IPropertySheetEntry

getDescriptor

protected org.eclipse.ui.views.properties.IPropertyDescriptor getDescriptor()
Returns the descriptor for this entry.

Returns:
IPropertyDescriptor

getDisplayName

public java.lang.String getDisplayName()
Specified by:
getDisplayName in interface org.eclipse.ui.views.properties.IPropertySheetEntry

getEditor

public org.eclipse.jface.viewers.CellEditor getEditor(org.eclipse.swt.widgets.Composite parent)
Specified by:
getEditor in interface org.eclipse.ui.views.properties.IPropertySheetEntry

getEditValue

protected java.lang.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 java.lang.String getErrorText()
Specified by:
getErrorText in interface org.eclipse.ui.views.properties.IPropertySheetEntry

getFilters

public java.lang.String[] getFilters()
Specified by:
getFilters in interface org.eclipse.ui.views.properties.IPropertySheetEntry

getHelpContextIds

public java.lang.Object getHelpContextIds()
Specified by:
getHelpContextIds in interface org.eclipse.ui.views.properties.IPropertySheetEntry

getImage

public org.eclipse.swt.graphics.Image getImage()
Specified by:
getImage in interface org.eclipse.ui.views.properties.IPropertySheetEntry

getParent

protected PropertySheetEntry getParent()
Returns the parent PropertySheetEntry

Returns:
parent

getPropertySource

protected org.eclipse.ui.views.properties.IPropertySource getPropertySource(java.lang.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

getValueAsString

public java.lang.String getValueAsString()
Specified by:
getValueAsString in interface org.eclipse.ui.views.properties.IPropertySheetEntry

getValues

public java.lang.Object[] getValues()
Returns the value objects of this entry.

Returns:
Object[]

hasChildEntries

public boolean hasChildEntries()
Specified by:
hasChildEntries in interface org.eclipse.ui.views.properties.IPropertySheetEntry

refreshFromRoot

protected void refreshFromRoot()
Refresh the entry tree from the root down


removePropertySheetEntryListener

public void removePropertySheetEntryListener(org.eclipse.ui.views.properties.IPropertySheetEntryListener listener)
Specified by:
removePropertySheetEntryListener in interface org.eclipse.ui.views.properties.IPropertySheetEntry

resetPropertyValue

public void resetPropertyValue()
Specified by:
resetPropertyValue in interface org.eclipse.ui.views.properties.IPropertySheetEntry

setPropertySourceProvider

public void setPropertySourceProvider(org.eclipse.ui.views.properties.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

setValue

protected void setValue(java.lang.Object newValue)
Set the value for this entry.

We set the given value as the value for all our value objects. We then call our parent to update the property we represent with the given value. We then trigger a model refresh.

Parameters:
newValue - the new value

setValues

public void setValues(java.lang.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 org.eclipse.ui.views.properties.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