Editor (@NotNull AnActionEvent e) { Editor editor = e.getData(CommonDataKeys.EDITOR); if (editor != null) return editor; Project project = e.getProject(); if (project == null) return null; return FileEditorManager.getInstance(project).getSelectedTextEditor(); }