void (Node parent, @NotNull Tree tree) { if (parent == null) { removePath(new CachingTreePath(object)); tree.removeEmpty(this); } else if (parent.loading == this) { parent.loading = null; } else if (parent.paths.isEmpty()) { LOG.warn("remove from invalid parent"); } else { parent.paths.forEach(path -> removePath(path.pathByAddingChild(object))); tree.removeEmpty(this); } }