boolean isEmpty = (val == null || val.equals(""));
Action a;
Project proj = caretCanvas.getProject();
if (caretCreatingText) {
if (!isEmpty) {
CircuitMutation xn = new CircuitMutation(caretCircuit);
xn.add(caretComponent);
a = xn.toAction(getFromLocale("addComponentAction",
Text.FACTORY.getDisplayGetter()));
} else {
// don't add the blank text field
a = null;
}
} else {
if (isEmpty && caretComponent.getFactory() instanceof Text) {
CircuitMutation xn = new CircuitMutation(caretCircuit);
xn.add(caretComponent);
a = xn.toAction(getFromLocale("removeComponentAction",
Text.FACTORY.getDisplayGetter()));
} else {
Object obj = caretComponent.getFeature(TextEditable.class);
// should never happen
if (obj == null) {