How to get Project Path from File in Editor? [message #330591] |
Mon, 04 August 2008 19: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 20:51 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
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.
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: How to get Project Path from File in Editor? [message #330618 is a reply to message #330593] |
Tue, 05 August 2008 18: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.12600 seconds