DataContext (@NotNull DataContext dataContext) { if (dataContext instanceof SimpleDataContext) return dataContext; SimpleDataContext.Builder builder = SimpleDataContext.builder() .addAll(dataContext, PROJECT, PROJECT_FILE_DIRECTORY, EDITOR, VIRTUAL_FILE, MODULE, PSI_FILE); VirtualFile virtualFile = dataContext.getData(VIRTUAL_FILE); if (virtualFile == null) { Project project = dataContext.getData(PROJECT); FileEditor editor = project == null ? null : FileEditorManager.getInstance(project).getSelectedEditor(); VirtualFile editorFile = editor == null ? null : editor.getFile(); builder.add(VIRTUAL_FILE, editorFile); } return builder.build(); }