JFace のさまざまなセルに検証を追加したいと考えていTableViewer
ます。
それを行う最良の方法は何ですか?
私は使用しようとしConverter
ましValidator
た、例えば
// define a validator to check that only numbers are entered
IValidator validator = new IValidator() {
@Override
public IStatus validate(Object value) {
if (value instanceof Integer) {
if (value.toString().matches(".*\\d.*")) {
return ValidationStatus.ok();
}
}
return ValidationStatus.error(value.toString() +"is not a number");
}
};
// create UpdateValueStrategy and assign
// to the binding
UpdateValueStrategy strategy = new UpdateValueStrategy();
strategy.setBeforeSetValidator(validator);
Binding bindValue = ctx.bindValue(widgetValue, modelValue, strategy, null);
のセルに対してそれを行う正しい方法TableViewer
ですか? (例: check String
、int
、Date
s )