Cleanup (unneeded constant duplication)

This commit is contained in:
Roman Shevchenko
2015-12-03 23:00:45 +01:00
parent 85e10805be
commit a546419fff
2 changed files with 8 additions and 6 deletions
@@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable;
* <p>To get the list of all open projects, use {@code ProjectManager.getInstance().getOpenProjects()}.
*/
public interface Project extends ComponentManager, AreaInstance {
String DIRECTORY_STORE_FOLDER = ProjectCoreUtil.DIRECTORY_BASED_PROJECT_DIR;
String DIRECTORY_STORE_FOLDER = ".idea";
/**
* Returns a name ot the project. For a directory-based project it's an arbitrary string specified by user at project creation
@@ -24,20 +24,22 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Author: dmitrylomov
* @author dmitrylomov
*/
public class ProjectCoreUtil {
public static final String DIRECTORY_BASED_PROJECT_DIR = ".idea";
/** @deprecated use {@link Project#DIRECTORY_STORE_FOLDER} (to be removed in IDEA 17) */
@SuppressWarnings("unused")
public static final String DIRECTORY_BASED_PROJECT_DIR = Project.DIRECTORY_STORE_FOLDER;
public static boolean isProjectOrWorkspaceFile(@NotNull VirtualFile file) {
return isProjectOrWorkspaceFile(file, file.getFileType());
}
public static boolean isProjectOrWorkspaceFile(@NotNull VirtualFile file, @Nullable final FileType fileType) {
public static boolean isProjectOrWorkspaceFile(@NotNull VirtualFile file, @Nullable FileType fileType) {
if (fileType instanceof InternalFileType) return true;
VirtualFile parent = file.isDirectory() ? file: file.getParent();
while (parent != null) {
if (Comparing.equal(parent.getNameSequence(), DIRECTORY_BASED_PROJECT_DIR, SystemInfoRt.isFileSystemCaseSensitive)) return true;
if (Comparing.equal(parent.getNameSequence(), Project.DIRECTORY_STORE_FOLDER, SystemInfoRt.isFileSystemCaseSensitive)) return true;
parent = parent.getParent();
}
return false;
@@ -51,4 +53,4 @@ public class ProjectCoreUtil {
return theProject;
}
public static volatile Project theProject;
}
}