|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.ui.views.properties.ResourcePropertySource
A Resource property source.
Field Summary | |
protected IResource |
element
|
protected String |
errorMessage
|
protected static String |
NOT_LOCAL_TEXT
|
protected static IPropertyDescriptor[] |
propertyDescriptors
|
Constructor Summary | |
ResourcePropertySource(IResource res)
Creates a PropertySource and stores its IResource |
Method Summary | |
Object |
getEditableValue()
Returns a value for this property source that can be edited in a property sheet. |
IPropertyDescriptor[] |
getPropertyDescriptors()
Returns the list of property descriptors for this property source. |
Object |
getPropertyValue(Object name)
Returns the value of the property with the given id if it has one. |
boolean |
isPropertySet(Object property)
Returns whether the value of the property with the given id has changed from its default value. |
void |
resetPropertyValue(Object property)
The ResourcePropertySource implementation of this
IPropertySource method does nothing since all
properties are read-only. |
void |
setPropertyValue(Object name,
Object value)
The ResourcePropertySource implementation of this
IPropertySource method does nothing since all
properties are read-only. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static String NOT_LOCAL_TEXT
protected IResource element
protected String errorMessage
protected static IPropertyDescriptor[] propertyDescriptors
Constructor Detail |
public ResourcePropertySource(IResource res)
res
- the resource for which this is a property sourceMethod Detail |
public Object getEditableValue()
IPropertySource
This value is used when this IPropertySource
is appearing
in the property sheet as the value of a property of some other
IPropertySource
This value is passed as the input to a cell editor opening on an
IPropertySource
.
This value is also used when an IPropertySource
is being
used as the value in a setPropertyValue
message. The reciever
of the message would then typically use the editable value to update the
original property source or construct a new instance.
For example an email address which is a property source may have an editable value which is a string so that it can be edited in a text cell editor. The email address would also have a constructor or setter that takes the edited string so that an appropriate instance can be created or the original instance modified when the edited value is set.
This behavior is important for another reason. When the property sheet is showing properties for more than one object (multiple selection), a property sheet entry will display and edit a single value (typically coming from the first selected object). After a property has been edited in a cell editor, the same value is set as the property value for all of the objects. This is fine for primitive types but otherwise all of the objects end up with a reference to the same value. Thus by creating an editable value and using it to update the state of the original property source object, one is able to edit several property source objects at once (multiple selection).
getEditableValue
in interface IPropertySource
public IPropertyDescriptor[] getPropertyDescriptors()
IPropertySource
getPropertyValue
and setPropertyValue
methods
are used to read and write the actual property values by specifying
the property ids from these property descriptors.
Implementors should cache the descriptors as they will be asked for the descriptors with any edit/update. Since descriptors provide cell editors, returning the same descriptors if possible allows for efficient updating.
getPropertyDescriptors
in interface IPropertySource
public Object getPropertyValue(Object name)
IPropertySource
null
if this source if the property's value is
null
value or if this source does not have the specified
property.
getPropertyValue
in interface IPropertySource
name
- the id of the property being set
null
IPropertySource.setPropertyValue(java.lang.Object, java.lang.Object)
public boolean isPropertySet(Object property)
IPropertySource
false
if the notion of default value
is not meaningful for the specified property, or if this source does not have
the specified property.
isPropertySet
in interface IPropertySource
property
- the id of the property
true
if the value of the specified property has changed
from its original default value, and false
otherwisepublic void resetPropertyValue(Object property)
ResourcePropertySource
implementation of this
IPropertySource
method does nothing since all
properties are read-only.
resetPropertyValue
in interface IPropertySource
property
- the id of the property being resetpublic void setPropertyValue(Object name, Object value)
ResourcePropertySource
implementation of this
IPropertySource
method does nothing since all
properties are read-only.
setPropertyValue
in interface IPropertySource
name
- the id of the property being setvalue
- the new value for the property; null
is allowedIPropertySource.getPropertyValue(java.lang.Object)
,
IPropertySource.getEditableValue()
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |