IDEA-236830 Light Edit: Recent Locations: navigation to file by Enter pressing doesn't work

GitOrigin-RevId: 84b77750a2de158b5a17f13ba823018689eff4ca
This commit is contained in:
Rustam Vishnyakov
2020-06-10 14:12:41 +03:00
committed by intellij-monorepo-bot
parent 858c78591d
commit 009fbd8aca
3 changed files with 46 additions and 8 deletions
@@ -6,7 +6,6 @@ import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.util.NlsActions;
import com.intellij.util.Consumer;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -59,15 +58,15 @@ public abstract class DumbAwareAction extends AnAction implements DumbAware {
super(dynamicText, icon);
}
private static class SimpleDumbAwareAction extends DumbAwareAction implements ActionWithDelegate<Consumer<? super AnActionEvent>> {
static class SimpleDumbAwareAction extends DumbAwareAction implements ActionWithDelegate<Consumer<? super AnActionEvent>> {
private final Consumer<? super AnActionEvent> myActionPerformed;
private SimpleDumbAwareAction(Consumer<? super AnActionEvent> actionPerformed) {
SimpleDumbAwareAction(Consumer<? super AnActionEvent> actionPerformed) {
myActionPerformed = actionPerformed;
}
private SimpleDumbAwareAction(@NlsActions.ActionText String text,
Consumer<? super AnActionEvent> actionPerformed) {
SimpleDumbAwareAction(@NlsActions.ActionText String text,
Consumer<? super AnActionEvent> actionPerformed) {
super(text);
myActionPerformed = actionPerformed;
}
@@ -0,0 +1,38 @@
// 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.
package com.intellij.openapi.project;
import com.intellij.ide.lightEdit.LightEditCompatible;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.util.NlsActions;
import com.intellij.util.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public final class LightEditActionFactory {
private LightEditActionFactory() {
}
@NotNull
public static DumbAwareAction create(@NotNull Consumer<? super AnActionEvent> actionPerformed) {
return new SimpleLightEditCompatibleAction(actionPerformed);
}
@NotNull
public static DumbAwareAction create(@Nullable @NlsActions.ActionText String text,
@NotNull Consumer<? super AnActionEvent> actionPerformed) {
return new SimpleLightEditCompatibleAction(text, actionPerformed);
}
private static class SimpleLightEditCompatibleAction extends DumbAwareAction.SimpleDumbAwareAction implements LightEditCompatible {
SimpleLightEditCompatibleAction(Consumer<? super AnActionEvent> actionPerformed) {
super(actionPerformed);
}
SimpleLightEditCompatibleAction(@NlsActions.ActionText String text,
Consumer<? super AnActionEvent> actionPerformed) {
super(text, actionPerformed);
}
}
}
@@ -18,6 +18,7 @@ import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
import com.intellij.openapi.fileEditor.impl.IdeDocumentHistoryImpl;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.LightEditActionFactory;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
@@ -134,7 +135,7 @@ public final class RecentLocationsAction extends DumbAwareAction implements Ligh
.setLocateWithinScreenBounds(false)
.createPopup();
DumbAwareAction.create(event -> {
LightEditActionFactory.create(event -> {
checkBox.setSelected(!checkBox.isSelected());
updateItems(model, listWithFilter, title, checkBox, popup);
}).registerCustomShortcutSet(showChangedOnlyShortcutSet, list, popup);
@@ -313,10 +314,10 @@ public final class RecentLocationsAction extends DumbAwareAction implements Ligh
}
});
DumbAwareAction.create(e -> navigateToSelected(project, list, popup))
LightEditActionFactory.create(e -> navigateToSelected(project, list, popup))
.registerCustomShortcutSet(CustomShortcutSet.fromString("ENTER"), listWithFilter, popup);
DumbAwareAction.create(e -> removePlaces(project, listWithFilter, list, data, checkBox.isSelected()))
LightEditActionFactory.create(e -> removePlaces(project, listWithFilter, list, data, checkBox.isSelected()))
.registerCustomShortcutSet(CustomShortcutSet.fromString("DELETE", "BACK_SPACE"), listWithFilter, popup);
}