Hello, all,
I'm a newbie to plugin development so sorry if this is a silly question, but after searching and searching, I still haven't found the answer. How do I get the "current project"? That is, the project that I have clicked on when running my plugin? In my plugin, I'm generating some files, but I need to get the appropriate IProject from the workspace. How do I do this?
How to get "current project"?
At 10:39 AM on Jul 27, 2006, Lonnie Lewis
wrote:
I'm a newbie to plugin development so sorry if this is a silly question, but after searching and searching, I still haven't found the answer. How do I get the "current project"? That is, the project that I have clicked on when running my plugin? In my plugin, I'm generating some files, but I need to get the appropriate IProject from the workspace. How do I do this?
Thanks.
2 replies so far (
Post your own)
Re: How to get "current project"?
The selection should contain what project it's associated with.http://www.eclipse.org/articles/Article-WorkbenchSelections/article.html
http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/ISelection.html
Cast it to an IStructedSelection, then adapt it to an IResource, then use getProject() on that.
Alex.
Re: How to get "current project"?
Great! Thank you very much for the quick response. I appreciate it.