Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » IDocumentProvider.getAnnotationModel is null
IDocumentProvider.getAnnotationModel is null [message #1003509] Mon, 21 January 2013 11:53 Go to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hello,

when calling documentProvider.getAnnotationModel(getEditorInput()) returns null. How can I get this method to return an IAnnotationModel. The only way I found was to override the methode of FileDocumentProvider to return a annotation model. Is this the right way to do it?

Thanks,

Ralph
Re: IDocumentProvider.getAnnotationModel is null [message #1003620 is a reply to message #1003509] Mon, 21 January 2013 16:16 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 21.01.2013 12:53, Ralph Gerbig wrote:
> Hello,
>
> when calling documentProvider.getAnnotationModel(getEditorInput())
> returns null. How can I get this method to return an IAnnotationModel.
> The only way I found was to override the methode of
> FileDocumentProvider to return a annotation model. Is this the right
> way to do it?
Try using TextFileDocumentProvider.

Dani
>
> Thanks,
>
> Ralph
Re: IDocumentProvider.getAnnotationModel is null [message #1003907 is a reply to message #1003620] Tue, 22 January 2013 08:06 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi Dani,

thanks for your reply. FileTextDocumentProvider also returns null. I did take a look at its source code and the implementation of createAnnotationModel could be the reason for it.

/**
 * Creates and returns the annotation model for the given file.
 *
 * @param file the file
 * @return the file's annotation model or <code>null</code> if none
 */
 protected IAnnotationModel createAnnotationModel(IFile file) {
	return null;
 }


Ralph
Re: IDocumentProvider.getAnnotationModel is null [message #1004069 is a reply to message #1003907] Tue, 22 January 2013 14:25 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 22.01.2013 09:06, Ralph Gerbig wrote:
> Hi Dani,
>
> thanks for your reply. FileTextDocumentProvider also returns null. I
> did take a look at its source code and the implementation of
> createAnnotationModel could be the reason for it.

By default, the annotation model is taken from the file buffer, so it
looks like something is going wrong there. See
org.eclipse.ui.editors.text.TextFileDocumentProvider.createFileInfo(Object)
for a debug entry point.

Dani
>
> /**
> * Creates and returns the annotation model for the given file.
> *
> * @param file the file
> * @return the file's annotation model or <code>null</code> if none
> */
> protected IAnnotationModel createAnnotationModel(IFile file) {
> return null;
> }
>
>
> Ralph
Re: IDocumentProvider.getAnnotationModel is null [message #1004070 is a reply to message #1004069] Tue, 22 January 2013 14:29 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

this is where my problem seems to come from. I do not hava a file for my document. It displays a custom implementation of IEditorInput.

Ralph
Re: IDocumentProvider.getAnnotationModel is null [message #1004087 is a reply to message #1004070] Tue, 22 January 2013 14:55 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 22.01.2013 15:29, Ralph Gerbig wrote:
> Hi,
>
> this is where my problem seems to come from. I do not hava a file for
> my document. It displays a custom implementation of IEditorInput.
OK, in that case you have to create your own document provider (try
whether you can inherit from StorageDocumentProvider otherwise use
AbstractDocumentProvider) and implement #createAnnotationModel(...),
returning a new AnnotationModel();.

Another approach could be to back your data by your own file system
implementation (EFS). That way you could then use the
TextFileDocumentProvider.

Dani
> Ralph
Re: IDocumentProvider.getAnnotationModel is null [message #1004652 is a reply to message #1004087] Wed, 23 January 2013 15:44 Go to previous message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi Dani,

thank you very much for your excellent support. I did create my own document provider.

Thank you very much!

Ralph
Previous Topic:CVS Password Not Saved with Eclipse 3.4
Next Topic:SIGSEGV error while running eclipse equinox.launcher on HP-UX and JRE6
Goto Forum:
  


Current Time: Thu Mar 28 12:46:26 GMT 2024

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

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

Back to the top