public class FieldDecorationRegistry extends Object
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.
FieldDecoration
,
ImageRegistry
Modifier and Type | Field and 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 and Description |
---|
FieldDecorationRegistry()
Construct a FieldDecorationRegistry.
|
Modifier and Type | Method and 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,
Image image)
Registers a field decoration using the specified id.
|
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.
|
static void |
setDefault(FieldDecorationRegistry defaultRegistry)
Set the default FieldDecorationRegistry.
|
void |
unregisterFieldDecoration(String id)
Unregisters the field decoration with the specified id.
|
public static final String DEC_CONTENT_PROPOSAL
public static final String DEC_REQUIRED
public static final String DEC_ERROR
public static final String DEC_WARNING
public static final String DEC_INFORMATION
public static final String DEC_ERROR_QUICKFIX
public FieldDecorationRegistry()
public static FieldDecorationRegistry getDefault()
public static void setDefault(FieldDecorationRegistry defaultRegistry)
defaultRegistry
- the singleton FieldDecorationRegistry that is used to manage
shared field decorations.public int getMaximumDecorationWidth()
public int getMaximumDecorationHeight()
public void registerFieldDecoration(String id, String description, Image image)
id
- the String id used to identify and access the decoration.description
- the String description to be used in the decoration, or
null
if the decoration has no description.image
- the image to be used in the decorationpublic void registerFieldDecoration(String id, String description, String imageId)
id
- the String id used to identify and access the decoration.description
- the String description to be used in the decoration, or
null
if the decoration has no description. *imageId
- the id of the image in the JFaceResources image registry that
is used for this decoratorpublic void registerFieldDecoration(String id, String description, String imageId, ImageRegistry imageRegistry)
id
- the String id used to identify and access the decoration.description
- the String description to be used in the decoration, or
null
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 imagepublic void unregisterFieldDecoration(String id)
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.
id
- the String id of the decoration to be unregistered.public FieldDecoration getFieldDecoration(String id)
id
- the String id used to access the decoration.null
if there is no decoration with the specified id.
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.