Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » how to get the currently used Project
how to get the currently used Project [message #120362] Tue, 29 November 2005 08:47 Go to next message
Eclipse UserFriend
Originally posted by: Knadine.t-online.de

hi,

can somebody tell me how to get the "active" project? I know there are no
active Projects in Eclipse but only open and closed ones, I mean the
project that is in use. I wrote a plugin and if I click on an action in a
custom popup-menu that I added to the outline page, I want to add some
files to the project I'm currently working with. But how can I get the
project?

thx
sth_Weird
Re: how to get the currently used Project [message #120632 is a reply to message #120362] Tue, 29 November 2005 22:02 Go to previous message
Eclipse UserFriend
Originally posted by: pete_c_johnson_2.yahoo.com

I had the same need in my plugin and found that, in my case, the
ISelection passed into selectionChanged(IAction, ISelection) in my popup
action evaluated to an IResource. My popup is associated with files, so
I'm not sure yours will be the same for the outline, but if you can get
ahold of the IResource for what was clicked on, you can call
IResource.getProject() to get yourself an IProject. From there you can
add anything you'd like.

Don't forget to call IProject.refreshLocal() when you are done adding
files. That'll add them to the project so they will show up in the
project explorer.
Previous Topic:Opening Java classes
Next Topic:How to get Java documentation displayed in content assist?
Goto Forum:
  


Current Time: Sun Oct 06 12:49:32 GMT 2024

Powered by FUDForum. Page generated in 0.07928 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top