void (Object @NotNull [] elements, int index, boolean parentsOnly, boolean checkIfInStricture, boolean canSmartExpand, @NotNull ActionCallback done, int currentDepth) { if (elements.length <= 0) { done.setDone(); return; } if (index >= elements.length) { return; } int[] actualDepth = {currentDepth}; boolean breakCallChain = false; if (actualDepth[0] > Registry.intValue("ide.tree.expandRecursionDepth")) { actualDepth[0] = 0; breakCallChain = true; } Runnable expandRunnable = new TreeRunnable("AbstractTreeUi.expandNext") { @Override public void perform() { _expand(elements[index], new TreeRunnable("AbstractTreeUi.expandNext: on done") { @Override public void perform() { done.setDone(); expandNext(elements, index + 1, parentsOnly, checkIfInStricture, canSmartExpand, done, actualDepth[0] + 1); } }, parentsOnly, checkIfInStricture, canSmartExpand); } }; if (breakCallChain && !isPassthroughMode()) { SwingUtilities.invokeLater(expandRunnable); } else { expandRunnable.run(); } }