void (@NotNull AnActionEvent e) { final Project project = e.getData(CommonDataKeys.PROJECT); FileEditorManagerEx editorManager = getEditorManager(project); EditorWindow window = e.getData(EditorWindow.DATA_KEY); VirtualFile file = null; if (window == null) { window = editorManager.getCurrentWindow(); if (window != null) { file = window.getSelectedFile(); } } else { file = e.getData(CommonDataKeys.VIRTUAL_FILE); } if (file != null) { editorManager.closeFileWithChecks(file, window); } }