How to get current Project? (the project with user focus)
Hello,
Is there an API to get the project in the current frame? In other words, if several projects are open in different frames, I only want the project that has focus.
ProjectManager.getOpenProjects() gets me all open projects.
Thanks!
Please sign in to leave a comment.
Hello JoeNearBoston,
Where are you calling this method from? If you have an action, you can get
the project with AnActionEvent.getData(DataKeys.PROJECT).
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Hi, I think it's possible doing that in such way:
DataContext dataContext = anActionEvent.getDataContext();
Project project = DataKeys.PROJECT.getData(dataContext);
anActionEvent is com.intellij.openapi.actionSystem.AnActionEvent. In my case when I invoke some popup menu in the current frame, then I receive an anActionEvent and I can get the current project.
Thanks, that will work.