Class FieldDecorationRegistry
- java.lang.Object
-
- org.eclipse.jface.fieldassist.FieldDecorationRegistry
-
public class FieldDecorationRegistry extends Object
FieldDecorationRegistry is a common registry used to define shared field decorations within an application. Unlike resource registries, the FieldDecorationRegistry does not perform any lifecycle management of the decorations.Clients may specify images for the decorations in several different ways. Images may be described by their image id in a specified
ImageRegistry
. In this case, the life cycle of the image is managed by the image registry, and the decoration registry will not attempt to obtain an image from the image registry until the decoration is actually requested. In cases where the client has access to an already-created image, the image itself can be specified when registering the decoration. In this case, the life cycle should be managed by the specifying client.- Since:
- 3.2
- See Also:
FieldDecoration
,ImageRegistry
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEC_CONTENT_PROPOSAL
Decoration id for the decoration that should be used to cue the user that content proposals are available.static String
DEC_ERROR
Decoration id for the decoration that should be used to cue the user that a field has an error.static String
DEC_ERROR_QUICKFIX
Decoration id for the decoration that should be used to cue the user that a field has an error with quick fix available.static String
DEC_INFORMATION
Decoration id for the decoration that should be used to cue the user that a field has additional information.static String
DEC_REQUIRED
Decoration id for the decoration that should be used to cue the user that a field is required.static String
DEC_WARNING
Decoration id for the decoration that should be used to cue the user that a field has a warning.
-
Constructor Summary
Constructors Constructor Description FieldDecorationRegistry()
Construct a FieldDecorationRegistry.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FieldDecorationRegistry
getDefault()
Get the default FieldDecorationRegistry.FieldDecoration
getFieldDecoration(String id)
Returns the field decoration registered by the specified id .int
getMaximumDecorationHeight()
Get the maximum height (in pixels) of any decoration retrieved so far in the registry.int
getMaximumDecorationWidth()
Get the maximum width (in pixels) of any decoration retrieved so far in the registry.void
registerFieldDecoration(String id, String description, String imageId)
Registers a field decoration using the specified id.void
registerFieldDecoration(String id, String description, String imageId, ImageRegistry imageRegistry)
Registers a field decoration using the specified id.void
registerFieldDecoration(String id, String description, Image image)
Registers a field decoration using the specified id.static void
setDefault(FieldDecorationRegistry defaultRegistry)
Set the default FieldDecorationRegistry.void
unregisterFieldDecoration(String id)
Unregisters the field decoration with the specified id.
-
-
-
Field Detail
-
DEC_CONTENT_PROPOSAL
public static final String DEC_CONTENT_PROPOSAL
Decoration id for the decoration that should be used to cue the user that content proposals are available.- See Also:
- Constant Field Values
-
DEC_REQUIRED
public static final String DEC_REQUIRED
Decoration id for the decoration that should be used to cue the user that a field is required.- See Also:
- Constant Field Values
-
DEC_ERROR
public static final String DEC_ERROR
Decoration id for the decoration that should be used to cue the user that a field has an error.- See Also:
- Constant Field Values
-
DEC_WARNING
public static final String DEC_WARNING
Decoration id for the decoration that should be used to cue the user that a field has a warning.- See Also:
- Constant Field Values
-
DEC_INFORMATION
public static final String DEC_INFORMATION
Decoration id for the decoration that should be used to cue the user that a field has additional information.- Since:
- 3.3
- See Also:
- Constant Field Values
-
DEC_ERROR_QUICKFIX
public static final String DEC_ERROR_QUICKFIX
Decoration id for the decoration that should be used to cue the user that a field has an error with quick fix available.- Since:
- 3.3
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDefault
public static FieldDecorationRegistry getDefault()
Get the default FieldDecorationRegistry.- Returns:
- the singleton FieldDecorationRegistry that is used to manage shared field decorations.
-
setDefault
public static void setDefault(FieldDecorationRegistry defaultRegistry)
Set the default FieldDecorationRegistry.- Parameters:
defaultRegistry
- the singleton FieldDecorationRegistry that is used to manage shared field decorations.
-
getMaximumDecorationWidth
public int getMaximumDecorationWidth()
Get the maximum width (in pixels) of any decoration retrieved so far in the registry. This value changes as decorations are added and retrieved. This value can be used by clients to reserve space or otherwise compute margins when aligning non-decorated fields with decorated fields.- Returns:
- the maximum width in pixels of any accessed decoration
-
getMaximumDecorationHeight
public int getMaximumDecorationHeight()
Get the maximum height (in pixels) of any decoration retrieved so far in the registry. This value changes as decorations are added and retrieved. This value can be used by clients to reserve space or otherwise compute margins when aligning non-decorated fields with decorated fields.- Returns:
- the maximum height in pixels of any accessed decoration
-
registerFieldDecoration
public void registerFieldDecoration(String id, String description, Image image)
Registers a field decoration using the specified id. The lifecyle of the supplied image should be managed by the client. That is, it will never be disposed by this registry and the decoration should be removed from the registry if the image is ever disposed elsewhere.- Parameters:
id
- the String id used to identify and access the decoration.description
- the String description to be used in the decoration, ornull
if the decoration has no description.image
- the image to be used in the decoration
-
registerFieldDecoration
public void registerFieldDecoration(String id, String description, String imageId)
Registers a field decoration using the specified id. An image id of an image located in the default JFaceResources image registry is supplied. The image will not be created until the decoration is requested.- Parameters:
id
- the String id used to identify and access the decoration.description
- the String description to be used in the decoration, ornull
if the decoration has no description. *imageId
- the id of the image in the JFaceResources image registry that is used for this decorator
-
registerFieldDecoration
public void registerFieldDecoration(String id, String description, String imageId, ImageRegistry imageRegistry)
Registers a field decoration using the specified id. An image id and an image registry are supplied. The image will not be created until the decoration is requested.- Parameters:
id
- the String id used to identify and access the decoration.description
- the String description to be used in the decoration, ornull
if the decoration has no description. *imageId
- the id of the image in the supplied image registry that is used for this decoratorimageRegistry
- the registry used to obtain the image
-
unregisterFieldDecoration
public void unregisterFieldDecoration(String id)
Unregisters the field decoration with the specified id. No lifecycle management is performed on the decoration's image. This message has no effect if no field decoration with the specified id was previously registered.This method need not be called if the registered decoration's image is managed in an image registry. In that case, leaving the decoration in the registry will do no harm since the image will remain valid and will be properly disposed when the application is shut down. This method should be used in cases where the caller intends to dispose of the image referred to by the decoration, or otherwise determines that the decoration should no longer be used.
- Parameters:
id
- the String id of the decoration to be unregistered.
-
getFieldDecoration
public FieldDecoration getFieldDecoration(String id)
Returns the field decoration registered by the specified id .- Parameters:
id
- the String id used to access the decoration.- Returns:
- the FieldDecoration with the specified id, or
null
if there is no decoration with the specified id.
-
-