From 6b014fa166c208e08bbaf0911a6f11cfba766d9c Mon Sep 17 00:00:00 2001 From: Alexandr Suhinin Date: Mon, 5 Aug 2024 10:24:26 +0300 Subject: [PATCH] [extract method] remove redundant method GitOrigin-RevId: 9b47742682fdb7e16d33987d4f64e1d34666ffde --- .../extractMethod/newImpl/ExtractOptionsPipeline.kt | 12 ------------ .../extractMethod/newImpl/MethodExtractor.kt | 5 +++-- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/ExtractOptionsPipeline.kt b/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/ExtractOptionsPipeline.kt index ce9fdefc8b09..68d168e56d0e 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/ExtractOptionsPipeline.kt +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/ExtractOptionsPipeline.kt @@ -31,7 +31,6 @@ import com.intellij.refactoring.extractMethod.newImpl.structures.InputParameter import com.intellij.refactoring.util.RefactoringUtil import com.intellij.refactoring.util.VariableData import com.siyeh.ig.psiutils.ClassUtils -import kotlinx.coroutines.suspendCancellableCoroutine import java.util.concurrent.CompletableFuture object ExtractMethodPipeline { @@ -144,17 +143,6 @@ object ExtractMethodPipeline { .toList() } - suspend fun selectOption(editor: Editor, options: List): ExtractOptions { - require(options.isNotEmpty()) - val project = options.first().project - return suspendCancellableCoroutine { continuation -> - selectOptionWithTargetClass(editor, project, options) - .thenApply { selectedOption -> - continuation.resumeWith(Result.success(selectedOption)) - } - } - } - fun selectOptionWithTargetClass(editor: Editor, project: Project, options: List): CompletableFuture { require(options.isNotEmpty()) if (options.size == 1) { diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/MethodExtractor.kt b/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/MethodExtractor.kt index e60dc7573281..c2ccdce9554d 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/MethodExtractor.kt +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/MethodExtractor.kt @@ -24,7 +24,7 @@ import com.intellij.refactoring.extractMethod.ExtractMethodHandler import com.intellij.refactoring.extractMethod.newImpl.ExtractMethodHelper.guessMethodName import com.intellij.refactoring.extractMethod.newImpl.ExtractMethodHelper.replaceWithMethod import com.intellij.refactoring.extractMethod.newImpl.ExtractMethodPipeline.findAllOptionsToExtract -import com.intellij.refactoring.extractMethod.newImpl.ExtractMethodPipeline.selectOption +import com.intellij.refactoring.extractMethod.newImpl.ExtractMethodPipeline.selectOptionWithTargetClass import com.intellij.refactoring.extractMethod.newImpl.ExtractMethodPipeline.withFilteredAnnotations import com.intellij.refactoring.extractMethod.newImpl.inplace.* import com.intellij.refactoring.extractMethod.newImpl.parameterObject.ResultObjectExtractor @@ -35,6 +35,7 @@ import com.intellij.refactoring.util.CommonRefactoringUtil import com.intellij.refactoring.util.ConflictsUtil import com.intellij.util.containers.MultiMap import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.future.await import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.jetbrains.annotations.NonNls @@ -85,7 +86,7 @@ class MethodExtractor { val preparePlacesTime = System.currentTimeMillis() - prepareStart val options = withContext(Dispatchers.EDT) { - selectOption(editor, descriptorsForAllTargetPlaces) + selectOptionWithTargetClass(editor, file.project, descriptorsForAllTargetPlaces).await() } if (EditorSettingsExternalizable.getInstance().isVariableInplaceRenameEnabled) { val templateStart = System.currentTimeMillis()