Get the path of the current document [message #53066] |
Wed, 01 April 2009 12:08  |
Eclipse User |
|
|
|
Hello,
I want to get the path of the current document. For example if I have this
strucutre :
MyProject
|-- Folder 1
|-- Folder 2
|-- Folder 3
|-- File.java
and I'm editing File.java, I want to becom the path Folder 3/File.java or
MyProject/Folder 3/File.java.
How can I do that ? I mean this should be a very basic functionnality or
not ?
Thanks for help,
Alain
|
|
|
Re: Get the path of the current document [message #53244 is a reply to message #53066] |
Thu, 02 April 2009 09:08  |
Eclipse User |
|
|
|
Assuming you're working with an IEditorPart, which has an IEditorInput,
that is most likely an IFileEditorInput, which gives you a handle to the
backing IFile, which has various methods for retrieving the IPath. You
can manipulate the segments in the path to get what you need.
-Ben
Alain Sahli wrote:
> Hello,
>
> I want to get the path of the current document. For example if I have
> this strucutre :
>
> MyProject
> |-- Folder 1
> |-- Folder 2
> |-- Folder 3
> |-- File.java
>
> and I'm editing File.java, I want to becom the path Folder 3/File.java
> or MyProject/Folder 3/File.java.
>
> How can I do that ? I mean this should be a very basic functionnality or
> not ?
>
> Thanks for help,
> Alain
>
|
|
|
Re: Get the path of the current document [message #594506 is a reply to message #53066] |
Thu, 02 April 2009 09:08  |
Eclipse User |
|
|
|
Assuming you're working with an IEditorPart, which has an IEditorInput,
that is most likely an IFileEditorInput, which gives you a handle to the
backing IFile, which has various methods for retrieving the IPath. You
can manipulate the segments in the path to get what you need.
-Ben
Alain Sahli wrote:
> Hello,
>
> I want to get the path of the current document. For example if I have
> this strucutre :
>
> MyProject
> |-- Folder 1
> |-- Folder 2
> |-- Folder 3
> |-- File.java
>
> and I'm editing File.java, I want to becom the path Folder 3/File.java
> or MyProject/Folder 3/File.java.
>
> How can I do that ? I mean this should be a very basic functionnality or
> not ?
>
> Thanks for help,
> Alain
>
|
|
|
Powered by
FUDForum. Page generated in 0.06160 seconds