void (DataContext dataContext, Project project) { final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(project); EditorWindow currentWindow = EditorWindow.DATA_KEY.getData(dataContext); if (currentWindow == null) { currentWindow = editorManager.getCurrentWindow(); } VirtualFile selectedFile = Objects.requireNonNull(currentWindow).getSelectedFile(); if (selectedFile == null) { selectedFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); } var files = currentWindow.getFileList(); int index = files.indexOf(selectedFile); LOG.assertTrue(index != -1); int targetIndex = switch (myNavigationType) { case PREV -> (index + files.size() - 1) % files.size(); case NEXT -> (index + files.size() + 1) % files.size(); case LAST -> files.size() - 1; default -> myNavigationType.ordinal(); }; if (targetIndex < files.size()) { editorManager.openFile(files.get(targetIndex), true); } }