Class ResourcePropertySource
- java.lang.Object
-
- org.eclipse.ui.views.properties.ResourcePropertySource
-
- All Implemented Interfaces:
IPropertySource
- Direct Known Subclasses:
FilePropertySource
public class ResourcePropertySource extends Object implements IPropertySource
A Resource property source.
-
-
Field Summary
Fields Modifier and Type Field Description protected IResourceelementprotected StringerrorMessageprotected static StringFILE_NOT_EXIST_TEXTprotected static StringFILE_NOT_FOUNDprotected static StringNOT_LOCAL_TEXTprotected static IPropertyDescriptor[]propertyDescriptorsprotected static IPropertyDescriptor[]propertyDescriptorsLinkVariableprotected static StringUNDEFINED_PATH_VARIABLE
-
Constructor Summary
Constructors Constructor Description ResourcePropertySource(IResource res)Creates a PropertySource and stores its IResource
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetEditableValue()Returns a value for this property source that can be edited in a property sheet.protected FilegetFile(IResource resource)Get the java.io.File equivalent of the passed IFile.IPropertyDescriptor[]getPropertyDescriptors()Returns the list of property descriptors for this property source.ObjectgetPropertyValue(Object name)Returns the value of the property with the given id if it has one.booleanisPropertySet(Object property)Returns whether the value of the property with the given id has changed from its default value.voidresetPropertyValue(Object property)TheResourcePropertySourceimplementation of thisIPropertySourcemethod does nothing since all properties are read-only.voidsetPropertyValue(Object name, Object value)TheResourcePropertySourceimplementation of thisIPropertySourcemethod does nothing since all properties are read-only.
-
-
-
Field Detail
-
NOT_LOCAL_TEXT
protected static String NOT_LOCAL_TEXT
-
FILE_NOT_FOUND
protected static String FILE_NOT_FOUND
-
UNDEFINED_PATH_VARIABLE
protected static String UNDEFINED_PATH_VARIABLE
-
FILE_NOT_EXIST_TEXT
protected static String FILE_NOT_EXIST_TEXT
-
element
protected IResource element
-
errorMessage
protected String errorMessage
-
propertyDescriptors
protected static IPropertyDescriptor[] propertyDescriptors
-
propertyDescriptorsLinkVariable
protected static IPropertyDescriptor[] propertyDescriptorsLinkVariable
-
-
Constructor Detail
-
ResourcePropertySource
public ResourcePropertySource(IResource res)
Creates a PropertySource and stores its IResource- Parameters:
res- the resource for which this is a property source
-
-
Method Detail
-
getEditableValue
public Object getEditableValue()
Description copied from interface:IPropertySourceReturns a value for this property source that can be edited in a property sheet.This value is used when this
IPropertySourceis appearing in the property sheet as the value of a property of some otherIPropertySourceThis value is passed as the input to a cell editor opening on an
IPropertySource.This value is also used when an
IPropertySourceis being used as the value in asetPropertyValuemessage. The receiver 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).
- Specified by:
getEditableValuein interfaceIPropertySource- Returns:
- a value that can be edited
-
getPropertyDescriptors
public IPropertyDescriptor[] getPropertyDescriptors()
Description copied from interface:IPropertySourceReturns the list of property descriptors for this property source. ThegetPropertyValueandsetPropertyValuemethods 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.
- Specified by:
getPropertyDescriptorsin interfaceIPropertySource- Returns:
- the property descriptors
-
getPropertyValue
public Object getPropertyValue(Object name)
Description copied from interface:IPropertySourceReturns the value of the property with the given id if it has one. Returnsnullif the property's value isnullvalue or if this source does not have the specified property.- Specified by:
getPropertyValuein interfaceIPropertySource- Parameters:
name- the id of the property being set- Returns:
- the value of the property, or
null - See Also:
IPropertySource.setPropertyValue(java.lang.Object, java.lang.Object)
-
isPropertySet
public boolean isPropertySet(Object property)
Description copied from interface:IPropertySourceReturns whether the value of the property with the given id has changed from its default value. Returnsfalseif this source does not have the specified property.If the notion of default value is not meaningful for the specified property then
falseis returned.- Specified by:
isPropertySetin interfaceIPropertySource- Parameters:
property- the id of the property- Returns:
trueif the value of the specified property has changed from its original default value,falseif the specified property does not have a meaningful default value, andfalseif this source does not have the specified property- See Also:
IPropertySource2.isPropertyResettable(Object),IPropertySource.resetPropertyValue(Object)
-
resetPropertyValue
public void resetPropertyValue(Object property)
TheResourcePropertySourceimplementation of thisIPropertySourcemethod does nothing since all properties are read-only.- Specified by:
resetPropertyValuein interfaceIPropertySource- Parameters:
property- the id of the property being reset- See Also:
IPropertySource.isPropertySet(Object),IPropertySource2.isPropertyResettable(Object)
-
setPropertyValue
public void setPropertyValue(Object name, Object value)
TheResourcePropertySourceimplementation of thisIPropertySourcemethod does nothing since all properties are read-only.- Specified by:
setPropertyValuein interfaceIPropertySource- Parameters:
name- the id of the property being setvalue- the new value for the property;nullis allowed- See Also:
IPropertySource.getPropertyValue(java.lang.Object),IPropertySource.getEditableValue()
-
-