final Entity res = new Entity(facade.getKind());
Realm<Field> realm = new Realm<Field>(rStr);
Binding bnd = new Binding("");
bnd.setName("Choose property for initializing.");
final CompositeEditor editor = new CompositeEditor(bnd);
editor.setLayout(new GridLayout(1, true));
final Binding value = new EditingBinding(res, res, false) {
public void commit() {
for (String b : getKnownChilds()) {
// if(facade.getKindsOfChildren().containsKey(b)){
// continue;
// }
Binding binding = getBinding(b);
Object value = binding.getValue();
if (binding instanceof EditingBinding) {
if (((EditingBinding) binding).isResetToNull()) {
((EditingBinding) binding)
.setResetToNull(false);
setPropValue(b, binding, null);
continue;
}
}
// int count = 0;
// if (value instanceof Collection<?>) {
// Collection c = (Collection) value;
// for (Iterator iterator = c.iterator(); iterator
// .hasNext();) {
// Object object = (Object) iterator.next();
// if (object instanceof NullValue) {
// iterator.remove();
// count++;
// }
// }
// for (int a = 0; a < count; a++) {
// c.add(null);
// }
// }
try {
// if (value instanceof Collection) {
// Collection c = (Collection) value;
// if (c.size() != 0) {
// Object obj = c
// .toArray(new Object[c.size()])[c
// .size() - 1];
// if (isSupported(obj)) {
// setPropValue(b, binding, value);
// }
// } else {
// setPropValue(b, binding, value);
// }
// } else {
// if (isSupported(value)) {
// setPropValue(b, binding, value);
// }
// }
setPropValue(b, binding, value);
} catch (Exception e) {
MessageDialog.openError(Display.getDefault()
.getActiveShell(), "Error", e.getMessage());
throw new RuntimeException(e);
}
}
}
};
value.setName("New Value");
value.setReadOnly(false);
Binding combo = bnd.getBinding("combo");
combo.setName("All Available Properties");
combo.setReadOnly(false);
combo.setAutoCommit(true);
combo.setRealm(realm);
combo.setRequired(true);
combo.setAdapter(ITextLabelProvider.class,
new TextProviderAdapter() {
public String getText(Object object) {
return ((Field) object).name;
}
});
ComboEnumeratedValueSelector<Field> fields = new ComboEnumeratedValueSelector<Field>(
combo);
fields.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
IValueListener l = new VCHListener(value, editor, res, inner);
combo.addValueListener(l);
editor.add(fields);
if (rStr.size() != 0) {
combo.setValue(rStr.toArray()[0], null);
}
TitledDialog tid = new TitledDialog(editor) {
protected void okPressed() {