@Override public void invoke( @NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) { ResourceBundleEditor bundleEditor = ResourceBundleUtil.getEditor(dataContext); if (bundleEditor == null) { return; } String propertyName = bundleEditor.getState(FileEditorStateLevel.NAVIGATION).getPropertyName(); if (propertyName == null) { return; } ResourceBundle bundle = ResourceBundleUtil.getResourceBundleFromDataContext(dataContext); if (bundle == null) { return; } Messages.showInputDialog( project, PropertiesBundle.message("rename.bundle.enter.new.resource.bundle.key.name.prompt.text"), PropertiesBundle.message("rename.resource.bundle.key.dialog.title"), Messages.getQuestionIcon(), propertyName, new ResourceBundleKeyRenameValidator(project, bundleEditor, bundle, propertyName)); }
@Override public boolean isAvailableOnDataContext(DataContext dataContext) { ResourceBundleEditor editor = ResourceBundleUtil.getEditor(dataContext); if (editor == null) { return false; } return editor.getState(FileEditorStateLevel.NAVIGATION).getPropertyName() != null; }