Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » FileLink in console with a external file
FileLink in console with a external file [message #328359] Fri, 23 May 2008 06:48 Go to next message
No real name is currently offline No real nameFriend
Messages: 64
Registered: July 2009
Member
hi all,

I try to have a link in a console that open a file who is not in the
workspace

to be practical , I have that

IFile confFile = ResourcesPlugin.getWorkspace().getRoot()
.getFileForLocation(new Path(line));

who return null cause the file représented by his path is out of the
workspace (but really exist)

I found that
http://www.google.com/codesearch?hl=fr&q=+package:https: //sifsstud2.hsr.ch/publicsvn/PythonRefactoring/trunk+doOpenE ditor+show:aW3_nOKb3zY:0TJD2-nsoQg:aW3_nOKb3zY&sa=N& cd=1&ct=rc&cs_p=https://sifsstud2.hsr.ch/publicsvn/P ythonRefactoring/trunk&cs_f=src/org.python.pydev/src/org /python/pydev/plugin/PydevPlugin.java

but it seem ood and bizarre (with a big ALL BELOW IS COPIED) .

plus, there some part of code I dont unterdstand like

return new PydevFileEditorInput(new File(fileAbsolutePath));

who return a class derived from IPathEditorInput and ILocationProvider

me the only thing I have is A TextEditor class so must I replace this
kind of thing by
return new MyEditor().getInputEditor().???


or is there any other facilities??
thanks

a++
Re: FileLink in console with a external file [message #328401 is a reply to message #328359] Fri, 23 May 2008 22:48 Go to previous message
David Kyle is currently offline David KyleFriend
Messages: 125
Registered: July 2009
Senior Member
Julien,

Look at the class OpenLocalFileAction (the code for File->Open File...) in
the org.eclipse.ui.ide plugin and search for the following.

IFileStore fileStore = EFS.getLocalFileSystem().getStore(new
Path(filterPath));

A bit of magic turns the IFileStore into a FileStoreEditorInput which is
used by your editor. If your editor, like ours, needs to open a plan old
file you can turn the FileStoreEditorInput into an IPath in your
IAdapterFactory. It would look something like this:

URI uri = ((FileStoreEditorInput) adaptableObject).getURI();
IPath path = URIUtil.toPath(uri);
File file = new File(path.toString());

David Kyle
http://richclientplatform.blogspot.com/
Previous Topic:classes appearing twice in my plugin
Next Topic:Separators in org.eclipse.ui.popupMenus
Goto Forum:
  


Current Time: Thu Jul 25 23:30:52 GMT 2024

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

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

Back to the top