From d6ffb1205c6fd5fdeffa52c1d4b8de94322d1fdc Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 17 Jun 2013 13:22:46 +0200 Subject: [PATCH] replace some hardcoded .idea literals with references --- .../intellij/platform/templates/LocalArchivedTemplate.java | 5 +++-- .../platform/templates/SaveProjectAsTemplateAction.java | 2 +- .../com/intellij/platform/templates/SystemFileProcessor.java | 2 +- .../intellij/platform/templates/TemplateModuleBuilder.java | 2 +- .../src/com/intellij/projectImport/ProjectFormatPanel.java | 3 ++- .../core-api/src/com/intellij/openapi/project/Project.java | 2 +- .../com/intellij/openapi/application/ex/PathManagerEx.java | 3 ++- .../com/intellij/openapi/vcs/impl/DefaultVcsRootPolicy.java | 2 +- 8 files changed, 12 insertions(+), 9 deletions(-) diff --git a/java/idea-ui/src/com/intellij/platform/templates/LocalArchivedTemplate.java b/java/idea-ui/src/com/intellij/platform/templates/LocalArchivedTemplate.java index 1b9f3c2ef6c1..f671335e6d7e 100644 --- a/java/idea-ui/src/com/intellij/platform/templates/LocalArchivedTemplate.java +++ b/java/idea-ui/src/com/intellij/platform/templates/LocalArchivedTemplate.java @@ -19,6 +19,7 @@ import com.intellij.ide.util.projectWizard.WizardInputField; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.module.ModuleTypeManager; +import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.util.JDOMUtil; @@ -43,8 +44,8 @@ import java.util.zip.ZipInputStream; */ public class LocalArchivedTemplate extends ArchivedProjectTemplate { - public static final String DESCRIPTION_PATH = ".idea/description.html"; - static final String IDEA_INPUT_FIELDS_XML = ".idea/project-template.xml"; + public static final String DESCRIPTION_PATH = Project.DIRECTORY_STORE_FOLDER + "/description.html"; + static final String IDEA_INPUT_FIELDS_XML = Project.DIRECTORY_STORE_FOLDER + "/project-template.xml"; private final URL myArchivePath; private final ModuleType myModuleType; diff --git a/java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java b/java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java index e6cb2a3ed94e..54c0b7c02516 100644 --- a/java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java +++ b/java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java @@ -162,7 +162,7 @@ public class SaveProjectAsTemplateAction extends AnAction { if (relativePath == null) { throw new RuntimeException("Can't find relative path for " + virtualFile); } - final boolean system = ".idea".equals(virtualFile.getParent().getName()); + final boolean system = Project.DIRECTORY_STORE_FOLDER.equals(virtualFile.getParent().getName()); if (system) { if (!fileName.equals("description.html") && !fileName.equals(PROJECT_TEMPLATE_XML) && diff --git a/java/idea-ui/src/com/intellij/platform/templates/SystemFileProcessor.java b/java/idea-ui/src/com/intellij/platform/templates/SystemFileProcessor.java index f57c954c20b6..29f21b4203de 100644 --- a/java/idea-ui/src/com/intellij/platform/templates/SystemFileProcessor.java +++ b/java/idea-ui/src/com/intellij/platform/templates/SystemFileProcessor.java @@ -53,7 +53,7 @@ public class SystemFileProcessor extends ProjectTemplateFileProcessor { @Override protected String encodeFileText(String content, VirtualFile file, Project project) throws IOException { final String fileName = file.getName(); - if (file.getParent().getName().equals(".idea") && fileName.equals("workspace.xml")) { + if (file.getParent().getName().equals(Project.DIRECTORY_STORE_FOLDER) && fileName.equals("workspace.xml")) { List componentList = new ArrayList(); for (String componentName : COMPONENT_NAMES) { diff --git a/java/idea-ui/src/com/intellij/platform/templates/TemplateModuleBuilder.java b/java/idea-ui/src/com/intellij/platform/templates/TemplateModuleBuilder.java index 01502b3fb156..4b0727abd148 100644 --- a/java/idea-ui/src/com/intellij/platform/templates/TemplateModuleBuilder.java +++ b/java/idea-ui/src/com/intellij/platform/templates/TemplateModuleBuilder.java @@ -205,7 +205,7 @@ public class TemplateModuleBuilder extends ModuleBuilder { @Nullable @Override public String fun(String path) { - if (moduleMode && path.contains(".idea")) return null; + if (moduleMode && path.contains(Project.DIRECTORY_STORE_FOLDER)) return null; if (basePackage != null) { return path.replace(getPathFragment(basePackage.getDefaultValue()), getPathFragment(basePackage.getValue())); } diff --git a/java/idea-ui/src/com/intellij/projectImport/ProjectFormatPanel.java b/java/idea-ui/src/com/intellij/projectImport/ProjectFormatPanel.java index e367ce765f98..9b7795d91e4b 100644 --- a/java/idea-ui/src/com/intellij/projectImport/ProjectFormatPanel.java +++ b/java/idea-ui/src/com/intellij/projectImport/ProjectFormatPanel.java @@ -23,13 +23,14 @@ package com.intellij.projectImport; import com.intellij.ide.util.PropertiesComponent; import com.intellij.ide.util.projectWizard.WizardContext; import com.intellij.openapi.components.StorageScheme; +import com.intellij.openapi.project.Project; import javax.swing.*; public class ProjectFormatPanel { private static final String STORAGE_FORMAT_PROPERTY = "default.storage.format"; - public static final String DIR_BASED = ".idea (directory based)"; + public static final String DIR_BASED = Project.DIRECTORY_STORE_FOLDER + " (directory based)"; private static final String FILE_BASED = ".ipr (file based)"; private JComboBox myStorageFormatCombo; diff --git a/platform/core-api/src/com/intellij/openapi/project/Project.java b/platform/core-api/src/com/intellij/openapi/project/Project.java index 84f4b9c84e3c..8c1e0fb100e3 100644 --- a/platform/core-api/src/com/intellij/openapi/project/Project.java +++ b/platform/core-api/src/com/intellij/openapi/project/Project.java @@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable; * Project interface class. */ public interface Project extends ComponentManager, AreaInstance { - @NonNls String DIRECTORY_STORE_FOLDER = ".idea"; + @NonNls String DIRECTORY_STORE_FOLDER = ProjectCoreUtil.DIRECTORY_BASED_PROJECT_DIR; /** * Returns a name ot the project. For a directory-based project it's an arbitrary string specified by user at project creation diff --git a/platform/testFramework/src/com/intellij/openapi/application/ex/PathManagerEx.java b/platform/testFramework/src/com/intellij/openapi/application/ex/PathManagerEx.java index a9a1eb4d7237..37803518329f 100644 --- a/platform/testFramework/src/com/intellij/openapi/application/ex/PathManagerEx.java +++ b/platform/testFramework/src/com/intellij/openapi/application/ex/PathManagerEx.java @@ -26,6 +26,7 @@ package com.intellij.openapi.application.ex; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.module.impl.ModuleManagerImpl; +import com.intellij.openapi.project.Project; import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; @@ -387,7 +388,7 @@ public class PathManagerEx { } ourCommunityModules = new THashSet(); - File modulesXml = findFileUnderCommunityHome(".idea/modules.xml"); + File modulesXml = findFileUnderCommunityHome(Project.DIRECTORY_STORE_FOLDER + "/modules.xml"); if (!modulesXml.exists()) { throw new IllegalStateException("Cannot obtain test data path: " + modulesXml.getAbsolutePath() + " not found"); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultVcsRootPolicy.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultVcsRootPolicy.java index 2be72ffccb42..622099e7e0fa 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultVcsRootPolicy.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultVcsRootPolicy.java @@ -52,7 +52,7 @@ public abstract class DefaultVcsRootPolicy { final StorageScheme storageScheme = ((ProjectEx) project).getStateStore().getStorageScheme(); boolean isDirectoryBased = StorageScheme.DIRECTORY_BASED.equals(storageScheme); final String[] parts = new String[] {"Content roots of all modules", "all immediate descendants of project base directory", - ".idea directory contents"}; + Project.DIRECTORY_STORE_FOLDER + " directory contents"}; final StringBuilder sb = new StringBuilder(parts[0]); if (isDirectoryBased) { sb.append(", ");