Search in sources :

Example 1 with SerializationFilter

use of com.intellij.util.xmlb.SerializationFilter in project intellij-community by JetBrains.

the class XDebuggerBreakpointsContextProvider method saveContext.

@Override
public void saveContext(Element toElement) throws WriteExternalException {
    XBreakpointManagerImpl.BreakpointManagerState state = myBreakpointManager.getState();
    Element serialize = XmlSerializer.serialize(state, new SerializationFilter() {

        @Override
        public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
            return accessor.read(bean) != null;
        }
    });
    toElement.addContent(serialize.removeContent());
}
Also used : SerializationFilter(com.intellij.util.xmlb.SerializationFilter) Element(org.jdom.Element) Accessor(com.intellij.util.xmlb.Accessor) XBreakpointManagerImpl(com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl)

Example 2 with SerializationFilter

use of com.intellij.util.xmlb.SerializationFilter in project intellij-community by JetBrains.

the class XDebuggerWatchesProvider method saveContext.

@Override
public void saveContext(Element toElement) throws WriteExternalException {
    XDebuggerWatchesManager.WatchesManagerState state = myWatchesManager.getState();
    Element serialize = XmlSerializer.serialize(state, new SerializationFilter() {

        @Override
        public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
            return accessor.read(bean) != null;
        }
    });
    toElement.addContent(serialize.removeContent());
}
Also used : XDebuggerWatchesManager(com.intellij.xdebugger.impl.XDebuggerWatchesManager) SerializationFilter(com.intellij.util.xmlb.SerializationFilter) Element(org.jdom.Element) Accessor(com.intellij.util.xmlb.Accessor)

Example 3 with SerializationFilter

use of com.intellij.util.xmlb.SerializationFilter in project intellij-community by JetBrains.

the class PersistableCodeStyleSchemes method getState.

@Nullable
@Override
public Element getState() {
    CodeStyleScheme currentScheme = getCurrentScheme();
    CURRENT_SCHEME_NAME = currentScheme == null ? null : currentScheme.getName();
    return XmlSerializer.serialize(this, new SerializationFilter() {

        @Override
        public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
            if ("CURRENT_SCHEME_NAME".equals(accessor.getName())) {
                return !CodeStyleSchemeImpl.DEFAULT_SCHEME_NAME.equals(accessor.read(bean));
            } else {
                return accessor.getValueClass().equals(String.class);
            }
        }
    });
}
Also used : CodeStyleScheme(com.intellij.psi.codeStyle.CodeStyleScheme) SerializationFilter(com.intellij.util.xmlb.SerializationFilter) Accessor(com.intellij.util.xmlb.Accessor) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Accessor (com.intellij.util.xmlb.Accessor)3 SerializationFilter (com.intellij.util.xmlb.SerializationFilter)3 Element (org.jdom.Element)2 CodeStyleScheme (com.intellij.psi.codeStyle.CodeStyleScheme)1 XDebuggerWatchesManager (com.intellij.xdebugger.impl.XDebuggerWatchesManager)1 XBreakpointManagerImpl (com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl)1 Nullable (org.jetbrains.annotations.Nullable)1