mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
cleanup: introduce LanguageRefactoringSupport#getInstance
GitOrigin-RevId: 832c2688ee1976e8e353291c645b676c77ecd2ce
This commit is contained in:
committed by
intellij-monorepo-bot
parent
72fdcc80d1
commit
3f27a3edf1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.intention.impl;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionMemory;
|
||||
@@ -71,7 +71,7 @@ public final class IntroduceVariableIntentionAction extends BaseRefactoringInten
|
||||
if (type != null) return new IntroduceEmptyVariableHandlerImpl().generatePreview(editor, element.getContainingFile(), type);
|
||||
final PsiExpression expression = detectExpressionStatement(element);
|
||||
if (expression == null) return IntentionPreviewInfo.EMPTY;
|
||||
RefactoringSupportProvider supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE);
|
||||
RefactoringSupportProvider supportProvider = LanguageRefactoringSupport.getInstance().forLanguage(JavaLanguage.INSTANCE);
|
||||
JavaIntroduceVariableHandlerBase handler = (JavaIntroduceVariableHandlerBase)supportProvider.getIntroduceVariableHandler();
|
||||
if (handler instanceof PreviewableRefactoringActionHandler previewableRefactoringActionHandler) {
|
||||
return previewableRefactoringActionHandler.generatePreview(project, expression);
|
||||
@@ -89,7 +89,7 @@ public final class IntroduceVariableIntentionAction extends BaseRefactoringInten
|
||||
|
||||
final PsiExpression expression = detectExpressionStatement(element);
|
||||
if (expression == null) return;
|
||||
RefactoringSupportProvider supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE);
|
||||
RefactoringSupportProvider supportProvider = LanguageRefactoringSupport.getInstance().forLanguage(JavaLanguage.INSTANCE);
|
||||
JavaIntroduceVariableHandlerBase handler = (JavaIntroduceVariableHandlerBase)supportProvider.getIntroduceVariableHandler();
|
||||
assert handler != null;
|
||||
handler.invoke(project, editor, expression);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.refactoring.changeSignature;
|
||||
|
||||
import com.intellij.lang.LanguageRefactoringSupport;
|
||||
@@ -7,12 +7,10 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.psi.impl.source.tree.Factory;
|
||||
import com.intellij.psi.impl.source.tree.SharedImplUtil;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.CharTable;
|
||||
import com.intellij.util.CommonJavaRefactoringUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -94,7 +92,7 @@ public final class ChangeSignatureUtil {
|
||||
}
|
||||
|
||||
public static void invokeChangeSignatureOn(PsiMethod method, Project project) {
|
||||
RefactoringSupportProvider provider = LanguageRefactoringSupport.INSTANCE.forContext(method);
|
||||
RefactoringSupportProvider provider = LanguageRefactoringSupport.getInstance().forContext(method);
|
||||
ChangeSignatureHandler handler = provider != null ? provider.getChangeSignatureHandler() : null;
|
||||
if (handler != null) {
|
||||
handler.invoke(project, new PsiElement[]{method}, null);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.refactoring.introduceVariable;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightUtil;
|
||||
@@ -368,7 +368,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
|
||||
final PsiFile file = anchorStatement.getContainingFile();
|
||||
IntroduceVariableUtil.LOG.assertTrue(file != null, "expr.getContainingFile() == null");
|
||||
final PsiElement nameSuggestionContext = editor == null ? null : file.findElementAt(editor.getCaretModel().getOffset());
|
||||
final RefactoringSupportProvider supportProvider = LanguageRefactoringSupport.INSTANCE.forContext(expr);
|
||||
final RefactoringSupportProvider supportProvider = LanguageRefactoringSupport.getInstance().forContext(expr);
|
||||
final boolean isInplaceAvailableOnDataContext =
|
||||
supportProvider != null &&
|
||||
editor.getSettings().isVariableInplaceRenameEnabled() &&
|
||||
|
||||
@@ -97,7 +97,7 @@ public class PullAsAbstractUpFix extends LocalQuickFixAndIntentionActionOnPsiEle
|
||||
|
||||
if (noClassesFound.get()) {
|
||||
//check visibility
|
||||
var supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE);
|
||||
var supportProvider = LanguageRefactoringSupport.getInstance().forLanguage(JavaLanguage.INSTANCE);
|
||||
var handler = supportProvider.getExtractInterfaceHandler();
|
||||
if (handler == null) {
|
||||
throw new IllegalStateException("Handler is null, supportProvider class = " + supportProvider.getClass());
|
||||
@@ -122,7 +122,7 @@ public class PullAsAbstractUpFix extends LocalQuickFixAndIntentionActionOnPsiEle
|
||||
final MemberInfo memberInfo = new MemberInfo(method);
|
||||
memberInfo.setChecked(true);
|
||||
memberInfo.setToAbstract(true);
|
||||
var supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE);
|
||||
var supportProvider = LanguageRefactoringSupport.getInstance().forLanguage(JavaLanguage.INSTANCE);
|
||||
var handler = (JavaPullUpHandlerBase)supportProvider.getPullUpHandler();
|
||||
if (handler == null) {
|
||||
throw new IllegalStateException("Handler is null, supportProvider class = " + supportProvider.getClass());
|
||||
@@ -164,13 +164,13 @@ public class PullAsAbstractUpFix extends LocalQuickFixAndIntentionActionOnPsiEle
|
||||
|
||||
registrar.add(new PullAsAbstractUpFix(methodWithOverrides, name));
|
||||
if (canBePulledUp) {
|
||||
var supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE);
|
||||
var supportProvider = LanguageRefactoringSupport.getInstance().forLanguage(JavaLanguage.INSTANCE);
|
||||
registrar.add(new RunRefactoringAction(supportProvider.getPullUpHandler(), JavaBundle.message("pull.members.up.fix.name")));
|
||||
}
|
||||
|
||||
|
||||
if (! (containingClass instanceof PsiAnonymousClass)){
|
||||
var supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE);
|
||||
var supportProvider = LanguageRefactoringSupport.getInstance().forLanguage(JavaLanguage.INSTANCE);
|
||||
|
||||
registrar.add(new RunRefactoringAction(supportProvider.getExtractInterfaceHandler(), JavaBundle.message("extract.interface.command.name")));
|
||||
registrar.add(new RunRefactoringAction(supportProvider.getExtractSuperClassHandler(), JavaBundle.message("extract.superclass.command.name")));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.intention.impl;
|
||||
|
||||
import com.intellij.codeInsight.intention.preview.IntentionPreviewInfo;
|
||||
@@ -29,7 +29,7 @@ public class IntroduceVariableErrorFixAction extends LocalQuickFixAndIntentionAc
|
||||
@Nullable Editor editor,
|
||||
@NotNull PsiElement startElement,
|
||||
@NotNull PsiElement endElement) {
|
||||
RefactoringActionHandler handler = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE).getIntroduceVariableHandler();
|
||||
RefactoringActionHandler handler = LanguageRefactoringSupport.getInstance().forLanguage(JavaLanguage.INSTANCE).getIntroduceVariableHandler();
|
||||
assert handler != null;
|
||||
((JavaIntroduceVariableHandlerBase)handler).invoke(project, editor, (PsiExpression)startElement);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class IntroduceVariableErrorFixAction extends LocalQuickFixAndIntentionAc
|
||||
public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
|
||||
PsiElement element = PsiTreeUtil.findSameElementInCopy(myStartElement.getElement(), file);
|
||||
if (element == null) return IntentionPreviewInfo.EMPTY;
|
||||
RefactoringActionHandler handler = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE).getIntroduceVariableHandler();
|
||||
RefactoringActionHandler handler = LanguageRefactoringSupport.getInstance().forLanguage(JavaLanguage.INSTANCE).getIntroduceVariableHandler();
|
||||
assert handler != null;
|
||||
if (handler instanceof PreviewableRefactoringActionHandler previewableRefactoringActionHandler) {
|
||||
return previewableRefactoringActionHandler.generatePreview(project, element);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.template.postfix.templates;
|
||||
|
||||
import com.intellij.lang.LanguageRefactoringSupport;
|
||||
@@ -20,7 +20,7 @@ public class IntroduceFieldPostfixTemplate extends PostfixTemplateWithExpression
|
||||
|
||||
@Override
|
||||
protected void expandForChooseExpression(@NotNull PsiElement expression, @NotNull Editor editor) {
|
||||
var supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE);
|
||||
var supportProvider = LanguageRefactoringSupport.getInstance().forLanguage(JavaLanguage.INSTANCE);
|
||||
JavaIntroduceFieldHandlerBase handler = (JavaIntroduceFieldHandlerBase)supportProvider.getIntroduceFieldHandler();
|
||||
assert handler != null;
|
||||
handler.invoke(expression.getProject(), expression, editor);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.template.postfix.templates;
|
||||
|
||||
import com.intellij.lang.LanguageRefactoringSupport;
|
||||
@@ -24,7 +24,7 @@ public class IntroduceVariablePostfixTemplate extends PostfixTemplateWithExpress
|
||||
@Override
|
||||
protected void expandForChooseExpression(@NotNull PsiElement expression, @NotNull Editor editor) {
|
||||
// for advanced stuff use ((PsiJavaCodeReferenceElement)expression).advancedResolve(true).getElement();
|
||||
JavaIntroduceVariableHandlerBase handler = (JavaIntroduceVariableHandlerBase)LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE)
|
||||
JavaIntroduceVariableHandlerBase handler = (JavaIntroduceVariableHandlerBase)LanguageRefactoringSupport.getInstance().forLanguage(JavaLanguage.INSTANCE)
|
||||
.getIntroduceVariableHandler();
|
||||
assert handler != null;
|
||||
handler.invoke(expression.getProject(), editor, (PsiExpression)expression);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.refactoring.util;
|
||||
|
||||
import com.intellij.codeInspection.RedundantLambdaCodeBlockInspection;
|
||||
@@ -340,7 +340,7 @@ public final class LambdaRefactoringUtil {
|
||||
JavaRefactoringBundle.message("side.effects.detected.title"), Messages.getQuestionIcon()) == Messages.YES) {
|
||||
//ensure introduced before lambda
|
||||
qualifierExpression.putUserData(ElementToWorkOn.PARENT, lambdaExpression);
|
||||
RefactoringSupportProvider supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE);
|
||||
RefactoringSupportProvider supportProvider = LanguageRefactoringSupport.getInstance().forLanguage(JavaLanguage.INSTANCE);
|
||||
JavaIntroduceVariableHandlerBase handler = (JavaIntroduceVariableHandlerBase)supportProvider.getIntroduceVariableHandler();
|
||||
assert handler != null;
|
||||
handler.invoke(qualifierExpression.getProject(), editor, qualifierExpression);
|
||||
|
||||
@@ -54,7 +54,7 @@ public final class CommonJavaRefactoringUtil {
|
||||
);
|
||||
|
||||
public static @NotNull JavaBaseRefactoringSupportProvider getRefactoringSupport() {
|
||||
var provider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE);
|
||||
var provider = LanguageRefactoringSupport.getInstance().forLanguage(JavaLanguage.INSTANCE);
|
||||
return (JavaBaseRefactoringSupportProvider)provider;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
|
||||
public abstract class BasePlatformRefactoringAction extends BaseRefactoringAction {
|
||||
private final CachedValue<Boolean> myHidden = new CachedValueImpl<>(
|
||||
() -> CachedValueProvider.Result.create(calcHidden(), LanguageRefactoringSupport.INSTANCE));
|
||||
() -> CachedValueProvider.Result.create(calcHidden(), LanguageRefactoringSupport.getInstance()));
|
||||
private final Condition<RefactoringSupportProvider> myCondition = provider -> getRefactoringHandler(provider) != null;
|
||||
|
||||
@Override
|
||||
@@ -77,7 +77,7 @@ public abstract class BasePlatformRefactoringAction extends BaseRefactoringActio
|
||||
}
|
||||
|
||||
protected @Nullable RefactoringActionHandler getHandler(@NotNull Language language, PsiElement element) {
|
||||
List<RefactoringSupportProvider> providers = LanguageRefactoringSupport.INSTANCE.allForLanguage(language);
|
||||
List<RefactoringSupportProvider> providers = LanguageRefactoringSupport.getInstance().allForLanguage(language);
|
||||
if (providers.isEmpty()) return null;
|
||||
if (element == null) return getRefactoringHandler(providers.get(0));
|
||||
for (RefactoringSupportProvider provider : providers) {
|
||||
@@ -95,7 +95,7 @@ public abstract class BasePlatformRefactoringAction extends BaseRefactoringActio
|
||||
|
||||
@Override
|
||||
protected boolean isAvailableForLanguage(final Language language) {
|
||||
List<RefactoringSupportProvider> providers = LanguageRefactoringSupport.INSTANCE.allForLanguage(language);
|
||||
List<RefactoringSupportProvider> providers = LanguageRefactoringSupport.getInstance().allForLanguage(language);
|
||||
return ContainerUtil.find(providers, myCondition) != null;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ public final class ChangeSignatureAction extends BasePlatformRefactoringAction {
|
||||
}
|
||||
|
||||
public static @Nullable ChangeSignatureHandler getChangeSignatureHandler(@NotNull PsiElement language) {
|
||||
RefactoringSupportProvider provider = LanguageRefactoringSupport.INSTANCE.forContext(language);
|
||||
RefactoringSupportProvider provider = LanguageRefactoringSupport.getInstance().forContext(language);
|
||||
return provider != null ? provider.getChangeSignatureHandler() : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class MemberInplaceRenameHandler extends VariableInplaceRenameHandler {
|
||||
element = PsiTreeUtil.getParentOfType(nameSuggestionContext, PsiNamedElement.class);
|
||||
}
|
||||
final RefactoringSupportProvider
|
||||
supportProvider = element == null ? null : LanguageRefactoringSupport.INSTANCE.forContext(element);
|
||||
supportProvider = element == null ? null : LanguageRefactoringSupport.getInstance().forContext(element);
|
||||
return editor.getSettings().isVariableInplaceRenameEnabled()
|
||||
&& supportProvider != null
|
||||
&& element instanceof PsiNameIdentifierOwner
|
||||
|
||||
@@ -47,7 +47,7 @@ public class VariableInplaceRenameHandler implements RenameHandler {
|
||||
@NotNull PsiFile file) {
|
||||
final PsiElement nameSuggestionContext = file.findElementAt(editor.getCaretModel().getOffset());
|
||||
if (element == null || !element.isValid()) return false;
|
||||
RefactoringSupportProvider supportProvider = LanguageRefactoringSupport.INSTANCE.forContext(element);
|
||||
RefactoringSupportProvider supportProvider = LanguageRefactoringSupport.getInstance().forContext(element);
|
||||
return supportProvider != null &&
|
||||
editor.getSettings().isVariableInplaceRenameEnabled() &&
|
||||
supportProvider.isInplaceRenameAvailable(element, nameSuggestionContext);
|
||||
|
||||
@@ -450,7 +450,7 @@ public final class SafeDeleteProcessor extends BaseRefactoringProcessor {
|
||||
public static boolean validElement(@NotNull PsiElement element) {
|
||||
if (element instanceof PsiFile) return true;
|
||||
if (!element.isPhysical()) return false;
|
||||
RefactoringSupportProvider provider = LanguageRefactoringSupport.INSTANCE.forContext(element);
|
||||
RefactoringSupportProvider provider = LanguageRefactoringSupport.getInstance().forContext(element);
|
||||
return provider != null && provider.isSafeDeleteAvailable(element);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public final class LanguageRefactoringSupport extends LanguageExtension<RefactoringSupportProvider> {
|
||||
/**
|
||||
* @deprecated Use {@link #getInstance} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static final LanguageRefactoringSupport INSTANCE = new LanguageRefactoringSupport();
|
||||
|
||||
public static @NotNull LanguageRefactoringSupport getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private LanguageRefactoringSupport() {
|
||||
super("com.intellij.lang.refactoringSupport", new RefactoringSupportProvider() {});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.groovy.refactoring.introduce;
|
||||
|
||||
import com.intellij.codeInsight.highlighting.HighlightManager;
|
||||
@@ -514,7 +514,7 @@ public abstract class GrIntroduceHandlerBase<Settings extends GrIntroduceSetting
|
||||
}
|
||||
|
||||
public static boolean isInplace(@NotNull Editor editor, @NotNull PsiElement place) {
|
||||
final RefactoringSupportProvider supportProvider = LanguageRefactoringSupport.INSTANCE.forContext(place);
|
||||
final RefactoringSupportProvider supportProvider = LanguageRefactoringSupport.getInstance().forContext(place);
|
||||
return supportProvider != null &&
|
||||
(editor.getUserData(InplaceRefactoring.INTRODUCE_RESTART) == null || !editor.getUserData(InplaceRefactoring.INTRODUCE_RESTART)) &&
|
||||
editor.getUserData(AbstractInplaceIntroducer.ACTIVE_INTRODUCE) == null &&
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.jetbrains.kotlin.idea.codeInsight.intentions.shared
|
||||
|
||||
@@ -56,7 +56,7 @@ class IntroduceVariableIntention : SelfTargetingIntention<PsiElement>(
|
||||
override fun applyTo(element: PsiElement, editor: Editor?) {
|
||||
val expression = getExpressionToProcess(element) ?: return
|
||||
val introduceVariableHandler =
|
||||
LanguageRefactoringSupport.INSTANCE.forLanguage(KotlinLanguage.INSTANCE).introduceVariableHandler as KotlinIntroduceVariableHandler
|
||||
LanguageRefactoringSupport.getInstance().forLanguage(KotlinLanguage.INSTANCE).introduceVariableHandler as KotlinIntroduceVariableHandler
|
||||
introduceVariableHandler.collectCandidateTargetContainersAndDoRefactoring(
|
||||
element.project, editor, expression, isVar = false, occurrencesToReplace = null, onNonInteractiveFinish = null
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.codeInsight.postfix
|
||||
|
||||
import com.intellij.codeInsight.template.postfix.templates.PostfixTemplateProvider
|
||||
@@ -27,7 +27,7 @@ internal class KotlinIntroduceVariablePostfixTemplate(
|
||||
@OptIn(KaAllowAnalysisOnEdt::class)
|
||||
override fun expandForChooseExpression(expression: PsiElement, editor: Editor) {
|
||||
val introduceVariableHandler =
|
||||
LanguageRefactoringSupport.INSTANCE.forLanguage(KotlinLanguage.INSTANCE).introduceVariableHandler as KotlinIntroduceVariableHandler
|
||||
LanguageRefactoringSupport.getInstance().forLanguage(KotlinLanguage.INSTANCE).introduceVariableHandler as KotlinIntroduceVariableHandler
|
||||
allowAnalysisOnEdt {
|
||||
@OptIn(KaAllowAnalysisFromWriteAction::class)
|
||||
allowAnalysisFromWriteAction {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 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.changeSignature
|
||||
|
||||
import com.intellij.application.options.CodeStyle
|
||||
@@ -149,7 +149,7 @@ public @interface NotNull {
|
||||
}
|
||||
|
||||
protected fun findTargetElement(): PsiElement? {
|
||||
val provider = LanguageRefactoringSupport.INSTANCE.forContext(file)
|
||||
val provider = LanguageRefactoringSupport.getInstance().forContext(file)
|
||||
return provider!!.changeSignatureHandler!!.findTargetMember(file, editor)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.python.refactoring;
|
||||
|
||||
import com.intellij.lang.LanguageRefactoringSupport;
|
||||
@@ -18,7 +18,7 @@ public class PyExtractMethodTest extends LightMarkedTestCase {
|
||||
final String dir = "refactoring/extractmethod/";
|
||||
|
||||
myFixture.configureByFile(dir + beforeName);
|
||||
final RefactoringSupportProvider provider = LanguageRefactoringSupport.INSTANCE.forLanguage(PythonLanguage.getInstance());
|
||||
final RefactoringSupportProvider provider = LanguageRefactoringSupport.getInstance().forLanguage(PythonLanguage.getInstance());
|
||||
assertNotNull(provider);
|
||||
final RefactoringActionHandler handler = provider.getExtractMethodHandler();
|
||||
assertNotNull(handler);
|
||||
|
||||
Reference in New Issue
Block a user