| how to get the currently used Project [message #120362] | 
Tue, 29 November 2005 03:47   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 17:02   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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.
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.49325 seconds