Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.ui.views.properties
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):

- `setDescription`
- `setCategory`
- `setLabelProvider`
- `setHelpContexts`

Subclasses should reimplement `getPropertyEditor` to 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 a `TextCellEditor`
- `ComboBoxPropertyDescriptor - edits with a `ComboBoxCellEditor``
- `ColorPropertyDescriptor - edits with a `ColorCellEditor``

Constructor Summary
`PropertyDescriptor(Object id, String displayName)` Creates a new property descriptor with the given id and display name

Method Summary
`CellEditor` | `createPropertyEditor(Composite parent)` The `PropertyDescriptor` implementation of this `IPropertyDescriptor` method returns `null`.
`protected boolean` | `getAlwaysIncompatible()` Returns `true` if this property descriptor is to be always considered incompatible with any other property descriptor.
`String` | `getCategory()` The `PropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value set by the `setCategory` method.
`String` | `getDescription()` The `PropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value set by the `setDescription` method.
`String` | `getDisplayName()` The `SimplePropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value supplied on the constructor.
`String[]` | `getFilterFlags()` The `SimplePropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value set by the `setFilterFlags` method.
`Object` | `getHelpContextIds()` The `SimplePropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value set by the `setHelpContextId` method.
`Object` | `getId()` The `PropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value supplied on the constructor.
`ILabelProvider` | `getLabelProvider()` The `PropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value set by the `setProvider` method or, if no value has been set it returns a `LabelProvider`
`protected ICellEditorValidator` | `getValidator()` Returns the input validator for editing the property.
`boolean` | `isCompatibleWith(IPropertyDescriptor anotherProperty)` The `SimplePropertyDescriptor` implementation of this `IPropertyDescriptor` method returns true if the other property has the same id and category and `getAlwaysIncompatible()` returns false
`boolean` | `isLabelProviderSet()` Returns whether a label provider has been set on the receiver.
`void` | `setAlwaysIncompatible(boolean flag)` Sets a flag indicating whether this property descriptor is to be always considered incompatible with any other property descriptor.
`void` | `setCategory(String category)` Sets the category for this property descriptor.
`void` | `setDescription(String description)` Sets the description for this property descriptor.
`void` | `setFilterFlags(String[] value)` Sets the the filter flags for this property descriptor.
`void` | `setHelpContextIds(Object contextIds)` Sets the help context id for this property descriptor.
`void` | `setLabelProvider(ILabelProvider provider)` Sets the label provider for this property descriptor.
`void` | `setValidator(ICellEditorValidator validator)` Sets the input validator for the cell editor for this property descriptor.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PropertyDescriptor

    public PropertyDescriptor(Object id,
                              String displayName)

  Creates a new property descriptor with the given id and display name

Method Detail

### createPropertyEditor

    public CellEditor createPropertyEditor(Composite parent)

  The `PropertyDescriptor` implementation of this `IPropertyDescriptor` method returns `null`.

  Since no cell editor is returned, the property is read only.

  Specified by:
    `createPropertyEditor` in interface `IPropertyDescriptor`
  Parameters:
    `parent` - the parent widget for the cell editor
  Returns:
    the cell editor for this property, or `null` if this property cannot be edited

### getAlwaysIncompatible

    protected boolean getAlwaysIncompatible()

  Returns `true` if this property descriptor is to be always considered incompatible with any other property descriptor. This prevents a property from displaying during multiple selection.

  Returns:
    `true` to indicate always incompatible

### getCategory

    public String getCategory()

  The `PropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value set by the `setCategory` method. If unset, this method returns `null` indicating the default category.

  Specified by:
    `getCategory` in interface `IPropertyDescriptor`
  Returns:
    the category name, or `null` if the default category is to be used
  See Also:
    `setCategory(java.lang.String)`

### getDescription

    public String getDescription()

  The `PropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value set by the `setDescription` method. If unset, this method returns `null` indicating no description.

  Specified by:
    `getDescription` in interface `IPropertyDescriptor`
  Returns:
    a brief description, or `null` if none
  See Also:
    `setDescription(java.lang.String)`

### getDisplayName

    public String getDisplayName()

  The `SimplePropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value supplied on the constructor.

  Specified by:
    `getDisplayName` in interface `IPropertyDescriptor`
  Returns:
    a displayable name

### getFilterFlags

    public String[] getFilterFlags()

  The `SimplePropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value set by the `setFilterFlags` method. If unset, this method returns `null`.

  Valid values for these flags are declared as constants on `IPropertySheetEntry`

  Specified by:
    `getFilterFlags` in interface `IPropertyDescriptor`
  Returns:
    a list of filter types to which this property belongs, or `null` if none

### getHelpContextIds

    public Object getHelpContextIds()

  The `SimplePropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value set by the `setHelpContextId` method. If unset, this method returns `null`.

  Specified by:
    `getHelpContextIds` in interface `IPropertyDescriptor`
  Returns:
    the help context id for this entry
  See Also:
    `setHelpContextIds(java.lang.Object)`

### getId

    public Object getId()

  The `PropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value supplied on the constructor.

  Specified by:
    `getId` in interface `IPropertyDescriptor`
  Returns:
    the property id

### getLabelProvider

    public ILabelProvider getLabelProvider()

  The `PropertyDescriptor` implementation of this `IPropertyDescriptor` method returns the value set by the `setProvider` method or, if no value has been set it returns a `LabelProvider`

  Specified by:
    `getLabelProvider` in interface `IPropertyDescriptor`
  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)

  The `SimplePropertyDescriptor` implementation of this `IPropertyDescriptor` method returns true if the other property has the same id and category and `getAlwaysIncompatible()` returns false

  Specified by:
    `isCompatibleWith` in interface `IPropertyDescriptor`
  Parameters:
    `anotherProperty` - the other property descriptor
  Returns:
    `true` if the property descriptors are compatible, and `false` otherwise

### 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` - `true` to indicate always incompatible

### setCategory

    public void setCategory(String category)

  Sets the category for this property descriptor.

  Parameters:
    `category` - the category for the descriptor, or `null` if 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, or `null` if 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 `String` representing a context id. The previously valid parameter types are deprecated. The plural name for this method is unfortunate.

  Parameters:
    `contextIds` - the help context ids, or `null` if 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 `LabelProvider` will be created as the default when needed.

  Parameters:
    `provider` - the label provider for the descriptor, or `null` if 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, or `null` if none

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.