void () { final Set<PsiFile> set = new HashSet<>(); ContainerUtil.addAll(set, getPackageDirectory("package1").getFiles()); ContainerUtil.addAll(set, getPackageDirectory("package1/package2/package3").getFiles()); ContainerUtil.addAll(set, getPackageDirectory(".").getFiles()); final DependenciesPanel.DependencyPanelSettings panelSettings = new DependenciesPanel.DependencyPanelSettings(); panelSettings.UI_COMPACT_EMPTY_MIDDLE_PACKAGES = false; panelSettings.UI_FLATTEN_PACKAGES = false; panelSettings.UI_SHOW_FILES = true; panelSettings.UI_FILTER_LEGALS = false; panelSettings.UI_SHOW_MODULES = true; panelSettings.UI_GROUP_BY_SCOPE_TYPE = false; TreeModel model = FileTreeModelBuilder.createTreeModel(getProject(), false, set, ALL_MARKED, panelSettings); JTree tree = new Tree(); TreeTestUtil.assertTreeUI(tree); tree.setModel(model); PlatformTestUtil.expandAll(tree); PlatformTestUtil.assertTreeEqual(tree, """ -Root -structure -src -package1 -package2 -package3 Test3.java Test1.java Test.java """); panelSettings.UI_COMPACT_EMPTY_MIDDLE_PACKAGES = true; model = FileTreeModelBuilder.createTreeModel(getProject(), false, set, ALL_MARKED, panelSettings); tree.setModel(model); PlatformTestUtil.expandAll(tree); TreeUtil.traverse((TreeNode)model.getRoot(), node -> { ((DefaultMutableTreeNode)node).setUserObject(node.toString()); return true; }); PlatformTestUtil.assertTreeEqual(tree, """ -Root -structure -src -package1 -package2/package3 Test3.java Test1.java Test.java """); panelSettings.UI_FLATTEN_PACKAGES = true; model = FileTreeModelBuilder.createTreeModel(getProject(), false, set, ALL_MARKED, panelSettings); tree.setModel(model); PlatformTestUtil.expandAll(tree); PlatformTestUtil.assertTreeEqual(tree, """ -Root -structure -src -package1 Test1.java -package1/package2/package3 Test3.java Test.java """); }