Skip to main content


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 16:08 Go to next message
Alain Sahli is currently offline Alain SahliFriend
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 13:08 Go to previous message
Ben Vitale is currently offline Ben VitaleFriend
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 13:08 Go to previous message
Ben Vitale is currently offline Ben VitaleFriend
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: Tue Apr 23 16:35:15 GMT 2024

Powered by FUDForum. Page generated in 0.02959 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top