Class PropertyDescriptor
- java.lang.Object
-
- org.eclipse.ui.views.properties.PropertyDescriptor
-
- All Implemented Interfaces:
IPropertyDescriptor
- Direct Known Subclasses:
ColorPropertyDescriptor,ComboBoxPropertyDescriptor,TextPropertyDescriptor
public class PropertyDescriptor extends Object implements IPropertyDescriptor
Standard implementation for property descriptors.The required attributes of property descriptors (id and display name) are passed to the constructor; the optional attributes can be configured using the various set methods (all have reasonable default values):
setDescriptionsetCategorysetLabelProvidersetHelpContexts
Subclasses should reimplement
getPropertyEditorto provide a cell editor for changing the value; otherwise the property will be effectively read only.There are several concrete subclasses provided in this package that cover the most common cases:
TextPropertyDescriptor- edits with aTextCellEditorComboBoxPropertyDescriptor- edits with aComboBoxCellEditorColorPropertyDescriptor- edits with aColorCellEditor
-
-
Constructor Summary
Constructors Constructor Description PropertyDescriptor(Object id, String displayName)Creates a new property descriptor with the given id and display name
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CellEditorcreatePropertyEditor(Composite parent)ThePropertyDescriptorimplementation of thisIPropertyDescriptormethod returnsnull.protected booleangetAlwaysIncompatible()Returnstrueif this property descriptor is to be always considered incompatible with any other property descriptor.StringgetCategory()ThePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value set by thesetCategorymethod.StringgetDescription()ThePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value set by thesetDescriptionmethod.StringgetDisplayName()TheSimplePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value supplied on the constructor.String[]getFilterFlags()TheSimplePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value set by thesetFilterFlagsmethod.ObjectgetHelpContextIds()TheSimplePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value set by thesetHelpContextIdmethod.ObjectgetId()ThePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value supplied on the constructor.ILabelProvidergetLabelProvider()ThePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value set by thesetProvidermethod or, if no value has been set it returns aLabelProviderprotected ICellEditorValidatorgetValidator()Returns the input validator for editing the property.booleanisCompatibleWith(IPropertyDescriptor anotherProperty)TheSimplePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns true if the other property has the same id and category andgetAlwaysIncompatible()returns falsebooleanisLabelProviderSet()Returns whether a label provider has been set on the receiver.voidsetAlwaysIncompatible(boolean flag)Sets a flag indicating whether this property descriptor is to be always considered incompatible with any other property descriptor.voidsetCategory(String category)Sets the category for this property descriptor.voidsetDescription(String description)Sets the description for this property descriptor.voidsetFilterFlags(String[] value)Sets the the filter flags for this property descriptor.voidsetHelpContextIds(Object contextIds)Sets the help context id for this property descriptor.voidsetLabelProvider(ILabelProvider provider)Sets the label provider for this property descriptor.voidsetValidator(ICellEditorValidator validator)Sets the input validator for the cell editor for this property descriptor.
-
-
-
Method Detail
-
createPropertyEditor
public CellEditor createPropertyEditor(Composite parent)
ThePropertyDescriptorimplementation of thisIPropertyDescriptormethod returnsnull.Since no cell editor is returned, the property is read only.
- Specified by:
createPropertyEditorin interfaceIPropertyDescriptor- Parameters:
parent- the parent widget for the cell editor- Returns:
- the cell editor for this property, or
nullif this property cannot be edited
-
getAlwaysIncompatible
protected boolean getAlwaysIncompatible()
Returnstrueif this property descriptor is to be always considered incompatible with any other property descriptor. This prevents a property from displaying during multiple selection.- Returns:
trueto indicate always incompatible
-
getCategory
public String getCategory()
ThePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value set by thesetCategorymethod. If unset, this method returnsnullindicating the default category.- Specified by:
getCategoryin interfaceIPropertyDescriptor- Returns:
- the category name, or
nullif the default category is to be used - See Also:
setCategory(java.lang.String)
-
getDescription
public String getDescription()
ThePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value set by thesetDescriptionmethod. If unset, this method returnsnullindicating no description.- Specified by:
getDescriptionin interfaceIPropertyDescriptor- Returns:
- a brief description, or
nullif none - See Also:
setDescription(java.lang.String)
-
getDisplayName
public String getDisplayName()
TheSimplePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value supplied on the constructor.- Specified by:
getDisplayNamein interfaceIPropertyDescriptor- Returns:
- a displayable name
-
getFilterFlags
public String[] getFilterFlags()
TheSimplePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value set by thesetFilterFlagsmethod. If unset, this method returnsnull.Valid values for these flags are declared as constants on
IPropertySheetEntry- Specified by:
getFilterFlagsin interfaceIPropertyDescriptor- Returns:
- a list of filter types to which this property belongs, or
nullif none
-
getHelpContextIds
public Object getHelpContextIds()
TheSimplePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value set by thesetHelpContextIdmethod. If unset, this method returnsnull.- Specified by:
getHelpContextIdsin interfaceIPropertyDescriptor- Returns:
- the help context id for this entry
- See Also:
setHelpContextIds(java.lang.Object)
-
getId
public Object getId()
ThePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value supplied on the constructor.- Specified by:
getIdin interfaceIPropertyDescriptor- Returns:
- the property id
-
getLabelProvider
public ILabelProvider getLabelProvider()
ThePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns the value set by thesetProvidermethod or, if no value has been set it returns aLabelProvider- Specified by:
getLabelProviderin interfaceIPropertyDescriptor- Returns:
- the label provider used to display this property
- See Also:
setLabelProvider(org.eclipse.jface.viewers.ILabelProvider)
-
getValidator
protected ICellEditorValidator getValidator()
Returns the input validator for editing the property.- Returns:
- the validator used to verify correct values for this property,
or
null
-
isLabelProviderSet
public boolean isLabelProviderSet()
Returns whether a label provider has been set on the receiver.- Returns:
- whether a label provider has been set on the receiver.
- Since:
- 3.0
- See Also:
setLabelProvider(org.eclipse.jface.viewers.ILabelProvider)
-
isCompatibleWith
public boolean isCompatibleWith(IPropertyDescriptor anotherProperty)
TheSimplePropertyDescriptorimplementation of thisIPropertyDescriptormethod returns true if the other property has the same id and category andgetAlwaysIncompatible()returns false- Specified by:
isCompatibleWithin interfaceIPropertyDescriptor- Parameters:
anotherProperty- the other property descriptor- Returns:
trueif the property descriptors are compatible, andfalseotherwise
-
setAlwaysIncompatible
public void setAlwaysIncompatible(boolean flag)
Sets a flag indicating whether this property descriptor is to be always considered incompatible with any other property descriptor. Setting this flag prevents a property from displaying during multiple selection.- Parameters:
flag-trueto indicate always incompatible
-
setCategory
public void setCategory(String category)
Sets the category for this property descriptor.- Parameters:
category- the category for the descriptor, ornullif none- See Also:
getCategory()
-
setDescription
public void setDescription(String description)
Sets the description for this property descriptor. The description should be limited to a single line so that it can be displayed in the status line.- Parameters:
description- the description, ornullif none- See Also:
getDescription()
-
setFilterFlags
public void setFilterFlags(String[] value)
Sets the the filter flags for this property descriptor. The description should be limited to a single line so that it can be displayed in the status line.Valid values for these flags are declared as constants on
IPropertySheetEntry- Parameters:
value- the filter flags- See Also:
getFilterFlags()
-
setHelpContextIds
public void setHelpContextIds(Object contextIds)
Sets the help context id for this property descriptor. NOTE: Help support system API's changed since 2.0 and arrays of contexts are no longer supported.Thus the only valid parameter type for this method is a
Stringrepresenting a context id. The previously valid parameter types are deprecated. The plural name for this method is unfortunate.- Parameters:
contextIds- the help context ids, ornullif none- See Also:
getHelpContextIds()
-
setLabelProvider
public void setLabelProvider(ILabelProvider provider)
Sets the label provider for this property descriptor.If no label provider is set an instance of
LabelProviderwill be created as the default when needed.- Parameters:
provider- the label provider for the descriptor, ornullif the default label provider should be used- See Also:
getLabelProvider()
-
setValidator
public void setValidator(ICellEditorValidator validator)
Sets the input validator for the cell editor for this property descriptor.[Issue: This method should be unnecessary is the cell editor's own validator is used. ]
- Parameters:
validator- the cell input validator, ornullif none
-
-