Search in sources :

Example 1 with XExpressionState

use of com.intellij.xdebugger.impl.breakpoints.XExpressionState in project intellij-community by JetBrains.

the class DebuggerUtilsImpl method writeTextWithImports.

@Override
public void writeTextWithImports(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.serializeInto(new XExpressionState(expression), element, new SkipDefaultValuesSerializationFilters());
        }
    }
}
Also used : SkipDefaultValuesSerializationFilters(com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters) Element(org.jdom.Element) XExpression(com.intellij.xdebugger.XExpression) XExpressionState(com.intellij.xdebugger.impl.breakpoints.XExpressionState)

Example 2 with XExpressionState

use of com.intellij.xdebugger.impl.breakpoints.XExpressionState in project intellij-community by JetBrains.

the class DebuggerUtilsImpl method readTextWithImports.

@Override
public TextWithImports readTextWithImports(Element root, String name) {
    String s = JDOMExternalizerUtil.readField(root, name);
    if (s != null) {
        return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, s);
    } else {
        Element option = JDOMExternalizerUtil.getOption(root, name);
        if (option != null) {
            XExpressionState state = new XExpressionState();
            XmlSerializer.deserializeInto(state, option);
            return TextWithImportsImpl.fromXExpression(state.toXExpression());
        }
    }
    return null;
}
Also used : Element(org.jdom.Element) TextWithImportsImpl(com.intellij.debugger.engine.evaluation.TextWithImportsImpl) XExpressionState(com.intellij.xdebugger.impl.breakpoints.XExpressionState)

Aggregations

XExpressionState (com.intellij.xdebugger.impl.breakpoints.XExpressionState)2 Element (org.jdom.Element)2 TextWithImportsImpl (com.intellij.debugger.engine.evaluation.TextWithImportsImpl)1 SkipDefaultValuesSerializationFilters (com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters)1 XExpression (com.intellij.xdebugger.XExpression)1