diff --git a/images/src/org/intellij/images/options/impl/OptionsManagerImpl.java b/images/src/org/intellij/images/options/impl/OptionsManagerImpl.java index 146655408931..2383387e96e8 100644 --- a/images/src/org/intellij/images/options/impl/OptionsManagerImpl.java +++ b/images/src/org/intellij/images/options/impl/OptionsManagerImpl.java @@ -15,7 +15,10 @@ */ package org.intellij.images.options.impl; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.RoamingType; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.WriteExternalException; import org.intellij.images.options.Options; @@ -29,7 +32,7 @@ import org.jdom.Element; */ @State( name = "Images.OptionsManager", - storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/images.support.xml", roamingType = RoamingType.DISABLED)} + storages = @Storage(value = "images.support.xml", roamingType = RoamingType.DISABLED) ) final class OptionsManagerImpl extends OptionsManager implements PersistentStateComponent { private final OptionsImpl options = new OptionsImpl(); diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java index 95f6a84510d8..9e9b36e9c351 100644 --- a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java @@ -33,7 +33,10 @@ import com.intellij.openapi.compiler.CompilerManager; import com.intellij.openapi.compiler.options.ExcludeEntryDescription; import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration; import com.intellij.openapi.compiler.options.ExcludesConfiguration; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.ProjectComponent; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.fileTypes.FileType; @@ -71,13 +74,7 @@ import org.jetbrains.jps.model.serialization.java.compiler.JpsJavaCompilerConfig import java.io.File; import java.util.*; -@State( - name = "CompilerConfiguration", - storages = { - @Storage(file = StoragePathMacros.PROJECT_FILE), - @Storage(file = "compiler.xml", scheme = StorageScheme.DIRECTORY_BASED) - } -) +@State(name = "CompilerConfiguration", storages = @Storage("compiler.xml")) public class CompilerConfigurationImpl extends CompilerConfiguration implements PersistentStateComponent, ProjectComponent { private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.CompilerConfiguration"); public static final String TESTS_EXTERNAL_COMPILER_HOME_PROPERTY_NAME = "tests.external.compiler.home"; diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerConfiguration.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerConfiguration.java index 977b769e1e6b..ae9847983c98 100755 --- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerConfiguration.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -15,19 +15,16 @@ */ package com.intellij.compiler.impl.javaCompiler.eclipse; -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.project.Project; import com.intellij.util.xmlb.XmlSerializerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.jps.model.java.compiler.EclipseCompilerOptions; -@State( - name = "EclipseCompilerSettings", - storages = { - @Storage(file = StoragePathMacros.PROJECT_FILE), - @Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/compiler.xml", scheme = StorageScheme.DIRECTORY_BASED) - } -) +@State(name = "EclipseCompilerSettings", storages = @Storage("compiler.xml")) public class EclipseCompilerConfiguration implements PersistentStateComponent { private final EclipseCompilerOptions mySettings = new EclipseCompilerOptions(); diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacConfiguration.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacConfiguration.java index ed3c49761da3..5978236c671d 100755 --- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacConfiguration.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -21,13 +21,7 @@ import com.intellij.util.xmlb.XmlSerializerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions; -@State( - name = "JavacSettings", - storages = { - @Storage(file = StoragePathMacros.PROJECT_FILE), - @Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/compiler.xml", scheme = StorageScheme.DIRECTORY_BASED) - } -) +@State(name = "JavacSettings", storages = @Storage("compiler.xml")) public class JavacConfiguration implements PersistentStateComponent { private final JpsJavaCompilerOptions mySettings = new JpsJavaCompilerOptions(); private final Project myProject; diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicConfiguration.java b/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicConfiguration.java index f24546f4ea3f..efc51a80e4f6 100755 --- a/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicConfiguration.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -15,19 +15,16 @@ */ package com.intellij.compiler.impl.rmiCompiler; -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.project.Project; import com.intellij.util.xmlb.XmlSerializerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.jps.model.java.compiler.RmicCompilerOptions; -@State( - name = "RmicSettings", - storages = { - @Storage(file = StoragePathMacros.PROJECT_FILE), - @Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/compiler.xml", scheme = StorageScheme.DIRECTORY_BASED) - } -) +@State(name = "RmicSettings", storages = @Storage("compiler.xml")) public class RmicConfiguration implements PersistentStateComponent { private final RmicCompilerOptions mySettings = new RmicCompilerOptions(); diff --git a/java/compiler/impl/src/com/intellij/compiler/options/ValidationConfiguration.java b/java/compiler/impl/src/com/intellij/compiler/options/ValidationConfiguration.java index 31c614e9088d..f208f7de40ee 100644 --- a/java/compiler/impl/src/com/intellij/compiler/options/ValidationConfiguration.java +++ b/java/compiler/impl/src/com/intellij/compiler/options/ValidationConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -19,7 +19,10 @@ import com.intellij.openapi.compiler.CompileContext; import com.intellij.openapi.compiler.Compiler; import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration; import com.intellij.openapi.compiler.options.ExcludesConfiguration; -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.project.Project; import com.intellij.util.xmlb.XmlSerializerUtil; @@ -29,13 +32,7 @@ import java.util.Map; /** * @author Dmitry Avdeev */ -@State( - name = "ValidationConfiguration", - storages = { - @Storage(file = StoragePathMacros.WORKSPACE_FILE), - @Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/validation.xml", scheme = StorageScheme.DIRECTORY_BASED) - } -) +@State(name = "ValidationConfiguration", storages = @Storage("validation.xml")) public class ValidationConfiguration implements PersistentStateComponent { public boolean VALIDATE_ON_BUILD = false; @@ -79,12 +76,6 @@ public class ValidationConfiguration implements PersistentStateComponent { private static final Logger LOG = Logger.getInstance("#com.intellij.packaging.impl.artifacts.ArtifactManagerImpl"); @NonNls public static final String COMPONENT_NAME = "ArtifactManager"; diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsWorkspaceSettings.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsWorkspaceSettings.java index 900a593ed7e0..cd03fdb7da82 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsWorkspaceSettings.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsWorkspaceSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -16,7 +16,6 @@ package com.intellij.packaging.impl.compiler; import com.intellij.openapi.components.*; -import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.project.Project; import com.intellij.packaging.artifacts.Artifact; import com.intellij.packaging.artifacts.ArtifactManager; @@ -35,7 +34,7 @@ import java.util.List; */ @State(name = "ArtifactsWorkspaceSettings", storages = { - @Storage(file = StoragePathMacros.WORKSPACE_FILE) + @Storage(StoragePathMacros.WORKSPACE_FILE) }) public class ArtifactsWorkspaceSettings implements PersistentStateComponent { private ArtifactsWorkspaceSettingsState myState = new ArtifactsWorkspaceSettingsState(); diff --git a/java/compiler/openapi/src/com/intellij/compiler/CompilerWorkspaceConfiguration.java b/java/compiler/openapi/src/com/intellij/compiler/CompilerWorkspaceConfiguration.java index 27831b7043b2..ac62b1a2dbc0 100644 --- a/java/compiler/openapi/src/com/intellij/compiler/CompilerWorkspaceConfiguration.java +++ b/java/compiler/openapi/src/com/intellij/compiler/CompilerWorkspaceConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -25,13 +25,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.registry.Registry; import com.intellij.util.xmlb.XmlSerializerUtil; -@State( - name = "CompilerWorkspaceConfiguration", - storages = { - @Storage( - file = StoragePathMacros.WORKSPACE_FILE - )} -) +@State(name = "CompilerWorkspaceConfiguration", storages = @Storage(StoragePathMacros.WORKSPACE_FILE)) public class CompilerWorkspaceConfiguration implements PersistentStateComponent { private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.CompilerWorkspaceConfiguration"); diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java index 76521190e468..b9c8da73b787 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -66,7 +66,7 @@ import java.io.File; import java.util.*; import java.util.jar.Attributes; -@State(name = "DebuggerManager", storages = {@Storage(file = StoragePathMacros.WORKSPACE_FILE)}) +@State(name = "DebuggerManager", storages = {@Storage(StoragePathMacros.WORKSPACE_FILE)}) public class DebuggerManagerImpl extends DebuggerManagerEx implements PersistentStateComponent { private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.impl.DebuggerManagerImpl"); diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java index 23c51bf3eb97..18b7eb6f25e2 100644 --- a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java +++ b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java @@ -40,8 +40,8 @@ import java.util.Map; name = "DebuggerSettings", defaultStateAsResource = true, storages = { - @Storage(file = "debugger.xml"), - @Storage(file = "other.xml", deprecated = true) + @Storage("debugger.xml"), + @Storage(value = "other.xml", deprecated = true) } ) public class DebuggerSettings implements Cloneable, PersistentStateComponent { diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/NodeRendererSettings.java b/java/debugger/impl/src/com/intellij/debugger/settings/NodeRendererSettings.java index 441fb5448970..073871026ee1 100644 --- a/java/debugger/impl/src/com/intellij/debugger/settings/NodeRendererSettings.java +++ b/java/debugger/impl/src/com/intellij/debugger/settings/NodeRendererSettings.java @@ -28,7 +28,10 @@ import com.intellij.debugger.ui.tree.DebuggerTreeNode; import com.intellij.debugger.ui.tree.ValueDescriptor; import com.intellij.debugger.ui.tree.render.*; import com.intellij.debugger.ui.tree.render.Renderer; -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.fileTypes.StdFileTypes; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.*; @@ -57,9 +60,7 @@ import java.util.List; @State( name="NodeRendererSettings", storages= { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/debugger.renderers.xml" - )} + @Storage("debugger.renderers.xml")} ) public class NodeRendererSettings implements PersistentStateComponent { @NonNls private static final String REFERENCE_RENDERER = "Reference renderer"; diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/ThreadsViewSettings.java b/java/debugger/impl/src/com/intellij/debugger/settings/ThreadsViewSettings.java index af35bf423aac..ef5cc20b9826 100644 --- a/java/debugger/impl/src/com/intellij/debugger/settings/ThreadsViewSettings.java +++ b/java/debugger/impl/src/com/intellij/debugger/settings/ThreadsViewSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -15,15 +15,16 @@ */ package com.intellij.debugger.settings; -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.util.xmlb.XmlSerializerUtil; @State( name="ThreadsViewSettings", storages= { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/debugger.threadsview.xml" - )} + @Storage("debugger.threadsview.xml")} ) public class ThreadsViewSettings implements PersistentStateComponent { public boolean SHOW_THREAD_GROUPS = false; diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/ViewsGeneralSettings.java b/java/debugger/impl/src/com/intellij/debugger/settings/ViewsGeneralSettings.java index ceeda9125a65..d8d4c1c668f9 100644 --- a/java/debugger/impl/src/com/intellij/debugger/settings/ViewsGeneralSettings.java +++ b/java/debugger/impl/src/com/intellij/debugger/settings/ViewsGeneralSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -15,12 +15,15 @@ */ package com.intellij.debugger.settings; -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.util.xmlb.XmlSerializerUtil; @State( name = "ViewsSettings", - storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/debugger.frameview.xml") + storages = @Storage("debugger.frameview.xml") ) public class ViewsGeneralSettings implements PersistentStateComponent { public boolean SHOW_OBJECTID = true; diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/FacetEditorsStateManagerImpl.java b/java/idea-ui/src/com/intellij/facet/impl/ui/FacetEditorsStateManagerImpl.java index 091c2df0e910..61020f8dd4ef 100644 --- a/java/idea-ui/src/com/intellij/facet/impl/ui/FacetEditorsStateManagerImpl.java +++ b/java/idea-ui/src/com/intellij/facet/impl/ui/FacetEditorsStateManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -34,14 +34,7 @@ import java.util.Map; /** * @author nik */ -@State( - name = "FacetEditorsStateManager", - storages = { - @Storage( - file = StoragePathMacros.WORKSPACE_FILE - ) - } -) +@State(name = "FacetEditorsStateManager", storages = @Storage(StoragePathMacros.WORKSPACE_FILE)) public class FacetEditorsStateManagerImpl extends FacetEditorsStateManager implements PersistentStateComponent{ private final Map myFacetTypeStates = new HashMap(); private FacetEditorsStateBean myBean = new FacetEditorsStateBean(); diff --git a/java/idea-ui/src/com/intellij/ide/RecentProjectsManagerImpl.java b/java/idea-ui/src/com/intellij/ide/RecentProjectsManagerImpl.java index 4f69a13853ec..afb691615298 100644 --- a/java/idea-ui/src/com/intellij/ide/RecentProjectsManagerImpl.java +++ b/java/idea-ui/src/com/intellij/ide/RecentProjectsManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -19,7 +19,6 @@ import com.intellij.ide.impl.ProjectUtil; import com.intellij.openapi.components.RoamingType; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; -import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.project.Project; import com.intellij.util.messages.MessageBus; import org.jetbrains.annotations.NotNull; @@ -27,8 +26,8 @@ import org.jetbrains.annotations.NotNull; @State( name = "RecentProjectsManager", storages = { - @Storage(file = StoragePathMacros.APP_CONFIG + "/recentProjects.xml", roamingType = RoamingType.DISABLED), - @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml", deprecated = true) + @Storage(value = "recentProjects.xml", roamingType = RoamingType.DISABLED), + @Storage(value = "other.xml", deprecated = true) } ) public class RecentProjectsManagerImpl extends RecentProjectsManagerBase { diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SelectTemplateSettings.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SelectTemplateSettings.java index 414fca47790b..72b7d70294b9 100644 --- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SelectTemplateSettings.java +++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SelectTemplateSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable; */ @State( name = "SelectProjectTemplateSettings", - storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/projectSelectTemplate.xml", roamingType = RoamingType.DISABLED) + storages = @Storage(value = "projectSelectTemplate.xml", roamingType = RoamingType.DISABLED) ) public class SelectTemplateSettings implements PersistentStateComponent { public boolean EXPERT_MODE = false; diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/dependencyAnalysis/AnalyzeDependenciesSettings.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/dependencyAnalysis/AnalyzeDependenciesSettings.java index b652960fd369..5fe757b1e200 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/dependencyAnalysis/AnalyzeDependenciesSettings.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/dependencyAnalysis/AnalyzeDependenciesSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -16,16 +16,12 @@ package com.intellij.openapi.roots.ui.configuration.dependencyAnalysis; import com.intellij.openapi.components.*; -import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.project.Project; /** * The default mode for classpath details settings */ -@State( - name = "AnalyzeDependenciesSettings", - storages = {@Storage( - file = StoragePathMacros.WORKSPACE_FILE)}) +@State(name = "AnalyzeDependenciesSettings", storages = @Storage(StoragePathMacros.WORKSPACE_FILE)) public class AnalyzeDependenciesSettings implements PersistentStateComponent { /** * The current state diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/GlobalProjectStructureProblemsSettings.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/GlobalProjectStructureProblemsSettings.java index 373723cb3742..533670c69e13 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/GlobalProjectStructureProblemsSettings.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/GlobalProjectStructureProblemsSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -17,14 +17,10 @@ package com.intellij.openapi.roots.ui.configuration.projectRoot.daemon; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; -import com.intellij.openapi.components.StoragePathMacros; /** * @author nik */ -@State( - name = "ProjectStructureProblems", - storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/projectStructureProblems.xml")} -) +@State(name = "ProjectStructureProblems", storages = @Storage("projectStructureProblems.xml")) public class GlobalProjectStructureProblemsSettings extends ProjectStructureProblemsSettingsBase { } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/ProjectStructureProblemsSettingsImpl.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/ProjectStructureProblemsSettingsImpl.java index 6cb37e056fee..e9d347f6f2ce 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/ProjectStructureProblemsSettingsImpl.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/ProjectStructureProblemsSettingsImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -24,7 +24,7 @@ import com.intellij.openapi.components.StoragePathMacros; */ @State( name = "ProjectStructureProblems", - storages = {@Storage(file = StoragePathMacros.WORKSPACE_FILE)} + storages = {@Storage(StoragePathMacros.WORKSPACE_FILE)} ) public class ProjectStructureProblemsSettingsImpl extends ProjectStructureProblemsSettingsBase { } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java index 9539d2d598ab..064f7276d475 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -20,7 +20,9 @@ import com.intellij.codeInsight.AnnotationUtil; import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer; import com.intellij.codeInspection.reference.*; import com.intellij.openapi.application.ApplicationManager; -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.extensions.ExtensionPoint; import com.intellij.openapi.extensions.ExtensionPointListener; import com.intellij.openapi.extensions.Extensions; @@ -44,10 +46,7 @@ import org.jetbrains.annotations.Nullable; import java.util.*; -@State( - name = "EntryPointsManager", - storages = {@Storage(file = StoragePathMacros.PROJECT_FILE)} -) +@State(name = "EntryPointsManager") public abstract class EntryPointsManagerBase extends EntryPointsManager implements PersistentStateComponent { @NonNls private static final String[] STANDARD_ANNOS = { "javax.ws.rs.*", diff --git a/java/java-analysis-impl/src/org/jetbrains/java/generate/GenerateToStringContext.java b/java/java-analysis-impl/src/org/jetbrains/java/generate/GenerateToStringContext.java index 9a433929e681..87851c067702 100644 --- a/java/java-analysis-impl/src/org/jetbrains/java/generate/GenerateToStringContext.java +++ b/java/java-analysis-impl/src/org/jetbrains/java/generate/GenerateToStringContext.java @@ -15,19 +15,16 @@ */ package org.jetbrains.java.generate; -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 org.jetbrains.java.generate.config.Config; /** * Application context for this plugin. */ -@State( - name = "ToStringSettings", - storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/other.xml" - )} -) +@State(name = "ToStringSettings", storages = @Storage("other.xml")) public class GenerateToStringContext implements PersistentStateComponent { public static GenerateToStringContext getInstance() { return ServiceManager.getService(GenerateToStringContext.class); diff --git a/java/java-impl/src/com/intellij/codeInsight/JavaProjectCodeInsightSettings.java b/java/java-impl/src/com/intellij/codeInsight/JavaProjectCodeInsightSettings.java index cab9767a1323..94a51a4747d3 100644 --- a/java/java-impl/src/com/intellij/codeInsight/JavaProjectCodeInsightSettings.java +++ b/java/java-impl/src/com/intellij/codeInsight/JavaProjectCodeInsightSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -16,7 +16,10 @@ package com.intellij.codeInsight; import com.intellij.openapi.Disposable; -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.project.Project; import com.intellij.openapi.util.Disposer; import com.intellij.util.containers.ContainerUtil; @@ -33,13 +36,7 @@ import java.util.List; /** * @author peter */ -@State( - name = "JavaProjectCodeInsightSettings", - storages = { - @Storage(file = StoragePathMacros.PROJECT_FILE), - @Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/codeInsightSettings.xml", scheme = StorageScheme.DIRECTORY_BASED) - } -) +@State(name = "JavaProjectCodeInsightSettings", storages = @Storage("codeInsightSettings.xml")) public class JavaProjectCodeInsightSettings implements PersistentStateComponent { @Tag("excluded-names") @AbstractCollection(surroundWithTag = false, elementTag = "name", elementValueAttribute = "") diff --git a/java/java-impl/src/com/intellij/codeInsight/NullableNotNullManagerImpl.java b/java/java-impl/src/com/intellij/codeInsight/NullableNotNullManagerImpl.java index adb18e11b682..87016a182efa 100644 --- a/java/java-impl/src/com/intellij/codeInsight/NullableNotNullManagerImpl.java +++ b/java/java-impl/src/com/intellij/codeInsight/NullableNotNullManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -17,14 +17,9 @@ package com.intellij.codeInsight; import com.intellij.codeInspection.dataFlow.HardcodedContracts; import com.intellij.openapi.components.State; -import com.intellij.openapi.components.Storage; -import com.intellij.openapi.components.StoragePathMacros; import com.intellij.psi.PsiElement; -@State( - name = "NullableNotNullManager", - storages = {@Storage(file = StoragePathMacros.PROJECT_FILE)} -) +@State(name = "NullableNotNullManager") public class NullableNotNullManagerImpl extends NullableNotNullManager { protected boolean hasHardcodedContracts(PsiElement element) { return HardcodedContracts.hasHardcodedContracts(element); diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaCodeFoldingSettingsImpl.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaCodeFoldingSettingsImpl.java index 205391007219..b17508711d3b 100644 --- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaCodeFoldingSettingsImpl.java +++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaCodeFoldingSettingsImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -17,7 +17,10 @@ package com.intellij.codeInsight.folding.impl; import com.intellij.ide.IdeBundle; import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.components.*; +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; @@ -26,9 +29,7 @@ import java.io.File; @State( name="JavaCodeFoldingSettings", storages= { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/editor.codeinsight.xml" - )} + @Storage("editor.codeinsight.xml")} ) public class JavaCodeFoldingSettingsImpl extends JavaCodeFoldingSettingsBase implements PersistentStateComponent, ExportableComponent { diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/EqualsHashCodeTemplatesManager.java b/java/java-impl/src/com/intellij/codeInsight/generation/EqualsHashCodeTemplatesManager.java index 71f1046c5f08..802f73f223de 100644 --- a/java/java-impl/src/com/intellij/codeInsight/generation/EqualsHashCodeTemplatesManager.java +++ b/java/java-impl/src/com/intellij/codeInsight/generation/EqualsHashCodeTemplatesManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -18,7 +18,6 @@ package com.intellij.codeInsight.generation; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; -import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.util.Couple; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.containers.ContainerUtil; @@ -33,13 +32,7 @@ import java.util.Collection; import java.util.LinkedHashMap; import java.util.Set; -@State( - name = "EqualsHashCodeTemplates", - storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/equalsHashCodeTemplates.xml" - )} -) +@State(name = "EqualsHashCodeTemplates", storages = @Storage("equalsHashCodeTemplates.xml")) public class EqualsHashCodeTemplatesManager extends TemplatesManager { private static final String DEFAULT_EQUALS = "/com/intellij/codeInsight/generation/defaultEquals.vm"; private static final String DEFAULT_HASH_CODE = "/com/intellij/codeInsight/generation/defaultHashCode.vm"; diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GetterTemplatesManager.java b/java/java-impl/src/com/intellij/codeInsight/generation/GetterTemplatesManager.java index d7c8d645ea87..8640d5aad428 100644 --- a/java/java-impl/src/com/intellij/codeInsight/generation/GetterTemplatesManager.java +++ b/java/java-impl/src/com/intellij/codeInsight/generation/GetterTemplatesManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -18,20 +18,13 @@ package com.intellij.codeInsight.generation; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; -import com.intellij.openapi.components.StoragePathMacros; import org.jetbrains.java.generate.exception.TemplateResourceException; import org.jetbrains.java.generate.template.TemplateResource; import org.jetbrains.java.generate.template.TemplatesManager; import java.io.IOException; -@State( - name = "GetterTemplates", - storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/getterTemplates.xml" - )} -) +@State(name = "GetterTemplates", storages = @Storage("getterTemplates.xml")) public class GetterTemplatesManager extends TemplatesManager { private static final String DEFAULT = "defaultGetter.vm"; diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/SetterTemplatesManager.java b/java/java-impl/src/com/intellij/codeInsight/generation/SetterTemplatesManager.java index 8c474d500ac3..fd962880e763 100644 --- a/java/java-impl/src/com/intellij/codeInsight/generation/SetterTemplatesManager.java +++ b/java/java-impl/src/com/intellij/codeInsight/generation/SetterTemplatesManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -18,20 +18,13 @@ package com.intellij.codeInsight.generation; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; -import com.intellij.openapi.components.StoragePathMacros; import org.jetbrains.java.generate.exception.TemplateResourceException; import org.jetbrains.java.generate.template.TemplateResource; import org.jetbrains.java.generate.template.TemplatesManager; import java.io.IOException; -@State( - name = "SetterTemplates", - storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/setterTemplates.xml" - )} -) +@State(name = "SetterTemplates", storages = @Storage("setterTemplates.xml")) public class SetterTemplatesManager extends TemplatesManager { private static final String DEFAULT = "defaultSetter.vm"; private static final String BUILDER = "builderSetter.vm"; diff --git a/java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerImpl.java b/java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerImpl.java index f338282881fb..f80a4ff7cdca 100644 --- a/java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerImpl.java +++ b/java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -26,7 +26,8 @@ package com.intellij.codeInspection.ex; import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer; import com.intellij.codeInspection.util.SpecialAnnotationsUtil; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.State; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectUtil; import com.intellij.openapi.ui.DialogWrapper; @@ -38,10 +39,7 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; -@State( - name = "EntryPointsManager", - storages = {@Storage(file = StoragePathMacros.PROJECT_FILE)} -) +@State(name = "EntryPointsManager") public class EntryPointsManagerImpl extends EntryPointsManagerBase implements PersistentStateComponent { public EntryPointsManagerImpl(Project project) { super(project); diff --git a/java/java-impl/src/com/intellij/javadoc/JavadocGenerationManager.java b/java/java-impl/src/com/intellij/javadoc/JavadocGenerationManager.java index b1a5ef4984ef..7dbd51d06036 100644 --- a/java/java-impl/src/com/intellij/javadoc/JavadocGenerationManager.java +++ b/java/java-impl/src/com/intellij/javadoc/JavadocGenerationManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -21,7 +21,9 @@ import com.intellij.execution.ExecutionException; import com.intellij.execution.executors.DefaultRunExecutor; import com.intellij.execution.runners.ExecutionEnvironmentBuilder; import com.intellij.execution.util.ExecutionErrorDialog; -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.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.InvalidDataException; @@ -29,13 +31,7 @@ import com.intellij.openapi.util.WriteExternalException; import org.jdom.Element; import org.jetbrains.annotations.NotNull; -@State(name = "JavadocGenerationManager", - storages = { - @Storage( - file = StoragePathMacros.PROJECT_FILE - ) - } -) +@State(name = "JavadocGenerationManager") public final class JavadocGenerationManager implements PersistentStateComponent { private static final Logger LOG = Logger.getInstance("#com.intellij.javadoc.JavadocGenerationManager"); private final JavadocConfiguration myConfiguration; diff --git a/java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java b/java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java index 7453c329b0d0..2e27afaeec6c 100644 --- a/java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java +++ b/java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -15,16 +15,13 @@ */ package com.intellij.refactoring; -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.util.xmlb.XmlSerializerUtil; -@State( - name = "RefactoringSettings", - storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/other.xml" - )} -) +@State(name = "RefactoringSettings", storages = @Storage("other.xml")) public class JavaRefactoringSettings implements PersistentStateComponent { // properties should be public in order to get saved by DefaultExternalizable implementation diff --git a/platform/analysis-api/src/com/intellij/psi/search/scope/packageSet/NamedScopeManager.java b/platform/analysis-api/src/com/intellij/psi/search/scope/packageSet/NamedScopeManager.java index 3d94737276aa..2435419179ba 100644 --- a/platform/analysis-api/src/com/intellij/psi/search/scope/packageSet/NamedScopeManager.java +++ b/platform/analysis-api/src/com/intellij/psi/search/scope/packageSet/NamedScopeManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -32,10 +32,7 @@ import javax.swing.*; import java.util.ArrayList; import java.util.List; -@State( - name = "NamedScopeManager", - storages = @Storage(file = StoragePathMacros.WORKSPACE_FILE) -) +@State(name = "NamedScopeManager", storages = @Storage(StoragePathMacros.WORKSPACE_FILE)) public class NamedScopeManager extends NamedScopesHolder { public OrderState myOrderState = new OrderState(); diff --git a/platform/analysis-impl/src/com/intellij/packageDependencies/DependencyValidationManagerImpl.java b/platform/analysis-impl/src/com/intellij/packageDependencies/DependencyValidationManagerImpl.java index b27bae4e0576..8afce66d50a9 100644 --- a/platform/analysis-impl/src/com/intellij/packageDependencies/DependencyValidationManagerImpl.java +++ b/platform/analysis-impl/src/com/intellij/packageDependencies/DependencyValidationManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -17,7 +17,9 @@ package com.intellij.packageDependencies; import com.intellij.icons.AllIcons; import com.intellij.ide.IdeBundle; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.MainConfigurationStateSplitter; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.NotNullLazyValue; @@ -38,10 +40,7 @@ import java.util.*; @State( name = "DependencyValidationManager", - storages = { - @Storage(file = StoragePathMacros.PROJECT_FILE), - @Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/scopes", scheme = StorageScheme.DIRECTORY_BASED, - stateSplitter = DependencyValidationManagerImpl.ScopesStateSplitter.class)} + storages = @Storage(value = "scopes", stateSplitter = DependencyValidationManagerImpl.ScopesStateSplitter.class) ) public class DependencyValidationManagerImpl extends DependencyValidationManager { private static final NotNullLazyValue ourSharedScopeIcon = new NotNullLazyValue() { diff --git a/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManagerImpl.java b/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManagerImpl.java index c64f5c77ac8c..f1d90ce1417a 100644 --- a/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManagerImpl.java +++ b/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -23,8 +23,6 @@ import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; -import com.intellij.openapi.components.StoragePathMacros; -import com.intellij.openapi.components.StorageScheme; import com.intellij.openapi.project.DumbAwareRunnable; import com.intellij.openapi.project.Project; import com.intellij.openapi.startup.StartupManager; @@ -50,10 +48,7 @@ import java.util.concurrent.ConcurrentHashMap; */ @State( name = "InspectionProjectProfileManager", - storages = { - @Storage(file = StoragePathMacros.PROJECT_FILE), - @Storage(file = "inspectionProfiles", scheme = StorageScheme.DIRECTORY_BASED, stateSplitter = DefaultProjectProfileManager.ProfileStateSplitter.class) - } + storages = @Storage(value = "inspectionProfiles", stateSplitter = DefaultProjectProfileManager.ProfileStateSplitter.class) ) public class InspectionProjectProfileManagerImpl extends InspectionProjectProfileManager { private final Map myName2Profile = new ConcurrentHashMap(); diff --git a/platform/built-in-server/src/org/jetbrains/builtInWebServer/BuiltInServerOptions.java b/platform/built-in-server/src/org/jetbrains/builtInWebServer/BuiltInServerOptions.java index b2098feaf923..7f3fcc7811ab 100644 --- a/platform/built-in-server/src/org/jetbrains/builtInWebServer/BuiltInServerOptions.java +++ b/platform/built-in-server/src/org/jetbrains/builtInWebServer/BuiltInServerOptions.java @@ -2,7 +2,10 @@ package org.jetbrains.builtInWebServer; import com.intellij.notification.NotificationType; import com.intellij.openapi.application.ApplicationNamesInfo; -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.options.Configurable; import com.intellij.openapi.options.SimpleConfigurable; import com.intellij.openapi.util.Getter; @@ -23,7 +26,7 @@ import java.util.Collections; @State( name = "BuiltInServerOptions", - storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml") + storages = @Storage("other.xml") ) public class BuiltInServerOptions implements PersistentStateComponent, Getter { private static final int DEFAULT_PORT = 63342; diff --git a/platform/configuration-store-impl/src/ApplicationStoreImpl.kt b/platform/configuration-store-impl/src/ApplicationStoreImpl.kt index e35623a1ca9d..05d4a01735cb 100644 --- a/platform/configuration-store-impl/src/ApplicationStoreImpl.kt +++ b/platform/configuration-store-impl/src/ApplicationStoreImpl.kt @@ -21,7 +21,6 @@ import com.intellij.openapi.application.PathManager import com.intellij.openapi.application.invokeAndWaitIfNeed import com.intellij.openapi.components.PathMacroManager import com.intellij.openapi.components.StateStorageOperation -import com.intellij.openapi.components.StoragePathMacros import com.intellij.openapi.components.impl.BasePathMacroManager import com.intellij.openapi.components.impl.ServiceManagerImpl import com.intellij.openapi.components.impl.stores.FileStorageCoreUtil @@ -34,6 +33,8 @@ import org.jdom.Element private class ApplicationPathMacroManager : BasePathMacroManager(null) +const val APP_CONFIG = "\$APP_CONFIG$" + class ApplicationStoreImpl(private val application: Application, pathMacroManager: PathMacroManager? = null) : ComponentStoreImpl() { override val storageManager = ApplicationStorageManager(application, pathMacroManager) @@ -43,7 +44,7 @@ class ApplicationStoreImpl(private val application: Application, pathMacroManage override fun setPath(path: String) { // app config must be first, because collapseMacros collapse from fist to last, so, at first we must replace APP_CONFIG because it overlaps ROOT_CONFIG value - storageManager.addMacro(StoragePathMacros.APP_CONFIG, "$path/${ApplicationStorageManager.FILE_STORAGE_DIR}") + storageManager.addMacro(APP_CONFIG, "$path/${ApplicationStorageManager.FILE_STORAGE_DIR}") storageManager.addMacro(ROOT_CONFIG, path) val configDir = LocalFileSystem.getInstance().refreshAndFindFileByPath(path) @@ -103,12 +104,12 @@ class ApplicationStorageManager(private val application: Application, pathMacroM } } - override fun normalizeFileSpec(fileSpec: String) = removeMacroIfStartsWith(super.normalizeFileSpec(fileSpec), StoragePathMacros.APP_CONFIG) + override fun normalizeFileSpec(fileSpec: String) = removeMacroIfStartsWith(super.normalizeFileSpec(fileSpec), APP_CONFIG) override fun expandMacros(path: String) = if (path[0] == '$') { super.expandMacros(path) } else { - "${expandMacro(StoragePathMacros.APP_CONFIG)}/$path" + "${expandMacro(APP_CONFIG)}/$path" } } \ No newline at end of file diff --git a/platform/configuration-store-impl/src/ComponentStoreImpl.kt b/platform/configuration-store-impl/src/ComponentStoreImpl.kt index 2dd2fe318d09..71737bf30c97 100644 --- a/platform/configuration-store-impl/src/ComponentStoreImpl.kt +++ b/platform/configuration-store-impl/src/ComponentStoreImpl.kt @@ -46,14 +46,20 @@ import com.intellij.util.xmlb.JDOMXIncluder import gnu.trove.THashMap import org.jdom.Element import org.jetbrains.annotations.TestOnly -import java.io.File import java.io.IOException +import java.nio.file.Paths import java.util.* import java.util.concurrent.CopyOnWriteArrayList import com.intellij.openapi.util.Pair as JBPair internal val LOG = Logger.getInstance(ComponentStoreImpl::class.java) +internal val deprecatedComparator = Comparator { o1, o2 -> + val w1 = if (o1.deprecated) 1 else 0 + val w2 = if (o2.deprecated) 1 else 0 + w1 - w2 +} + abstract class ComponentStoreImpl : IComponentStore { private val components = Collections.synchronizedMap(THashMap()) private val settingsSavingComponents = CopyOnWriteArrayList() @@ -68,9 +74,6 @@ abstract class ComponentStoreImpl : IComponentStore { override final fun getStateStorageManager() = storageManager - // return null if not applicable - protected open fun selectDefaultStorages(storages: Array, operation: StateStorageOperation): Array? = null - override final fun initComponent(component: Any, service: Boolean) { if (component is SettingsSavingComponent) { settingsSavingComponents.add(component) @@ -163,13 +166,13 @@ abstract class ComponentStoreImpl : IComponentStore { return } - val file: File + val absolutePath: String val state = StoreUtil.getStateSpec(component.javaClass) if (state != null) { - file = File(storageManager.expandMacros(findNonDeprecated(state.storages).file)) + absolutePath = Paths.get(storageManager.expandMacros(findNonDeprecated(state.storages).path)).toAbsolutePath().toString() } else if (component is ExportableApplicationComponent && component is NamedJDOMExternalizable) { - file = PathManager.getOptionsFile(component) + absolutePath = PathManager.getOptionsFile(component).absolutePath } else { throw AssertionError("${component.javaClass} doesn't have @State annotation and doesn't implement ExportableApplicationComponent") @@ -177,11 +180,11 @@ abstract class ComponentStoreImpl : IComponentStore { runWriteAction { try { - VfsRootAccess.allowRootAccess(file.absolutePath) + VfsRootAccess.allowRootAccess(absolutePath) CompoundRuntimeException.throwIfNotEmpty(doSave(sessions)) } finally { - VfsRootAccess.disallowRootAccess(file.absolutePath) + VfsRootAccess.disallowRootAccess(absolutePath) } } } @@ -327,13 +330,7 @@ abstract class ComponentStoreImpl : IComponentStore { throw AssertionError("No storage specified") } - - val defaultStorages = selectDefaultStorages(storages, operation) - if (defaultStorages != null) { - return defaultStorages - } - - return sortStoragesByDeprecated(storages) + return storages.sortByDeprecated() } override final fun isReloadPossible(componentNames: MutableSet) = !componentNames.any { isNotReloadable(it) } @@ -461,28 +458,24 @@ enum class StateLoadPolicy { LOAD, LOAD_ONLY_DEFAULT, NOT_LOAD } -internal fun sortStoragesByDeprecated(storages: Array): Array { - if (storages.isEmpty()) { - return storages +internal fun Array.sortByDeprecated(): Array { + if (isEmpty()) { + return this } - if (!storages[0].deprecated) { + if (!this[0].deprecated) { var othersAreDeprecated = true - for (i in 1..storages.size - 1) { - if (!storages[i].deprecated) { + for (i in 1..size - 1) { + if (!this[i].deprecated) { othersAreDeprecated = false break } } if (othersAreDeprecated) { - return storages + return this } } - return storages.sortedArrayWith(Comparator { o1, o2 -> - val w1 = if (o1.deprecated) 1 else 0 - val w2 = if (o2.deprecated) 1 else 0 - w1 - w2 - }) + return sortedArrayWith(deprecatedComparator) } \ No newline at end of file diff --git a/platform/configuration-store-impl/src/DefaultProjectStoreImpl.kt b/platform/configuration-store-impl/src/DefaultProjectStoreImpl.kt index 092a31434fb1..bcf5595f007f 100644 --- a/platform/configuration-store-impl/src/DefaultProjectStoreImpl.kt +++ b/platform/configuration-store-impl/src/DefaultProjectStoreImpl.kt @@ -25,7 +25,7 @@ import java.io.File internal class DefaultProjectStoreImpl(override val project: ProjectImpl, private val pathMacroManager: PathMacroManager) : ComponentStoreImpl() { companion object { - const val FILE_SPEC = "${StoragePathMacros.APP_CONFIG}/project.default.xml" + const val FILE_SPEC = "${APP_CONFIG}/project.default.xml" } // see note about default state in project store @@ -79,7 +79,7 @@ internal class DefaultProjectStoreImpl(override val project: ProjectImpl, privat override final fun getPathMacroManagerForDefaults() = pathMacroManager - override fun selectDefaultStorages(storages: Array, operation: StateStorageOperation) = selectDefaultStorages(storages, operation, StorageScheme.DEFAULT) + override fun getStorageSpecs(component: PersistentStateComponent, stateSpec: State, operation: StateStorageOperation) = arrayOf(PROJECT_FILE_STORAGE_ANNOTATION) override fun setPath(path: String) { } @@ -98,7 +98,7 @@ internal class DefaultProjectStoreImpl(override val project: ProjectImpl, privat } // ExportSettingsAction checks only "State" annotation presence, but doesn't require PersistentStateComponent implementation, so, we can just specify annotation -@State(name = "ProjectManager", storages = arrayOf(Storage(file = DefaultProjectStoreImpl.FILE_SPEC))) +@State(name = "ProjectManager", storages = arrayOf(Storage(DefaultProjectStoreImpl.FILE_SPEC))) private class DefaultProjectExportableAndSaveTrigger : SettingsSavingComponent { @Volatile var project: Project? = null diff --git a/platform/configuration-store-impl/src/ExportSettingsAction.kt b/platform/configuration-store-impl/src/ExportSettingsAction.kt index fb1a4dd7d366..2459160fb86f 100644 --- a/platform/configuration-store-impl/src/ExportSettingsAction.kt +++ b/platform/configuration-store-impl/src/ExportSettingsAction.kt @@ -197,8 +197,8 @@ fun getExportableComponentsMap(onlyExisting: Boolean, return@PairProcessor true } - val storage = sortStoragesByDeprecated(stateAnnotation.storages).firstOrNull() ?: return@PairProcessor true - if (!(storage.roamingType != RoamingType.DISABLED && storage.storageClass == StateStorage::class && storage.scheme == StorageScheme.DEFAULT && !storage.file.isNullOrEmpty())) { + val storage = stateAnnotation.storages.sortByDeprecated().firstOrNull() ?: return@PairProcessor true + if (!(storage.roamingType != RoamingType.DISABLED && storage.storageClass == StateStorage::class && !storage.path.isNullOrEmpty())) { return@PairProcessor true } @@ -215,7 +215,7 @@ fun getExportableComponentsMap(onlyExisting: Boolean, } } - val file = Paths.get(storageManager.expandMacros(storage.file)) + val file = Paths.get(storageManager.expandMacros(storage.path)) val isFileIncluded = !isSkipFile(file) if (isFileIncluded || additionalExportFile != null) { if (computePresentableNames && onlyExisting && additionalExportFile == null && file.fileName.toString().endsWith(".xml")) { diff --git a/platform/configuration-store-impl/src/FileBasedStorage.kt b/platform/configuration-store-impl/src/FileBasedStorage.kt index 360d0dba144b..926fad02a10e 100644 --- a/platform/configuration-store-impl/src/FileBasedStorage.kt +++ b/platform/configuration-store-impl/src/FileBasedStorage.kt @@ -231,7 +231,7 @@ fun Parent.toBufferExposingByteArray(lineSeparator: String = "\n"): BufferExposi return out } -fun isProjectOrModuleFile(fileSpec: String): Boolean = StoragePathMacros.PROJECT_FILE == fileSpec || fileSpec.startsWith(StoragePathMacros.PROJECT_CONFIG_DIR) || fileSpec == StoragePathMacros.MODULE_FILE +fun isProjectOrModuleFile(fileSpec: String): Boolean = PROJECT_FILE == fileSpec || fileSpec.startsWith(PROJECT_CONFIG_DIR) || fileSpec == StoragePathMacros.MODULE_FILE fun detectLineSeparators(chars: CharSequence, defaultSeparator: LineSeparator?): LineSeparator { for (c in chars) { diff --git a/platform/configuration-store-impl/src/ProjectStateStorageManager.kt b/platform/configuration-store-impl/src/ProjectStateStorageManager.kt index 6a218b91a4fc..8f6af8dd2680 100644 --- a/platform/configuration-store-impl/src/ProjectStateStorageManager.kt +++ b/platform/configuration-store-impl/src/ProjectStateStorageManager.kt @@ -27,14 +27,14 @@ class ProjectStateStorageManager(macroSubstitutor: TrackingPathMacroSubstitutor, val VERSION_OPTION = "version" } - override fun normalizeFileSpec(fileSpec: String) = removeMacroIfStartsWith(super.normalizeFileSpec(fileSpec), StoragePathMacros.PROJECT_CONFIG_DIR) + override fun normalizeFileSpec(fileSpec: String) = removeMacroIfStartsWith(super.normalizeFileSpec(fileSpec), PROJECT_CONFIG_DIR) override fun expandMacros(path: String): String { if (path[0] == '$') { return super.expandMacros(path) } else { - return "${expandMacro(StoragePathMacros.PROJECT_CONFIG_DIR)}/$path" + return "${expandMacro(PROJECT_CONFIG_DIR)}/$path" } } @@ -47,6 +47,6 @@ class ProjectStateStorageManager(macroSubstitutor: TrackingPathMacroSubstitutor, if (workspace && (operation != StateStorageOperation.READ || getOrCreateStorage(StoragePathMacros.WORKSPACE_FILE, RoamingType.DISABLED).hasState(componentName, false))) { return StoragePathMacros.WORKSPACE_FILE } - return StoragePathMacros.PROJECT_FILE + return PROJECT_FILE } } \ No newline at end of file diff --git a/platform/configuration-store-impl/src/ProjectStoreImpl.kt b/platform/configuration-store-impl/src/ProjectStoreImpl.kt index 0168a616451d..ac4b97bc31b9 100644 --- a/platform/configuration-store-impl/src/ProjectStoreImpl.kt +++ b/platform/configuration-store-impl/src/ProjectStoreImpl.kt @@ -42,6 +42,7 @@ import com.intellij.openapi.vfs.VfsUtil import com.intellij.openapi.vfs.VirtualFile import com.intellij.util.PathUtilRt import com.intellij.util.SmartList +import com.intellij.util.containers.isNullOrEmpty import com.intellij.util.lang.CompoundRuntimeException import java.io.File import java.io.IOException @@ -50,9 +51,17 @@ import java.nio.file.Path import java.nio.file.Paths import java.util.* +const val PROJECT_FILE = "\$PROJECT_FILE$" +const val PROJECT_CONFIG_DIR = "\$PROJECT_CONFIG_DIR$" + val IProjectStore.nameFile: Path get() = Paths.get(projectBasePath, Project.DIRECTORY_STORE_FOLDER, ProjectImpl.NAME_FILE) +internal val PROJECT_FILE_STORAGE_ANNOTATION = ProjectFileStorageAnnotation() +internal val DEPRECATED_PROJECT_FILE_STORAGE_ANNOTATION = object : ProjectFileStorageAnnotation() { + override fun deprecated() = true +} + abstract class ProjectStoreBase(override final val project: ProjectImpl) : ComponentStoreImpl(), IProjectStore { // protected setter used in upsource // Zelix KlassMaster - ERROR: Could not find method 'getScheme()' @@ -73,7 +82,7 @@ abstract class ProjectStoreBase(override final val project: ProjectImpl) : Compo loadPolicy = if (value) StateLoadPolicy.NOT_LOAD else StateLoadPolicy.LOAD } - override fun getProjectFilePath() = storageManager.expandMacro(StoragePathMacros.PROJECT_FILE) + override fun getProjectFilePath() = storageManager.expandMacro(PROJECT_FILE) override final fun getWorkspaceFilePath() = storageManager.expandMacro(StoragePathMacros.WORKSPACE_FILE) @@ -86,7 +95,7 @@ abstract class ProjectStoreBase(override final val project: ProjectImpl) : Compo val element = (defaultProject.stateStore as DefaultProjectStoreImpl).getStateCopy() if (element != null) { - (storageManager.getOrCreateStorage(StoragePathMacros.PROJECT_FILE) as XmlElementStorage).setDefaultState(element) + (storageManager.getOrCreateStorage(PROJECT_FILE) as XmlElementStorage).setDefaultState(element) } } @@ -102,7 +111,7 @@ abstract class ProjectStoreBase(override final val project: ProjectImpl) : Compo if (FileUtilRt.extensionEquals(filePath, ProjectFileType.DEFAULT_EXTENSION)) { scheme = StorageScheme.DEFAULT - storageManager.addMacro(StoragePathMacros.PROJECT_FILE, filePath) + storageManager.addMacro(PROJECT_FILE, filePath) val workspacePath = composeWsPath(filePath) storageManager.addMacro(StoragePathMacros.WORKSPACE_FILE, workspacePath) @@ -125,8 +134,8 @@ abstract class ProjectStoreBase(override final val project: ProjectImpl) : Compo // if useOldWorkspaceContentIfExists false, so, file path is expected to be correct (we must avoid file io operations) val isDir = !useOldWorkspaceContentIfExists || file.isDirectory val configDir = "${(if (isDir) filePath else PathUtilRt.getParentPath(filePath))}/${Project.DIRECTORY_STORE_FOLDER}" - storageManager.addMacro(StoragePathMacros.PROJECT_CONFIG_DIR, configDir) - storageManager.addMacro(StoragePathMacros.PROJECT_FILE, "$configDir/misc.xml") + storageManager.addMacro(PROJECT_CONFIG_DIR, configDir) + storageManager.addMacro(PROJECT_FILE, "$configDir/misc.xml") storageManager.addMacro(StoragePathMacros.WORKSPACE_FILE, "$configDir/workspace.xml") if (!isDir) { @@ -164,7 +173,7 @@ private open class ProjectStoreImpl(project: ProjectImpl, private val pathMacroM } override fun getProjectName(): String { - if (scheme == StorageScheme.DIRECTORY_BASED) { + if (isDirectoryBased) { val baseDir = projectBasePath val nameFile = nameFile if (nameFile.exists()) { @@ -194,8 +203,11 @@ private open class ProjectStoreImpl(project: ProjectImpl, private val pathMacroM } } + private val isDirectoryBased: Boolean + get() = scheme == StorageScheme.DIRECTORY_BASED + private fun saveProjectName() { - if (scheme != StorageScheme.DIRECTORY_BASED) { + if (!isDirectoryBased) { return } @@ -279,78 +291,68 @@ private open class ProjectStoreImpl(project: ProjectImpl, private val pathMacroM } override fun getStorageSpecs(component: PersistentStateComponent, stateSpec: State, operation: StateStorageOperation): Array { - // if we create project from default, component state written not to own storage file, but to project file, - // we don't have time to fix it properly, so, ancient hack restored. - val result = super.getStorageSpecs(component, stateSpec, operation) - // don't add fake storage if project file storage already listed, otherwise data will be deleted on write (because of "deprecated") - for (storage in result) { - if (storage.file == StoragePathMacros.PROJECT_FILE) { - return result - } - } - return Array(result.size + 1) { if (it == result.size) DEFAULT_STORAGE_ANNOTATION else result[it] } - } - - companion object { - private val DEFAULT_STORAGE_ANNOTATION = DefaultStorageAnnotation() - - private fun dropUnableToSaveProjectNotification(project: Project, readOnlyFiles: Array) { - val notifications = NotificationsManager.getNotificationsManager().getNotificationsOfType(UnableToSaveProjectNotification::class.java, project) - if (notifications.isEmpty()) { - Notifications.Bus.notify(UnableToSaveProjectNotification(project, readOnlyFiles), project) - } - else { - notifications[0].myFiles = readOnlyFiles - } + val storages = stateSpec.storages + if (storages.isEmpty()) { + return arrayOf(PROJECT_FILE_STORAGE_ANNOTATION) } - private fun getFilesList(readonlyFiles: List>) = Array(readonlyFiles.size) { readonlyFiles[it].second } - } - - override fun selectDefaultStorages(storages: Array, operation: StateStorageOperation) = selectDefaultStorages(storages, operation, scheme) -} - -internal fun selectDefaultStorages(storages: Array, operation: StateStorageOperation, scheme: StorageScheme): Array { - if (operation === StateStorageOperation.READ) { - val result = SmartList() - for (i in storages.indices.reversed()) { - val storage = storages[i] - if (storage.scheme == scheme) { - result.add(storage) - } - } - - for (storage in storages) { - if (storage.scheme == StorageScheme.DEFAULT && !result.contains(storage)) { - result.add(storage) - } - } - - return result.toTypedArray() - } - else if (operation == StateStorageOperation.WRITE) { - val result = SmartList() - for (storage in storages) { - if (storage.scheme == scheme) { - result.add(storage) - } - } - - if (result.isEmpty()) { + if (isDirectoryBased) { + var result: MutableList? = null for (storage in storages) { - if (storage.scheme == StorageScheme.DEFAULT) { + @Suppress("DEPRECATION") + if (storage.scheme == scheme || storage.path != PROJECT_FILE) { + if (result == null) { + result = SmartList() + } result.add(storage) } } - } - return result.toTypedArray() - } - else { - return emptyArray() + if (result.isNullOrEmpty()) { + return arrayOf(PROJECT_FILE_STORAGE_ANNOTATION) + } + else { + result!!.sortWith(deprecatedComparator) + // if we create project from default, component state written not to own storage file, but to project file, + // we don't have time to fix it properly, so, ancient hack restored + result.add(DEPRECATED_PROJECT_FILE_STORAGE_ANNOTATION) + return result.toTypedArray() + } + } + else { + var result: MutableList? = null + for (storage in storages) { + @Suppress("DEPRECATION") + if (storage.path == PROJECT_FILE || storage.path == StoragePathMacros.WORKSPACE_FILE) { + if (result == null) { + result = SmartList() + } + result.add(storage) + } + } + if (result.isNullOrEmpty()) { + return arrayOf(PROJECT_FILE_STORAGE_ANNOTATION) + } + else { + result!!.sortWith(deprecatedComparator) + return result.toTypedArray() + } + } } } +private fun dropUnableToSaveProjectNotification(project: Project, readOnlyFiles: Array) { + val notifications = NotificationsManager.getNotificationsManager().getNotificationsOfType(UnableToSaveProjectNotification::class.java, project) + if (notifications.isEmpty()) { + Notifications.Bus.notify(UnableToSaveProjectNotification(project, readOnlyFiles), project) + } + else { + notifications[0].myFiles = readOnlyFiles + } +} + +private fun getFilesList(readonlyFiles: List>) = Array(readonlyFiles.size) { readonlyFiles[it].second } + private class ProjectWithModulesStoreImpl(project: ProjectImpl, pathMacroManager: PathMacroManager) : ProjectStoreImpl(project, pathMacroManager) { override fun beforeSave(readonlyFiles: List>) { super.beforeSave(readonlyFiles) diff --git a/platform/configuration-store-impl/src/StateStorageManagerImpl.kt b/platform/configuration-store-impl/src/StateStorageManagerImpl.kt index e099dbbc393d..e0c72a8ab4e4 100644 --- a/platform/configuration-store-impl/src/StateStorageManagerImpl.kt +++ b/platform/configuration-store-impl/src/StateStorageManagerImpl.kt @@ -130,7 +130,7 @@ open class StateStorageManagerImpl(private val rootTagName: String, } } - override final fun getStateStorage(storageSpec: Storage) = getOrCreateStorage(storageSpec.file, storageSpec.roamingType, + override final fun getStateStorage(storageSpec: Storage) = getOrCreateStorage(storageSpec.path, storageSpec.roamingType, JavaAnnotationHelperForKotlin.getStorageClass(storageSpec), JavaAnnotationHelperForKotlin.getStateSplitterClass(storageSpec)) protected open fun normalizeFileSpec(fileSpec: String): String { @@ -142,7 +142,7 @@ open class StateStorageManagerImpl(private val rootTagName: String, fun getOrCreateStorage(collapsedPath: String, roamingType: RoamingType = RoamingType.DEFAULT, storageClass: Class = StateStorage::class.java, - @Suppress("DEPRECATION") @SuppressWarnings("deprecation") stateSplitter: Class = StateSplitterEx::class.java): StateStorage { + @Suppress("DEPRECATION") stateSplitter: Class = StateSplitterEx::class.java): StateStorage { val normalizedCollapsedPath = normalizeFileSpec(collapsedPath) val key = if (storageClass == StateStorage::class.java) normalizedCollapsedPath else storageClass.name storageLock.withLock { @@ -398,4 +398,8 @@ private fun String.startsWithMacro(macro: String): Boolean { return length > i && this[i] == '/' && startsWith(macro) } -fun removeMacroIfStartsWith(path: String, macro: String) = if (path.startsWithMacro(macro)) path.substring(macro.length + 1) else path \ No newline at end of file +fun removeMacroIfStartsWith(path: String, macro: String) = if (path.startsWithMacro(macro)) path.substring(macro.length + 1) else path + +@Suppress("DEPRECATION") +val Storage.path: String + get() = if (value.isNullOrEmpty()) file else value \ No newline at end of file diff --git a/platform/configuration-store-impl/src/com/intellij/configurationStore/DefaultStorageAnnotation.java b/platform/configuration-store-impl/src/com/intellij/configurationStore/ProjectFileStorageAnnotation.java similarity index 83% rename from platform/configuration-store-impl/src/com/intellij/configurationStore/DefaultStorageAnnotation.java rename to platform/configuration-store-impl/src/com/intellij/configurationStore/ProjectFileStorageAnnotation.java index c1bf7d107f59..693a1634b693 100644 --- a/platform/configuration-store-impl/src/com/intellij/configurationStore/DefaultStorageAnnotation.java +++ b/platform/configuration-store-impl/src/com/intellij/configurationStore/ProjectFileStorageAnnotation.java @@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull; import java.lang.annotation.Annotation; @SuppressWarnings("ClassExplicitlyAnnotation") -public final class DefaultStorageAnnotation implements Storage { +public class ProjectFileStorageAnnotation implements Storage { @Override public String id() { return "___Default___"; @@ -14,7 +14,12 @@ public final class DefaultStorageAnnotation implements Storage { @Override public String file() { - return StoragePathMacros.PROJECT_FILE; + return value(); + } + + @Override + public String value() { + return ProjectStoreImplKt.PROJECT_FILE; } @Override @@ -24,7 +29,7 @@ public final class DefaultStorageAnnotation implements Storage { @Override public boolean deprecated() { - return true; + return false; } @Override diff --git a/platform/configuration-store-impl/testSrc/ApplicationStoreTest.kt b/platform/configuration-store-impl/testSrc/ApplicationStoreTest.kt index f6023a1732cb..7c71f19f97d0 100644 --- a/platform/configuration-store-impl/testSrc/ApplicationStoreTest.kt +++ b/platform/configuration-store-impl/testSrc/ApplicationStoreTest.kt @@ -119,7 +119,7 @@ internal class ApplicationStoreTest { testAppConfig.refreshVfs() val storageManager = ApplicationManager.getApplication().stateStore.stateStorageManager - val optionsPath = storageManager.expandMacros(StoragePathMacros.APP_CONFIG) + val optionsPath = storageManager.expandMacros(APP_CONFIG) val rootConfigPath = storageManager.expandMacros(ROOT_CONFIG) val map = getExportableComponentsMap(false, true, storageManager) assertThat(map).isNotEmpty @@ -201,7 +201,7 @@ internal class ApplicationStoreTest { """) } - @State(name = "A", storages = arrayOf(Storage(file = "a.xml")), additionalExportFile = "foo") + @State(name = "A", storages = arrayOf(Storage("a.xml")), additionalExportFile = "foo") private open class A : PersistentStateComponent { data class State(@Attribute var foo: String = "", @Attribute var bar: String = "") @@ -237,7 +237,7 @@ internal class ApplicationStoreTest { } @Test fun `do not check if only format changed for non-roamable storage`() { - @State(name = "A", storages = arrayOf(Storage(file = "b.xml", roamingType = RoamingType.DISABLED))) + @State(name = "A", storages = arrayOf(Storage(value = "b.xml", roamingType = RoamingType.DISABLED))) class AWorkspace : A() val oldContent = "" @@ -296,7 +296,7 @@ internal class ApplicationStoreTest { } override fun setPath(path: String) { - storageManager.addMacro(StoragePathMacros.APP_CONFIG, path) + storageManager.addMacro(APP_CONFIG, path) // yes, in tests APP_CONFIG equals to ROOT_CONFIG (as ICS does) storageManager.addMacro(ROOT_CONFIG, path) } @@ -307,7 +307,7 @@ internal class ApplicationStoreTest { var foo = "defaultValue" } - @State(name = "A", storages = arrayOf(Storage(file = "new.xml"), Storage(file = StoragePathMacros.APP_CONFIG + "/old.xml", deprecated = true))) + @State(name = "A", storages = arrayOf(Storage("new.xml"), Storage(value = "old.xml", deprecated = true))) class SeveralStoragesConfigured : Foo(), PersistentStateComponent { override fun getState(): SeveralStoragesConfigured? { return this @@ -318,7 +318,7 @@ internal class ApplicationStoreTest { } } - @State(name = "A", storages = arrayOf(Storage(file = "old.xml", deprecated = true), Storage(file = "${StoragePathMacros.APP_CONFIG}/new.xml"))) + @State(name = "A", storages = arrayOf(Storage(value = "old.xml", deprecated = true), Storage("new.xml"))) class ActualStorageLast : Foo(), PersistentStateComponent { override fun getState() = this diff --git a/platform/configuration-store-impl/testSrc/DefaultProjectStoreTest.kt b/platform/configuration-store-impl/testSrc/DefaultProjectStoreTest.kt index ec3f09103821..ab6fdc71f7d1 100644 --- a/platform/configuration-store-impl/testSrc/DefaultProjectStoreTest.kt +++ b/platform/configuration-store-impl/testSrc/DefaultProjectStoreTest.kt @@ -24,10 +24,7 @@ internal class DefaultProjectStoreTest { internal const val TEST_COMPONENT_NAME = "Foo" - @State(name = TEST_COMPONENT_NAME, storages = arrayOf( - Storage(file = StoragePathMacros.PROJECT_FILE), - Storage(file = "${StoragePathMacros.PROJECT_CONFIG_DIR}/testSchemes", scheme = StorageScheme.DIRECTORY_BASED, stateSplitter = TestStateSplitter::class)) - ) + @State(name = TEST_COMPONENT_NAME, storages = arrayOf(Storage(value = "testSchemes", stateSplitter = TestStateSplitter::class))) private class TestComponent: PersistentStateComponent { private var element = Element("state") @@ -47,7 +44,7 @@ internal class DefaultProjectStoreTest { tempDirManager, WrapRule { val app = ApplicationManagerEx.getApplicationEx() - val path = Paths.get(app.stateStore.stateStorageManager.expandMacros(StoragePathMacros.APP_CONFIG)) + val path = Paths.get(app.stateStore.stateStorageManager.expandMacros(APP_CONFIG)) // dream about using in memory fs per test as ICS partially does and avoid such hacks path.refreshVfs() diff --git a/platform/configuration-store-impl/testSrc/ProjectStoreTest.kt b/platform/configuration-store-impl/testSrc/ProjectStoreTest.kt index c2350d80947b..d60d4d9ceccc 100644 --- a/platform/configuration-store-impl/testSrc/ProjectStoreTest.kt +++ b/platform/configuration-store-impl/testSrc/ProjectStoreTest.kt @@ -17,8 +17,10 @@ package com.intellij.configurationStore import com.intellij.ide.highlighter.ProjectFileType import com.intellij.openapi.application.runWriteAction -import com.intellij.openapi.components.* +import com.intellij.openapi.components.PersistentStateComponent +import com.intellij.openapi.components.State import com.intellij.openapi.components.impl.stores.IProjectStore +import com.intellij.openapi.components.stateStore import com.intellij.openapi.project.Project import com.intellij.openapi.project.ProjectManager import com.intellij.openapi.project.ex.ProjectEx @@ -84,7 +86,7 @@ internal class ProjectStoreTest { private val iprFileContent = "\n\n \n \n" - @State(name = "AATestComponent", storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE))) + @State(name = "AATestComponent") private class TestComponent : PersistentStateComponent { private var state: TestState? = null @@ -107,7 +109,7 @@ internal class ProjectStoreTest { assertThat(project.basePath).isEqualTo(PathUtil.getParentPath((PathUtil.getParentPath(project.projectFilePath!!)))) // test reload on external change - val file = File(project.stateStore.stateStorageManager.expandMacros(StoragePathMacros.PROJECT_FILE)) + val file = File(project.stateStore.stateStorageManager.expandMacros(PROJECT_FILE)) file.writeText(file.readText().replace("""