From 179f71a4f4494d7fead409d31e304aa75e4ae82c Mon Sep 17 00:00:00 2001 From: Bart van Helvert Date: Wed, 26 Apr 2023 16:57:16 +0200 Subject: [PATCH] [kotlin] Introduce `KotlinMoveRefactoringSupport` ^KTIJ-23273 A compiler version agnostic interface to be used in common code for the move refactoring. GitOrigin-RevId: 57c8b6291e6da618de552d38ab87ee053dfed947 --- .../refactoring/move/K1MoveRefactoringSupport.kt | 14 ++++++++++++++ .../k1/resources/META-INF/refactorings-fe10.xml | 3 +++ .../move/KotlinMoveRefactoringSupport.kt | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/K1MoveRefactoringSupport.kt create mode 100644 plugins/kotlin/refactorings/kotlin.refactorings.common/src/org/jetbrains/kotlin/idea/refactoring/move/KotlinMoveRefactoringSupport.kt diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/K1MoveRefactoringSupport.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/K1MoveRefactoringSupport.kt new file mode 100644 index 000000000000..8347d1f7d461 --- /dev/null +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/K1MoveRefactoringSupport.kt @@ -0,0 +1,14 @@ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package org.jetbrains.kotlin.idea.refactoring.move + +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiReference +import com.intellij.psi.search.SearchScope +import org.jetbrains.kotlin.idea.base.searching.usages.KotlinFindUsagesHandlerFactory + +internal class K1MoveRefactoringSupport : KotlinMoveRefactoringSupport { + override fun findReferencesToHighlight(target: PsiElement, searchScope: SearchScope): Collection { + return KotlinFindUsagesHandlerFactory(target.project).createFindUsagesHandler(target, false) + .findReferencesToHighlight(target, searchScope) + } +} \ No newline at end of file diff --git a/plugins/kotlin/plugin/k1/resources/META-INF/refactorings-fe10.xml b/plugins/kotlin/plugin/k1/resources/META-INF/refactorings-fe10.xml index 8ca4b1d689db..32329adf88f4 100644 --- a/plugins/kotlin/plugin/k1/resources/META-INF/refactorings-fe10.xml +++ b/plugins/kotlin/plugin/k1/resources/META-INF/refactorings-fe10.xml @@ -35,6 +35,9 @@ + + +} \ No newline at end of file