| Opening an Editor on a (non-local) EFS FileStore [message #319430] |
Mon, 20 August 2007 21:49  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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
>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.10120 seconds