@Override
 public void invoke(
     final @NotNull Project project, Editor editor, final PsiFile file, DataContext dataContext) {
   final ResourceBundleEditor resourceBundleEditor =
       (ResourceBundleEditor) PlatformDataKeys.FILE_EDITOR.getData(dataContext);
   assert resourceBundleEditor != null;
   final ResourceBundleEditorViewElement selectedElement =
       resourceBundleEditor.getSelectedElementIfOnlyOne();
   if (selectedElement != null) {
     CommandProcessor.getInstance()
         .runUndoTransparentAction(
             () -> {
               if (selectedElement instanceof PropertiesPrefixGroup) {
                 final PropertiesPrefixGroup group = (PropertiesPrefixGroup) selectedElement;
                 ResourceBundleRenameUtil.renameResourceBundleKeySection(
                     getPsiElementsFromGroup(group),
                     group.getPresentableName(),
                     group.getPrefix().length() - group.getPresentableName().length());
               } else if (selectedElement instanceof ResourceBundlePropertyStructureViewElement) {
                 final PsiElement psiElement =
                     ((ResourceBundlePropertyStructureViewElement) selectedElement)
                         .getProperty()
                         .getPsiElement();
                 ResourceBundleRenameUtil.renameResourceBundleKey(psiElement, project);
               } else if (selectedElement instanceof ResourceBundleFileStructureViewElement) {
                 ResourceBundleRenameUtil.renameResourceBundleBaseName(
                     ((ResourceBundleFileStructureViewElement) selectedElement).getValue(),
                     project);
               } else {
                 throw new IllegalStateException(
                     "unsupported type: " + selectedElement.getClass());
               }
             });
   }
 }
 private static List<PsiElement> getPsiElementsFromGroup(
     final PropertiesPrefixGroup propertiesPrefixGroup) {
   return ContainerUtil.mapNotNull(
       propertiesPrefixGroup.getChildren(),
       (NullableFunction<TreeElement, PsiElement>)
           treeElement -> {
             if (treeElement instanceof PropertiesStructureViewElement) {
               return ((PropertiesStructureViewElement) treeElement).getValue().getPsiElement();
             }
             if (treeElement instanceof ResourceBundlePropertyStructureViewElement) {
               return ((ResourceBundlePropertyStructureViewElement) treeElement)
                   .getProperty()
                   .getPsiElement();
             }
             return null;
           });
 }