use of com.intellij.util.xmlb.Accessor 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());
}
use of com.intellij.util.xmlb.Accessor 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());
}
use of com.intellij.util.xmlb.Accessor in project intellij-community by JetBrains.
the class CompilerConfigurationImpl method getState.
@Override
public Element getState() {
Element state = new Element("state");
XmlSerializer.serializeInto(myState, state, new SkipDefaultValuesSerializationFilters() {
@Override
public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
return super.accepts(accessor, bean);
}
});
if (!myAddNotNullAssertions) {
addChild(state, JpsJavaCompilerConfigurationSerializer.ADD_NOTNULL_ASSERTIONS).setAttribute(JpsJavaCompilerConfigurationSerializer.ENABLED, String.valueOf(myAddNotNullAssertions));
}
if (myExcludesConfiguration.getExcludeEntryDescriptions().length > 0) {
myExcludesConfiguration.writeExternal(addChild(state, JpsJavaCompilerConfigurationSerializer.EXCLUDE_FROM_COMPILE));
}
Element resourceExtensions = new Element(JpsJavaCompilerConfigurationSerializer.RESOURCE_EXTENSIONS);
for (String pattern : getRegexpPatterns()) {
addChild(resourceExtensions, JpsJavaCompilerConfigurationSerializer.ENTRY).setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, pattern);
}
if (!JDOMUtil.isEmpty(resourceExtensions)) {
state.addContent(resourceExtensions);
}
if ((myWildcardPatternsInitialized || !myWildcardPatterns.isEmpty()) && !DEFAULT_WILDCARD_PATTERNS.equals(myWildcardPatterns)) {
final Element wildcardPatterns = addChild(state, JpsJavaCompilerConfigurationSerializer.WILDCARD_RESOURCE_PATTERNS);
for (final String wildcardPattern : myWildcardPatterns) {
addChild(wildcardPatterns, JpsJavaCompilerConfigurationSerializer.ENTRY).setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, wildcardPattern);
}
}
Element annotationProcessingSettings = new Element(JpsJavaCompilerConfigurationSerializer.ANNOTATION_PROCESSING);
Element profileElement = new Element("profile");
profileElement.setAttribute("default", "true");
AnnotationProcessorProfileSerializer.writeExternal(myDefaultProcessorsProfile, profileElement);
if (!JDOMUtil.isEmpty(profileElement, 2)) {
annotationProcessingSettings.addContent(profileElement);
}
for (ProcessorConfigProfile profile : myModuleProcessorProfiles) {
Element element = new Element("profile");
AnnotationProcessorProfileSerializer.writeExternal(profile, element);
annotationProcessingSettings.addContent(element);
}
if (!JDOMUtil.isEmpty(annotationProcessingSettings)) {
state.addContent(annotationProcessingSettings);
}
if (!StringUtil.isEmpty(myBytecodeTargetLevel) || !myModuleBytecodeTarget.isEmpty()) {
final Element bytecodeTarget = addChild(state, JpsJavaCompilerConfigurationSerializer.BYTECODE_TARGET_LEVEL);
if (!StringUtil.isEmpty(myBytecodeTargetLevel)) {
bytecodeTarget.setAttribute(JpsJavaCompilerConfigurationSerializer.TARGET_ATTRIBUTE, myBytecodeTargetLevel);
}
if (!myModuleBytecodeTarget.isEmpty()) {
final List<String> moduleNames = new ArrayList<>(myModuleBytecodeTarget.keySet());
Collections.sort(moduleNames, String.CASE_INSENSITIVE_ORDER);
for (String name : moduleNames) {
final Element moduleElement = addChild(bytecodeTarget, JpsJavaCompilerConfigurationSerializer.MODULE);
moduleElement.setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, name);
final String value = myModuleBytecodeTarget.get(name);
moduleElement.setAttribute(JpsJavaCompilerConfigurationSerializer.TARGET_ATTRIBUTE, value != null ? value : "");
}
}
}
return state;
}
use of com.intellij.util.xmlb.Accessor 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);
}
}
});
}
use of com.intellij.util.xmlb.Accessor in project intellij-community by JetBrains.
the class LoggerInitializedWithForeignClassInspectionBase method writeSettings.
@Override
public void writeSettings(@NotNull Element element) throws WriteExternalException {
loggerClassName = formatString(loggerFactoryClassNames);
loggerFactoryMethodName = formatString(loggerFactoryMethodNames);
XmlSerializer.serializeInto(this, element, new SerializationFilterBase() {
@Override
protected boolean accepts(@NotNull Accessor accessor, @NotNull Object bean, @Nullable Object beanValue) {
if ("loggerClassName".equals(accessor.getName()) && DEFAULT_LOGGER_CLASS_NAMES.equals(beanValue)) {
return false;
}
if ("loggerFactoryMethodNames".equals(accessor.getName()) && DEFAULT_FACTORY_METHOD_NAMES.equals(beanValue)) {
return false;
}
return true;
}
});
}
Aggregations