TreeModelBuilder (@NotNull Collection<? extends ChangeList> changeLists, boolean skipSingleDefaultChangeList, @Nullable Function<? super ChangeNodeDecorator, ? extends ChangeNodeDecorator> changeDecoratorProvider) { assert myProject != null; final RemoteRevisionsCache revisionsCache = RemoteRevisionsCache.getInstance(myProject); boolean skipChangeListNode = skipSingleDefaultChangeList && isSingleBlankChangeList(changeLists); for (ChangeList list : changeLists) { List<Change> changes = sorted(list.getChanges(), CHANGE_COMPARATOR); ChangeListRemoteState listRemoteState = new ChangeListRemoteState(changes.size()); ChangesBrowserNode<?> changesParent; if (!skipChangeListNode) { ChangesBrowserChangeListNode listNode = new ChangesBrowserChangeListNode(myProject, list, listRemoteState); listNode.markAsHelperNode(); insertSubtreeRoot(listNode); changesParent = listNode; } else { changesParent = myRoot; } for (int i = 0; i < changes.size(); i++) { Change change = changes.get(i); RemoteStatusChangeNodeDecorator baseDecorator = new RemoteStatusChangeNodeDecorator(revisionsCache, listRemoteState, i); ChangeNodeDecorator decorator = changeDecoratorProvider != null ? changeDecoratorProvider.apply(baseDecorator) : baseDecorator; insertChangeNode(change, changesParent, createChangeNode(change, decorator)); } } return this; }