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

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

public class UndoablePropertySheetEntry
extends PropertySheetEntry

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
protected  CommandStack stack
           
 
Fields inherited from interface org.eclipse.ui.views.properties.IPropertySheetEntry
FILTER_ID_EXPERT
 
Constructor Summary
UndoablePropertySheetEntry()
           
UndoablePropertySheetEntry(CommandStack stack)
           
 
Method Summary
protected  PropertySheetEntry[] createChildEntries(int size)
          Return an array of property sheet entries
protected  PropertySheetEntry createChildEntry()
          Return a new PropertySheetEntry.
 void dispose()
           
protected  CommandStack getCommandStack()
          returns the Command stack from the root entry
 void resetPropertyValue()
           
 void setCommandStack(CommandStack stack)
           
protected  void setValue(java.lang.Object newValue)
          Set the value for this entry.
protected  void valueChanged(UndoablePropertySheetEntry child, CompoundCommand command)
          The value of the given child entry has changed.
 
Methods inherited from class org.eclipse.gef.internal.ui.properties.PropertySheetEntry
addPropertySheetEntryListener, applyEditorValue, computeMergedPropertyDescriptors, getCategory, getChildEntries, getDescription, getDescriptor, getDisplayName, getEditor, getEditValue, getErrorText, getFilters, getHelpContextIds, getImage, getParent, getPropertySource, getValueAsString, getValues, hasChildEntries, refreshFromRoot, removePropertySheetEntryListener, setPropertySourceProvider, setValues, valueChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stack

protected CommandStack stack
Constructor Detail

UndoablePropertySheetEntry

public UndoablePropertySheetEntry()

UndoablePropertySheetEntry

public UndoablePropertySheetEntry(CommandStack stack)
Method Detail

createChildEntries

protected PropertySheetEntry[] createChildEntries(int size)
Return an array of property sheet entries

Overrides:
createChildEntries in class PropertySheetEntry
Parameters:
size - size of the new array
Returns:
array of new property sheet entries

createChildEntry

protected PropertySheetEntry createChildEntry()
Description copied from class: PropertySheetEntry
Return a new PropertySheetEntry.

Overrides:
createChildEntry in class PropertySheetEntry
Returns:
new PropertySheetEntry

dispose

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

getCommandStack

protected CommandStack getCommandStack()
returns the Command stack from the root entry

Returns:

resetPropertyValue

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

setCommandStack

public void setCommandStack(CommandStack stack)

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.

Overrides:
setValue in class PropertySheetEntry
Parameters:
newValue - the new value

valueChanged

protected void valueChanged(UndoablePropertySheetEntry child,
                            CompoundCommand command)
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