void (@NotNull AnActionEvent e) { RadComponent rootComponent = myArea.getRootComponent(); if (rootComponent != null) { final Set<RadComponent> parents = RadComponent.getParents(myArea.getSelection()); final List<RadComponent> components = new ArrayList<>(); rootComponent.accept(new RadComponentVisitor() { @Override public void endVisit(RadComponent component) { if (parents.contains(component.getParent())) { components.add(component); } } }, true); myArea.setSelection(components); } }