How do I get a reference to the current project in an Eclipse plugin?

Posted by Martin Doms on Stack Overflow See other posts from Stack Overflow or by Martin Doms
Published on 2010-04-14T23:02:01Z Indexed on 2010/04/14 23:03 UTC
Read the original article Hit count: 266

Filed under:
|
|
|

I'm creating an editor for Eclipse. Right now the editor fires up with the user creates a new file with the appropriate extension. My question is, how can I get a reference to the project in which the file resides? For example, say I have a workspace with 2 projects, P1 and P2. I right click P2 and create a new file, can I get a reference to P2 from this somehow?

Ultimately I need to reference the AST or Java Model of the project but even a String identifying the project would work.

© Stack Overflow or respective owner

Related posts about eclipse-plugin

Related posts about pde