void (@NotNull AnActionEvent e) { final LayoutTreeComponent treeComponent = myArtifactEditor.getLayoutTreeComponent(); final LayoutTreeSelection selection = treeComponent.getSelection(); final CompositePackagingElement<?> parent = selection.getCommonParentElement(); if (parent == null) return; final PackagingElementNode<?> parentNode = selection.getNodes().get(0).getParentNode(); if (parentNode == null) return; if (!treeComponent.checkCanModifyChildren(parent, parentNode, selection.getNodes())) { return; } final CompositePackagingElementType<?>[] types = PackagingElementFactory.getInstance().getCompositeElementTypes(); final List<PackagingElement<?>> selected = selection.getElements(); if (types.length == 1) { surroundWith(types[0], parent, selected, treeComponent); } else { JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<CompositePackagingElementType>( JavaUiBundle.message("popup.title.surround.with"), types) { @Override public Icon getIconFor(CompositePackagingElementType aValue) { return aValue.getCreateElementIcon(); } @NotNull @Override public String getTextFor(CompositePackagingElementType value) { return value.getPresentableName(); } @Override public PopupStep onChosen(final CompositePackagingElementType selectedValue, boolean finalChoice) { return doFinalStep(() -> surroundWith(selectedValue, parent, selected, treeComponent)); } }).showInBestPositionFor(e.getDataContext()); } }