void (@NotNull VirtualFile file) { // find first valid parent for removed file while (!file.isValid()) { file = file.getParent(); if (file == null) return; } SmartList<TreePath> structures = new SmartList<>(); SmartList<TreePath> presentations = new SmartList<>(); myAsyncTreeModel.accept(new ProjectViewFileVisitor(file, structures::add) { @NotNull @Override protected Action visit(@NotNull TreePath path, @NotNull AbstractTreeNode node, @NotNull VirtualFile element) { Action action = super.visit(path, node, element); if (action == Action.CONTINUE) presentations.add(path); return action; } }, false).onSuccess(path -> { update(presentations, false); update(structures, true); }); }