void (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { LookupManager.getInstance(project).hideActiveLookup(); int caretOffset = editor.getCaretModel().getOffset(); int caretLine = editor.getCaretModel().getLogicalPosition().line; int[] offsets = MethodUpDownUtil.getNavigationOffsets(file, caretOffset); for(int i = offsets.length - 1; i >= 0; i--){ int offset = offsets[i]; if (offset < caretOffset){ int line = editor.offsetToLogicalPosition(offset).line; if (line < caretLine){ editor.getCaretModel().removeSecondaryCarets(); editor.getCaretModel().moveToOffset(offset); editor.getSelectionModel().removeSelection(); editor.getScrollingModel().scrollToCaret(ScrollType.CENTER_UP); IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation(); break; } } } }