1

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 StringintDates )

4

0 に答える 0