mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Don't use misleading optimization (NewVirtualFile.getCachedChildren) in project open processors as it actually useless most time (since inheritors use findChild api) and can return wrong answer in some cases (e.g. in headless mode)
This commit is contained in:
@@ -37,7 +37,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -45,8 +45,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author anna
|
||||
@@ -82,12 +80,9 @@ public abstract class ProjectOpenProcessorBase<T extends ProjectImportBuilder> e
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Collection<VirtualFile> getFileChildren(VirtualFile file) {
|
||||
if (file instanceof NewVirtualFile) {
|
||||
return ((NewVirtualFile)file).getCachedChildren();
|
||||
}
|
||||
|
||||
return Arrays.asList(file.getChildren());
|
||||
@NotNull
|
||||
private static VirtualFile[] getFileChildren(VirtualFile file) {
|
||||
return ObjectUtils.chooseNotNull(file.getChildren(), VirtualFile.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
protected static boolean canOpenFile(VirtualFile file, String[] supported) {
|
||||
|
||||
-5
@@ -63,11 +63,6 @@ public class GradleProjectOpenProcessor extends ProjectOpenProcessorBase<GradleP
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (String supported : getSupportedExtensions()) {
|
||||
if (file.findChild(supported) != null) return true;
|
||||
}
|
||||
}
|
||||
return super.canOpenProject(file);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user