void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); DataContext dataContext = event.getDataContext(); Project project = CommonDataKeys.PROJECT.getData(dataContext); if (LightEdit.owns(project)) { presentation.setEnabled(LightEditService.getInstance().isTabNavigationAvailable(this)); return; } presentation.setEnabled(false); if (project == null || project.isDisposed()) { return; } final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); if (toolWindowManager.isEditorComponentActive()) { final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(project); EditorWindow currentWindow = EditorWindow.DATA_KEY.getData(dataContext); if (currentWindow == null){ editorManager.getCurrentWindow (); } if (currentWindow != null) { final List<EditorComposite> composites = currentWindow.getAllComposites(); switch (myNavigationType) { case PREV, NEXT -> presentation.setEnabled(composites.size() > 1); case LAST -> { int index = composites.indexOf(currentWindow.getSelectedComposite()); presentation.setEnabled(index < composites.size()); } default -> { int targetIndex = myNavigationType.ordinal(); presentation.setEnabled(targetIndex < composites.size()); } } } return; } ContentManager contentManager = PlatformDataKeys.NONEMPTY_CONTENT_MANAGER.getData(dataContext); presentation.setEnabled(contentManager != null && contentManager.getContentCount() > 1 && contentManager.isSingleSelection()); }