| [EMF] Editor Page for source code field? [message #992382]
||Fri, 21 December 2012 14:07
| Juan Pedro Silva
Registered: July 2009
I am facing some problems trying to add an editor page to the generated multipage editor for editing the contents of a particular model element's field. I have defined an EMF metamodel in which some elements have a String field which will contain some Java code. Now I am trying to extend
to be able to edit this field's content, to no avail.
I have already extended AbstractDecoratedTextEditor and I'm using a customized implementation of DocumentProvider to provide the correct content to the editor. I've also created my own StringEditorInput to be provided as the editor's input. I have registered my DP for this type of editor input, and also set it programmatically in my editor's constructor, but I got that far. Regretfully, I am getting AssertionFailedExceptions when trying to use the editor for my models.
I tried to debug the code, and found that the problem occurs at
method. The exact offending line is (AnnotationModel.java:line 498):
Assert.isTrue(fDocument == null || fDocument == document);
when called from within the for loop below in that same method (AnnotationModel.java:lines 517 to 529):
for (Iterator it= fAttachments.keySet().iterator(); it.hasNext();)
IAnnotationModel model= (IAnnotationModel) fAttachments.get(it.next());
The document variable in the assertion always contains the document passed by my DocumentProvider but, when called from within that for loop (on the IAnnotationModel model elements), the fDocument field contains a SynchronizableDocument (which contains the complete contents of the enclosing file). It looks as if it was created using the default DocumentProvider and not my own, even though I registered my DP for my type of EditorInput.
I would really appreciate if any of you could point me towards the right path on how to solve this (or, alternatively, show me a better approach to take). Is there a way to set the document in these IAnnotationModel model elements?
Thanks in advance.
[Updated on: Fri, 21 December 2012 16:42]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02073 seconds