diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ModuleRunConfigurationManager.java b/platform/lang-impl/src/com/intellij/execution/impl/ModuleRunConfigurationManager.java index b17e2f03bdd9..169c68e17528 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/ModuleRunConfigurationManager.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/ModuleRunConfigurationManager.java @@ -22,6 +22,7 @@ import com.intellij.execution.configurations.RunConfiguration; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; +import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleComponent; @@ -45,11 +46,7 @@ import java.util.Set; @State( name = ModuleRunConfigurationManager.COMPONENT_NAME, - storages = { - @Storage( - file = "$MODULE_FILE$" - ) - } + storages = @Storage(file = StoragePathMacros.MODULE_FILE) ) public final class ModuleRunConfigurationManager extends ModuleAdapter implements ModuleComponent, PersistentStateComponent { private static final Logger LOG = Logger.getInstance(ModuleRunConfigurationManager.class); diff --git a/platform/lang-impl/src/com/intellij/facet/FacetManagerImpl.java b/platform/lang-impl/src/com/intellij/facet/FacetManagerImpl.java index 93315c57cc49..cd2cf5319306 100644 --- a/platform/lang-impl/src/com/intellij/facet/FacetManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/facet/FacetManagerImpl.java @@ -16,7 +16,10 @@ package com.intellij.facet; -import com.intellij.facet.impl.*; +import com.intellij.facet.impl.FacetLoadingErrorDescription; +import com.intellij.facet.impl.FacetModelBase; +import com.intellij.facet.impl.FacetModelImpl; +import com.intellij.facet.impl.FacetUtil; import com.intellij.facet.impl.invalid.InvalidFacet; import com.intellij.facet.impl.invalid.InvalidFacetConfiguration; import com.intellij.facet.impl.invalid.InvalidFacetManager; @@ -25,6 +28,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; +import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleComponent; @@ -48,12 +52,8 @@ import java.util.*; * @author nik */ @State( - name = FacetManagerImpl.COMPONENT_NAME, - storages = { - @Storage( - file = "$MODULE_FILE$" - ) - } + name = FacetManagerImpl.COMPONENT_NAME, + storages = @Storage(file = StoragePathMacros.MODULE_FILE) ) public class FacetManagerImpl extends FacetManager implements ModuleComponent, PersistentStateComponent { private static final Logger LOG = Logger.getInstance("#com.intellij.facet.FacetManagerImpl"); diff --git a/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStateStorageManager.java b/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStateStorageManager.java index 516c89f7a109..b2e14eb9e06c 100644 --- a/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStateStorageManager.java +++ b/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStateStorageManager.java @@ -19,6 +19,7 @@ package com.intellij.openapi.components.impl.stores; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.components.StateStorage; import com.intellij.openapi.components.StateStorageOperation; +import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.components.TrackingPathMacroSubstitutor; import com.intellij.openapi.module.Module; import org.jetbrains.annotations.NonNls; @@ -42,7 +43,7 @@ class ModuleStateStorageManager extends StateStorageManagerImpl { @Nullable @Override protected String getOldStorageSpec(@NotNull Object component, @NotNull String componentName, @NotNull StateStorageOperation operation) { - return ModuleStoreImpl.DEFAULT_STATE_STORAGE; + return StoragePathMacros.MODULE_FILE; } @Override diff --git a/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java b/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java index ba6bb7474fc4..5380788ea0d9 100644 --- a/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java @@ -48,8 +48,6 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM private final ModuleImpl myModule; - public static final String DEFAULT_STATE_STORAGE = "$MODULE_FILE$"; - @SuppressWarnings({"UnusedDeclaration"}) public ModuleStoreImpl(final ComponentManagerImpl componentManager, final ModuleImpl module) { super(componentManager); @@ -58,7 +56,7 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM @Override protected FileBasedStorage getMainStorage() { - FileBasedStorage storage = (FileBasedStorage)getStateStorageManager().getStateStorage(DEFAULT_STATE_STORAGE, RoamingType.PER_USER); + FileBasedStorage storage = (FileBasedStorage)getStateStorageManager().getStateStorage(StoragePathMacros.MODULE_FILE, RoamingType.PER_USER); assert storage != null; return storage; } @@ -176,8 +174,8 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM final String path = filePath.replace(File.separatorChar, '/'); LocalFileSystem.getInstance().refreshAndFindFileByPath(path); final StateStorageManager storageManager = getStateStorageManager(); - storageManager.clearStateStorage(DEFAULT_STATE_STORAGE); - storageManager.addMacro(DEFAULT_STATE_STORAGE, path); + storageManager.clearStateStorage(StoragePathMacros.MODULE_FILE); + storageManager.addMacro(StoragePathMacros.MODULE_FILE, path); } @Override diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerComponent.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerComponent.java index b1cf77106b6d..46f0cb1b4697 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerComponent.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerComponent.java @@ -27,15 +27,8 @@ import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager; @State( name = "NewModuleRootManager", storages = { - @Storage( - id = ClassPathStorageUtil.DEFAULT_STORAGE, - file = "$MODULE_FILE$" - ), - - @Storage( - id = ClasspathStorage.SPECIAL_STORAGE, - storageClass = ClasspathStorage.class - ) + @Storage(id = ClassPathStorageUtil.DEFAULT_STORAGE, file = StoragePathMacros.MODULE_FILE), + @Storage(id = ClasspathStorage.SPECIAL_STORAGE, storageClass = ClasspathStorage.class) }, storageChooser = ModuleRootManagerComponent.StorageChooser.class ) diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java index 348f30eeff10..30dde0ad011d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java @@ -381,6 +381,6 @@ public class StorageUtil { } public static boolean isProjectOrModuleFile(@NotNull String fileSpec) { - return StoragePathMacros.PROJECT_FILE.equals(fileSpec) || fileSpec.startsWith(StoragePathMacros.PROJECT_CONFIG_DIR) || fileSpec.equals("$MODULE_FILE$"); + return StoragePathMacros.PROJECT_FILE.equals(fileSpec) || fileSpec.startsWith(StoragePathMacros.PROJECT_CONFIG_DIR) || fileSpec.equals(StoragePathMacros.MODULE_FILE); } } diff --git a/platform/projectModel-api/src/com/intellij/openapi/components/StoragePathMacros.java b/platform/projectModel-api/src/com/intellij/openapi/components/StoragePathMacros.java index 3a292dd7175c..bd27738ecab4 100644 --- a/platform/projectModel-api/src/com/intellij/openapi/components/StoragePathMacros.java +++ b/platform/projectModel-api/src/com/intellij/openapi/components/StoragePathMacros.java @@ -55,6 +55,8 @@ public class StoragePathMacros { */ @NonNls @NotNull public static final String WORKSPACE_FILE = "$WORKSPACE_FILE$"; + @NonNls @NotNull public static final String MODULE_FILE = "$MODULE_FILE$"; + private StoragePathMacros() { } diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseModuleManagerImpl.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseModuleManagerImpl.java index 30147f28f02d..c8176b6b225a 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseModuleManagerImpl.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseModuleManagerImpl.java @@ -19,6 +19,7 @@ package org.jetbrains.idea.eclipse.config; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; +import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleServiceManager; import com.intellij.openapi.roots.impl.storage.ClassPathStorageUtil; @@ -29,15 +30,14 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.idea.eclipse.EclipseModuleManager; import org.jetbrains.jps.eclipse.model.JpsEclipseClasspathSerializer; -import java.util.*; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; @State( name = "EclipseModuleManager", - storages = { - @Storage( - file = "$MODULE_FILE$" - ) - } + storages = @Storage(file = StoragePathMacros.MODULE_FILE) ) public class EclipseModuleManagerImpl implements EclipseModuleManager, PersistentStateComponent { @NonNls private static final String VALUE_ATTR = "value"; diff --git a/python/src/com/jetbrains/python/ReSTService.java b/python/src/com/jetbrains/python/ReSTService.java index 4eb2ee2dc83f..b307b75b3fb0 100644 --- a/python/src/com/jetbrains/python/ReSTService.java +++ b/python/src/com/jetbrains/python/ReSTService.java @@ -18,6 +18,7 @@ package com.jetbrains.python; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; +import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleServiceManager; import com.intellij.util.xmlb.XmlSerializerUtil; @@ -26,8 +27,9 @@ import org.jetbrains.annotations.NotNull; /** * User: catherine */ -@State(name = "ReSTService", - storages = {@Storage(file = "$MODULE_FILE$")} +@State( + name = "ReSTService", + storages = @Storage(file = StoragePathMacros.MODULE_FILE) ) public class ReSTService implements PersistentStateComponent { public String DOC_DIR = ""; diff --git a/python/src/com/jetbrains/python/documentation/PyDocumentationSettings.java b/python/src/com/jetbrains/python/documentation/PyDocumentationSettings.java index 49a17efd28a6..e88ddc4e0af7 100644 --- a/python/src/com/jetbrains/python/documentation/PyDocumentationSettings.java +++ b/python/src/com/jetbrains/python/documentation/PyDocumentationSettings.java @@ -18,6 +18,7 @@ package com.jetbrains.python.documentation; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; +import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleServiceManager; import com.intellij.openapi.util.text.StringUtil; @@ -36,8 +37,9 @@ import java.util.List; /** * @author yole */ -@State(name = "PyDocumentationSettings", - storages = {@Storage(file = "$MODULE_FILE$")} +@State( + name = "PyDocumentationSettings", + storages = @Storage(file = StoragePathMacros.MODULE_FILE) ) public class PyDocumentationSettings implements PersistentStateComponent { public String myDocStringFormat = DocStringFormat.REST; diff --git a/python/src/com/jetbrains/python/packaging/PyPackageRequirementsSettings.java b/python/src/com/jetbrains/python/packaging/PyPackageRequirementsSettings.java index cf7388fb9872..423e7c815137 100644 --- a/python/src/com/jetbrains/python/packaging/PyPackageRequirementsSettings.java +++ b/python/src/com/jetbrains/python/packaging/PyPackageRequirementsSettings.java @@ -18,6 +18,7 @@ package com.jetbrains.python.packaging; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; +import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleServiceManager; import com.intellij.util.xmlb.XmlSerializerUtil; @@ -26,8 +27,10 @@ import org.jetbrains.annotations.NotNull; /** * @author vlan */ -@State(name = "PackageRequirementsSettings", - storages = {@Storage(file = "$MODULE_FILE$")}) +@State( + name = "PackageRequirementsSettings", + storages = @Storage(file = StoragePathMacros.MODULE_FILE) +) public class PyPackageRequirementsSettings implements PersistentStateComponent { public static final String DEFAULT_REQUIREMENTS_PATH = "requirements.txt"; diff --git a/python/src/com/jetbrains/python/testing/TestRunnerService.java b/python/src/com/jetbrains/python/testing/TestRunnerService.java index 6f41b035cd9f..a116395e0c13 100644 --- a/python/src/com/jetbrains/python/testing/TestRunnerService.java +++ b/python/src/com/jetbrains/python/testing/TestRunnerService.java @@ -18,6 +18,7 @@ package com.jetbrains.python.testing; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; +import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleServiceManager; import com.intellij.util.xmlb.XmlSerializerUtil; @@ -29,8 +30,9 @@ import java.util.List; /** * User: catherine */ -@State(name = "TestRunnerService", - storages = {@Storage(file = "$MODULE_FILE$")} +@State( + name = "TestRunnerService", + storages = @Storage(file = StoragePathMacros.MODULE_FILE) ) public class TestRunnerService implements PersistentStateComponent { private List myConfigurations = new ArrayList();