void (Tree tree, JComponent myToolbar, JBPopup myPopup) { Ref<Boolean> canShrink = Ref.create(true); ((XDebuggerTree)tree).addTreeListener(new XDebuggerTreeListener() { @Override public void childrenLoaded(@NotNull XDebuggerTreeNode node, @NotNull List<? extends XValueContainerNode<?>> children, boolean last) { if (last) { updateDebugPopupBounds(tree, myToolbar, myPopup, canShrink.get()); canShrink.set(false); } } @Override public void nodeLoaded(@NotNull RestorableStateNode node, @NotNull String name) { updateDebugPopupBounds(tree, myToolbar, myPopup, false); } }); updateDebugPopupBounds(tree, myToolbar, myPopup, canShrink.get()); }