Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » read path within an editor
read path within an editor [message #266050] Mon, 09 August 2004 08:19 Go to next message
Eclipse UserFriend
Originally posted by: rm.triadem.ch

Hello,

How can I read the complete path (not only the filename) of an opened
file within an editor?

Example code:
public class MyTestEditor extends EditorPart {

public void init(IEditorSite site, IEditorInput input) {
setSite(site);
setInput(input);
String filename = input.getName();
/* ??????????????????????????????????
String path =
??????????????????????????????????
*/
}
}


Thank you in advance,
René
Re: read path within an editor [message #266146 is a reply to message #266050] Mon, 09 August 2004 18:05 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Hi,

The interface IEditorInput has methods to get the complete path of the
file, provided that you are dealing with StorageEditorInput object...See
below...The 'm_file' has the complete path.

The interface IStorageEditorInput (the sub interface of IEditorInput)
has the method getStorage() that returns the IStorage object. From
there call, IStorage.getFullPath() that returns an IPath object which
has many methods to get information on the file/the storage.

Hope that helps.

Alex.


Rene Maurer wrote:

> Hello,
>
> How can I read the complete path (not only the filename) of an opened
> file within an editor?
>
> Example code:
> public class MyTestEditor extends EditorPart {
>
> public void init(IEditorSite site, IEditorInput input) {
> setSite(site);
> setInput(input);
> String filename = input.getName();
> /* ??????????????????????????????????
> String path =
> ??????????????????????????????????
> */
> }
> }
>
>
> Thank you in advance,
> René
Re: read path within an editor [message #266374 is a reply to message #266146] Wed, 11 August 2004 02:49 Go to previous message
Eclipse UserFriend
Originally posted by: rm.triadem.ch

Alex Le wrote:

> The interface IStorageEditorInput (the sub interface of IEditorInput)
> has the method getStorage() that returns the IStorage object. From
> there call, IStorage.getFullPath() that returns an IPath object which
> has many methods to get information on the file/the storage.
>
> Hope that helps.

TNX, it does.
Currently I am dealing with IFileEditorInput, which is sufficient for me
right now [ IFile file = ((IFileEditorInput)input).getFile(); ) ].

René
Previous Topic:how to open detached view from code?
Next Topic:Combo Question advice
Goto Forum:
  


Current Time: Tue May 13 07:27:26 EDT 2025

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

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

Back to the top