void (@NotNull List<FoldingDescriptor> descriptors, @NotNull PsiElement root, @NotNull Document document, boolean quick) { if (!(root instanceof PsiJavaFile)) return; PsiJavaFile file = (PsiJavaFile) root; Set<PsiElement> processedComments = new HashSet<>(); addFoldsForImports(descriptors, file); PsiJavaModule module = file.getModuleDeclaration(); if (module != null) { addFoldsForModule(descriptors, module, document, processedComments); } PsiClass[] classes = file.getClasses(); for (PsiClass aClass : classes) { ProgressManager.checkCanceled(); ProgressIndicatorProvider.checkCanceled(); addFoldsForClass(descriptors, aClass, document, processedComments, quick); } addFoldsForFileHeader(descriptors, file, document); addCommentsToFold(descriptors, root, document, processedComments); }