mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
deprecate jdom.kt loadElement methods because now JDOMUtil uses the same StAX parser (~ several month ago migrated from SAX to StAX and make new behaviour default)
This commit is contained in:
+2
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.java.codeInsight.javadoc
|
||||
|
||||
import com.intellij.codeInsight.javadoc.JavaDocInfoGeneratorFactory
|
||||
@@ -20,14 +6,13 @@ import com.intellij.psi.PsiJavaFile
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.testFramework.assertions.Assertions.assertThat
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import com.intellij.util.loadElement
|
||||
|
||||
class LightJavadocGeneratorTest : LightCodeInsightFixtureTestCase() {
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor = JAVA_9
|
||||
|
||||
fun testPlainModule() = doTestModule("module M.N { }", """<div class='definition'><pre>module <b>M.N</b></pre></div>""".trimIndent())
|
||||
|
||||
fun testDocumentedModule() = doTestModule("/** One humble module. */\n@Deprecated\nmodule M.N { }", """<div class='definition'><pre>@<a href="psi_element://java.lang.Deprecated"><code>Deprecated</code></a>
|
||||
fun testDocumentedModule() = doTestModule("/** One humble module. */\n@Deprecated\nmodule M.N { }", """<div class='definition'><pre>@<a href="psi_element://java.lang.Deprecated"><code>Deprecated</code></a>
|
||||
module <b>M.N</b></pre></div><div class='content'> One humble module. </div><table class='sections'><p></table>""".trimIndent())
|
||||
|
||||
private fun doTestModule(text: String, expected: String) {
|
||||
|
||||
+2
-2
@@ -17,6 +17,7 @@ import com.intellij.openapi.project.ProjectManager
|
||||
import com.intellij.openapi.project.ProjectManagerListener
|
||||
import com.intellij.openapi.startup.StartupActivity
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.packageDependencies.DependencyValidationManager
|
||||
import com.intellij.profile.ProfileChangeAdapter
|
||||
@@ -25,7 +26,6 @@ import com.intellij.psi.search.scope.packageSet.NamedScopeManager
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import com.intellij.util.getAttributeBooleanValue
|
||||
import com.intellij.util.loadElement
|
||||
import com.intellij.util.xmlb.Accessor
|
||||
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters
|
||||
import com.intellij.util.xmlb.XmlSerializer
|
||||
@@ -42,7 +42,7 @@ import java.util.function.Function
|
||||
private const val VERSION = "1.0"
|
||||
private const val PROJECT_DEFAULT_PROFILE_NAME = "Project Default"
|
||||
|
||||
private val defaultSchemeDigest = loadElement("""<component name="InspectionProjectProfileManager">
|
||||
private val defaultSchemeDigest = JDOMUtil.load("""<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
</profile>
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.intellij.openapi.components.StoragePathMacros
|
||||
import com.intellij.openapi.diagnostic.debug
|
||||
import com.intellij.openapi.diagnostic.debugOrInfoIfTestMode
|
||||
import com.intellij.openapi.fileEditor.impl.LoadTextUtil
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream
|
||||
import com.intellij.openapi.util.io.FileUtilRt
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
@@ -178,7 +179,7 @@ open class FileBasedStorage(file: Path,
|
||||
else {
|
||||
val data = file.readChars()
|
||||
lineSeparator = detectLineSeparators(data, if (isUseXmlProlog) null else LineSeparator.LF)
|
||||
return loadElement(data)
|
||||
return JDOMUtil.load(data)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ import com.intellij.openapi.module.impl.ModuleManagerImpl
|
||||
import com.intellij.openapi.module.impl.getModuleNameByFilePath
|
||||
import com.intellij.openapi.project.ProjectBundle
|
||||
import com.intellij.openapi.project.isExternalStorageEnabled
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent
|
||||
import com.intellij.util.LineSeparator
|
||||
import com.intellij.util.loadElement
|
||||
import org.jdom.Element
|
||||
import java.io.FileNotFoundException
|
||||
import java.nio.ByteBuffer
|
||||
@@ -100,7 +100,7 @@ internal class ModuleStateStorageManager(macroSubstitutor: TrackingPathMacroSubs
|
||||
runAndHandleExceptions {
|
||||
val charBuffer = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(virtualFile.contentsToByteArray()))
|
||||
lineSeparator = detectLineSeparators(charBuffer, if (isUseXmlProlog) null else LineSeparator.LF)
|
||||
return loadElement(charBuffer)
|
||||
return JDOMUtil.load(charBuffer)
|
||||
}
|
||||
}
|
||||
return null
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.intellij.util.LineSeparator
|
||||
import com.intellij.util.SmartList
|
||||
import com.intellij.util.containers.SmartHashSet
|
||||
import com.intellij.util.io.delete
|
||||
import com.intellij.util.loadElement
|
||||
import gnu.trove.THashMap
|
||||
import org.jdom.Attribute
|
||||
import org.jdom.Element
|
||||
@@ -51,7 +50,7 @@ abstract class XmlElementStorage protected constructor(val fileSpec: String,
|
||||
if (useStreamProvider && provider != null) {
|
||||
isLoadLocalData = !provider.read(fileSpec, roamingType) { inputStream ->
|
||||
inputStream?.let {
|
||||
element = loadElement(inputStream)
|
||||
element = JDOMUtil.load(inputStream)
|
||||
providerDataStateChanged(createDataWriterForElement(element!!, toString()), DataStateChanged.LOADED)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.intellij.configurationStore
|
||||
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream
|
||||
import com.intellij.util.loadElement
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.Test
|
||||
|
||||
@@ -78,7 +77,7 @@ class BinaryXmlOutputterTest {
|
||||
private fun test(xml: String) {
|
||||
val byteOut = BufferExposingByteArrayOutputStream()
|
||||
byteOut.use {
|
||||
serializeElementToBinary(loadElement(xml), it)
|
||||
serializeElementToBinary(JDOMUtil.load(xml), it)
|
||||
}
|
||||
|
||||
val xmlAfter = JDOMUtil.writeElement(byteOut.toByteArray().inputStream().use { deserializeElementFromBinary(it) })
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.configurationStore
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
@@ -10,7 +11,6 @@ import com.intellij.psi.codeStyle.CustomCodeStyleSettings
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.testFramework.ProjectRule
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import com.intellij.util.loadElement
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.jdom.Element
|
||||
import org.junit.ClassRule
|
||||
@@ -43,7 +43,7 @@ class CodeStyleTest {
|
||||
<option name="KEEP_BLANK_LINES_IN_CODE" value="10" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>""".trimIndent()
|
||||
settings.readExternal(loadElement(loaded))
|
||||
settings.readExternal(JDOMUtil.load(loaded))
|
||||
|
||||
val serialized = Element("code_scheme").setAttribute("name", "testSchemeName")
|
||||
settings.writeExternal(serialized)
|
||||
@@ -75,7 +75,7 @@ class CodeStyleTest {
|
||||
extra = Element(tagName)
|
||||
parentElement.addContent(extra)
|
||||
}
|
||||
|
||||
|
||||
val option = Element("option")
|
||||
option.setAttribute("name", "MAIN")
|
||||
option.setAttribute("value", "3")
|
||||
@@ -103,7 +103,7 @@ class CodeStyleTest {
|
||||
|
||||
try {
|
||||
val settings = CodeStyleSettings()
|
||||
val text : (param: String) -> String = { param ->
|
||||
val text : (param: String) -> String = { param ->
|
||||
"""
|
||||
<code_scheme name="testSchemeName" version="${CodeStyleSettings.CURR_VERSION}">
|
||||
<NewComponent>
|
||||
@@ -126,7 +126,7 @@ class CodeStyleTest {
|
||||
</codeStyleSettings>
|
||||
</code_scheme>""".trimIndent()
|
||||
}
|
||||
settings.readExternal(loadElement(text("2")))
|
||||
settings.readExternal(JDOMUtil.load(text("2")))
|
||||
|
||||
val serialized = Element("code_scheme").setAttribute("name", "testSchemeName")
|
||||
settings.writeExternal(serialized)
|
||||
@@ -149,7 +149,7 @@ class CodeStyleTest {
|
||||
<option name="RIGHT_MARGIN" value="64" />
|
||||
</code_scheme>""".trimIndent();
|
||||
|
||||
settings.readExternal(loadElement(initial))
|
||||
settings.readExternal(JDOMUtil.load(initial))
|
||||
settings.resetDeprecatedFields()
|
||||
|
||||
val serialized = Element("code_scheme").setAttribute("name", "testSchemeName")
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.intellij.openapi.application.ex.PathManagerEx
|
||||
import com.intellij.openapi.application.runWriteAction
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.project.ProjectManager
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.openapi.vfs.refreshVfs
|
||||
import com.intellij.testFramework.*
|
||||
@@ -95,7 +96,8 @@ internal class DefaultProjectStoreTest {
|
||||
@Test fun `new project from default - directory-based storage`() {
|
||||
val defaultProject = ProjectManager.getInstance().defaultProject
|
||||
val defaultTestComponent = TestComponent()
|
||||
defaultTestComponent.loadState(loadElement("""<component><main name="$TEST_COMPONENT_NAME"/><sub name="foo" /><sub name="bar" /></component>"""))
|
||||
defaultTestComponent.loadState(
|
||||
JDOMUtil.load("""<component><main name="$TEST_COMPONENT_NAME"/><sub name="foo" /><sub name="bar" /></component>"""))
|
||||
val stateStore = defaultProject.stateStore as ComponentStoreImpl
|
||||
stateStore.initComponent(defaultTestComponent, true)
|
||||
try {
|
||||
|
||||
@@ -4,12 +4,12 @@ package com.intellij.configurationStore
|
||||
import com.intellij.idea.Bombed
|
||||
import com.intellij.openapi.components.MainConfigurationStateSplitter
|
||||
import com.intellij.openapi.components.StateStorage
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.testFramework.ProjectRule
|
||||
import com.intellij.testFramework.RuleChain
|
||||
import com.intellij.testFramework.TemporaryDirectory
|
||||
import com.intellij.testFramework.assertions.Assertions.assertThat
|
||||
import com.intellij.testFramework.runInEdtAndWait
|
||||
import com.intellij.util.loadElement
|
||||
import org.jdom.Element
|
||||
import org.junit.ClassRule
|
||||
import org.junit.Rule
|
||||
@@ -24,7 +24,7 @@ private fun StateStorage.SaveSessionProducer.save() {
|
||||
|
||||
private fun StateStorageBase<*>.setStateAndSave(componentName: String, state: String?) {
|
||||
val externalizationSession = createSaveSessionProducer()!!
|
||||
externalizationSession.setState(null, componentName, if (state == null) Element("state") else loadElement(state))
|
||||
externalizationSession.setState(null, componentName, if (state == null) Element("state") else JDOMUtil.load(state))
|
||||
externalizationSession.save()
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
package com.intellij.configurationStore
|
||||
|
||||
import com.intellij.openapi.components.BaseState
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.testFramework.assertions.Assertions.assertThat
|
||||
import com.intellij.util.loadElement
|
||||
import com.intellij.util.xmlb.annotations.Attribute
|
||||
import com.intellij.util.xmlb.annotations.CollectionBean
|
||||
import org.junit.Test
|
||||
@@ -74,7 +74,7 @@ class StoredPropertyStateTest {
|
||||
assertThat(state).isEqualTo(newEqualState)
|
||||
|
||||
assertThat(state.serialize()).isEqualTo("""<AState customName="foo" />""")
|
||||
assertThat(loadElement("""<AState customName="foo" />""").deserialize(AState::class.java).languageLevel).isEqualTo("foo")
|
||||
assertThat(JDOMUtil.load("""<AState customName="foo" />""").deserialize(AState::class.java).languageLevel).isEqualTo("foo")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.intellij.configurationStore.xml
|
||||
import com.intellij.configurationStore.AState
|
||||
import com.intellij.configurationStore.deserialize
|
||||
import com.intellij.openapi.components.BaseState
|
||||
import com.intellij.util.loadElement
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.util.xmlb.annotations.MapAnnotation
|
||||
import com.intellij.util.xmlb.annotations.Property
|
||||
import com.intellij.util.xmlb.annotations.Tag
|
||||
@@ -86,25 +86,25 @@ class KotlinXmlSerializerTest {
|
||||
</option>
|
||||
</bean>""", data)
|
||||
|
||||
assertThat(loadElement("""<bean>
|
||||
<option name="PLACES_MAP">
|
||||
<entry key="">
|
||||
<PlaceSettings>
|
||||
<option name="IGNORE_POLICY" />
|
||||
</PlaceSettings>
|
||||
</entry>
|
||||
</option>
|
||||
</bean>""").deserialize<Foo>().PLACES_MAP.get("")!!.IGNORE_POLICY).isEqualTo(IgnorePolicy.DEFAULT)
|
||||
assertThat(JDOMUtil.load("""<bean>
|
||||
<option name="PLACES_MAP">
|
||||
<entry key="">
|
||||
<PlaceSettings>
|
||||
<option name="IGNORE_POLICY" />
|
||||
</PlaceSettings>
|
||||
</entry>
|
||||
</option>
|
||||
</bean>""").deserialize<Foo>().PLACES_MAP.get("")!!.IGNORE_POLICY).isEqualTo(IgnorePolicy.DEFAULT)
|
||||
|
||||
val value = loadElement("""<bean>
|
||||
<option name="PLACES_MAP">
|
||||
<entry key="">
|
||||
<PlaceSettings>
|
||||
<option name="SOME_UNKNOWN_VALUE" />
|
||||
</PlaceSettings>
|
||||
</entry>
|
||||
</option>
|
||||
</bean>""").deserialize<Foo>()
|
||||
val value = JDOMUtil.load("""<bean>
|
||||
<option name="PLACES_MAP">
|
||||
<entry key="">
|
||||
<PlaceSettings>
|
||||
<option name="SOME_UNKNOWN_VALUE" />
|
||||
</PlaceSettings>
|
||||
</entry>
|
||||
</option>
|
||||
</bean>""").deserialize<Foo>()
|
||||
assertThat(value).isNotNull()
|
||||
val placeSettings = value.PLACES_MAP.get("")
|
||||
assertThat(placeSettings).isNotNull()
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.intellij.openapi.util.JDOMExternalizableStringList
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.testFramework.assertions.Assertions.assertThat
|
||||
import com.intellij.util.SmartList
|
||||
import com.intellij.util.loadElement
|
||||
import com.intellij.util.xmlb.SkipDefaultsSerializationFilter
|
||||
import com.intellij.util.xmlb.XmlSerializer
|
||||
import com.intellij.util.xmlb.annotations.AbstractCollection
|
||||
@@ -212,76 +211,76 @@ internal class XmlSerializerCollectionTest {
|
||||
}
|
||||
|
||||
@Test fun testPropertyAndNoSurround() {
|
||||
val bean = XmlSerializer.deserialize<PluginBean>(loadElement("""<idea-plugin>
|
||||
<id>com.intellij.database.ide</id>
|
||||
<name>DataGrip Customization</name>
|
||||
<vendor>JetBrains</vendor>
|
||||
<category>Database</category>
|
||||
val bean = XmlSerializer.deserialize<PluginBean>(JDOMUtil.load("""<idea-plugin>
|
||||
<id>com.intellij.database.ide</id>
|
||||
<name>DataGrip Customization</name>
|
||||
<vendor>JetBrains</vendor>
|
||||
<category>Database</category>
|
||||
|
||||
<depends>com.intellij.modules.datagrip</depends>
|
||||
<depends>com.intellij.database</depends>
|
||||
<depends>com.intellij.modules.datagrip</depends>
|
||||
<depends>com.intellij.database</depends>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<projectViewPane implementation="com.intellij.database.ide.DatabaseProjectViewPane"/>
|
||||
<directoryProjectConfigurator implementation="com.intellij.database.ide.DatabaseProjectConfigurator"/>
|
||||
<nonProjectFileWritingAccessExtension implementation="com.intellij.database.vfs.DbNonProjectFileWritingAccessExtension"/>
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<projectViewPane implementation="com.intellij.database.ide.DatabaseProjectViewPane"/>
|
||||
<directoryProjectConfigurator implementation="com.intellij.database.ide.DatabaseProjectConfigurator"/>
|
||||
<nonProjectFileWritingAccessExtension implementation="com.intellij.database.vfs.DbNonProjectFileWritingAccessExtension"/>
|
||||
|
||||
<applicationService serviceInterface="com.intellij.openapi.wm.impl.FrameTitleBuilder"
|
||||
serviceImplementation="com.intellij.database.ide.DatabaseFrameTitleBuilder"
|
||||
<applicationService serviceInterface="com.intellij.openapi.wm.impl.FrameTitleBuilder"
|
||||
serviceImplementation="com.intellij.database.ide.DatabaseFrameTitleBuilder"
|
||||
overrides="true"/>
|
||||
<applicationService serviceInterface="com.intellij.openapi.fileEditor.impl.EditorEmptyTextPainter"
|
||||
serviceImplementation="com.intellij.database.ide.DatabaseEditorEmptyTextPainter"
|
||||
overrides="true"/>
|
||||
<applicationService serviceInterface="com.intellij.ide.RecentProjectsManager"
|
||||
serviceImplementation="com.intellij.database.ide.DatabaseRecentProjectManager"
|
||||
overrides="true"/>
|
||||
<projectService serviceInterface="com.intellij.ide.projectView.ProjectView"
|
||||
serviceImplementation="com.intellij.database.ide.DatabaseProjectView"
|
||||
overrides="true"/>
|
||||
<applicationService serviceInterface="com.intellij.openapi.fileEditor.impl.EditorEmptyTextPainter"
|
||||
serviceImplementation="com.intellij.database.ide.DatabaseEditorEmptyTextPainter"
|
||||
<projectService serviceInterface="com.intellij.psi.search.ProjectScopeBuilder"
|
||||
serviceImplementation="com.intellij.database.ide.DatabaseProjectScopeBuilder"
|
||||
overrides="true"/>
|
||||
<applicationService serviceInterface="com.intellij.ide.RecentProjectsManager"
|
||||
serviceImplementation="com.intellij.database.ide.DatabaseRecentProjectManager"
|
||||
overrides="true"/>
|
||||
<projectService serviceInterface="com.intellij.ide.projectView.ProjectView"
|
||||
serviceImplementation="com.intellij.database.ide.DatabaseProjectView"
|
||||
overrides="true"/>
|
||||
<projectService serviceInterface="com.intellij.psi.search.ProjectScopeBuilder"
|
||||
serviceImplementation="com.intellij.database.ide.DatabaseProjectScopeBuilder"
|
||||
overrides="true"/>
|
||||
</extensions>
|
||||
</extensions>
|
||||
|
||||
<application-components>
|
||||
<component>
|
||||
<implementation-class>com.intellij.database.ide.DataGripInitialConfigurator</implementation-class>
|
||||
<headless-implementation-class/>
|
||||
</component>
|
||||
</application-components>
|
||||
<application-components>
|
||||
<component>
|
||||
<implementation-class>com.intellij.database.ide.DataGripInitialConfigurator</implementation-class>
|
||||
<headless-implementation-class/>
|
||||
</component>
|
||||
</application-components>
|
||||
|
||||
<project-components>
|
||||
<component>
|
||||
<option name="overrides" value="true"/>
|
||||
<interface-class>com.intellij.database.autoConfig.DatabaseConfigFileWatcher</interface-class>
|
||||
<implementation-class/>
|
||||
</component>
|
||||
</project-components>
|
||||
<project-components>
|
||||
<component>
|
||||
<option name="overrides" value="true"/>
|
||||
<interface-class>com.intellij.database.autoConfig.DatabaseConfigFileWatcher</interface-class>
|
||||
<implementation-class/>
|
||||
</component>
|
||||
</project-components>
|
||||
|
||||
<actions>
|
||||
<action id="DBE.AddContentRoot" class="com.intellij.database.ide.actions.AddContentRootAction" text="Attach Directory">
|
||||
<add-to-group group-id="ProjectViewPopupMenu" anchor="before" relative-to-action="WeighingNewGroup"/>
|
||||
<add-to-group group-id="FileOpenGroup" anchor="last"/>
|
||||
</action>
|
||||
<group id="NewProjectOrModuleGroup">
|
||||
<action id="NewProject" class="com.intellij.database.ide.actions.NewProjectAction" text="Project..."/>
|
||||
<separator/>
|
||||
</group>
|
||||
<actions>
|
||||
<action id="DBE.AddContentRoot" class="com.intellij.database.ide.actions.AddContentRootAction" text="Attach Directory">
|
||||
<add-to-group group-id="ProjectViewPopupMenu" anchor="before" relative-to-action="WeighingNewGroup"/>
|
||||
<add-to-group group-id="FileOpenGroup" anchor="last"/>
|
||||
</action>
|
||||
<group id="NewProjectOrModuleGroup">
|
||||
<action id="NewProject" class="com.intellij.database.ide.actions.NewProjectAction" text="Project..."/>
|
||||
<separator/>
|
||||
</group>
|
||||
|
||||
<action id="NewSqlFile" class="com.intellij.database.ide.actions.NewSqlFileAction">
|
||||
<add-to-group group-id="DBE.NewFile" anchor="first"/>
|
||||
</action>
|
||||
<action id="NewSqlFile" class="com.intellij.database.ide.actions.NewSqlFileAction">
|
||||
<add-to-group group-id="DBE.NewFile" anchor="first"/>
|
||||
</action>
|
||||
|
||||
<action overrides="true" id="GotoClass" class="com.intellij.ide.actions.GotoClassAction" text="Table/Class..."/>
|
||||
<action overrides="true" id="GotoClass" class="com.intellij.ide.actions.GotoClassAction" text="Table/Class..."/>
|
||||
|
||||
<reference id="DatabaseView.PropertiesAction">
|
||||
<add-to-group group-id="FileMainSettingsGroup" anchor="after" relative-to-action="ShowSettings"/>
|
||||
</reference>
|
||||
<reference id="DatabaseView.PropertiesAction">
|
||||
<add-to-group group-id="FileMainSettingsGroup" anchor="after" relative-to-action="ShowSettings"/>
|
||||
</reference>
|
||||
|
||||
<action overrides="true" id="DatabaseView.ImportDataSources" class="com.intellij.openapi.actionSystem.EmptyAction"
|
||||
text="Import from Sources..."/>
|
||||
</actions>
|
||||
</idea-plugin>"""), PluginBean::class.java)
|
||||
<action overrides="true" id="DatabaseView.ImportDataSources" class="com.intellij.openapi.actionSystem.EmptyAction"
|
||||
text="Import from Sources..."/>
|
||||
</actions>
|
||||
</idea-plugin>"""), PluginBean::class.java)
|
||||
|
||||
assertThat(bean.actions.joinToString("\n") { JDOMUtil.writeElement(it) }).isEqualTo("""
|
||||
<actions>
|
||||
|
||||
@@ -7,11 +7,11 @@ import com.intellij.configurationStore.StoredPropertyStateTest
|
||||
import com.intellij.configurationStore.clearBindingCache
|
||||
import com.intellij.configurationStore.deserialize
|
||||
import com.intellij.configurationStore.serialize
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import com.intellij.testFramework.assertConcurrent
|
||||
import com.intellij.testFramework.assertions.Assertions.assertThat
|
||||
import com.intellij.util.loadElement
|
||||
import com.intellij.util.xmlb.*
|
||||
import com.intellij.util.xmlb.annotations.*
|
||||
import junit.framework.TestCase
|
||||
@@ -421,13 +421,13 @@ internal class XmlSerializerTest {
|
||||
}
|
||||
|
||||
@Test fun deserializeFromFormattedXML() {
|
||||
val bean = loadElement("""
|
||||
<bean>
|
||||
<option name="intV" value="2"/>
|
||||
<vValue v="1"/>
|
||||
<vValue v="2"/>
|
||||
<vValue v="3"/>
|
||||
</bean>""").deserialize<BeanWithArrayWithoutAllTag>()
|
||||
val bean = JDOMUtil.load("""
|
||||
<bean>
|
||||
<option name="intV" value="2"/>
|
||||
<vValue v="1"/>
|
||||
<vValue v="2"/>
|
||||
<vValue v="3"/>
|
||||
</bean>""").deserialize<BeanWithArrayWithoutAllTag>()
|
||||
assertThat(bean.intV).isEqualTo(2)
|
||||
assertThat("[1, 2, 3]").isEqualTo(Arrays.asList(*bean.v).toString())
|
||||
}
|
||||
@@ -502,7 +502,8 @@ internal class XmlSerializerTest {
|
||||
}
|
||||
|
||||
@Test fun deserializeJDOMElementField() {
|
||||
val bean = loadElement("<BeanWithJDOMElement><option name=\"STRING_V\" value=\"bye\"/><actions><action/><action/></actions></BeanWithJDOMElement>").deserialize<BeanWithJDOMElement>()
|
||||
val bean = JDOMUtil.load(
|
||||
"<BeanWithJDOMElement><option name=\"STRING_V\" value=\"bye\"/><actions><action/><action/></actions></BeanWithJDOMElement>").deserialize<BeanWithJDOMElement>()
|
||||
|
||||
assertThat(bean.STRING_V).isEqualTo("bye")
|
||||
assertThat(bean.actions).isNotNull
|
||||
@@ -516,7 +517,7 @@ internal class XmlSerializerTest {
|
||||
|
||||
@Test fun jdomElementArrayField() {
|
||||
val text = "<BeanWithJDOMElementArray>\n" + " <option name=\"STRING_V\" value=\"bye\" />\n" + " <actions>\n" + " <action />\n" + " <action />\n" + " </actions>\n" + " <actions>\n" + " <action />\n" + " </actions>\n" + "</BeanWithJDOMElementArray>"
|
||||
val bean = loadElement(text).deserialize<BeanWithJDOMElementArray>()
|
||||
val bean = JDOMUtil.load(text).deserialize<BeanWithJDOMElementArray>()
|
||||
|
||||
TestCase.assertEquals("bye", bean.STRING_V)
|
||||
TestCase.assertNotNull(bean.actions)
|
||||
@@ -609,7 +610,8 @@ internal class XmlSerializerTest {
|
||||
val bean = BeanWithPublicFields()
|
||||
bean.STRING_V = "zzz"
|
||||
|
||||
XmlSerializer.deserializeInto(bean, loadElement("<BeanWithPublicFields><option name=\"INT_V\" value=\"999\"/></BeanWithPublicFields>"))
|
||||
XmlSerializer.deserializeInto(bean,
|
||||
JDOMUtil.load("<BeanWithPublicFields><option name=\"INT_V\" value=\"999\"/></BeanWithPublicFields>"))
|
||||
|
||||
assertThat(bean.INT_V).isEqualTo(999)
|
||||
assertThat(bean.STRING_V).isEqualTo("zzz")
|
||||
@@ -654,16 +656,16 @@ internal class XmlSerializerTest {
|
||||
@Tag("bean")
|
||||
data class Bean(@Tag val description: String? = null)
|
||||
|
||||
var bean = loadElement("""<bean>
|
||||
<description>
|
||||
<![CDATA[
|
||||
<h4>Node.js integration</h4>
|
||||
]]>
|
||||
</description>
|
||||
</bean>""").deserialize<Bean>()
|
||||
var bean = JDOMUtil.load("""<bean>
|
||||
<description>
|
||||
<![CDATA[
|
||||
<h4>Node.js integration</h4>
|
||||
]]>
|
||||
</description>
|
||||
</bean>""").deserialize<Bean>()
|
||||
assertThat(bean.description).isEqualToIgnoringWhitespace("<h4>Node.js integration</h4>")
|
||||
|
||||
bean = loadElement("""<bean><description><![CDATA[<h4>Node.js integration</h4>]]></description></bean>""").deserialize()
|
||||
bean = JDOMUtil.load("""<bean><description><![CDATA[<h4>Node.js integration</h4>]]></description></bean>""").deserialize()
|
||||
assertThat(bean.description).isEqualTo("<h4>Node.js integration</h4>")
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ package com.intellij.credentialStore.kdbx
|
||||
import com.intellij.credentialStore.OneTimeString
|
||||
import com.intellij.credentialStore.createSecureRandom
|
||||
import com.intellij.credentialStore.generateBytes
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.util.getOrCreate
|
||||
import com.intellij.util.io.toByteArray
|
||||
import com.intellij.util.loadElement
|
||||
import org.bouncycastle.crypto.SkippingStreamCipher
|
||||
import org.bouncycastle.crypto.engines.ChaCha7539Engine
|
||||
import org.bouncycastle.crypto.params.KeyParameter
|
||||
@@ -179,42 +179,42 @@ private fun base64FromUuid(uuid: UUID): String {
|
||||
private fun createEmptyDatabase(): Element {
|
||||
val creationDate = formattedNow()
|
||||
@Suppress("SpellCheckingInspection")
|
||||
return loadElement("""<KeePassFile>
|
||||
<Meta>
|
||||
<Generator>IJ</Generator>
|
||||
<HeaderHash></HeaderHash>
|
||||
<DatabaseName>New Database</DatabaseName>
|
||||
<DatabaseNameChanged>${creationDate}</DatabaseNameChanged>
|
||||
<DatabaseDescription>Empty Database</DatabaseDescription>
|
||||
<DatabaseDescriptionChanged>${creationDate}</DatabaseDescriptionChanged>
|
||||
<DefaultUserName/>
|
||||
<DefaultUserNameChanged>${creationDate}</DefaultUserNameChanged>
|
||||
<MaintenanceHistoryDays>365</MaintenanceHistoryDays>
|
||||
<Color/>
|
||||
<MasterKeyChanged>${creationDate}</MasterKeyChanged>
|
||||
<MasterKeyChangeRec>-1</MasterKeyChangeRec>
|
||||
<MasterKeyChangeForce>-1</MasterKeyChangeForce>
|
||||
<MemoryProtection>
|
||||
<ProtectTitle>False</ProtectTitle>
|
||||
<ProtectUserName>False</ProtectUserName>
|
||||
<ProtectPassword>True</ProtectPassword>
|
||||
<ProtectURL>False</ProtectURL>
|
||||
<ProtectNotes>False</ProtectNotes>
|
||||
</MemoryProtection>
|
||||
<CustomIcons/>
|
||||
<RecycleBinEnabled>True</RecycleBinEnabled>
|
||||
<RecycleBinUUID>AAAAAAAAAAAAAAAAAAAAAA==</RecycleBinUUID>
|
||||
<RecycleBinChanged>${creationDate}</RecycleBinChanged>
|
||||
<EntryTemplatesGroup>AAAAAAAAAAAAAAAAAAAAAA==</EntryTemplatesGroup>
|
||||
<EntryTemplatesGroupChanged>${creationDate}</EntryTemplatesGroupChanged>
|
||||
<LastSelectedGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastSelectedGroup>
|
||||
<LastTopVisibleGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleGroup>
|
||||
<HistoryMaxItems>10</HistoryMaxItems>
|
||||
<HistoryMaxSize>6291456</HistoryMaxSize>
|
||||
<Binaries/>
|
||||
<CustomData/>
|
||||
</Meta>
|
||||
</KeePassFile>""")
|
||||
return JDOMUtil.load("""<KeePassFile>
|
||||
<Meta>
|
||||
<Generator>IJ</Generator>
|
||||
<HeaderHash></HeaderHash>
|
||||
<DatabaseName>New Database</DatabaseName>
|
||||
<DatabaseNameChanged>${creationDate}</DatabaseNameChanged>
|
||||
<DatabaseDescription>Empty Database</DatabaseDescription>
|
||||
<DatabaseDescriptionChanged>${creationDate}</DatabaseDescriptionChanged>
|
||||
<DefaultUserName/>
|
||||
<DefaultUserNameChanged>${creationDate}</DefaultUserNameChanged>
|
||||
<MaintenanceHistoryDays>365</MaintenanceHistoryDays>
|
||||
<Color/>
|
||||
<MasterKeyChanged>${creationDate}</MasterKeyChanged>
|
||||
<MasterKeyChangeRec>-1</MasterKeyChangeRec>
|
||||
<MasterKeyChangeForce>-1</MasterKeyChangeForce>
|
||||
<MemoryProtection>
|
||||
<ProtectTitle>False</ProtectTitle>
|
||||
<ProtectUserName>False</ProtectUserName>
|
||||
<ProtectPassword>True</ProtectPassword>
|
||||
<ProtectURL>False</ProtectURL>
|
||||
<ProtectNotes>False</ProtectNotes>
|
||||
</MemoryProtection>
|
||||
<CustomIcons/>
|
||||
<RecycleBinEnabled>True</RecycleBinEnabled>
|
||||
<RecycleBinUUID>AAAAAAAAAAAAAAAAAAAAAA==</RecycleBinUUID>
|
||||
<RecycleBinChanged>${creationDate}</RecycleBinChanged>
|
||||
<EntryTemplatesGroup>AAAAAAAAAAAAAAAAAAAAAA==</EntryTemplatesGroup>
|
||||
<EntryTemplatesGroupChanged>${creationDate}</EntryTemplatesGroupChanged>
|
||||
<LastSelectedGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastSelectedGroup>
|
||||
<LastTopVisibleGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleGroup>
|
||||
<HistoryMaxItems>10</HistoryMaxItems>
|
||||
<HistoryMaxSize>6291456</HistoryMaxSize>
|
||||
<Binaries/>
|
||||
<CustomData/>
|
||||
</Meta>
|
||||
</KeePassFile>""")
|
||||
}
|
||||
|
||||
internal class StringProtectedByStreamCipher(value: ByteArray, private val cipher: SkippingStreamCipher) : SecureString {
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ import com.intellij.configurationStore.DataWriterFilter
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.externalSystem.service.project.manage.ExternalProjectsDataStorage
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.util.io.*
|
||||
import com.intellij.util.loadElement
|
||||
import org.jdom.Element
|
||||
import java.nio.file.Path
|
||||
|
||||
@@ -80,7 +80,7 @@ internal abstract class FileSystemExternalSystemStorage(dirName: String, project
|
||||
}
|
||||
|
||||
return nameToPath(name).inputStreamIfExists()?.use {
|
||||
loadElement(it)
|
||||
JDOMUtil.load(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.actions.project
|
||||
|
||||
import com.intellij.CommonBundle
|
||||
@@ -14,10 +14,10 @@ import com.intellij.openapi.module.impl.ModuleRenamingHistoryState
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.ProjectBundle
|
||||
import com.intellij.openapi.ui.Messages
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.openapi.wm.IdeFocusManager
|
||||
import com.intellij.util.loadElement
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import com.intellij.util.write
|
||||
import com.intellij.util.xmlb.XmlSerializationException
|
||||
@@ -42,7 +42,7 @@ class LoadModuleRenamingSchemeAction(private val dialog: ConvertModuleGroupsToQu
|
||||
}
|
||||
|
||||
val renamingState = try {
|
||||
XmlSerializer.deserialize(loadElement(file.inputStream), ModuleRenamingHistoryState::class.java)
|
||||
XmlSerializer.deserialize(JDOMUtil.load(file.inputStream), ModuleRenamingHistoryState::class.java)
|
||||
}
|
||||
catch (e: XmlSerializationException) {
|
||||
LOG.info(e)
|
||||
|
||||
@@ -12,8 +12,8 @@ import com.intellij.openapi.project.DumbAwareAction
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.*
|
||||
import com.intellij.openapi.updateSettings.impl.UpdateChecker
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.ui.ScrollPaneFactory
|
||||
import com.intellij.util.loadElement
|
||||
import com.intellij.util.text.nullize
|
||||
import com.intellij.util.ui.JBUI
|
||||
import com.intellij.util.ui.UIUtil
|
||||
@@ -88,7 +88,9 @@ class ShowUpdateInfoDialogAction : DumbAwareAction() {
|
||||
return ValidationInfo("Please paste something here", textArea)
|
||||
}
|
||||
|
||||
try { loadElement(completeUpdateInfoXml(text)) }
|
||||
try {
|
||||
JDOMUtil.load(completeUpdateInfoXml(text))
|
||||
}
|
||||
catch (e: Exception) {
|
||||
return ValidationInfo(e.message ?: "Error: ${e.javaClass.name}", textArea)
|
||||
}
|
||||
@@ -104,7 +106,7 @@ class ShowUpdateInfoDialogAction : DumbAwareAction() {
|
||||
internal fun patchFilePath() = fileField.field.text.nullize(nullizeSpaces = true)
|
||||
|
||||
private fun completeUpdateInfoXml(text: String) =
|
||||
when (loadElement(text).name) {
|
||||
when (JDOMUtil.load(text).name) {
|
||||
"products" -> text
|
||||
"channel" -> {
|
||||
val productName = ApplicationNamesInfo.getInstance().fullProductName
|
||||
|
||||
@@ -7,8 +7,8 @@ import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.diagnostic.runAndLogException
|
||||
import com.intellij.openapi.keymap.Keymap
|
||||
import com.intellij.openapi.keymap.KeymapManager
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import com.intellij.util.loadElement
|
||||
import gnu.trove.THashMap
|
||||
import org.jdom.Element
|
||||
import java.util.*
|
||||
@@ -48,7 +48,7 @@ open class DefaultKeymap {
|
||||
|
||||
LOG.runAndLogException {
|
||||
loadKeymapsFromElement(object: SchemeDataHolder<KeymapImpl> {
|
||||
override fun read() = provider.load(key) { loadElement(it) }
|
||||
override fun read() = provider.load(key) { JDOMUtil.load(it) }
|
||||
|
||||
override fun updateDigest(scheme: KeymapImpl) {
|
||||
}
|
||||
|
||||
+5
-5
@@ -25,6 +25,7 @@ import com.intellij.openapi.project.ProjectManager
|
||||
import com.intellij.openapi.ui.Messages
|
||||
import com.intellij.openapi.util.ActionCallback
|
||||
import com.intellij.openapi.util.BuildNumber
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
@@ -34,7 +35,6 @@ import com.intellij.util.containers.ContainerUtil
|
||||
import com.intellij.util.containers.MultiMap
|
||||
import com.intellij.util.io.HttpRequests
|
||||
import com.intellij.util.io.URLUtil
|
||||
import com.intellij.util.loadElement
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import com.intellij.xml.util.XmlStringUtil
|
||||
import gnu.trove.THashMap
|
||||
@@ -169,7 +169,7 @@ object UpdateChecker {
|
||||
.connect {
|
||||
try {
|
||||
if (settings.isPlatformUpdateEnabled)
|
||||
UpdatesInfo(loadElement(it.reader))
|
||||
UpdatesInfo(JDOMUtil.load(it.reader))
|
||||
else
|
||||
null
|
||||
}
|
||||
@@ -203,7 +203,7 @@ object UpdateChecker {
|
||||
.forceHttps(settings.canUseSecureConnection())
|
||||
.connect {
|
||||
try {
|
||||
UpdatesInfo(loadElement(it.reader))
|
||||
UpdatesInfo(JDOMUtil.load(it.reader))
|
||||
}
|
||||
catch (e: JDOMException) {
|
||||
// corrupted content, don't bother telling user
|
||||
@@ -543,13 +543,13 @@ object UpdateChecker {
|
||||
val newBuild: BuildInfo?
|
||||
val patches: UpdateChain?
|
||||
if (forceUpdate) {
|
||||
val node = loadElement(updateInfoText).getChild("product")?.getChild("channel") ?: throw IllegalArgumentException("//channel missing")
|
||||
val node = JDOMUtil.load(updateInfoText).getChild("product")?.getChild("channel") ?: throw IllegalArgumentException("//channel missing")
|
||||
channel = UpdateChannel(node)
|
||||
newBuild = channel.builds.firstOrNull() ?: throw IllegalArgumentException("//build missing")
|
||||
patches = newBuild.patches.firstOrNull()?.let { UpdateChain(listOf(it.fromBuild, newBuild.number), it.size) }
|
||||
}
|
||||
else {
|
||||
val updateInfo = UpdatesInfo(loadElement(updateInfoText))
|
||||
val updateInfo = UpdatesInfo(JDOMUtil.load(updateInfoText))
|
||||
val strategy = UpdateStrategy(ApplicationInfo.getInstance().build, updateInfo)
|
||||
val checkForUpdateResult = strategy.checkForUpdates()
|
||||
channel = checkForUpdateResult.updatedChannel
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.updates
|
||||
|
||||
import com.intellij.openapi.updateSettings.impl.ChannelStatus
|
||||
import com.intellij.openapi.updateSettings.impl.UpdateChannel
|
||||
import com.intellij.openapi.updateSettings.impl.UpdatesInfo
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase
|
||||
import com.intellij.util.loadElement
|
||||
import org.junit.Assume.assumeTrue
|
||||
import org.junit.Test
|
||||
import java.io.IOException
|
||||
@@ -119,5 +119,5 @@ class UpdateInfoParsingTest : BareTestFixtureTestCase() {
|
||||
assertEquals("162.99.2", buildInfo.patches[0].fromBuild.asStringWithoutProductCode())
|
||||
}
|
||||
|
||||
private fun load(text: String) = UpdatesInfo(loadElement(text))
|
||||
private fun load(text: String) = UpdatesInfo(JDOMUtil.load(text))
|
||||
}
|
||||
@@ -3,8 +3,8 @@ package com.intellij.ide.updates
|
||||
|
||||
import com.intellij.openapi.updateSettings.impl.*
|
||||
import com.intellij.openapi.util.BuildNumber
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase
|
||||
import com.intellij.util.loadElement
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.Test
|
||||
|
||||
@@ -268,13 +268,13 @@ class UpdateStrategyTest : BareTestFixtureTestCase() {
|
||||
selectedChannel: ChannelStatus,
|
||||
testData: String,
|
||||
ignoredBuilds: List<String> = emptyList()): CheckForUpdateResult {
|
||||
val updates = UpdatesInfo(loadElement("""
|
||||
<products>
|
||||
<product name="IntelliJ IDEA">
|
||||
<code>IU</code>
|
||||
${testData}
|
||||
</product>
|
||||
</products>"""))
|
||||
val updates = UpdatesInfo(JDOMUtil.load("""
|
||||
<products>
|
||||
<product name="IntelliJ IDEA">
|
||||
<code>IU</code>
|
||||
${testData}
|
||||
</product>
|
||||
</products>"""))
|
||||
val settings = UpdateSettings()
|
||||
settings.selectedChannelStatus = selectedChannel
|
||||
settings.ignoredBuildNumbers += ignoredBuilds
|
||||
|
||||
+16
-16
@@ -3,9 +3,9 @@ package com.intellij.openapi.updateSettings
|
||||
|
||||
import com.intellij.configurationStore.deserialize
|
||||
import com.intellij.openapi.updateSettings.impl.UpdateOptions
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.testFramework.ProjectRule
|
||||
import com.intellij.testFramework.assertions.Assertions.assertThat
|
||||
import com.intellij.util.loadElement
|
||||
import org.junit.ClassRule
|
||||
import org.junit.Test
|
||||
|
||||
@@ -24,20 +24,20 @@ class UpdateOptionsTest {
|
||||
|
||||
@Test
|
||||
fun test() {
|
||||
loadElement("""
|
||||
<component name="UpdatesConfigurable">
|
||||
<enabledExternalComponentSources>
|
||||
<item value="Android SDK" />
|
||||
</enabledExternalComponentSources>
|
||||
<option name="externalUpdateChannels">
|
||||
<map>
|
||||
<entry key="Android SDK" value="Stable Channel" />
|
||||
</map>
|
||||
</option>
|
||||
<knownExternalComponentSources>
|
||||
<item value="Android SDK" />
|
||||
</knownExternalComponentSources>
|
||||
<option name="UPDATE_CHANNEL_TYPE" value="eap" />
|
||||
</component>""").deserialize(UpdateOptions::class.java)
|
||||
JDOMUtil.load("""
|
||||
<component name="UpdatesConfigurable">
|
||||
<enabledExternalComponentSources>
|
||||
<item value="Android SDK" />
|
||||
</enabledExternalComponentSources>
|
||||
<option name="externalUpdateChannels">
|
||||
<map>
|
||||
<entry key="Android SDK" value="Stable Channel" />
|
||||
</map>
|
||||
</option>
|
||||
<knownExternalComponentSources>
|
||||
<item value="Android SDK" />
|
||||
</knownExternalComponentSources>
|
||||
<option name="UPDATE_CHANNEL_TYPE" value="eap" />
|
||||
</component>""").deserialize(UpdateOptions::class.java)
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.util
|
||||
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
@@ -31,22 +32,22 @@ internal class JDOMUtilTest {
|
||||
@Test
|
||||
fun deepMerge() {
|
||||
assertThat(JDOMUtil.deepMerge(
|
||||
loadElement("""<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="f1" />
|
||||
<module fileurl="f2" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>"""),
|
||||
loadElement("""<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="f3" />
|
||||
<module fileurl="f4" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>""")))
|
||||
JDOMUtil.load("""<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="f1" />
|
||||
<module fileurl="f2" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>"""),
|
||||
JDOMUtil.load("""<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="f3" />
|
||||
<module fileurl="f4" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>""")))
|
||||
.isEqualTo("""<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
@@ -62,14 +63,14 @@ internal class JDOMUtilTest {
|
||||
@Test
|
||||
fun `deepMerge override empty tag`() {
|
||||
assertThat(JDOMUtil.deepMerge(
|
||||
loadElement("""<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel />
|
||||
</component>"""),
|
||||
loadElement("""<component name="ExternalCompilerConfiguration">
|
||||
<bytecodeTargetLevel>
|
||||
<module name="my-app" target="1.5" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>""")))
|
||||
JDOMUtil.load("""<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel />
|
||||
</component>"""),
|
||||
JDOMUtil.load("""<component name="ExternalCompilerConfiguration">
|
||||
<bytecodeTargetLevel>
|
||||
<module name="my-app" target="1.5" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>""")))
|
||||
.isEqualTo("""
|
||||
<component name="ExternalCompilerConfiguration">
|
||||
<bytecodeTargetLevel>
|
||||
|
||||
@@ -40,16 +40,19 @@ fun Parent.write(output: OutputStream, lineSeparator: String = "\n") {
|
||||
}
|
||||
|
||||
@Throws(IOException::class, JDOMException::class)
|
||||
@Deprecated("Use JDOMUtil.load directly", ReplaceWith("JDOMUtil.load(chars)", "com.intellij.openapi.util.JDOMUtil"))
|
||||
fun loadElement(chars: CharSequence): Element = JDOMUtil.load(chars)
|
||||
|
||||
@Throws(IOException::class, JDOMException::class)
|
||||
@Deprecated("Use JDOMUtil.load directly", ReplaceWith("JDOMUtil.load(reader)", "com.intellij.openapi.util.JDOMUtil"))
|
||||
fun loadElement(reader: Reader): Element = JDOMUtil.load(reader)
|
||||
|
||||
@Throws(IOException::class, JDOMException::class)
|
||||
fun loadElement(stream: InputStream): Element = JDOMUtil.load(stream.bufferedReader())
|
||||
@Deprecated("Use JDOMUtil.load directly", ReplaceWith("JDOMUtil.load(stream)", "com.intellij.openapi.util.JDOMUtil"))
|
||||
fun loadElement(stream: InputStream): Element = JDOMUtil.load(stream)
|
||||
|
||||
@Throws(IOException::class, JDOMException::class)
|
||||
fun loadElement(path: Path): Element = loadElement(path.inputStream())
|
||||
fun loadElement(path: Path): Element = JDOMUtil.load(path.inputStream())
|
||||
|
||||
fun Element?.isEmpty(): Boolean = this == null || JDOMUtil.isEmpty(this)
|
||||
|
||||
|
||||
+6
-2
@@ -2,9 +2,13 @@
|
||||
package com.intellij.configurationStore
|
||||
|
||||
import com.intellij.openapi.components.RoamingType
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.util.*
|
||||
import com.intellij.util.ArrayUtil
|
||||
import com.intellij.util.PathUtilRt
|
||||
import com.intellij.util.isEmpty
|
||||
import com.intellij.util.text.UniqueNameGenerator
|
||||
import com.intellij.util.toByteArray
|
||||
import org.jdom.Element
|
||||
import java.io.InputStream
|
||||
import java.util.*
|
||||
@@ -106,7 +110,7 @@ class SchemeManagerIprProvider(private val subStateTagName: String, private val
|
||||
names.sortWith(comparator)
|
||||
}
|
||||
for (name in names) {
|
||||
nameToData.get(name)?.let { state.addContent(loadElement(it.inputStream())) }
|
||||
nameToData.get(name)?.let { state.addContent(JDOMUtil.load(it.inputStream())) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import com.intellij.execution.configurations.RunConfiguration
|
||||
import com.intellij.execution.impl.deserializeConfigurationFrom
|
||||
import com.intellij.execution.impl.serializeConfigurationInto
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.testFramework.assertions.Assertions.assertThat
|
||||
import com.intellij.util.loadElement
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
|
||||
@@ -20,7 +20,7 @@ fun checkRunConfigurationSerialization(configuration: RunConfiguration, expected
|
||||
|
||||
if (factory != null) {
|
||||
val c2 = factory.createTemplateConfiguration(project)
|
||||
deserializeConfigurationFrom(c2, loadElement(expected))
|
||||
deserializeConfigurationFrom(c2, JDOMUtil.load(expected))
|
||||
checkRunConfigurationSerialization(c2, expected, null, project)
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import com.intellij.openapi.progress.EmptyProgressIndicator
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Factory
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.openapi.vfs.VfsUtil
|
||||
@@ -26,7 +27,6 @@ import com.intellij.psi.search.*
|
||||
import com.intellij.usageView.UsageInfo
|
||||
import com.intellij.usages.*
|
||||
import com.intellij.util.Processor
|
||||
import com.intellij.util.loadElement
|
||||
import com.intellij.util.xmlb.XmlSerializationException
|
||||
import com.intellij.util.xmlb.XmlSerializer
|
||||
import org.jetbrains.idea.devkit.util.PsiUtil
|
||||
@@ -59,7 +59,7 @@ class MigrateModuleNamesInSourcesAction : AnAction("Find/Update Module Names in
|
||||
val renamingScheme = try {
|
||||
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(
|
||||
File(VfsUtil.virtualToIoFile(project.baseDir), "module-renaming-scheme.xml"))?.let {
|
||||
XmlSerializer.deserialize(loadElement(it.inputStream), ModuleRenamingHistoryState::class.java).oldToNewName
|
||||
XmlSerializer.deserialize(JDOMUtil.load(it.inputStream), ModuleRenamingHistoryState::class.java).oldToNewName
|
||||
}
|
||||
}
|
||||
catch (e: XmlSerializationException) {
|
||||
|
||||
Reference in New Issue
Block a user