import org.argeo.cms.viewers.EditablePart;
import org.argeo.cms.widgets.EditableText;
+import org.argeo.eclipse.ui.EclipseUiUtils;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
private String propertyName;
private String message;
+ // encode the '&' character in rap
+ private final static String AMPERSAND = "&";
+ private final static String AMPERSAND_REGEX = "&(?![#a-zA-Z0-9]+;)";
+
public EditablePropertyString(Composite parent, int style, Node node,
String propertyName, String message) throws RepositoryException {
super(parent, style, node, true);
Control child = getControl();
if (child instanceof Label) {
Label lbl = (Label) child;
- if (FormUtils.notEmpty(text))
+ if (EclipseUiUtils.isEmpty(text))
lbl.setText(message + " ");
else
- lbl.setText(text);
+ // TODO enhance this
+ lbl.setText(text.replaceAll(AMPERSAND_REGEX, AMPERSAND));
} else if (child instanceof Text) {
Text txt = (Text) child;
- if (FormUtils.notEmpty(text)) {
+ if (EclipseUiUtils.isEmpty(text)) {
txt.setText("");
txt.setMessage(message + " ");
} else
}
public synchronized void stopEditing() {
- if (FormUtils.notEmpty(((Text) getControl()).getText()))
+ if (EclipseUiUtils.isEmpty(((Text) getControl()).getText()))
getControl().setData(STYLE, propertyMessage.style());
else
getControl().setData(STYLE, propertyText.style());