| 
| How to get Project Path from File in Editor? [message #330591] | Mon, 04 August 2008 15:59  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: kevin.oberg.baesystems.com 
 Here is what I want to do:
 
 Look at the file open in the active editor, then find out what project it
 belongs to, then find the absolute path of said project.  The path I am
 referring to is the one that is displayed when you right-click a project=>
 Properties => Resource => Location: absolute_path_i_need_here
 
 I do not know how to get at that path, and all I have now is the active
 editor itself.
 |  |  |  | 
| 
| Re: How to get Project Path from File in Editor? [message #330593 is a reply to message #330591] | Mon, 04 August 2008 16:51   |  | 
| Eclipse User  |  |  |  |  | Kevin, 
 You could ask IEditorPart for the IEditorInput, test if it's an
 IFileEditorInput, get the File, get the project, and then call
 getLocation on the project.  I file like I ought to ask why you'd want
 the location since if you work directly with the underlying file system,
 you're likely to get yourself into trouble...
 
 
 Kevin Oberg wrote:
 > Here is what I want to do:
 >
 > Look at the file open in the active editor, then find out what project
 > it belongs to, then find the absolute path of said project.  The path
 > I am referring to is the one that is displayed when you right-click a
 > project=> Properties => Resource => Location: absolute_path_i_need_here
 >
 > I do not know how to get at that path, and all I have now is the
 > active editor itself.
 >
 |  |  |  | 
|  | 
| 
| Re: How to get Project Path from File in Editor? [message #330618 is a reply to message #330593] | Tue, 05 August 2008 14:38  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: kevin.oberg.baesystems.com 
 Thank you much to both of you.  In terms of why I want the location, I
 need it in order to run some command line stuff on the files in question
 among other things.  My plug-in does quite a bit with the underlying file
 system, but doesn't really use most of Eclipse's built-in stuff for that
 stuff on account of I sub-classed most everything I need and ignored
 everything I don't.
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.06189 seconds