[databinding] ControlDecorationSupport idea [message #22945] |
Wed, 22 July 2009 15:31  |
Eclipse User |
|
|
|
I'm experimenting with ControlDecorationSupport and it is quite handy! I
created a custom ControlDecorationUpdater because I wanted the feature for
required fields that:
- uses "FieldDecorationRegistry.DEC_REQUIRED" the first time
- uses "FieldDecorationRegistry.DEC_ERROR" if the status goes ok and then
back to error
This is a good practice for wizards, etc so users doesn't see a glaring red
X before they even have a chance to provide a value. To do this, I had to
override update() instead of getImage() because I needed access to the
decoration.
new ControlDecorationUpdater() {
protected void update(ControlDecoration decoration,
IStatus status) {
if (status == null || status.isOK()) {
decoration.hide();
} else {
if (decoration.getImage() == null
&& status instanceof RequiredStatus)
{ // my custom error IStatus
decoration
.setImage(FieldDecorationRegistry
.getDefault()
.getFieldDecoration(
FieldDecorationRegistry.DEC_REQUIRED).getImage());
} else {
decoration.setImage(getImage(status));
}
decoration
.setDescriptionText(getDescriptionText(status));
decoration.show();
}
}
}
I'm mentioning this as a use case to provide feedback. Has anyone else done
something similar? Would this concept be useful to add to the framework
level (maybe through other means)?
-Will
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04301 seconds