void (final Runnable r) { invokeLater(myProject, () -> { if (!ToolWindowManagerEx.getInstanceEx(myProject).shouldUpdateToolWindowContent(myToolWindow)) return; boolean shouldCreate = myStructure == null; if (shouldCreate) { initStructure(); } myTree.setPaintBusy(true); try { r.run(); if (shouldCreate) { restoreTreeState(); } } finally { myTree.setPaintBusy(false); } }); }