dispose() for extended Document? [message #333654] |
Fri, 19 December 2008 19:38 |
Eclipse User |
|
|
|
Originally posted by: zzq.hvc.rr.com
As a test case, I have a simple modification to the sample XML text
editor created by: New-> Project-> Plugin-in project-> Project with an
editor.
I defined a new class which extends the Document class. I overrode
createEmptyDocument() in XMLDocumentProvider to return a new extended
document instead of a new Document. The extended document is then
processed and returned to the editor by createDocument(...) in the provider.
I can successfully add methods and data to the extended Document, and it
seems to work as I had expected.
The problems is that I want to add some processing (removing a listener)
when the document is disposed (i.e. when the editor instance is closed).
I discovered that there is no dispose() method for a Document and thus
dispose() in my extended document is never called. I could not find an
equivalent of dispose() in the Document hierarchy.
Is this a bug? (or just a feature :-)? Is there any way around it? Is
there some other Document method that is called when a document is disposed?
I realize that I can simply save a link to the document in the XMLEditor
editor instance and invoke the extended document dispose() from within
the editor dispose().
But it appears to me that a very large amount of effort has gone into
keeping an editor and its document(s) very separate. I assume this is
intentional, perhaps to allow an editor to be shared. Am I correct in
thinking that forcing a one to one relationship between a document and
its editor is a bad idea?
Is there a preferred way to do what I'm trying to do?
Thanks.
Bill Fenlason
|
|
|
Re: dispose() for extended Document? [message #333656 is a reply to message #333654] |
Sat, 20 December 2008 16:19 |
Eclipse User |
|
|
|
Originally posted by: zzq.hvc.rr.com
I now see that an appropriate way is to override disposeElementInfo() in
my document provider and issue the dispose() for the extended document
there. Sorry for the noise, guess I should have dug more before
posting. Bill
|
|
|
|
Powered by
FUDForum. Page generated in 0.03935 seconds