void () { // We now know that the model is updated, but the tree may be still in the process of updating, // so we only finish measuring when the tree is done and the EDT is free again. SwingUtilities.invokeLater(() -> { var finish = System.currentTimeMillis(); ProjectViewPerformanceCollector.logExpandDirDuration(finish - start); }); // Detach right now to avoid sending multiple values. detach(); }