@Override public void writeExternal(Element element) throws WriteExternalException { Settings settings = new Settings(); settings.host = this.host; settings.port = this.port; settings.route = this.route; if (this.browser != null) settings.browser = this.browser.getId().toString(); else settings.browser = ""; if (this.interpreter != null) settings.interpreterName = this.interpreter.getName(); else settings.interpreterName = ""; XmlSerializer.serializeInto(settings, element, new SkipDefaultsSerializationFilter()); super.writeExternal(element); }
@Override public void writeExternal(final Element element) throws WriteExternalException { super.writeExternal(element); if (this.runFilePath != null) { final Element fileElement = new Element("file"); fileElement.setText(this.runFilePath); element.addContent(fileElement); } }
@Override public Element getState() { final Element component = new Element("component"); if (hasDefaultValues()) { return component; } try { DefaultJDOMExternalizer.writeExternal(this, component); } catch (WriteExternalException e) { LOG.error(e); } return component; }
@Override public Element getState() { @NonNls Element element = new Element("LogFilters"); try { for (LogFilter filter : myRegisteredLogFilters.keySet()) { Element filterElement = new Element(FILTER); filterElement.setAttribute(IS_ACTIVE, myRegisteredLogFilters.get(filter).toString()); filter.writeExternal(filterElement); element.addContent(filterElement); } DefaultJDOMExternalizer.writeExternal(this, element); } catch (WriteExternalException e) { LOG.error(e); } return element; }
@Test public void repeatedWriteShouldNotChangeElement() throws WriteExternalException { final XMLOutputter xmlOutputter = new XMLOutputter(Format.getCompactFormat()); state.getBlazeFlagsState().setRawFlags(ImmutableList.of("--flag1", "--flag2")); state.getExeFlagsState().setRawFlags(ImmutableList.of("--exe1", "--exe2")); state.setNativeDebuggingEnabled(true); Element firstWrite = new Element("test"); state.writeExternal(firstWrite); Element secondWrite = firstWrite.clone(); state.writeExternal(secondWrite); assertThat(xmlOutputter.outputString(secondWrite)) .isEqualTo(xmlOutputter.outputString(firstWrite)); }
public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); JDOMExternalizerUtil.writeField(element, "INTERPRETER_OPTIONS", myInterpreterOptions); writeEnvs(element); JDOMExternalizerUtil.writeField(element, "SDK_HOME", mySdkHome); JDOMExternalizerUtil.writeField(element, "WORKING_DIRECTORY", myWorkingDirectory); JDOMExternalizerUtil.writeField(element, "IS_MODULE_SDK", Boolean.toString(myUseModuleSdk)); JDOMExternalizerUtil.writeField(element, "ADD_CONTENT_ROOTS", Boolean.toString(myAddContentRoots)); JDOMExternalizerUtil.writeField(element, "ADD_SOURCE_ROOTS", Boolean.toString(myAddSourceRoots)); getConfigurationModule().writeExternal(element); // extension settings: PythonRunConfigurationExtensionsManager.getInstance().writeExternal(this, element); PathMappingSettings.writeExternal(element, getMappingSettings()); }
@Override public void writeExternal(Element element) throws WriteExternalException { blazeFlags.writeExternal(element); exeFlags.writeExternal(element); element.setAttribute(NATIVE_DEBUG_ATTR, Boolean.toString(nativeDebuggingEnabled)); element.removeChildren(DEPLOY_TARGET_STATES_TAG); Element deployTargetStatesElement = new Element(DEPLOY_TARGET_STATES_TAG); deployTargetManager.writeExternal(deployTargetStatesElement); element.addContent(deployTargetStatesElement); element.removeChildren(DEBUGGER_STATES_TAG); Element debuggerStatesElement = new Element(DEBUGGER_STATES_TAG); debuggerManager.writeExternal(debuggerStatesElement); element.addContent(debuggerStatesElement); }
public boolean equalTo(@NotNull ScopeToolState state2) { if (isEnabled() != state2.isEnabled()) return false; if (getLevel() != state2.getLevel()) return false; InspectionToolWrapper toolWrapper = getTool(); InspectionToolWrapper toolWrapper2 = state2.getTool(); if (!toolWrapper.isInitialized() && !toolWrapper2.isInitialized()) return true; try { @NonNls String tempRoot = "root"; Element oldToolSettings = new Element(tempRoot); toolWrapper.getTool().writeSettings(oldToolSettings); Element newToolSettings = new Element(tempRoot); toolWrapper2.getTool().writeSettings(newToolSettings); return JDOMUtil.areElementsEqual(oldToolSettings, newToolSettings); } catch (WriteExternalException e) { LOG.error(e); } return false; }
@Override public void writeSettings(@NotNull Element node) throws WriteExternalException { DefaultJDOMExternalizer.writeExternal(this, node, new DefaultJDOMExternalizer.JDOMFilter() { @Override public boolean isAccept(@NotNull Field field) { return !Comparing.equal(VARIABLES_NEW, field.getName()); } }); if (!m_ignoreAnnotatedVariablesNew) { final Element option = new Element("option"); option.setAttribute("name", VARIABLES_NEW); option.setAttribute("value", Boolean.toString(m_ignoreAnnotatedVariablesNew)); node.addContent(option); } }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); if (target != null) { // Target is persisted as a tag to permit multiple targets in the future. Element targetElement = new Element(TARGET_TAG); targetElement.setText(target.toString()); element.addContent(targetElement); } blazeFlags.writeExternal(element); exeFlags.writeExternal(element); if (pluginSdk != null) { element.setAttribute(SDK_ATTR, pluginSdk.getName()); } if (vmParameters != null) { element.setAttribute(VM_PARAMS_ATTR, vmParameters); } if (programParameters != null) { element.setAttribute(PROGRAM_PARAMS_ATTR, programParameters); } if (keepInSync != null) { element.setAttribute(KEEP_IN_SYNC_TAG, Boolean.toString(keepInSync)); } }
@Override public void writeExternal(final Element element) throws WriteExternalException { if (myStoredElement != null) { final List attributeList = myStoredElement.getAttributes(); for (Object anAttributeList : attributeList) { final Attribute a = (Attribute) anAttributeList; element.setAttribute(a.getName(), a.getValue()); } final List list = myStoredElement.getChildren(); for (Object child : list) { final Element c = (Element) child; element.addContent((Element) c.clone()); } } }
@Test public void readAndWriteShouldHandleNulls() throws InvalidDataException, WriteExternalException { Element element = new Element("test"); state.writeExternal(element); BlazeAndroidBinaryRunConfigurationState readState = new BlazeAndroidBinaryRunConfigurationState(buildSystem().getName()); readState.readExternal(element); BlazeAndroidRunConfigurationCommonState commonState = state.getCommonState(); BlazeAndroidRunConfigurationCommonState readCommonState = readState.getCommonState(); assertThat(readCommonState.getBlazeFlagsState().getRawFlags()) .isEqualTo(commonState.getBlazeFlagsState().getRawFlags()); assertThat(readCommonState.isNativeDebuggingEnabled()) .isEqualTo(commonState.isNativeDebuggingEnabled()); assertThat(readState.getActivityClass()).isEqualTo(state.getActivityClass()); assertThat(readState.getMode()).isEqualTo(state.getMode()); assertThat(readState.getLaunchMethod()).isEqualTo(state.getLaunchMethod()); assertThat(readState.useSplitApksIfPossible()).isEqualTo(state.useSplitApksIfPossible()); assertThat(readState.useWorkProfileIfPresent()).isEqualTo(state.useWorkProfileIfPresent()); assertThat(readState.getUserId()).isEqualTo(state.getUserId()); assertThat(readState.getDeepLink()).isEqualTo(state.getDeepLink()); }
@Override public void writeExternal(Element element) throws WriteExternalException { JDOMExternalizerUtil.addChildren(element, LOG_FILE, myLogFiles); JDOMExternalizerUtil.addChildren(element, PREDEFINED_LOG_FILE_ELEMENT, myPredefinedLogFiles); if (myFileOutputPath != null || mySaveOutput) { Element fileOutputPathElement = new Element(FILE_OUTPUT); if (myFileOutputPath != null) { fileOutputPathElement.setAttribute(OUTPUT_FILE, myFileOutputPath); } if (mySaveOutput) { fileOutputPathElement.setAttribute(SAVE, String.valueOf(mySaveOutput)); } element.addContent(fileOutputPathElement); } if (!isNewSerializationUsed()) { if (myShowConsoleOnStdOut) {//default value shouldn't be written element.setAttribute(SHOW_CONSOLE_ON_STD_OUT, String.valueOf(true)); } if (myShowConsoleOnStdErr) {//default value shouldn't be written element.setAttribute(SHOW_CONSOLE_ON_STD_ERR, String.valueOf(true)); } } }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); if (!StringUtil.isEmpty(scriptPath)) { element.setAttribute(SCRIPT_PATH_URL, scriptPath); } if (!StringUtil.isEmpty(scriptParameters)) { element.setAttribute(SCRIPT_PARAMETERS, scriptParameters); } if (!StringUtil.isEmpty(scriptOptions)) { element.setAttribute(SCRIPT_OPTIONS, scriptOptions); } element.setAttribute(SCRIPT_SHOW_EVENTS, myShowAppleEvents ? "true" : "false"); }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); TomcatInfoConfigs.getInstance(getProject()).setCurrent(tomcatInfo); // JDOMExternalizerUtil.writeField(element, "TOMCAT_INSTALLATION", tomcatInstallation); JDOMExternalizerUtil.writeField(element, "DOC_BASE", docBase); JDOMExternalizerUtil.writeField(element, "CONTEXT_PATH", contextPath); JDOMExternalizerUtil.writeField(element, "TOMCAT_PORT", port); JDOMExternalizerUtil.writeField(element, "VM_OPTIONS", vmOptions); }
@Nullable @Override public SeedStackNavigatorState getState() { ApplicationManager.getApplication().assertIsDispatchThread(); if (structure != null) { try { state.treeState = new Element("root"); TreeState.createOn(tree).writeExternal(state.treeState); } catch (WriteExternalException e) { SeedStackLog.LOG.warn("Cannot write SeedStack structure state", e); } } return state; }
@Override public void writeExternal(Element parentNode) throws WriteExternalException { super.writeExternal(parentNode); parentNode.addContent(XmlSerializer.serialize(runSettings)); writeModule(parentNode); }
/** Updates the element with the handler's state. */ @Override @SuppressWarnings("ThrowsUncheckedException") public final void writeExternal(Element element) throws WriteExternalException { for (RunConfigurationState state : getStates()) { state.writeExternal(element); } }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); // Stores the values of this class into the parent JDOMExternalizerUtil.writeField(element, HOST_PROP_NAME, this.host); JDOMExternalizerUtil.writeField(element, PORT_PROP_NAME, String.valueOf(this.port)); JDOMExternalizerUtil.writeField(element, JVM_PORT_PROP_NAME, String.valueOf(this.jvmPort)); JDOMExternalizerUtil.writeField(element, ISCUSTOMMAP_PROP_NAME, String.valueOf(isCustomAppsMap)); if (modulesToAppsMap != null) { for (String moduleName : modulesToAppsMap.keySet()) { JDOMExternalizerUtil.writeField(element, MODULE_NAME_PREFIX + moduleName, modulesToAppsMap.get(moduleName)); } } }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); JDOMExternalizerUtil.writeField(element, "SCRIPT_NAME", myScriptName); JDOMExternalizerUtil.writeField(element, "CLASS_NAME", myClassName); JDOMExternalizerUtil.writeField(element, "METHOD_NAME", myMethodName); JDOMExternalizerUtil.writeField(element, "FOLDER_NAME", myFolderName); JDOMExternalizerUtil.writeField(element, "TEST_TYPE", myTestType.toString()); JDOMExternalizerUtil.writeField(element, "PATTERN", myPattern); JDOMExternalizerUtil.writeField(element, "USE_PATTERN", String.valueOf(usePattern)); }
@Test public void readAndWriteShouldHandleNulls() throws InvalidDataException, WriteExternalException { Element element = new Element("test"); state.writeExternal(element); BlazeAndroidRunConfigurationCommonState readState = new BlazeAndroidRunConfigurationCommonState(buildSystem().getName(), false); readState.readExternal(element); assertThat(readState.getBlazeFlagsState().getRawFlags()) .isEqualTo(state.getBlazeFlagsState().getRawFlags()); assertThat(readState.getExeFlagsState().getRawFlags()) .isEqualTo(state.getExeFlagsState().getRawFlags()); assertThat(readState.isNativeDebuggingEnabled()).isEqualTo(state.isNativeDebuggingEnabled()); }
@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()); }
@Override public void writeExternal(Element element) throws WriteExternalException { if (!isNewSerializationUsed() && isGeneratedName()) { element.setAttribute("isGeneratedName", "true"); } super.writeExternal(element); }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); // Stores the values of this class into the parent String modulesString = GSON.toJson(tomcatModules); JDOMExternalizerUtil.writeField(element, MODULES_FIELD, modulesString); JDOMExternalizerUtil.writeField(element, TOMCAT_PATH_FIELD, this.getTomcatInstallation()); JDOMExternalizerUtil.writeField(element, VM_ARGS_FIELD, this.getVmArgs()); JDOMExternalizerUtil.writeField(element, PASS_PARENT_ENV_VARS_FIELD, "" + this.isPassParentEnvironmentVariables()); if (this.environmentVariables != null && !this.environmentVariables.isEmpty()) { EnvironmentVariablesComponent.writeExternal(element, this.getEnvironmentVariables()); } }
void writeTemplateContext(Element element, @Nullable TemplateContext defaultContext) throws WriteExternalException { Map<TemplateContextType, Boolean> diff = getDifference(defaultContext); for (TemplateContextType type : diff.keySet()) { Element optionElement = new Element("option"); optionElement.setAttribute("name", type.getContextId()); optionElement.setAttribute("value", diff.get(type).toString()); element.addContent(optionElement); } }
@SuppressWarnings({"HardCodedStringLiteral"}) public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); if (myLabelRenderer != null) { final Element labelRendererElement = myRendererSettings.writeRenderer(myLabelRenderer); labelRendererElement.setAttribute("role", "label"); element.addContent(labelRendererElement); } if (myChildrenRenderer != null) { final Element childrenRendererElement = myRendererSettings.writeRenderer(myChildrenRenderer); childrenRendererElement.setAttribute("role", "children"); element.addContent(childrenRendererElement); } }
@Override public void writeExternal(Element element) throws WriteExternalException { if (myFileUrl != null && myTargetName != null) { Element child = new Element(SETTINGS); child.setAttribute(FILE, myFileUrl); child.setAttribute(TARGET, myTargetName); element.addContent(child); } }
@Override public void writeSettings(@NotNull Element node) throws WriteExternalException { super.writeSettings(node); if (ignoreStaticMethods) { node.addContent(new Element("option").setAttribute("name", "ignoreStaticMethods") .setAttribute("value", String.valueOf(ignoreStaticMethods))); } if (ignoreGetterCalls) { node.addContent(new Element("option").setAttribute("name", "ignoreGetterCalls") .setAttribute("value", String.valueOf(ignoreGetterCalls))); } }
public void writeSettings(@NotNull Element node) throws WriteExternalException { BITS = 0; for (int i=11; i>=0; i--) { BITS <<= 1; if (OPTIONS.get(i)) BITS |= 1; } super.writeSettings(node); }
@SuppressWarnings({"HardCodedStringLiteral"}) public void writeExternal(final Element element) throws WriteExternalException { for (NodeRenderer renderer : myRepresentationNodes) { element.addContent(myRendererSettings.writeRenderer(renderer)); } element.setAttribute("VERSION", String.valueOf(VERSION)); }
@Override public void writeExternal(Element element) throws WriteExternalException { if (hasDefaultValues()) { return; } for (String value : this) { if (value != null) { final Element item = new Element(ITEM); item.setAttribute(VALUE, StringUtil.escapeXml(value)); element.addContent(item); } } }
@Override public void writeSettings(@NotNull Element node) throws WriteExternalException { node.addContent(new Element("option").setAttribute("name", "REPORT_VARIABLES").setAttribute("value", String.valueOf(REPORT_VARIABLES))); node.addContent(new Element("option").setAttribute("name", "REPORT_PARAMETERS").setAttribute("value", String.valueOf(REPORT_PARAMETERS))); if (!REPORT_CATCH_PARAMETERS) { node.addContent(new Element("option").setAttribute("name", "REPORT_CATCH_PARAMETERS").setAttribute("value", "false")); } if (!REPORT_FOREACH_PARAMETERS) { node.addContent(new Element("option").setAttribute("name", "REPORT_FOREACH_PARAMETERS").setAttribute("value", "false")); } }
public void writeExternal(Element parentElement, @NotNull final CustomCodeStyleSettings parentSettings) throws WriteExternalException { final Element childElement = new Element(myTagName); DefaultJDOMExternalizer.writeExternal(this, childElement, new DifferenceFilter<CustomCodeStyleSettings>(this, parentSettings)); if (!childElement.getContent().isEmpty()) { parentElement.addContent(childElement); } }
@Override public void writeSettings(@NotNull Element node) throws WriteExternalException { node.addContent(new Element("option").setAttribute("name", "SUGGEST_NULLABLE_ANNOTATIONS").setAttribute("value", String.valueOf(SUGGEST_NULLABLE_ANNOTATIONS))); node.addContent(new Element("option").setAttribute("name", "DONT_REPORT_TRUE_ASSERT_STATEMENTS").setAttribute("value", String.valueOf(DONT_REPORT_TRUE_ASSERT_STATEMENTS))); if (IGNORE_ASSERT_STATEMENTS) { node.addContent(new Element("option").setAttribute("name", "IGNORE_ASSERT_STATEMENTS").setAttribute("value", "true")); } if (!REPORT_CONSTANT_REFERENCE_VALUES) { node.addContent(new Element("option").setAttribute("name", "REPORT_CONSTANT_REFERENCE_VALUES").setAttribute("value", "false")); } if (TREAT_UNKNOWN_MEMBERS_AS_NULLABLE) { node.addContent(new Element("option").setAttribute("name", "TREAT_UNKNOWN_MEMBERS_AS_NULLABLE").setAttribute("value", "true")); } }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); JDOMExternalizerUtil.writeField(element, "PUREUNITTEST", String.valueOf(myIsPureUnittest)); JDOMExternalizerUtil.writeField(element, "PARAMS", myParams); JDOMExternalizerUtil.writeField(element, "USE_PARAM", String.valueOf(useParam)); }
@Override public void writeSettings(@NotNull Element node) throws WriteExternalException { if (myEffectiveLanguageLevel != null) { final Element llElement = new Element(EFFECTIVE_LL); llElement.setAttribute("value", myEffectiveLanguageLevel.toString()); node.addContent(llElement); } }
@Override public void writeSettings(@NotNull Element node) throws WriteExternalException { if (IGNORE_UNCHECKED_ASSIGNMENT || IGNORE_UNCHECKED_CALL || IGNORE_UNCHECKED_CAST || IGNORE_UNCHECKED_OVERRIDING || IGNORE_UNCHECKED_GENERICS_ARRAY_CREATION) { super.writeSettings(node); } }
@Override protected Element writeOldSettings(String sourceToolName) throws WriteExternalException { Element sourceElement = super.writeOldSettings(sourceToolName); if (UNUSED_SYMBOL.equals(sourceToolName)) { new UnusedSymbolLocalInspection().writeSettings(sourceElement); } else if (UNUSED_DECLARATION.equals(sourceToolName)) { new UnusedDeclarationInspection().writeUnusedDeclarationSettings(sourceElement); } return sourceElement; }
@Override public void writeSettings(@NotNull Element node) throws WriteExternalException { super.writeSettings(node); if (ignoreMultipleArrayParameters) { node.addContent(new Element("option").setAttribute("name", "ignoreMultipleArrayParameters"). setAttribute("value", String.valueOf(ignoreMultipleArrayParameters))); } }