java - Enabling and disabling of FieldEditors -
i have doubt related usage fieldeditors in plugin development. have preference page consists of stringfieldeditors, booleanfieldeditors, radiogroupfieldeditors etc.
the problem i'm facing follows:
i have booleanfilededitor called "full details". code follows:
booleanfieldeditor fulldetails = new booleanfieldeditor("fulldetails", "full details", org.eclipse.swt.swt.none, getfieldeditorparent()); addfield(fulldetails);
once user checks boolean field, stringfieldeditors follow booleanfieldeditor should enabled. otherwise should remain disabled. code other stringfieldeditors follows:
stringfieldeditor machinename = new stringfieldeditor("machinename", "host name", getfieldeditorparent()); addfield(machinename); stringfieldeditor ipaddress = new stringfieldeditor("ipaddress", "ip address", getfieldeditorparent()); addfield(ipaddress); stringfieldeditor cpuinfo = new stringfieldeditor("cpuinfo", "cpu info", getfieldeditorparent()); addfield(cpuinfo);
it helpful if can give pointers how can done.
you can use setpropertychangelistener
method of boolean field editor perform action when field changes. like:
fulldetails.setpropertychangelistener(new ipropertychangelistener() { @override public void propertychange(propertychangeevent event) { boolean newvalue = ((boolean) event.getnewvalue()).booleanvalue(); // enable/disable other fields machinename.setenabled(newvalue, getfieldeditorparent()); .... other fields .... });
Comments
Post a Comment