Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Re: not getting IFile
Re: not getting IFile [message #314024] Sun, 01 April 2007 04:10
Eclipse UserFriend
Originally posted by: hansm.science.uva.nlDELETE

After my suggestion to implement IFileEditorInput directly Ed Merks
<merks@ca.ibm.com> wrote on this subject:

> Your solutions sounds good, but I think you should just implement
> IStorageEditorInput directly, but not IFileEditorInput since your input
> will not generally be an IFile. When a given file system path doesn't
> correspond to something that's in the workspace, you should expect
> getFileForLocation to return null.

However, after some more digging into the Eclipse documentation I encountered
the FileStore. Easier perhaps than implementing IFileEditorInput is something
along the following lines. Of course one cannot profit from
ResourceChangeEvents, but as I understand that is restricted to things in the
Eclipse workspace, outside of which to code below is moving.

FileStoreEditorInput input = null;
try {
final IFileStore filestore = EFS.getStore(new URI(
"file:/Users/me/myfile"));
input = new FileStoreEditorInput(filestore); }
catch (final CoreException xcp) {
xcp.printStackTrace();
}
catch (final URISyntaxException xcp) {
xcp.printStackTrace();
}
final IWorkbenchPage page = getSite().getPage();
try {
page.openEditor(input, MyEditor.ID);
}
catch (final PartInitException xcp) {
xcp.printStackTrace();
}

One caveat. The example code for the multipage editor as generated by the
eclipse ide template checks for FileEditorInput which is now not applicable.
I hope others may find this information useful.

Hans van der Meer
Previous Topic:FrameworkEvent.ERROR when starting eclipse on Mac OS X
Next Topic:problems with undo in SourceViewer
Goto Forum:
  


Current Time: Sat Jun 21 17:25:07 EDT 2025

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

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

Back to the top