// gd.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
// gd.horizontalAlignment = SWT.LEFT;
// gd.verticalIndent = 0;
// gd.verticalAlignment = GridData.FILL;
text.setLayoutData(gd);
ISWTObservableValue textValue = Forms.observe(text);
// NOTE this code only works if the LanguageExpressionBean is
// not
// replaced under our feet!
final LanguageExpressionBean expression = LanguageExpressionBean.bindToNodeProperty(node, id);
final String expressionPropertyName = "expression";
Forms.bindBeanProperty(bindingContext, mmng, expression, expressionPropertyName, isMandatory(expression, expressionPropertyName), expressionPropertyName, textValue, text);
String languageLabel = EditorMessages.propertiesLanguageTitle;
toolkit.createLabel(composite, languageLabel);
// toolkit.createSeparator(composite, SWT.SEPARATOR);
Combo combo = new Combo(composite, SWT.NONE | SWT.BORDER);
combo.setItems(new Languages().languageArray());
toolkit.adapt(combo, true, true);
ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo);
Forms.bindBeanProperty(bindingContext, mmng, expression, "language", isMandatory(expression, "language"), languageLabel, comboValue, combo);
String language = expression.getLanguage();
if (language == null) {
language = CamelModelHelper.getDefaultLanguageName();
expression.setLanguage(language);
}
// now lets forward property events to the node
expression.addPropertyChangeListener(new PropertyChangeListener() {
/*
* (non-Javadoc)
*
* @see
* java.beans.PropertyChangeListener#propertyChange(java
* .beans .PropertyChangeEvent)
*/
@Override
public void propertyChange(PropertyChangeEvent event) {
node.firePropertyChange(id.toString(), null, expression);
}
});
} else {
String propertyName = getPropertyName(id);
Class refType = isBeanRef(node, propertyName);
if (refType != null) {
Combo combo = new Combo(parent, SWT.NONE | SWT.BORDER);
String[] beanRefs = getBeanRefs(refType);
combo.setItems(beanRefs);
toolkit.adapt(combo, true, true);
widget = combo;
ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo);
Forms.bindBeanProperty(bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, comboValue, combo);
} else if (isEndpointUri(node, propertyName)) {
Combo combo = new Combo(parent, SWT.NONE | SWT.BORDER);
combo.setItems(getEndpointUris());
toolkit.adapt(combo, true, true);
widget = combo;
ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo);
Forms.bindBeanProperty(bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, comboValue, combo);
} else if (descriptor instanceof BooleanPropertyDescriptor) {
Button checkbox = new Button(parent, SWT.CHECK);
widget = checkbox;
ISWTObservableValue textValue = Forms.observe(checkbox);
Forms.bindBeanProperty(bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, textValue, checkbox);
} else if (descriptor instanceof ListPropertyDescriptor) {
if (CamelModelHelper.isPropertyListOFSetHeaders(id)) {
Control control = bindSetHeaderTable(toolkit, parent, id);
widget = control;
} else {
Control control = bindListOfValues(toolkit, parent, id);
widget = control;
}
} else if (descriptor instanceof EnumPropertyDescriptor) {
EnumPropertyDescriptor enumProperty = (EnumPropertyDescriptor) descriptor;
ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY | SWT.BORDER);
combo.setContentProvider(ArrayContentProvider.getInstance());
combo.setInput(getEnumValues(enumProperty.getEnumType()));
IViewerObservableValue comboValue = ViewersObservables.observeSingleSelection(combo);
Control control = combo.getControl();
Forms.bindBeanProperty(bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, comboValue, control);
toolkit.adapt(control, true, true);
widget = control;
} else {
Text text;
if (isDescription) {
text = toolkit.createText(parent, "", SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
} else {
text = toolkit.createText(parent, "", SWT.BORDER);
}
text.setToolTipText(tooltip);
widget = text;
ISWTObservableValue textValue = Forms.observe(text);
Forms.bindBeanProperty(bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, textValue, text);
}
}
}
boolean isComplexOrUnion = isComplexProperty || isUnionProperty;