Commit 357a1315 authored by Vladimir Krivosheev's avatar Vladimir Krivosheev
Browse files

IDEA-CR-43092 use "obsolete" instead of "stalled"

parent 2b014e08
Branches unavailable Tags unavailable
No related merge requests found
Showing with 43 additions and 43 deletions
+43 -43
...@@ -11,8 +11,8 @@ import kotlinx.coroutines.coroutineScope ...@@ -11,8 +11,8 @@ import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicBoolean
// A way to remove stalled/unused component data. // A way to remove obsolete component data.
internal val STALLED_STORAGE_EP = ExtensionPointName<StalledStorageBean>("com.intellij.stalledStorage") internal val OBSOLETE_STORAGE_EP = ExtensionPointName<ObsoleteStorageBean>("com.intellij.obsoleteStorage")
abstract class ComponentStoreWithExtraComponents : ComponentStoreImpl() { abstract class ComponentStoreWithExtraComponents : ComponentStoreImpl() {
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
...@@ -81,14 +81,14 @@ abstract class ComponentStoreWithExtraComponents : ComponentStoreImpl() { ...@@ -81,14 +81,14 @@ abstract class ComponentStoreWithExtraComponents : ComponentStoreImpl() {
override fun commitComponents(isForce: Boolean, session: SaveSessionProducerManager, errors: MutableList<Throwable>) { override fun commitComponents(isForce: Boolean, session: SaveSessionProducerManager, errors: MutableList<Throwable>) {
// ensure that this task will not interrupt regular saving // ensure that this task will not interrupt regular saving
LOG.runAndLogException { LOG.runAndLogException {
commitStalledComponents(session, false) commitObsoleteComponents(session, false)
} }
super.commitComponents(isForce, session, errors) super.commitComponents(isForce, session, errors)
} }
internal open fun commitStalledComponents(session: SaveSessionProducerManager, isProjectLevel: Boolean) { internal open fun commitObsoleteComponents(session: SaveSessionProducerManager, isProjectLevel: Boolean) {
for (bean in STALLED_STORAGE_EP.extensionList) { for (bean in OBSOLETE_STORAGE_EP.extensionList) {
if (bean.isProjectLevel != isProjectLevel) { if (bean.isProjectLevel != isProjectLevel) {
continue continue
} }
......
...@@ -7,7 +7,7 @@ import com.intellij.util.xmlb.annotations.XCollection; ...@@ -7,7 +7,7 @@ import com.intellij.util.xmlb.annotations.XCollection;
import java.util.List; import java.util.List;
final class StalledStorageBean { final class ObsoleteStorageBean {
@Attribute @Attribute
public String file; public String file;
......
...@@ -353,9 +353,9 @@ private open class ProjectStoreImpl(project: Project, private val pathMacroManag ...@@ -353,9 +353,9 @@ private open class ProjectStoreImpl(project: Project, private val pathMacroManag
final override fun createSaveSessionProducerManager() = ProjectSaveSessionProducerManager(project) final override fun createSaveSessionProducerManager() = ProjectSaveSessionProducerManager(project)
final override fun commitStalledComponents(session: SaveSessionProducerManager, isProjectLevel: Boolean) { final override fun commitObsoleteComponents(session: SaveSessionProducerManager, isProjectLevel: Boolean) {
if (isDirectoryBased) { if (isDirectoryBased) {
super.commitStalledComponents(session, true) super.commitObsoleteComponents(session, true)
} }
} }
} }
......
...@@ -299,10 +299,10 @@ internal class ApplicationStoreTest { ...@@ -299,10 +299,10 @@ internal class ApplicationStoreTest {
@Test @Test
fun `remove stalled data`() = runBlocking<Unit> { fun `remove stalled data`() = runBlocking<Unit> {
val stalledStorageBean = StalledStorageBean() val obsoleteStorageBean = ObsoleteStorageBean()
stalledStorageBean.file = "i_do_not_want_to_be_deleted_but.xml" obsoleteStorageBean.file = "i_do_not_want_to_be_deleted_but.xml"
stalledStorageBean.components.addAll(listOf("loser1", "loser2", "lucky")) obsoleteStorageBean.components.addAll(listOf("loser1", "loser2", "lucky"))
PlatformTestUtil.maskExtensions(STALLED_STORAGE_EP, listOf(stalledStorageBean), disposableRule.disposable) PlatformTestUtil.maskExtensions(OBSOLETE_STORAGE_EP, listOf(obsoleteStorageBean), disposableRule.disposable)
@State(name = "loser1", storages = [(Storage(value = "i_do_not_want_to_be_deleted_but.xml"))]) @State(name = "loser1", storages = [(Storage(value = "i_do_not_want_to_be_deleted_but.xml"))])
class AOther : A() class AOther : A()
...@@ -325,8 +325,8 @@ internal class ApplicationStoreTest { ...@@ -325,8 +325,8 @@ internal class ApplicationStoreTest {
componentStore.save() componentStore.save()
// all must be saved regardless of stalledStorageBean because we have such components // all must be saved regardless of obsoleteStorageBean because we have such components
assertThat(testAppConfig.resolve(stalledStorageBean.file)).isEqualTo(""" assertThat(testAppConfig.resolve(obsoleteStorageBean.file)).isEqualTo("""
<application> <application>
<component name="loser1" foo="old" /> <component name="loser1" foo="old" />
<component name="loser2" foo="old?" /> <component name="loser2" foo="old?" />
...@@ -338,7 +338,7 @@ internal class ApplicationStoreTest { ...@@ -338,7 +338,7 @@ internal class ApplicationStoreTest {
// first looser is deleted since state equals to default (no committed component data) // first looser is deleted since state equals to default (no committed component data)
componentStore.save() componentStore.save()
assertThat(testAppConfig.resolve(stalledStorageBean.file)).isEqualTo(""" assertThat(testAppConfig.resolve(obsoleteStorageBean.file)).isEqualTo("""
<application> <application>
<component name="loser2" foo="old?" /> <component name="loser2" foo="old?" />
<component name="lucky" bar="foo" /> <component name="lucky" bar="foo" />
...@@ -349,7 +349,7 @@ internal class ApplicationStoreTest { ...@@ -349,7 +349,7 @@ internal class ApplicationStoreTest {
// second looser is deleted since state equals to default (no committed component data) // second looser is deleted since state equals to default (no committed component data)
componentStore.save() componentStore.save()
assertThat(testAppConfig.resolve(stalledStorageBean.file)).isEqualTo(""" assertThat(testAppConfig.resolve(obsoleteStorageBean.file)).isEqualTo("""
<application> <application>
<component name="lucky" bar="foo" /> <component name="lucky" bar="foo" />
</application> </application>
...@@ -358,12 +358,12 @@ internal class ApplicationStoreTest { ...@@ -358,12 +358,12 @@ internal class ApplicationStoreTest {
@Test @Test
fun `remove stalled data - keep file if another unknown component`() = runBlocking<Unit> { fun `remove stalled data - keep file if another unknown component`() = runBlocking<Unit> {
val stalledStorageBean = StalledStorageBean() val obsoleteStorageBean = ObsoleteStorageBean()
stalledStorageBean.file = "i_will_be_not_deleted.xml" obsoleteStorageBean.file = "i_will_be_not_deleted.xml"
stalledStorageBean.components.addAll(listOf("Loser")) obsoleteStorageBean.components.addAll(listOf("Loser"))
PlatformTestUtil.maskExtensions(STALLED_STORAGE_EP, listOf(stalledStorageBean), disposableRule.disposable) PlatformTestUtil.maskExtensions(OBSOLETE_STORAGE_EP, listOf(obsoleteStorageBean), disposableRule.disposable)
testAppConfig.resolve(stalledStorageBean.file).write(""" testAppConfig.resolve(obsoleteStorageBean.file).write("""
<application> <application>
<component name="Unknown" data="some data" /> <component name="Unknown" data="some data" />
<component name="Loser" foo="old?" /> <component name="Loser" foo="old?" />
...@@ -372,7 +372,7 @@ internal class ApplicationStoreTest { ...@@ -372,7 +372,7 @@ internal class ApplicationStoreTest {
componentStore.save() componentStore.save()
assertThat(testAppConfig.resolve(stalledStorageBean.file)).isEqualTo(""" assertThat(testAppConfig.resolve(obsoleteStorageBean.file)).isEqualTo("""
<application> <application>
<component name="Unknown" data="some data" /> <component name="Unknown" data="some data" />
</application> </application>
......
...@@ -182,16 +182,16 @@ internal class ProjectStoreTest { ...@@ -182,16 +182,16 @@ internal class ProjectStoreTest {
""".trimIndent()) """.trimIndent())
it.path it.path
}) { project -> }) { project ->
val stalledStorageBean = StalledStorageBean() val obsoleteStorageBean = ObsoleteStorageBean()
val storageFileName = "foo.xml" val storageFileName = "foo.xml"
stalledStorageBean.file = storageFileName obsoleteStorageBean.file = storageFileName
stalledStorageBean.components.addAll(listOf("AppLevelLoser")) obsoleteStorageBean.components.addAll(listOf("AppLevelLoser"))
val projectStalledStorageBean = StalledStorageBean() val projectStalledStorageBean = ObsoleteStorageBean()
projectStalledStorageBean.file = storageFileName projectStalledStorageBean.file = storageFileName
projectStalledStorageBean.isProjectLevel = true projectStalledStorageBean.isProjectLevel = true
projectStalledStorageBean.components.addAll(listOf("ProjectLevelLoser")) projectStalledStorageBean.components.addAll(listOf("ProjectLevelLoser"))
PlatformTestUtil.maskExtensions(STALLED_STORAGE_EP, listOf(stalledStorageBean, projectStalledStorageBean), project) PlatformTestUtil.maskExtensions(OBSOLETE_STORAGE_EP, listOf(obsoleteStorageBean, projectStalledStorageBean), project)
val componentStore = project.stateStore val componentStore = project.stateStore
...@@ -204,7 +204,7 @@ internal class ProjectStoreTest { ...@@ -204,7 +204,7 @@ internal class ProjectStoreTest {
componentStore.save() componentStore.save()
assertThat(Paths.get(project.stateStore.storageManager.expandMacros(PROJECT_CONFIG_DIR)).resolve(stalledStorageBean.file)).isEqualTo(""" assertThat(Paths.get(project.stateStore.storageManager.expandMacros(PROJECT_CONFIG_DIR)).resolve(obsoleteStorageBean.file)).isEqualTo("""
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="AppLevelLoser" foo="old?" /> <component name="AppLevelLoser" foo="old?" />
......
...@@ -348,6 +348,6 @@ ...@@ -348,6 +348,6 @@
<extensionPoint qualifiedName="com.intellij.search.traverseUiHelper" interface="com.intellij.ide.ui.search.TraverseUIHelper"/> <extensionPoint qualifiedName="com.intellij.search.traverseUiHelper" interface="com.intellij.ide.ui.search.TraverseUIHelper"/>
<extensionPoint name="stalledStorage" beanClass="com.intellij.configurationStore.StalledStorageBean"/> <extensionPoint name="obsoleteStorage" beanClass="com.intellij.configurationStore.ObsoleteStorageBean"/>
</extensionPoints> </extensionPoints>
</idea-plugin> </idea-plugin>
...@@ -600,28 +600,28 @@ ...@@ -600,28 +600,28 @@
<rawEditorTypedHandler implementationClass="com.intellij.openapi.editor.impl.EditorFactoryImpl$MyRawTypedHandler"/> <rawEditorTypedHandler implementationClass="com.intellij.openapi.editor.impl.EditorFactoryImpl$MyRawTypedHandler"/>
<stalledStorage file="statistics.toolbar.clicks.xml"> <obsoleteStorage file="statistics.toolbar.clicks.xml">
<components> <components>
<component>ToolbarClicksCollector</component> <component>ToolbarClicksCollector</component>
</components> </components>
</stalledStorage> </obsoleteStorage>
<stalledStorage file="statistics.main_menu.xml"> <obsoleteStorage file="statistics.main_menu.xml">
<components> <components>
<component>MainMenuCollector</component> <component>MainMenuCollector</component>
</components> </components>
</stalledStorage> </obsoleteStorage>
<stalledStorage file="statistics.shortcuts.xml"> <obsoleteStorage file="statistics.shortcuts.xml">
<components> <components>
<component>ShortcutsCollector</component> <component>ShortcutsCollector</component>
</components> </components>
</stalledStorage> </obsoleteStorage>
<stalledStorage file="statistics.application.usages.xml"> <obsoleteStorage file="statistics.application.usages.xml">
<components> <components>
<component>StatisticsApplicationUsages</component> <component>StatisticsApplicationUsages</component>
<component>UsageTrigger</component> <component>UsageTrigger</component>
</components> </components>
</stalledStorage> </obsoleteStorage>
<stalledStorage file="usage.statistics.xml"> <obsoleteStorage file="usage.statistics.xml">
<components> <components>
<component>StatisticsApplicationUsages</component> <component>StatisticsApplicationUsages</component>
<component>UsageTrigger</component> <component>UsageTrigger</component>
...@@ -634,18 +634,18 @@ ...@@ -634,18 +634,18 @@
<component>ActionsCollector</component> <component>ActionsCollector</component>
<component>FUSApplicationUsageTrigger</component> <component>FUSApplicationUsageTrigger</component>
</components> </components>
</stalledStorage> </obsoleteStorage>
<stalledStorage file="usage.statistics.xml" isProjectLevel="true"> <obsoleteStorage file="usage.statistics.xml" isProjectLevel="true">
<components> <components>
<component>FUSProjectUsageTrigger</component> <component>FUSProjectUsageTrigger</component>
</components> </components>
</stalledStorage> </obsoleteStorage>
<stalledStorage file="workspace.xml" isProjectLevel="true"> <obsoleteStorage file="workspace.xml" isProjectLevel="true">
<components> <components>
<component>FUSProjectUsageTrigger</component> <component>FUSProjectUsageTrigger</component>
</components> </components>
</stalledStorage> </obsoleteStorage>
<postStartupActivity implementation="com.intellij.ide.StartUpPerformanceReporter" order="last"/> <postStartupActivity implementation="com.intellij.ide.StartUpPerformanceReporter" order="last"/>
</extensions> </extensions>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment