Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Get the path of the current document
Get the path of the current document [message #53066] Wed, 01 April 2009 12:08 Go to next message
Alain Sahli is currently offline Alain Sahli
Messages: 19
Registered: July 2009
Junior Member
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 Go to previous message
Ben Vitale is currently offline Ben Vitale
Messages: 247
Registered: July 2009
Senior Member
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 Go to previous message
Ben Vitale is currently offline Ben Vitale
Messages: 247
Registered: July 2009
Senior Member
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
>
Previous Topic:Writing to stdout
Next Topic:Long delay + UI locked when saving MANIFESTs
Goto Forum:
  


Current Time: Fri Aug 29 18:23:46 EDT 2014

Powered by FUDForum. Page generated in 0.10353 seconds