From a6601b27e90235e0d01346dfe312b1a7f6bfe3ac Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Tue, 4 Oct 2016 19:37:25 +0300 Subject: [PATCH] Move: Show error message on applying to enum entries #KT-14182 Fixed --- ChangeLog.md | 1 + .../move/moveDeclarations/MoveKotlinDeclarationsHandler.kt | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 0c05affd95b..d7ff2d59219 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -239,6 +239,7 @@ These artifacts include extensions for the types available in the latter JDKs, s - [`KT-14157`](https://youtrack.jetbrains.com/issue/KT-14157) Rename: Rename do-while loop variables in the loop condition - [`KT-14128`](https://youtrack.jetbrains.com/issue/KT-14128), [`KT-13862`](https://youtrack.jetbrains.com/issue/KT-13862) Rename: Use qualified class name when looking for occurrences in non-code files - [`KT-6199`](https://youtrack.jetbrains.com/issue/KT-6199) Rename: Replace non-code class occurrences with new qualified name +- [`KT-14182`](https://youtrack.jetbrains.com/issue/KT-14182) Move: Show error message on applying to enum entries ##### New features diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsHandler.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsHandler.kt index 30d300bab51..c6d01262451 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsHandler.kt @@ -83,6 +83,12 @@ class MoveKotlinDeclarationsHandler : MoveHandlerDelegate() { return true } + if (elementsToSearch.any { it is KtEnumEntry }) { + val message = RefactoringBundle.getCannotRefactorMessage("Move declaration is not supported for enum entries") + CommonRefactoringUtil.showErrorHint(project, editor, message, MOVE_DECLARATIONS, null) + return true + } + when (container) { is PsiDirectory, is PsiPackage, is KtFile -> { val targetPackageName = MoveClassesOrPackagesImpl.getInitialTargetPackageName(targetContainer, elements)