Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Opening an Editor on a (non-local) EFS FileStore
Opening an Editor on a (non-local) EFS FileStore [message #319430] Mon, 20 August 2007 21:49 Go to next message
Eclipse UserFriend
Originally posted by: evanwilli.gmail.com

Hi,

I was wondering if someone could point me in the right direction with a problem I'm having (using Eclipse 3.3, on Windows).

I have written a simple EFS implementation, and would like to use an eclipse internal editor to edit these files (read and write access).

My current approach is to:

- use a IFileStore object, and wrap it as a FileStoreEditorInput

eg:
<code>
TreeObject to = (TreeObject) o;
MyFileStore s3 = to.getFilestore();

FileStoreEditorInput input = new FileStoreEditorInput(s3);

String sId = "org.eclipse.ui.DefaultTextEditor";

IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();

page.openEditor(input, sId, true);
</code>
Unfortunately, this gets a NPE when starting the editor:

<code>
org.eclipse.core.runtime.AssertionFailedException: null argument:
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:84)
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:72)
at org.eclipse.core.internal.filebuffers.TextFileBufferManager. createAnnotationModel(TextFileBufferManager.java:509)
at org.eclipse.core.internal.filebuffers.FileStoreTextFileBuffe r.getAnnotationModel(FileStoreTextFileBuffer.java:153)
at org.eclipse.ui.editors.text.TextFileDocumentProvider.getAnno tationModel(TextFileDocumentProvider.java:971)
at org.eclipse.ui.texteditor.MarkerRulerAction.getAnnotationMod el(MarkerRulerAction.java:267)
at org.eclipse.ui.texteditor.MarkerRulerAction.getMarkers(Marke rRulerAction.java:342)
at org.eclipse.ui.texteditor.MarkerRulerAction.update(MarkerRul erAction.java:199)
at org.eclipse.ui.texteditor.AbstractRulerActionDelegate.update (AbstractRulerActionDelegate.java:133)
at org.eclipse.ui.texteditor.AbstractRulerActionDelegate.setAct iveEditor(AbstractRulerActionDelegate.java:90)
at org.eclipse.ui.internal.EditorPluginAction.editorChanged(Edi torPluginAction.java:75)
at org.eclipse.ui.internal.EditorPluginAction.<init>(EditorPluginAction.java:34)
</code>

It seems that the line 153 of the FileStoreTextFileBuffer is passing the results of getLocation() - which fails the isNotNull assertion.
<code>
fAnnotationModel= fManager.createAnnotationModel(getLocation(), LocationKind.LOCATION);
</code>
But, the Javadoc for the getLocation method states:

<code>
Returns the location of this file buffer.

The location is either a full path of a workspace resource or an absolute path in the local file system.

Note: Since 3.3 this method can also return null if the file is not on the local file system.

Returns:
the location of this file buffer or null if the file is not on the local file system
</code>

Naturally, my file system is not local, so this will always be null.

Can anyone offer assistance with this ?

I have started to look at other alternatives - like, using a custom DocumentProvider - this seems to be encouraging, but since it adds more complexity, I'm a little wary about taking this route. Plus, I thought that the above should "just work" :-)

thanks,
Evan Williams
Re: Opening an Editor on a (non-local) EFS FileStore [message #319437 is a reply to message #319430] Tue, 21 August 2007 08:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Evan,

This sounds like something for which you should open a bugzilla. If
it's supposed to work for a file store, and that can return null for a
location, it should handle that. Have you tried returning a "fake"
location just to get past this point?


Evan Williams wrote:
> Hi,
>
> I was wondering if someone could point me in the right direction with a problem I'm having (using Eclipse 3.3, on Windows).
>
> I have written a simple EFS implementation, and would like to use an eclipse internal editor to edit these files (read and write access).
>
> My current approach is to:
>
> - use a IFileStore object, and wrap it as a FileStoreEditorInput
>
> eg:
> <code>
> TreeObject to = (TreeObject) o;
> MyFileStore s3 = to.getFilestore();
>
> FileStoreEditorInput input = new FileStoreEditorInput(s3);
>
> String sId = "org.eclipse.ui.DefaultTextEditor";
>
> IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
>
> page.openEditor(input, sId, true);
> </code>
> Unfortunately, this gets a NPE when starting the editor:
>
> <code>
> org.eclipse.core.runtime.AssertionFailedException: null argument:
> at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:84)
> at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:72)
> at org.eclipse.core.internal.filebuffers.TextFileBufferManager. createAnnotationModel(TextFileBufferManager.java:509)
> at org.eclipse.core.internal.filebuffers.FileStoreTextFileBuffe r.getAnnotationModel(FileStoreTextFileBuffer.java:153)
> at org.eclipse.ui.editors.text.TextFileDocumentProvider.getAnno tationModel(TextFileDocumentProvider.java:971)
> at org.eclipse.ui.texteditor.MarkerRulerAction.getAnnotationMod el(MarkerRulerAction.java:267)
> at org.eclipse.ui.texteditor.MarkerRulerAction.getMarkers(Marke rRulerAction.java:342)
> at org.eclipse.ui.texteditor.MarkerRulerAction.update(MarkerRul erAction.java:199)
> at org.eclipse.ui.texteditor.AbstractRulerActionDelegate.update (AbstractRulerActionDelegate.java:133)
> at org.eclipse.ui.texteditor.AbstractRulerActionDelegate.setAct iveEditor(AbstractRulerActionDelegate.java:90)
> at org.eclipse.ui.internal.EditorPluginAction.editorChanged(Edi torPluginAction.java:75)
> at org.eclipse.ui.internal.EditorPluginAction.<init>(EditorPluginAction.java:34)
> </code>
>
> It seems that the line 153 of the FileStoreTextFileBuffer is passing the results of getLocation() - which fails the isNotNull assertion.
> <code>
> fAnnotationModel= fManager.createAnnotationModel(getLocation(), LocationKind.LOCATION);
> </code>
> But, the Javadoc for the getLocation method states:
>
> <code>
> Returns the location of this file buffer.
>
> The location is either a full path of a workspace resource or an absolute path in the local file system.
>
> Note: Since 3.3 this method can also return null if the file is not on the local file system.
>
> Returns:
> the location of this file buffer or null if the file is not on the local file system
> </code>
>
> Naturally, my file system is not local, so this will always be null.
>
> Can anyone offer assistance with this ?
>
> I have started to look at other alternatives - like, using a custom DocumentProvider - this seems to be encouraging, but since it adds more complexity, I'm a little wary about taking this route. Plus, I thought that the above should "just work" :-)
>
> thanks,
> Evan Williams
>
Re: Opening an Editor on a (non-local) EFS FileStore [message #319451 is a reply to message #319430] Tue, 21 August 2007 12:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

I found a bunch of such bugs in the 3.2 timeframe, which mostly were fixable when I raised bugs against them. Although the N&N of 3.2 specificially listed the fact that code should handle null locations, there's plenty of code (both inside and outside Eclipse) that still doesn't do it properly.

I'd raise a bug against it, and if you can, a repeatable test case. Then it can be fixed, probably for 3.4 :-(

Alex.
Re: Opening an Editor on a (non-local) EFS FileStore [message #319464 is a reply to message #319451] Tue, 21 August 2007 21:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: evanwilli.gmail.com

Thanks for your thoughts.

This is my first bug report - I've raised bug # <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=200745" >200745</a> for this.

I'll see how it goes.

cheers,
Evan
Re: Opening an Editor on a (non-local) EFS FileStore [message #319482 is a reply to message #319464] Wed, 22 August 2007 10:55 Go to previous message
Eclipse UserFriend
Evan Williams wrote:

>Thanks for your thoughts.
>
>This is my first bug report - I've raised bug # <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=200745" >200745</a> for this.
>
>I'll see how it goes.
>
>
Definitely a bug. I'll take a look.

Dani

>cheers,
>Evan
>
>
Previous Topic:Why would a Marker's "Go To" not focus on line # in the editor?
Next Topic:how to read the extensions registry outside eclipse
Goto Forum:
  


Current Time: Sat Nov 08 04:08:56 EST 2025

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

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

Back to the top