mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (unneeded constant duplication)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user