void (@NotNull final AnActionEvent e) { final Object o = getSelectedObject(); if (o instanceof Artifact selected) { ModifiableArtifactModel artifactModel = myPackagingEditorContext.getOrCreateModifiableArtifactModel(); String suggestedName = ArtifactUtil.generateUniqueArtifactName(selected.getName(), artifactModel); final String newName = Messages.showInputDialog(JavaUiBundle.message("label.enter.artifact.name"), JavaUiBundle.message("dialog.title.copy.artifact"), COPY_ICON, suggestedName, new NonEmptyInputValidator()); if (newName == null) return; CompositePackagingElement<?> rootCopy = ArtifactUtil.copyFromRoot(selected.getRootElement(), myProject); artifactModel.addArtifact(newName, selected.getArtifactType(), rootCopy); } }