mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 15:06:56 +07:00
[rider] fix RIDER-107360
GitOrigin-RevId: bc2b3ccebccf3368a23de168127d2f5d627286d3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ba4241e602
commit
c2008ee80d
@@ -15,6 +15,7 @@ import com.intellij.openapi.editor.markup.MarkupModel;
|
|||||||
import com.intellij.openapi.editor.markup.RangeHighlighter;
|
import com.intellij.openapi.editor.markup.RangeHighlighter;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||||
|
import com.intellij.openapi.util.NlsContexts;
|
||||||
import com.intellij.openapi.util.Segment;
|
import com.intellij.openapi.util.Segment;
|
||||||
import com.intellij.openapi.util.TextRange;
|
import com.intellij.openapi.util.TextRange;
|
||||||
import com.intellij.psi.PsiFile;
|
import com.intellij.psi.PsiFile;
|
||||||
@@ -23,14 +24,17 @@ import com.intellij.spellchecker.DictionaryLayersProvider;
|
|||||||
import com.intellij.spellchecker.SpellCheckerManager;
|
import com.intellij.spellchecker.SpellCheckerManager;
|
||||||
import com.intellij.spellchecker.inspections.SpellCheckingInspection;
|
import com.intellij.spellchecker.inspections.SpellCheckingInspection;
|
||||||
import com.intellij.spellchecker.util.SpellCheckerBundle;
|
import com.intellij.spellchecker.util.SpellCheckerBundle;
|
||||||
import com.intellij.ui.components.JBList;
|
import com.intellij.ui.SimpleListCellRenderer;
|
||||||
import com.intellij.util.concurrency.ThreadingAssertions;
|
import com.intellij.util.concurrency.ThreadingAssertions;
|
||||||
import com.intellij.util.containers.ContainerUtil;
|
import com.intellij.util.containers.ContainerUtil;
|
||||||
|
import com.intellij.util.ui.JBUI;
|
||||||
import icons.SpellcheckerIcons;
|
import icons.SpellcheckerIcons;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public final class SaveTo implements SpellCheckerQuickFix, LowPriorityAction {
|
public final class SaveTo implements SpellCheckerQuickFix, LowPriorityAction {
|
||||||
@Nullable private DictionaryLayer myLayer = null;
|
@Nullable private DictionaryLayer myLayer = null;
|
||||||
@@ -78,22 +82,27 @@ public final class SaveTo implements SpellCheckerQuickFix, LowPriorityAction {
|
|||||||
.getDataContextFromFocusAsync()
|
.getDataContextFromFocusAsync()
|
||||||
.onSuccess(context -> {
|
.onSuccess(context -> {
|
||||||
if (layer == null) {
|
if (layer == null) {
|
||||||
final JBList<String> dictList = new JBList<>(
|
final List<String> dictList = new ArrayList<>(
|
||||||
ContainerUtil.map(DictionaryLayersProvider.getAllLayers(project), it -> it.getName())
|
ContainerUtil.map(DictionaryLayersProvider.getAllLayers(project), it -> it.getName())
|
||||||
);
|
);
|
||||||
|
|
||||||
JBPopupFactory.getInstance()
|
JBPopupFactory.getInstance()
|
||||||
.createListPopupBuilder(dictList)
|
.createPopupChooserBuilder(dictList)
|
||||||
.setTitle(SpellCheckerBundle.message("select.dictionary.title"))
|
.setTitle(SpellCheckerBundle.message("select.dictionary.title"))
|
||||||
.setItemChosenCallback(
|
.setItemChosenCallback(
|
||||||
() ->
|
(item) ->
|
||||||
CommandProcessor.getInstance().executeCommand(
|
CommandProcessor.getInstance().executeCommand(
|
||||||
project,
|
project,
|
||||||
() -> acceptWord(wordToSave, DictionaryLayersProvider.getLayer(project, dictList.getSelectedValue()), psiFile, wordRange),
|
() -> acceptWord(wordToSave, DictionaryLayersProvider.getLayer(project, item), psiFile, wordRange),
|
||||||
SpellCheckerBundle.message("save.0.to.dictionary.action", wordToSave),
|
SpellCheckerBundle.message("save.0.to.dictionary.action", wordToSave),
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
.setRenderer(SimpleListCellRenderer.create(
|
||||||
|
(var label, @NlsContexts.Label var value, var index) -> {
|
||||||
|
label.setText(value);
|
||||||
|
label.setBorder(JBUI.Borders.empty(0, 15));
|
||||||
|
}))
|
||||||
.createPopup()
|
.createPopup()
|
||||||
.showInBestPositionFor(context);
|
.showInBestPositionFor(context);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user