mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[project-view] make method name meaningful and add docs
This commit is contained in:
@@ -110,10 +110,10 @@ public class TreeViewUtil {
|
||||
if (!file.isDirectory()) {
|
||||
if (filter == null) return false;
|
||||
PsiFile childFile = manager.findFile(file);
|
||||
if (childFile != null && filter.accept(childFile)) return false;
|
||||
if (childFile != null && filter.shouldShow(childFile)) return false;
|
||||
}
|
||||
PsiDirectory childDir = manager.findDirectory(file);
|
||||
if (childDir != null && (filter == null || filter.accept(childDir))) {
|
||||
if (childDir != null && (filter == null || filter.shouldShow(childDir))) {
|
||||
directoriesCount++;
|
||||
if (strictlyEmpty && directoriesCount > 1) return false;
|
||||
if (JavaDirectoryService.getInstance().getPackage(childDir) != null) {
|
||||
|
||||
+3
-3
@@ -177,7 +177,7 @@ public class ProjectViewDirectoryHelper {
|
||||
if (withSubDirectories) {
|
||||
PsiDirectory[] subdirs = psiDirectory.getSubdirectories();
|
||||
for (PsiDirectory subdir : subdirs) {
|
||||
if (!skipDirectory(subdir) || filter != null && !filter.accept(subdir)) {
|
||||
if (!skipDirectory(subdir) || filter != null && !filter.shouldShow(subdir)) {
|
||||
continue;
|
||||
}
|
||||
VirtualFile directoryFile = subdir.getVirtualFile();
|
||||
@@ -291,7 +291,7 @@ public class ProjectViewDirectoryHelper {
|
||||
if (moduleFileIndex != null && !moduleFileIndex.isInContent(vFile)) {
|
||||
continue;
|
||||
}
|
||||
if (filter != null && !filter.accept((PsiFileSystemItem)child)) {
|
||||
if (filter != null && !filter.shouldShow((PsiFileSystemItem)child)) {
|
||||
continue;
|
||||
}
|
||||
if (child instanceof PsiFile) {
|
||||
@@ -323,7 +323,7 @@ public class ProjectViewDirectoryHelper {
|
||||
final Project project = dir.getProject();
|
||||
PsiDirectory[] subdirs = dir.getSubdirectories();
|
||||
for (PsiDirectory subdir : subdirs) {
|
||||
if (skipDirectory(subdir) || filter != null && !filter.accept(subdir)) {
|
||||
if (skipDirectory(subdir) || filter != null && !filter.shouldShow(subdir)) {
|
||||
continue;
|
||||
}
|
||||
if (moduleFileIndex != null && !moduleFileIndex.isInContent(subdir.getVirtualFile())) {
|
||||
|
||||
+2
-2
@@ -189,10 +189,10 @@ public class PsiDirectoryNode extends BasePsiNode<PsiDirectory> implements Navig
|
||||
PsiFileSystemItemFilter filter = getFilter();
|
||||
if (filter != null) {
|
||||
PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
|
||||
if (psiFile != null && !filter.accept(psiFile)) return false;
|
||||
if (psiFile != null && !filter.shouldShow(psiFile)) return false;
|
||||
|
||||
PsiDirectory psiDirectory = PsiManager.getInstance(project).findDirectory(file);
|
||||
if (psiDirectory != null && !filter.accept(psiDirectory)) return false;
|
||||
if (psiDirectory != null && !filter.shouldShow(psiDirectory)) return false;
|
||||
}
|
||||
|
||||
if (Registry.is("ide.hide.excluded.files")) {
|
||||
|
||||
+9
-1
@@ -15,10 +15,18 @@
|
||||
*/
|
||||
package com.intellij.ide.projectView.impl.nodes;
|
||||
|
||||
import com.intellij.ide.projectView.ViewSettings;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileSystemItem;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface PsiFileSystemItemFilter {
|
||||
|
||||
boolean accept(@NotNull PsiFileSystemItem item);
|
||||
/**
|
||||
* @param item {@link PsiFile file} or {@link PsiDirectory directory}.
|
||||
* @return <code>true</code> if item should be showed in project view, otherwise <code>false</code>.
|
||||
* @see ProjectViewDirectoryHelper#getDirectoryChildren(PsiDirectory, ViewSettings, boolean, PsiFileSystemItemFilter)
|
||||
*/
|
||||
boolean shouldShow(@NotNull PsiFileSystemItem item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user