void (Element root, String name, TextWithImports value) { if (value.getKind() == CodeFragmentKind.EXPRESSION) { JDOMExternalizerUtil.writeField(root, name, value.toExternalForm()); } else { Element element = JDOMExternalizerUtil.writeOption(root, name); XExpression expression = TextWithImportsImpl.toXExpression(value); if (expression != null) { XmlSerializer.serializeObjectInto(new XExpressionState(expression), element); } } }