void () { PackageDependenciesNode root = new RootNode(myProject); final PackageNode packageNode = getSelectedPackage(myLeftTree); if (packageNode != null) { boolean group = mySettings.UI_GROUP_BY_SCOPE_TYPE; mySettings.UI_GROUP_BY_SCOPE_TYPE = false; final PsiPackage aPackage = (PsiPackage)packageNode.getPsiElement(); final Set<List<PsiPackage>> cyclesOfPackages = myDependencies.get(aPackage); for (List<PsiPackage> packCycle : cyclesOfPackages) { PackageDependenciesNode[] nodes = new PackageDependenciesNode[packCycle.size()]; for (int i = packCycle.size() - 1; i >= 0; i--) { final PsiPackage psiPackage = packCycle.get(i); PsiPackage nextPackage = packCycle.get(i == 0 ? packCycle.size() - 1 : i - 1); PsiPackage prevPackage = packCycle.get(i == packCycle.size() - 1 ? 0 : i + 1); final Set<PsiFile> dependentFilesInPackage = myBuilder.getDependentFilesInPackage(prevPackage, psiPackage, nextPackage); final PackageDependenciesNode pack = (PackageDependenciesNode)TreeModelBuilder .createTreeModel(myProject, false, dependentFilesInPackage, __ -> false, mySettings).getRoot(); nodes[i] = hideEmptyMiddlePackages((PackageDependenciesNode)pack.getChildAt(0), new StringBuffer()); } PackageDependenciesNode cycleNode = new CycleNode(myProject); for (PackageDependenciesNode node : nodes) { node.setEquals(true); cycleNode.insert(node, 0); } root.add(cycleNode); } mySettings.UI_GROUP_BY_SCOPE_TYPE = group; } myRightTreeExpansionMonitor.freeze(); myRightTree.setModel(new TreeModel(root, -1, -1)); myRightTreeExpansionMonitor.restore(); expandFirstLevel(myRightTree); }