How to get recent project by right-clicking on the welcome screen?


I find the function com.intellij.openapi.wm.impl.welcomeScreen.projectActions.RecentProjectsWelcomeScreenActionBase#getSelectedItem

But this function is internal, so I try to find in my override function's parameter  AnActionEvent like below

Then use e.dataContext.getData("RECENT_PROJECT_SELECTED_ITEM") to get the project ,similarly,the interface I got  com.intellij.openapi.wm.impl.welcomeScreen.recentProjects.RecentProjectTreeItem and its implements are also internally modified

In the end I got the class by reflect, but it wasn't elegant enough, is there any other way?



These classes and members are not intended for use in plugins. Using reflection is dangerous and will lead to errors in case the implementation was changed.

Why do you need this? What is your use case?


I want to place some configuration files in project's .idea folder by right-click menu at welcome screen without open them

But I only use RecentProjectsManager or RecentProjectListActionProvider to get all recent projects not the selected by user


I see. I'm sorry, but Welcome Screen doesn't seem to be intended for extending.

I suggest finding another solution, for example:

  • Asking a user to add these files after a project is opened
  • Providing an action in a place when a project is opened, e.g., in the project view

I can use RecentProjectListActionProvider.getInstance().getActions() to get all recent projects, then popup a dialog let user to choose, but this interaction is too cumbersome

Since there is a way to get all the projects, why not open the API to let the plugin get the project currently selected by the user


RecentProjectListActionProvider is not a part of the welcome screen (welcome screen just uses it) but a service used more widely, so it seems a different case.

You can request opening this API via, but I doubt the responsible team will do it. Looking at the welcome screen code, the classes and members you need are in “impl” module, in “impl” package, and are explicitly marked as internal. It seems to be closed by design.


Can add actions to one recent project's right-click menu, but cant get selected project.

Wouldn't that be strange?