deprecate ExportableComponent

This commit is contained in:
Vladimir Krivosheev
2016-11-03 17:03:14 +01:00
parent ae70b17774
commit 2fba7f1d89
7 changed files with 23 additions and 61 deletions
@@ -15,38 +15,13 @@
*/
package com.intellij.codeInsight.folding.impl;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.ExportableComponent;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.NotNull;
import java.io.File;
@State(
name="JavaCodeFoldingSettings",
storages= {
@Storage("editor.codeinsight.xml")}
)
public class JavaCodeFoldingSettingsImpl extends JavaCodeFoldingSettingsBase implements PersistentStateComponent<JavaCodeFoldingSettingsImpl>,
ExportableComponent {
@Override
@NotNull
public File[] getExportFiles() {
return new File[]{PathManager.getOptionsFile("editor.codeinsight")};
}
@Override
@NotNull
public String getPresentableName() {
return IdeBundle.message("code.folding.settings");
}
@State(name = "JavaCodeFoldingSettings", storages = @Storage("editor.codeinsight.xml"))
public class JavaCodeFoldingSettingsImpl extends JavaCodeFoldingSettingsBase implements PersistentStateComponent<JavaCodeFoldingSettingsImpl> {
@Override
public JavaCodeFoldingSettingsImpl getState() {
return this;
@@ -128,16 +128,16 @@ internal class ApplicationStoreTest {
assertThat(map).isNotEmpty
fun test(item: ExportableItem) {
val file = item.files.first()
val file = item.file
assertThat(map.get(file)).containsExactly(item)
assertThat(file).doesNotExist()
}
test(ExportableItem(listOf(Paths.get(optionsPath, "filetypes.xml")), "File types", RoamingType.DEFAULT))
test(ExportableItem(listOf(Paths.get(rootConfigPath, "filetypes")), "File types", RoamingType.DEFAULT))
test(ExportableItem(listOf(Paths.get(optionsPath, "customization.xml")), "Menus and toolbars customization", RoamingType.DEFAULT))
test(ExportableItem(listOf(Paths.get(optionsPath, "templates.xml")), "Live templates", RoamingType.DEFAULT))
test(ExportableItem(listOf(Paths.get(rootConfigPath, "templates")), "Live templates", RoamingType.DEFAULT))
test(ExportableItem(Paths.get(optionsPath, "filetypes.xml"), "File types", RoamingType.DEFAULT))
test(ExportableItem(Paths.get(rootConfigPath, "filetypes"), "File types", RoamingType.DEFAULT))
test(ExportableItem(Paths.get(optionsPath, "customization.xml"), "Menus and toolbars customization", RoamingType.DEFAULT))
test(ExportableItem(Paths.get(optionsPath, "templates.xml"), "Live templates", RoamingType.DEFAULT))
test(ExportableItem(Paths.get(rootConfigPath, "templates"), "Live templates", RoamingType.DEFAULT))
}
@Test fun `import settings`() {
@@ -175,7 +175,7 @@ internal class ApplicationStoreTest {
val componentKey = A::class.java.name
picoContainer.registerComponent(InstanceComponentAdapter(componentKey, component))
try {
assertThat(getExportableComponentsMap(false, false, storageManager, relativePaths)).containsOnly(componentFile.to(listOf(ExportableItem(listOf(componentFile), ""))), additionalFile.to(listOf(ExportableItem(listOf(additionalFile), ""))))
assertThat(getExportableComponentsMap(false, false, storageManager, relativePaths)).containsOnly(componentFile.to(listOf(ExportableItem(componentFile, ""))), additionalFile.to(listOf(ExportableItem(additionalFile, ""))))
}
finally {
picoContainer.unregisterComponent(componentKey)
@@ -15,5 +15,6 @@
*/
package com.intellij.openapi.components;
@Deprecated
public interface ExportableApplicationComponent extends ApplicationComponent, ExportableComponent {
}
@@ -20,9 +20,7 @@ import org.jetbrains.annotations.NotNull;
import java.io.File;
/**
* @author yole
*/
@Deprecated
public interface ExportableComponent {
ExtensionPointName<ServiceBean> EXTENSION_POINT = new ExtensionPointName<ServiceBean>("com.intellij.exportable");
@@ -19,8 +19,10 @@ import com.intellij.codeInsight.template.impl.TemplateSettings;
import com.intellij.codeInsight.template.postfix.templates.PostfixTemplate;
import com.intellij.codeInsight.template.postfix.templates.PostfixTemplateProvider;
import com.intellij.codeInsight.template.postfix.templates.PostfixTemplatesUtils;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.*;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.util.Factory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
@@ -30,12 +32,11 @@ import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.Map;
import java.util.Set;
@State(name = "PostfixTemplatesSettings", storages = @Storage("postfixTemplates.xml"))
public class PostfixTemplatesSettings implements PersistentStateComponent<Element>, ExportableComponent {
public class PostfixTemplatesSettings implements PersistentStateComponent<Element> {
public static final Factory<Set<String>> SET_FACTORY = () -> ContainerUtil.newHashSet();
private Map<String, Set<String>> myLangToDisabledTemplates = ContainerUtil.newHashMap();
@@ -136,16 +137,4 @@ public class PostfixTemplatesSettings implements PersistentStateComponent<Elemen
myTemplatesState.clear();
}
}
@NotNull
@Override
public File[] getExportFiles() {
return new File[]{PathManager.getOptionsFile("postfixCompletion.xml")};
}
@NotNull
@Override
public String getPresentableName() {
return "Postfix Completion";
}
}
@@ -25,14 +25,14 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.DefaultActionGroup
import com.intellij.openapi.actionSystem.impl.BundledQuickListsProvider
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.ExportableApplicationComponent
import com.intellij.openapi.components.ApplicationComponent
import com.intellij.openapi.options.SchemeManager
import com.intellij.openapi.options.SchemeManagerFactory
import com.intellij.openapi.project.Project
import gnu.trove.THashSet
import java.util.function.Function
class QuickListsManager(private val myActionManager: ActionManager, schemeManagerFactory: SchemeManagerFactory) : ExportableApplicationComponent {
class QuickListsManager(private val myActionManager: ActionManager, schemeManagerFactory: SchemeManagerFactory) : ApplicationComponent {
private val mySchemeManager: SchemeManager<QuickList>
init {
@@ -47,7 +47,7 @@ class QuickListsManager(private val myActionManager: ActionManager, schemeManage
dataHolder.updateDigest(item)
return item
}
})
}, presentableName = IdeBundle.message("quick.lists.presentable.name"))
}
companion object {
@@ -56,10 +56,6 @@ class QuickListsManager(private val myActionManager: ActionManager, schemeManage
get() = ApplicationManager.getApplication().getComponent(QuickListsManager::class.java)
}
override fun getExportFiles() = arrayOf(mySchemeManager.rootDirectory)
override fun getPresentableName() = IdeBundle.message("quick.lists.presentable.name")!!
override fun getComponentName() = "QuickListsManager"
override fun initComponent() {
@@ -356,4 +356,7 @@ exportable.com.intellij.ide.ui.customization.CustomActionsSchema.presentable.nam
exportable.ActionMacroManager.presentable.name=Macros
exportable.ImportFilteringUsageViewSetting.presentable.name=Usage View: Imports
exportable.XPathView.XPathViewPlugin.presentable.name=XPath Viewer
exportable.ExternalResourceManagerImpl.presentable.name=Java EE External Resources
exportable.ExternalResourceManagerImpl.presentable.name=Java EE External Resources
exportable.JavaCodeFoldingSettings.presentable.name=Code Folding Settings
exportable.RubyI18nFoldingSettings.presentable.name=Code Folding Settings
exportable.PostfixTemplatesSettings.presentable.name=Postfix Completion