Problems conecting a custom document provider to CompilationUnitEditor. [message #989903] |
Sun, 09 December 2012 18:59 |
Juan Pedro Silva Messages: 258 Registered: July 2009 |
Senior Member |
|
|
Hi everybody.
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 reuse
CompilationUnitEditor's functionality to be able to edit this field's
content. I know that CompilationUnitEditor and related classes are
internal, but I assume the risk of them changing in the future.
So, I have extended CompilationUnitEditor and
CompilationUnitDocumentProvider to provide the correct content to the
editor (I am adding the DP programmatically to my editor in its
constructor). I got this 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
org.eclipse.jface.text.source.AnnotationModel.connect(AnnotationModel.java:498):
Assert.isTrue(fDocument == null || fDocument == document);
The "document" variable always contains the java code passed by my
DocumentProvider but, in some ocassions, the "fDocument" field contains
the complete contents of the file. It looks as if it was filled using
the default DocumentProvider and not my own. May that be the case? I
didn't want to register my document provider in the plugin.xml as it is
not the appropriate one for other editors of the same file extension.
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). I really look forward to your answer.
Regards,
Juan Pedro
|
|
|
|
Powered by
FUDForum. Page generated in 0.01537 seconds