void (final @NotNull Project project, Editor editor, final PsiFile file, DataContext dataContext) { final ResourceBundleEditor resourceBundleEditor = (ResourceBundleEditor)PlatformCoreDataKeys.FILE_EDITOR.getData(dataContext); assert resourceBundleEditor != null; final Object selectedElement = resourceBundleEditor.getSelectedElementIfOnlyOne(); if (selectedElement != null) { CommandProcessor.getInstance().runUndoTransparentAction(() -> { if (selectedElement instanceof PropertiesPrefixGroup group) { ResourceBundleRenameUtil.renameResourceBundleKeySection(getPsiElementsFromGroup(group), group.getPresentableName(), group.getPrefix().length() - group.getPresentableName().length()); } else if (selectedElement instanceof PropertyStructureViewElement) { final PsiElement psiElement = ((PropertyStructureViewElement)selectedElement).getPsiElement(); ResourceBundleRenameUtil.renameResourceBundleKey(psiElement, project); } else if (selectedElement instanceof ResourceBundleFileStructureViewElement) { ResourceBundleRenameUtil.renameResourceBundleBaseName(((ResourceBundleFileStructureViewElement)selectedElement).getValue(), project); } else { throw new IllegalStateException("unsupported type: " + selectedElement.getClass()); } }); } }