void (@NotNull StaticFilePath pathKey, @NotNull ChangesBrowserNode<?> subtreeRoot, @NotNull ChangesBrowserNode<?> node, @NotNull Function<StaticFilePath, ChangesBrowserNode<?>> nodeBuilder) { ProgressManager.checkCanceled(); PATH_NODE_BUILDER.set(subtreeRoot, nodeBuilder); if (!GROUPING_POLICY.isIn(subtreeRoot)) { ChangesGroupingPolicy policy = myProject != null ? myGroupingPolicyFactory.createGroupingPolicy(myProject, myModel) : NoneChangesGroupingPolicy.INSTANCE; GROUPING_POLICY.set(subtreeRoot, policy); } ChangesBrowserNode<?> parentNode = ReadAction.compute( () -> notNull(GROUPING_POLICY.getRequired(subtreeRoot).getParentNodeFor(pathKey, node, subtreeRoot), subtreeRoot)); ChangesBrowserNode<?> cachingRoot = BaseChangesGroupingPolicy.getCachingRoot(parentNode, subtreeRoot); myModel.insertNodeInto(node, parentNode, myModel.getChildCount(parentNode)); if (pathKey.isDirectory()) { DIRECTORY_CACHE.getValue(cachingRoot).put(pathKey.getKey(), node); } }