void (@NotNull AnActionEvent e) { final LayoutTreeSelection selection = myArtifactEditor.getLayoutTreeComponent().getSelection(); final PackagingElement<?> element = selection.getElementIfSingle(); final boolean visible = element instanceof RenameablePackagingElement && ((RenameablePackagingElement)element).canBeRenamed(); e.getPresentation().setEnabledAndVisible(visible); }