StoragePathMacros — add MODULE_FILE

This commit is contained in:
Vladimir Krivosheev
2014-10-07 11:45:19 +02:00
parent 91385467d6
commit 1687e46b1f
12 changed files with 42 additions and 42 deletions
@@ -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<Element> {
private static final Logger LOG = Logger.getInstance(ModuleRunConfigurationManager.class);
@@ -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<FacetManagerState> {
private static final Logger LOG = Logger.getInstance("#com.intellij.facet.FacetManagerImpl");
@@ -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
@@ -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
@@ -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
)
@@ -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);
}
}
@@ -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() {
}
@@ -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<Element> {
@NonNls private static final String VALUE_ATTR = "value";
@@ -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<ReSTService> {
public String DOC_DIR = "";
@@ -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<PyDocumentationSettings> {
public String myDocStringFormat = DocStringFormat.REST;
@@ -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<PyPackageRequirementsSettings> {
public static final String DEFAULT_REQUIREMENTS_PATH = "requirements.txt";
@@ -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<TestRunnerService> {
private List<String> myConfigurations = new ArrayList<String>();