Minimal editor based on bespoke IDocument [message #1732395] |
Mon, 16 May 2016 19:40 |
Robert Onslow Messages: 27 Registered: March 2016 |
Junior Member |
|
|
Hi
I have implemented a bespoke IDocument backed by a bespoke model. I extended org.eclipse.jface.text.Document and implemented get() and get(offset, length) of IDocument to return the model as text.
I create my bespoke IDocument within the getDocument(Object element) method of IDocumentProvider and then in TextEditor I use
setDocumentProvider(documentProvider)
When I run RCP, the text editor opens. Calls are made to get() and get(offset, length) of my IDocument, and debugging shows that the correct text is returned from the model.
But no content is shown in the TextEditor - just a blue background.
I suspect that I have missed a step but can't identify that at the moment.
Can anyone help with this?
Thanks
Robert
[Updated on: Mon, 16 May 2016 20:01] Report message to a moderator
|
|
|
Re: Minimal editor based on bespoke IDocument [message #1732408 is a reply to message #1732395] |
Mon, 16 May 2016 23:58 |
|
The short answer is that you've missed a lot of steps. An IDocument is not just a wrapper object around a String. Methods that the editor relies on would all be returning the wrong results, compared to what should be returned for your string, because your string isn't actually being stored in the document.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
Re: Minimal editor based on bespoke IDocument [message #1732566 is a reply to message #1732408] |
Wed, 18 May 2016 09:34 |
Robert Onslow Messages: 27 Registered: March 2016 |
Junior Member |
|
|
Thanks Nitin
It looks as though I should be implementing ITextStore over my model, rather than implementing IDocument.
So I implemented ITextStore for my model, and overrode Document.getTextStore() to return that implementation.
Still blank
Are there any docs which show how TextEditor calls out to IDocument, which shows what further helpers in Document I need to override?
Thanks
Robert
[Updated on: Wed, 18 May 2016 10:23] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.01458 seconds