Minor: Temporary rename of KotlinRefactoringUtil before conversion to Kotlin (to avoid conflict with existing kotlinRefactoringUtil.kt)
This commit is contained in:
@@ -22,7 +22,7 @@ import com.intellij.psi.PsiWhiteSpace;
|
|||||||
import com.intellij.util.IncorrectOperationException;
|
import com.intellij.util.IncorrectOperationException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.idea.KotlinBundle;
|
import org.jetbrains.kotlin.idea.KotlinBundle;
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil;
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil2;
|
||||||
import org.jetbrains.kotlin.psi.KtBlockExpression;
|
import org.jetbrains.kotlin.psi.KtBlockExpression;
|
||||||
import org.jetbrains.kotlin.psi.KtElement;
|
import org.jetbrains.kotlin.psi.KtElement;
|
||||||
import org.jetbrains.kotlin.psi.KtExpression;
|
import org.jetbrains.kotlin.psi.KtExpression;
|
||||||
@@ -44,7 +44,7 @@ public abstract class KotlinUnwrapRemoveBase extends AbstractUnwrapper<KotlinUnw
|
|||||||
@Override
|
@Override
|
||||||
public String getDescription(PsiElement e) {
|
public String getDescription(PsiElement e) {
|
||||||
assert e instanceof KtElement;
|
assert e instanceof KtElement;
|
||||||
return KotlinBundle.message(key, KotlinRefactoringUtil.getExpressionShortText((KtElement) e));
|
return KotlinBundle.message(key, KotlinRefactoringUtil2.getExpressionShortText((KtElement) e));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canExtractExpression(@NotNull KtExpression expression, @NotNull KtElement parent) {
|
protected boolean canExtractExpression(@NotNull KtExpression expression, @NotNull KtElement parent) {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.idea.findUsages.handlers.DelegatingFindMemberUsagesH
|
|||||||
import org.jetbrains.kotlin.idea.findUsages.handlers.KotlinFindClassUsagesHandler
|
import org.jetbrains.kotlin.idea.findUsages.handlers.KotlinFindClassUsagesHandler
|
||||||
import org.jetbrains.kotlin.idea.findUsages.handlers.KotlinFindMemberUsagesHandler
|
import org.jetbrains.kotlin.idea.findUsages.handlers.KotlinFindMemberUsagesHandler
|
||||||
import org.jetbrains.kotlin.idea.findUsages.handlers.KotlinTypeParameterFindUsagesHandler
|
import org.jetbrains.kotlin.idea.findUsages.handlers.KotlinTypeParameterFindUsagesHandler
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil2
|
||||||
import org.jetbrains.kotlin.plugin.findUsages.handlers.KotlinFindUsagesHandlerDecorator
|
import org.jetbrains.kotlin.plugin.findUsages.handlers.KotlinFindUsagesHandlerDecorator
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.isOverridable
|
import org.jetbrains.kotlin.psi.psiUtil.isOverridable
|
||||||
@@ -107,7 +107,7 @@ class KotlinFindUsagesHandlerFactory(project: Project) : FindUsagesHandlerFactor
|
|||||||
return KotlinFindMemberUsagesHandler.getInstance(declaration, factory = this)
|
return KotlinFindMemberUsagesHandler.getInstance(declaration, factory = this)
|
||||||
}
|
}
|
||||||
|
|
||||||
val declarationsToSearch = KotlinRefactoringUtil.checkSuperMethods(declaration, null, "super.methods.action.key.find.usages")
|
val declarationsToSearch = KotlinRefactoringUtil2.checkSuperMethods(declaration, null, "super.methods.action.key.find.usages")
|
||||||
return handlerForMultiple(declaration, declarationsToSearch)
|
return handlerForMultiple(declaration, declarationsToSearch)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -33,7 +33,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.kotlin.asJava.LightClassUtilsKt;
|
import org.jetbrains.kotlin.asJava.LightClassUtilsKt;
|
||||||
import org.jetbrains.kotlin.idea.KotlinBundle;
|
import org.jetbrains.kotlin.idea.KotlinBundle;
|
||||||
import org.jetbrains.kotlin.idea.findUsages.KotlinClassFindUsagesOptions;
|
import org.jetbrains.kotlin.idea.findUsages.KotlinClassFindUsagesOptions;
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil;
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil2;
|
||||||
import org.jetbrains.kotlin.psi.KtClass;
|
import org.jetbrains.kotlin.psi.KtClass;
|
||||||
import org.jetbrains.kotlin.psi.KtClassOrObject;
|
import org.jetbrains.kotlin.psi.KtClassOrObject;
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||||
@@ -154,7 +154,7 @@ public class KotlinFindClassUsagesDialog extends FindClassUsagesDialog {
|
|||||||
: klass.getUserData(ORIGINAL_CLASS);
|
: klass.getUserData(ORIGINAL_CLASS);
|
||||||
|
|
||||||
if (originalClass != null) {
|
if (originalClass != null) {
|
||||||
coloredComponent.append(KotlinRefactoringUtil.formatClass(originalClass));
|
coloredComponent.append(KotlinRefactoringUtil2.formatClass(originalClass));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -26,7 +26,7 @@ import com.intellij.ui.SimpleColoredComponent;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.idea.KotlinBundle;
|
import org.jetbrains.kotlin.idea.KotlinBundle;
|
||||||
import org.jetbrains.kotlin.idea.findUsages.KotlinFunctionFindUsagesOptions;
|
import org.jetbrains.kotlin.idea.findUsages.KotlinFunctionFindUsagesOptions;
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil;
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil2;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ public class KotlinFindFunctionUsagesDialog extends FindMethodUsagesDialog {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureLabelComponent(@NotNull SimpleColoredComponent coloredComponent) {
|
public void configureLabelComponent(@NotNull SimpleColoredComponent coloredComponent) {
|
||||||
coloredComponent.append(KotlinRefactoringUtil.formatJavaOrLightMethod((PsiMethod) myPsiElement));
|
coloredComponent.append(KotlinRefactoringUtil2.formatJavaOrLightMethod((PsiMethod) myPsiElement));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-2
@@ -68,8 +68,8 @@ import java.awt.*;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class KotlinRefactoringUtil {
|
public class KotlinRefactoringUtil2 {
|
||||||
private KotlinRefactoringUtil() {
|
private KotlinRefactoringUtil2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -27,7 +27,7 @@ import com.intellij.psi.util.PsiTreeUtil
|
|||||||
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
|
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
|
||||||
import org.jetbrains.kotlin.idea.refactoring.chooseContainerElementIfNecessary
|
import org.jetbrains.kotlin.idea.refactoring.chooseContainerElementIfNecessary
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringBundle
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringBundle
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil2
|
||||||
import org.jetbrains.kotlin.idea.util.psi.patternMatching.KotlinPsiRange
|
import org.jetbrains.kotlin.idea.util.psi.patternMatching.KotlinPsiRange
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.*
|
import org.jetbrains.kotlin.psi.psiUtil.*
|
||||||
@@ -122,7 +122,7 @@ fun selectElementsWithTargetParent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun selectSingleElement() {
|
fun selectSingleElement() {
|
||||||
KotlinRefactoringUtil.selectElement(editor, file, false, elementKinds) { expr ->
|
KotlinRefactoringUtil2.selectElement(editor, file, false, elementKinds) { expr ->
|
||||||
if (expr != null) {
|
if (expr != null) {
|
||||||
selectTargetContainer(listOf(expr))
|
selectTargetContainer(listOf(expr))
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -719,11 +719,11 @@ object KotlinIntroduceVariableHandler : RefactoringActionHandler {
|
|||||||
if (file !is KtFile) return
|
if (file !is KtFile) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
KotlinRefactoringUtil.selectElement(editor, file, listOf(CodeInsightUtils.ElementKind.EXPRESSION)) {
|
KotlinRefactoringUtil2.selectElement(editor, file, listOf(CodeInsightUtils.ElementKind.EXPRESSION)) {
|
||||||
doRefactoring(project, editor, it as KtExpression?, null, null)
|
doRefactoring(project, editor, it as KtExpression?, null, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e: KotlinRefactoringUtil.IntroduceRefactoringException) {
|
catch (e: KotlinRefactoringUtil2.IntroduceRefactoringException) {
|
||||||
showErrorHint(project, editor, e.message!!)
|
showErrorHint(project, editor, e.message!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -37,7 +37,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
|||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.kotlin.idea.KotlinBundle;
|
import org.jetbrains.kotlin.idea.KotlinBundle;
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil;
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil2;
|
||||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers;
|
||||||
import org.jetbrains.kotlin.psi.KtElement;
|
import org.jetbrains.kotlin.psi.KtElement;
|
||||||
import org.jetbrains.kotlin.psi.KtNamedFunction;
|
import org.jetbrains.kotlin.psi.KtNamedFunction;
|
||||||
@@ -110,7 +110,7 @@ class KotlinOverridingDialog extends DialogWrapper {
|
|||||||
|
|
||||||
assert element instanceof PsiMethod
|
assert element instanceof PsiMethod
|
||||||
: "Method accepts only kotlin functions/properties and java methods, but '" + element.getText() + "' was found";
|
: "Method accepts only kotlin functions/properties and java methods, but '" + element.getText() + "' was found";
|
||||||
return KotlinRefactoringUtil.formatPsiMethod((PsiMethod) element, true, false);
|
return KotlinRefactoringUtil2.formatPsiMethod((PsiMethod) element, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+8
-8
@@ -39,7 +39,7 @@ import org.jetbrains.kotlin.descriptors.Modality
|
|||||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
import org.jetbrains.kotlin.idea.core.deleteElementAndCleanParent
|
import org.jetbrains.kotlin.idea.core.deleteElementAndCleanParent
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil2
|
||||||
import org.jetbrains.kotlin.idea.references.KtReference
|
import org.jetbrains.kotlin.idea.references.KtReference
|
||||||
import org.jetbrains.kotlin.idea.search.usagesSearch.processDelegationCallConstructorUsages
|
import org.jetbrains.kotlin.idea.search.usagesSearch.processDelegationCallConstructorUsages
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens
|
import org.jetbrains.kotlin.lexer.KtTokens
|
||||||
@@ -260,10 +260,10 @@ class KotlinSafeDeleteProcessor : JavaSafeDeleteProcessor() {
|
|||||||
.mapTo(ArrayList<String>()) { overridenDescriptor ->
|
.mapTo(ArrayList<String>()) { overridenDescriptor ->
|
||||||
KotlinBundle.message(
|
KotlinBundle.message(
|
||||||
"x.implements.y",
|
"x.implements.y",
|
||||||
KotlinRefactoringUtil.formatFunction(declarationDescriptor, true),
|
KotlinRefactoringUtil2.formatFunction(declarationDescriptor, true),
|
||||||
KotlinRefactoringUtil.formatClass(declarationDescriptor.containingDeclaration, true),
|
KotlinRefactoringUtil2.formatClass(declarationDescriptor.containingDeclaration, true),
|
||||||
KotlinRefactoringUtil.formatFunction(overridenDescriptor, true),
|
KotlinRefactoringUtil2.formatFunction(overridenDescriptor, true),
|
||||||
KotlinRefactoringUtil.formatClass(overridenDescriptor.containingDeclaration, true)
|
KotlinRefactoringUtil2.formatClass(overridenDescriptor.containingDeclaration, true)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -332,18 +332,18 @@ class KotlinSafeDeleteProcessor : JavaSafeDeleteProcessor() {
|
|||||||
when (element) {
|
when (element) {
|
||||||
is KtParameter ->
|
is KtParameter ->
|
||||||
return element.toPsiParameters().flatMap { psiParameter ->
|
return element.toPsiParameters().flatMap { psiParameter ->
|
||||||
KotlinRefactoringUtil.checkParametersInMethodHierarchy(psiParameter) ?: emptyList()
|
KotlinRefactoringUtil2.checkParametersInMethodHierarchy(psiParameter) ?: emptyList()
|
||||||
}.ifEmpty { listOf(element) }
|
}.ifEmpty { listOf(element) }
|
||||||
|
|
||||||
is PsiParameter ->
|
is PsiParameter ->
|
||||||
return KotlinRefactoringUtil.checkParametersInMethodHierarchy(element)
|
return KotlinRefactoringUtil2.checkParametersInMethodHierarchy(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ApplicationManager.getApplication()!!.isUnitTestMode) return Collections.singletonList(element)
|
if (ApplicationManager.getApplication()!!.isUnitTestMode) return Collections.singletonList(element)
|
||||||
|
|
||||||
return when (element) {
|
return when (element) {
|
||||||
is KtNamedFunction, is KtProperty ->
|
is KtNamedFunction, is KtProperty ->
|
||||||
KotlinRefactoringUtil.checkSuperMethods(
|
KotlinRefactoringUtil2.checkSuperMethods(
|
||||||
element as KtDeclaration, allElementsToDelete, "super.methods.delete.with.usage.search"
|
element as KtDeclaration, allElementsToDelete, "super.methods.delete.with.usage.search"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import com.intellij.testFramework.LightCodeInsightTestCase;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils;
|
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils;
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil;
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil2;
|
||||||
import org.jetbrains.kotlin.psi.KtFile;
|
import org.jetbrains.kotlin.psi.KtFile;
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||||
|
|
||||||
@@ -34,11 +34,11 @@ public abstract class AbstractExpressionSelectionTest extends LightCodeInsightTe
|
|||||||
final String expectedExpression = KotlinTestUtils.getLastCommentInFile((KtFile) getFile());
|
final String expectedExpression = KotlinTestUtils.getLastCommentInFile((KtFile) getFile());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
KotlinRefactoringUtil.selectElement(
|
KotlinRefactoringUtil2.selectElement(
|
||||||
getEditor(),
|
getEditor(),
|
||||||
(KtFile) getFile(),
|
(KtFile) getFile(),
|
||||||
Collections.singletonList(CodeInsightUtils.ElementKind.EXPRESSION),
|
Collections.singletonList(CodeInsightUtils.ElementKind.EXPRESSION),
|
||||||
new KotlinRefactoringUtil.SelectElementCallback() {
|
new KotlinRefactoringUtil2.SelectElementCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void run(@Nullable PsiElement element) {
|
public void run(@Nullable PsiElement element) {
|
||||||
assertNotNull("Selected expression mustn't be null", element);
|
assertNotNull("Selected expression mustn't be null", element);
|
||||||
@@ -47,7 +47,7 @@ public abstract class AbstractExpressionSelectionTest extends LightCodeInsightTe
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (KotlinRefactoringUtil.IntroduceRefactoringException e) {
|
catch (KotlinRefactoringUtil2.IntroduceRefactoringException e) {
|
||||||
assertEquals(expectedExpression, "");
|
assertEquals(expectedExpression, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
|||||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils;
|
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils;
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil;
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil2;
|
||||||
import org.jetbrains.kotlin.psi.KtElement;
|
import org.jetbrains.kotlin.psi.KtElement;
|
||||||
import org.jetbrains.kotlin.psi.KtFile;
|
import org.jetbrains.kotlin.psi.KtFile;
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||||
@@ -34,12 +34,12 @@ public abstract class AbstractSmartSelectionTest extends LightCodeInsightTestCas
|
|||||||
configureByFile(path);
|
configureByFile(path);
|
||||||
String expectedResultText = KotlinTestUtils.getLastCommentInFile((KtFile) getFile());
|
String expectedResultText = KotlinTestUtils.getLastCommentInFile((KtFile) getFile());
|
||||||
|
|
||||||
List<KtElement> elements = KotlinRefactoringUtil.getSmartSelectSuggestions(
|
List<KtElement> elements = KotlinRefactoringUtil2.getSmartSelectSuggestions(
|
||||||
getFile(), getEditor().getCaretModel().getOffset(), CodeInsightUtils.ElementKind.EXPRESSION);
|
getFile(), getEditor().getCaretModel().getOffset(), CodeInsightUtils.ElementKind.EXPRESSION);
|
||||||
|
|
||||||
List<String> textualExpressions = new ArrayList<String>();
|
List<String> textualExpressions = new ArrayList<String>();
|
||||||
for (KtElement element : elements) {
|
for (KtElement element : elements) {
|
||||||
textualExpressions.add(KotlinRefactoringUtil.getExpressionShortText(element));
|
textualExpressions.add(KotlinRefactoringUtil2.getExpressionShortText(element));
|
||||||
}
|
}
|
||||||
assertEquals(expectedResultText, StringUtil.join(textualExpressions, "\n"));
|
assertEquals(expectedResultText, StringUtil.join(textualExpressions, "\n"));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -37,7 +37,7 @@ import com.intellij.refactoring.util.occurrences.ExpressionOccurrenceManager
|
|||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
||||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
|
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil2
|
||||||
import org.jetbrains.kotlin.idea.refactoring.introduce.extractFunction.EXTRACT_FUNCTION
|
import org.jetbrains.kotlin.idea.refactoring.introduce.extractFunction.EXTRACT_FUNCTION
|
||||||
import org.jetbrains.kotlin.idea.refactoring.introduce.extractFunction.ExtractKotlinFunctionHandler
|
import org.jetbrains.kotlin.idea.refactoring.introduce.extractFunction.ExtractKotlinFunctionHandler
|
||||||
import org.jetbrains.kotlin.idea.refactoring.introduce.extractionEngine.*
|
import org.jetbrains.kotlin.idea.refactoring.introduce.extractionEngine.*
|
||||||
@@ -115,7 +115,7 @@ abstract class AbstractExtractionTest() : KotlinLightCodeInsightFixtureTestCase(
|
|||||||
with (handler) {
|
with (handler) {
|
||||||
val target = (file as KtFile).findElementByCommentPrefix("// TARGET:") as? KtNamedDeclaration
|
val target = (file as KtFile).findElementByCommentPrefix("// TARGET:") as? KtNamedDeclaration
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
KotlinRefactoringUtil.selectElement(fixture.getEditor(), file, true, listOf(CodeInsightUtils.ElementKind.EXPRESSION)) { element ->
|
KotlinRefactoringUtil2.selectElement(fixture.getEditor(), file, true, listOf(CodeInsightUtils.ElementKind.EXPRESSION)) { element ->
|
||||||
invoke(fixture.getProject(), fixture.getEditor(), element as KtExpression, target)
|
invoke(fixture.getProject(), fixture.getEditor(), element as KtExpression, target)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -22,7 +22,7 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
|||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
|
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
|
||||||
import org.jetbrains.kotlin.idea.core.KotlinNameSuggester
|
import org.jetbrains.kotlin.idea.core.KotlinNameSuggester
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtil2
|
||||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||||
import org.jetbrains.kotlin.psi.KtExpression
|
import org.jetbrains.kotlin.psi.KtExpression
|
||||||
@@ -90,7 +90,7 @@ class KotlinNameSuggesterTest : LightCodeInsightFixtureTestCase() {
|
|||||||
if (withRuntime) {
|
if (withRuntime) {
|
||||||
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(myModule, PluginTestCaseBase.mockJdk())
|
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(myModule, PluginTestCaseBase.mockJdk())
|
||||||
}
|
}
|
||||||
KotlinRefactoringUtil.selectElement(myFixture.editor, file, listOf(CodeInsightUtils.ElementKind.EXPRESSION), object : KotlinRefactoringUtil.SelectElementCallback {
|
KotlinRefactoringUtil2.selectElement(myFixture.editor, file, listOf(CodeInsightUtils.ElementKind.EXPRESSION), object : KotlinRefactoringUtil2.SelectElementCallback {
|
||||||
override fun run(element: PsiElement?) {
|
override fun run(element: PsiElement?) {
|
||||||
val names = KotlinNameSuggester
|
val names = KotlinNameSuggester
|
||||||
.suggestNamesByExpressionAndType(element as KtExpression,
|
.suggestNamesByExpressionAndType(element as KtExpression,
|
||||||
@@ -104,7 +104,7 @@ class KotlinNameSuggesterTest : LightCodeInsightFixtureTestCase() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
catch (e: KotlinRefactoringUtil.IntroduceRefactoringException) {
|
catch (e: KotlinRefactoringUtil2.IntroduceRefactoringException) {
|
||||||
throw AssertionError("Failed to find expression: " + e.message)
|
throw AssertionError("Failed to find expression: " + e.message)
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user