How do a add cell editors to my property descriptors [message #466865] |
Wed, 18 January 2006 18:05 |
Eclipse User |
|
|
|
Originally posted by: erica.mitchell.iona.com
I'm creating ComboBoxPropertyDescriptor for both enums and booleans. when i go to edit the value i'm getting an exception in ComboBoxCellEditor in doSetValue because its not getting an Integer for the boolean string. Can i programatically set the cell editors that each type of proeprty descriptor should be using?
|
|
|
Re: How do a add cell editors to my property descriptors [message #466871 is a reply to message #466865] |
Wed, 18 January 2006 19:09 |
Eclipse User |
|
|
|
Originally posted by: erica.mitchell.iona.com
found a solution
public class BooleanCellEditor extends ComboBoxCellEditor {
final Integer intTrue = new Integer(0);
final Integer intFalse = new Integer(1);
public BooleanCellEditor(Composite parent, int style) {
super(parent, new String[] {"true", "false"}, style);
}
protected Object doGetValue() {
return new Boolean(
((Integer)super.doGetValue()).intValue() == 0
);
}
protected void doSetValue(Object value) {
Assert.isTrue( value instanceof Boolean );
super.doSetValue( ((Boolean)value).booleanValue() ? intTrue : intFalse );
}
|
|
|
Powered by
FUDForum. Page generated in 0.02306 seconds