mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
InlineHandlers are back
This commit is contained in:
+1
-1
@@ -100,7 +100,7 @@ public abstract class BasePlatformRefactoringAction extends BaseRefactoringActio
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private RefactoringActionHandler getHandler(@NotNull Language language, PsiElement element) {
|
||||
protected RefactoringActionHandler getHandler(@NotNull Language language, PsiElement element) {
|
||||
List<RefactoringSupportProvider> providers = LanguageRefactoringSupport.INSTANCE.allForLanguage(language);
|
||||
if (providers.isEmpty()) return null;
|
||||
if (element == null && !providers.isEmpty()) return getRefactoringHandler(providers.get(0));
|
||||
|
||||
@@ -23,6 +23,7 @@ package com.intellij.refactoring.actions;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.lang.refactoring.InlineActionHandler;
|
||||
import com.intellij.lang.refactoring.InlineHandler;
|
||||
import com.intellij.lang.refactoring.InlineHandlers;
|
||||
import com.intellij.lang.refactoring.RefactoringSupportProvider;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
@@ -36,6 +37,9 @@ import com.intellij.refactoring.inline.InlineRefactoringActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class InlineAction extends BasePlatformRefactoringAction {
|
||||
|
||||
public InlineAction() {
|
||||
@@ -71,6 +75,14 @@ public class InlineAction extends BasePlatformRefactoringAction {
|
||||
return new InlineRefactoringActionHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RefactoringActionHandler getHandler(@NotNull Language language, PsiElement element) {
|
||||
RefactoringActionHandler handler = super.getHandler(language, element);
|
||||
if (handler != null) return handler;
|
||||
List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(language);
|
||||
return handlers.isEmpty() ? null : new InlineRefactoringActionHandler();
|
||||
}
|
||||
|
||||
protected boolean isAvailableForLanguage(Language language) {
|
||||
for(InlineActionHandler handler: Extensions.getExtensions(InlineActionHandler.EP_NAME)) {
|
||||
if (handler.isEnabledForLanguage(language)) {
|
||||
|
||||
Reference in New Issue
Block a user