本文整理汇总了Java中com.intellij.openapi.vfs.VirtualFileVisitor.limit方法的典型用法代码示例。如果您正苦于以下问题:Java VirtualFileVisitor.limit方法的具体用法?Java VirtualFileVisitor.limit怎么用?Java VirtualFileVisitor.limit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vfs.VirtualFileVisitor
的用法示例。
在下文中一共展示了VirtualFileVisitor.limit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findApplicationFileRecursively
import com.intellij.openapi.vfs.VirtualFileVisitor; //导入方法依赖的package包/类
@Nullable
private File findApplicationFileRecursively(@NotNull final VirtualFile appDirectory,
@NotNull final String applicationName) {
final VirtualFileVisitor<VirtualFile> fileVisitor = new VirtualFileVisitor<VirtualFile>(VirtualFileVisitor
.limit(APP_DEPTH_SEARCH), VirtualFileVisitor.SKIP_ROOT, VirtualFileVisitor.NO_FOLLOW_SYMLINKS) {
@Override
public boolean visitFile(@NotNull VirtualFile file) {
if (ApplicationDictionary.SUPPORTED_APPLICATION_EXTENSIONS.contains(file.getExtension())) {
if (applicationName.equals(file.getNameWithoutExtension())) {
throw new MyStopVisitingException(file);
}
return false; //do not search inside application bundles
}
return true;
}
};
try {
VfsUtilCore.visitChildrenRecursively(appDirectory, fileVisitor, MyStopVisitingException.class);
} catch (MyStopVisitingException e) {
LOG.debug("Application file found for application " + applicationName + " : " + e.getResult());
return new File(e.getResult().getPath());
}
return null;
}
示例2: MyLimitedVirtualFileVisitor
import com.intellij.openapi.vfs.VirtualFileVisitor; //导入方法依赖的package包/类
private MyLimitedVirtualFileVisitor(@NotNull Project project, @NotNull TwigPath twigPath, boolean withPhp, int maxDepth, int maxDirs) {
super(VirtualFileVisitor.limit(maxDepth));
this.project = project;
this.twigPath = twigPath;
this.withPhp = withPhp;
this.childrenAllowToVisit = maxDirs;
}