TextWithImports (Element root, String name) { String s = JDOMExternalizerUtil.readField(root, name); if (s != null) { return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, s); } else { Element option = JDOMExternalizerUtil.readOption(root, name); if (option != null) { XExpressionState state = new XExpressionState(); XmlSerializer.deserializeInto(option, state); return TextWithImportsImpl.fromXExpression(state.toXExpression()); } } return null; }