IDEA-196575: No cursor in editor when opening file from project view with Enter

GitOrigin-RevId: cd4a9a45d0e42367a2869e8189fa4d6857987b7f
This commit is contained in:
Sergey Malenkov
2020-09-15 20:33:08 +00:00
committed by intellij-monorepo-bot
parent abd80c1c1a
commit ccd13a4b2d
2 changed files with 2 additions and 5 deletions
@@ -33,10 +33,6 @@ public final class EditSourceOnEnterKeyHandler {
}
public static void install(@NotNull JComponent component, @Nullable Runnable whenPerformed) {
install(component, whenPerformed, Registry.is("edit.source.on.enter.key.request.focus.in.editor"));
}
private static void install(@NotNull JComponent component, @Nullable Runnable whenPerformed, boolean requestFocus) {
onEnterKey(component, () -> {
if (Registry.is("edit.source.on.enter.key.disabled")) return false;
if (isOverriddenByAction(IdeActions.ACTION_EDIT_SOURCE)) return false;
@@ -44,6 +40,7 @@ public final class EditSourceOnEnterKeyHandler {
DataContext context = DataManager.getInstance().getDataContext(component);
List<Navigatable> navigatables = getNavigatables(context);
if (navigatables.isEmpty()) return false; // nowhere to navigate
boolean requestFocus = Registry.is("edit.source.on.enter.key.request.focus.in.editor");
navigatables.forEach(navigatable -> navigatable.navigate(requestFocus));
if (whenPerformed != null) whenPerformed.run();
return true;
@@ -177,7 +177,7 @@ ide.tree.expand.navigatable.on.double.click.disabled.description=Allows to preve
edit.source.on.enter.key.disabled=false
edit.source.on.enter.key.disabled.description=Allows to prevent navigation on the Enter key pressed
edit.source.on.enter.key.request.focus.in.editor=false
edit.source.on.enter.key.request.focus.in.editor=true
edit.source.on.enter.key.request.focus.in.editor.description=Specifies whether focus will be moved to the editor on the key pressed or not
edit.source.on.enter.key.non.source.navigation.enabled=false
edit.source.on.enter.key.non.source.navigation.enabled.description=Allows navigation even if navigatable object cannot navigate to editor