Refactoring: Rename AbstractExtractFunctionAction ->AbstractIntroduceAction and move to 'introduce' package
This commit is contained in:
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2015 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.idea.refactoring.introduce
|
||||||
|
|
||||||
|
import com.intellij.refactoring.actions.*
|
||||||
|
import com.intellij.psi.*
|
||||||
|
import org.jetbrains.kotlin.psi.*
|
||||||
|
|
||||||
|
public abstract class AbstractIntroduceAction : BasePlatformRefactoringAction() {
|
||||||
|
{
|
||||||
|
setInjectedContext(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun isAvailableInEditorOnly(): Boolean = true
|
||||||
|
|
||||||
|
protected override fun isEnabledOnElements(elements: Array<out PsiElement>): Boolean =
|
||||||
|
elements.all { it is JetElement }
|
||||||
|
}
|
||||||
+3
-16
@@ -16,30 +16,17 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.refactoring.introduce.extractFunction
|
package org.jetbrains.kotlin.idea.refactoring.introduce.extractFunction
|
||||||
|
|
||||||
import com.intellij.refactoring.actions.BasePlatformRefactoringAction
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.refactoring.RefactoringActionHandler
|
import com.intellij.refactoring.RefactoringActionHandler
|
||||||
import com.intellij.lang.refactoring.RefactoringSupportProvider
|
import com.intellij.lang.refactoring.RefactoringSupportProvider
|
||||||
import org.jetbrains.kotlin.psi.JetElement
|
|
||||||
import org.jetbrains.kotlin.idea.refactoring.JetRefactoringSupportProvider
|
import org.jetbrains.kotlin.idea.refactoring.JetRefactoringSupportProvider
|
||||||
|
import org.jetbrains.kotlin.idea.refactoring.introduce.*
|
||||||
|
|
||||||
public abstract class AbstractExtractFunctionAction: BasePlatformRefactoringAction() {
|
public class ExtractFunctionAction: AbstractIntroduceAction() {
|
||||||
{
|
|
||||||
setInjectedContext(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isAvailableInEditorOnly(): Boolean = true
|
|
||||||
|
|
||||||
protected override fun isEnabledOnElements(elements: Array<out PsiElement>): Boolean =
|
|
||||||
elements.all { it is JetElement }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ExtractFunctionAction: AbstractExtractFunctionAction() {
|
|
||||||
override fun getRefactoringHandler(provider: RefactoringSupportProvider): RefactoringActionHandler? =
|
override fun getRefactoringHandler(provider: RefactoringSupportProvider): RefactoringActionHandler? =
|
||||||
(provider as? JetRefactoringSupportProvider)?.getExtractFunctionHandler()
|
(provider as? JetRefactoringSupportProvider)?.getExtractFunctionHandler()
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ExtractFunctionToScopeAction: AbstractExtractFunctionAction() {
|
public class ExtractFunctionToScopeAction: AbstractIntroduceAction() {
|
||||||
override fun getRefactoringHandler(provider: RefactoringSupportProvider): RefactoringActionHandler? =
|
override fun getRefactoringHandler(provider: RefactoringSupportProvider): RefactoringActionHandler? =
|
||||||
(provider as? JetRefactoringSupportProvider)?.getExtractFunctionToScopeHandler()
|
(provider as? JetRefactoringSupportProvider)?.getExtractFunctionToScopeHandler()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user