From 25cab11761c344f1e5b9e2c57ce6f58d882fdfc9 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 28 Feb 2013 13:33:19 +0100 Subject: [PATCH] refactoring: introduce constant NAME_FILE for the .name file --- .../src/com/intellij/ide/RecentProjectsManagerBase.java | 3 ++- .../openapi/components/impl/stores/ProjectStoreImpl.java | 4 ++-- .../src/com/intellij/openapi/project/impl/ProjectImpl.java | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java b/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java index 97a7961f7bd6..8d6f9955d7ef 100644 --- a/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java +++ b/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java @@ -24,6 +24,7 @@ import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.project.ProjectManagerAdapter; +import com.intellij.openapi.project.impl.ProjectImpl; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.SystemInfo; @@ -265,7 +266,7 @@ public abstract class RecentProjectsManagerBase implements PersistentStateCompon private static String getProjectName(String path) { final File file = new File(path); if (file.isDirectory()) { - final File nameFile = new File(new File(path, Project.DIRECTORY_STORE_FOLDER), ".name"); + final File nameFile = new File(new File(path, Project.DIRECTORY_STORE_FOLDER), ProjectImpl.NAME_FILE); if (nameFile.exists()) { try { final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(nameFile), "UTF-8")); diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStoreImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStoreImpl.java index 02fb9ce70fc9..891875f715d3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStoreImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStoreImpl.java @@ -299,7 +299,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject final VirtualFile ideaDir = baseDir.findChild(Project.DIRECTORY_STORE_FOLDER); if (ideaDir != null && ideaDir.isValid()) { - final VirtualFile nameFile = ideaDir.findChild(".name"); + final VirtualFile nameFile = ideaDir.findChild(ProjectImpl.NAME_FILE); if (nameFile != null && nameFile.isValid()) { try { BufferedReader in = new BufferedReader(new InputStreamReader(nameFile.getInputStream(), "UTF-8")); @@ -549,7 +549,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject final VirtualFile baseDir = getProjectBaseDir(); if (baseDir != null && baseDir.isValid()) { filesToSave.add(FileSystem.FILE_SYSTEM - .createFile(new File(new File(baseDir.getPath(), Project.DIRECTORY_STORE_FOLDER), ".name").getPath())); + .createFile(new File(new File(baseDir.getPath(), Project.DIRECTORY_STORE_FOLDER), ProjectImpl.NAME_FILE).getPath())); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java index 8052dec5cd3d..07b9f899b3bc 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java @@ -75,6 +75,7 @@ import java.util.concurrent.atomic.AtomicBoolean; public class ProjectImpl extends ComponentManagerImpl implements ProjectEx { private static final Logger LOG = Logger.getInstance("#com.intellij.project.impl.ProjectImpl"); private static final String PLUGIN_SETTINGS_ERROR = "Plugin Settings Error"; + public static final String NAME_FILE = ".name"; private ProjectManagerImpl myManager; @@ -342,7 +343,7 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx { if (baseDir != null && baseDir.isValid()) { final VirtualFile ideaDir = baseDir.findChild(DIRECTORY_STORE_FOLDER); if (ideaDir != null && ideaDir.isValid() && ideaDir.isDirectory()) { - final File nameFile = new File(ideaDir.getPath(), ".name"); + final File nameFile = new File(ideaDir.getPath(), NAME_FILE); try { FileUtil.writeToFile(nameFile, getName().getBytes("UTF-8"), false); myOldName = null;