mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-completion] Specific actions to move through lookup options
Fixes IDEA-274076 Provide a way to change default keys used to navigate code completion list GitOrigin-RevId: ff5cb8d36c3b0f1315b7a1c708501134c15e8e67
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e0e69c4944
commit
b22d3db879
+28
-2
@@ -44,7 +44,9 @@ public abstract class LookupActionHandler extends EditorActionHandler {
|
||||
if (project != null && lookup != null) {
|
||||
LookupManager.getInstance(project).hideActiveLookup();
|
||||
}
|
||||
myOriginalHandler.execute(editor, caret, dataContext);
|
||||
if (myOriginalHandler != null) {
|
||||
myOriginalHandler.execute(editor, caret, dataContext);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,6 +105,28 @@ public abstract class LookupActionHandler extends EditorActionHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static class UpInLookupAction extends EditorAction {
|
||||
public UpInLookupAction() {
|
||||
super(new UpHandler(null) {
|
||||
@Override
|
||||
public boolean isEnabledForCaret(@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) {
|
||||
return LookupManager.getActiveLookup(editor) != null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static class DownInLookupAction extends EditorAction {
|
||||
public DownInLookupAction() {
|
||||
super(new DownHandler(null) {
|
||||
@Override
|
||||
public boolean isEnabledForCaret(@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) {
|
||||
return LookupManager.getActiveLookup(editor) != null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static final class UpDownInEditorHandler extends EditorActionHandler {
|
||||
private final boolean myUp;
|
||||
|
||||
@@ -140,7 +164,9 @@ public abstract class LookupActionHandler extends EditorActionHandler {
|
||||
@Override
|
||||
protected void executeInLookup(final LookupImpl lookup, DataContext context, Caret caret) {
|
||||
if (!UISettings.getInstance().getCycleScrolling() && !lookup.isFocused() && lookup.getList().getSelectedIndex() == 0) {
|
||||
myOriginalHandler.execute(lookup.getEditor(), caret, context);
|
||||
if (myOriginalHandler != null) {
|
||||
myOriginalHandler.execute(lookup.getEditor(), caret, context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
executeUpOrDown(lookup, true);
|
||||
|
||||
@@ -82,6 +82,8 @@ action.EditorLeftWithSelection.text=Left with Selection
|
||||
action.EditorRightWithSelection.text=Right with Selection
|
||||
action.EditorLookupUp.text=Lookup Up
|
||||
action.EditorLookupDown.text=Lookup Down
|
||||
action.EditorLookupSelectionUp.text=Select Previous Completion Option
|
||||
action.EditorLookupSelectionDown.text=Select Next Completion Option
|
||||
action.EditorIndentSelection.text=Indent Selection
|
||||
action.EditorUnindentSelection.text=Unindent Line or Selection
|
||||
action.EditorIndentLineOrSelection.text=Indent Line or Selection
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
<action id="EditorLookupUp" class="com.intellij.codeInsight.lookup.impl.LookupActionHandler$UpAction"/>
|
||||
<action id="EditorLookupDown" class="com.intellij.codeInsight.lookup.impl.LookupActionHandler$DownAction"/>
|
||||
<action id="EditorLookupSelectionUp" class="com.intellij.codeInsight.lookup.impl.LookupActionHandler$UpInLookupAction"/>
|
||||
<action id="EditorLookupSelectionDown" class="com.intellij.codeInsight.lookup.impl.LookupActionHandler$DownInLookupAction"/>
|
||||
</actions>
|
||||
|
||||
<xi:include href="/idea/PlatformActions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
|
||||
Reference in New Issue
Block a user