mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
avoid iterating all children of directory in order to determine its icon (IDEA-64348 redux)
This commit is contained in:
+2
-10
@@ -86,16 +86,8 @@ public class OpenProjectFileChooserDescriptor extends FileChooserDescriptor {
|
||||
private static boolean isProjectDirectory(final VirtualFile virtualFile) {
|
||||
// the root directory of any drive is never an IDEA project
|
||||
if (virtualFile.getParent() == null) return false;
|
||||
if (virtualFile.isDirectory() && virtualFile.isValid()) {
|
||||
final VirtualFile[] children = virtualFile.getChildren();
|
||||
if (children == null) return false;
|
||||
for (VirtualFile file : children) {
|
||||
if (file.getName().equals(Project.DIRECTORY_STORE_FOLDER)) return true;
|
||||
if (isIprFile(file)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// NOTE: For performance reasons, it's very important not to iterate through all of the children here.
|
||||
if (virtualFile.isDirectory() && virtualFile.isValid() && virtualFile.findChild(Project.DIRECTORY_STORE_FOLDER) != null) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user