TreeElement (@NotNull TreeElement child, @NotNull CompositeElement parent) { child.rawRemoveUpToWithoutNotifications(null, false); while (true) { child.setTreeParent(parent); TreeElement treeNext = child.getTreeNext(); if (treeNext == null) return child; child = treeNext; } }