Runtime

org.eclipse.gmf.runtime.emf.ui.properties.sections
Class PropertySheetEntry

java.lang.Object
  extended by org.eclipse.gmf.runtime.emf.ui.properties.sections.PropertySheetEntry
All Implemented Interfaces:
ICellEditorListener, IPropertySheetEntry
Direct Known Subclasses:
UndoableModelPropertySheetEntry

public class PropertySheetEntry
extends java.lang.Object
implements IPropertySheetEntry, ICellEditorListener

PropertySheetEntry that will be used in the PropertySheet view


Field Summary
protected  IPropertyDescriptor descriptor
          IPropertyDescriptor for thie PropertySheetEntry
protected  CellEditor editor
          CellEditor associated with this PropertySheetEntry
protected  java.lang.Object editValue
          The value of this entry is defined as the the first object in its value array or, if that object is an IPropertySource, the value it returns when sent getEditableValue
protected  PropertySheetEntry parent
          Parent of this PropertySheetEntry
protected  java.lang.Object[] values
          The values we are displaying/editing.
 
Fields inherited from interface org.eclipse.ui.views.properties.IPropertySheetEntry
FILTER_ID_EXPERT
 
Constructor Summary
PropertySheetEntry()
           
 
Method Summary
 void addPropertySheetEntryListener(IPropertySheetEntryListener listener)
           
 void applyEditorValue()
           
 void cancelEditor()
           
protected  java.util.List computeMergedPropertyDescriptors()
          Return the sorted intersection of all the IPropertyDescriptors for the objects.
protected  java.util.Map computePropertyDescriptorsFor(IPropertySource source)
          Returns an map of property descritptors (keyed on id) for the given property source.
protected  void createChildEntries()
          Create our child entries.
protected  PropertySheetEntry[] createChildEntries(int size)
          Creates a list of child PropertySheetEntry entries.
protected  PropertySheetEntry createChildEntry()
          Create child entry for this PropertySheerEntry
 void dispose()
           
 void editorValueChanged(boolean oldValidState, boolean newValidState)
           
 java.lang.String getCategory()
           
 IPropertySheetEntry[] getChildEntries()
           
 java.lang.String getDescription()
           
protected  IPropertyDescriptor getDescriptor()
          Returns the descriptor for this entry.
 java.lang.String getDisplayName()
           
 CellEditor getEditor(Composite parentComposite)
           
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()
           
 Image getImage()
           
protected  IPropertySource getPropertySource(java.lang.Object object)
          Returns an property source for the given object.
 java.lang.String getValueAsString()
           
protected  java.lang.Object[] getValues()
          Returns the value objects of this entry.
 boolean hasChildEntries()
           
protected  void refreshValues()
          Update our value objects.
 void removePropertySheetEntryListener(IPropertySheetEntryListener listener)
           
 void resetPropertyValue()
           
protected  void setErrorText(java.lang.String newErrorText)
          Set the error text.
 void setPropertySourceProvider(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 on IPropertySheetEntry 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
 

Field Detail

values

protected java.lang.Object[] values
The values we are displaying/editing. These objects repesent the value of one of the properties of the values of our parent entry. Except for the root entry where they represent the input (selected) objects.


editValue

protected java.lang.Object editValue
The value of this entry is defined as the the first object in its value array or, if that object is an IPropertySource, the value it returns when sent getEditableValue


parent

protected PropertySheetEntry parent
Parent of this PropertySheetEntry


descriptor

protected IPropertyDescriptor descriptor
IPropertyDescriptor for thie PropertySheetEntry


editor

protected CellEditor editor
CellEditor associated with this PropertySheetEntry

Constructor Detail

PropertySheetEntry

public PropertySheetEntry()
Method Detail

editorValueChanged

public void editorValueChanged(boolean oldValidState,
                               boolean newValidState)
Specified by:
editorValueChanged in interface ICellEditorListener

cancelEditor

public void cancelEditor()
Specified by:
cancelEditor in interface ICellEditorListener

addPropertySheetEntryListener

public void addPropertySheetEntryListener(IPropertySheetEntryListener listener)
Specified by:
addPropertySheetEntryListener in interface IPropertySheetEntry

applyEditorValue

public void applyEditorValue()
Specified by:
applyEditorValue in interface ICellEditorListener
Specified by:
applyEditorValue in interface IPropertySheetEntry

computeMergedPropertyDescriptors

protected java.util.List computeMergedPropertyDescriptors()
Return the sorted intersection of all the IPropertyDescriptors for the objects.

Returns:
sorted List of all the IPropertyDescriptors for the objects

computePropertyDescriptorsFor

protected java.util.Map computePropertyDescriptorsFor(IPropertySource source)
Returns an map of property descritptors (keyed on id) for the given property source.

Parameters:
source - a property source for which to obtain descriptors
Returns:
a table of decriptors keyed on their id

createChildEntries

protected void createChildEntries()
Create our child entries.


createChildEntries

protected PropertySheetEntry[] createChildEntries(int size)
Creates a list of child PropertySheetEntry entries.

Parameters:
size - list size
Returns:
list of child PropertySheerEntry

createChildEntry

protected PropertySheetEntry createChildEntry()
Create child entry for this PropertySheerEntry

Returns:
child PropertySheetEntry

dispose

public void dispose()
Specified by:
dispose in interface IPropertySheetEntry

getCategory

public java.lang.String getCategory()
Specified by:
getCategory in interface IPropertySheetEntry

getChildEntries

public IPropertySheetEntry[] getChildEntries()
Specified by:
getChildEntries in interface IPropertySheetEntry

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface IPropertySheetEntry

getDescriptor

protected IPropertyDescriptor getDescriptor()
Returns the descriptor for this entry.

Returns:
IPropertyDescriptor for this entry

getDisplayName

public java.lang.String getDisplayName()
Specified by:
getDisplayName in interface IPropertySheetEntry

getEditor

public CellEditor getEditor(Composite parentComposite)
Specified by:
getEditor in interface 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 IPropertySheetEntry

getFilters

public java.lang.String[] getFilters()
Specified by:
getFilters in interface IPropertySheetEntry

getHelpContextIds

public java.lang.Object getHelpContextIds()
Specified by:
getHelpContextIds in interface IPropertySheetEntry

getImage

public Image getImage()
Specified by:
getImage in interface IPropertySheetEntry

getPropertySource

protected 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 IPropertySheetEntry

getValues

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

Returns:
the value of objects property for this entry

hasChildEntries

public boolean hasChildEntries()
Specified by:
hasChildEntries in interface IPropertySheetEntry

refreshValues

protected void refreshValues()
Update our value objects. We ask our parent for the property values based on our descriptor.


removePropertySheetEntryListener

public void removePropertySheetEntryListener(IPropertySheetEntryListener listener)
Specified by:
removePropertySheetEntryListener in interface IPropertySheetEntry

resetPropertyValue

public void resetPropertyValue()
Specified by:
resetPropertyValue in interface IPropertySheetEntry

setErrorText

protected void setErrorText(java.lang.String newErrorText)
Set the error text. This should be set to null when the current value is valid, otherwise it should be set to a error string

Parameters:
newErrorText - the error tex

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 - the 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 on IPropertySheetEntry 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 - entry that changed its value

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.