Action (@NotNull TreePath path) { if (path.getParentPath() == null) return Action.CONTINUE; for (TreePath treePath : myPaths) { if (treePath.equals(path)) { myPaths.remove(treePath); return myPaths.isEmpty() ? Action.INTERRUPT : Action.CONTINUE; } } return Action.SKIP_CHILDREN; }