On 11/3/11 8:59 PM, Jörn Kottmann wrote:
Otherwise a client, needs to swap its listener when a document
changed, and it is also
not the place I would look for a document changed event.
Doesn't the client needs to do that anyway? I think there is no ways
to keep the document object. So we get a new object, the listeners
need to be removed and added to the new object. Therefore, when the
method is called the old and the new document need to be available
and I prefer to provide them both in the interface instead of calling
editor.getDocument() or something.
Did I miss here something?
No, I might be handy to provide the old and the new document, but
usually you call setInput on
a JFace viewer which then still knows the old input element and calls
inputChanged on the content
provider for you, so no need to do this manually.
Moving the event to an editor listener makes it easy to just call
setInput in our views to tell
the content provider that the input element changed. The setInput
methods around the
Cas Editor views might need to be improved (at least the one I reviewed
yesterday),
I can help with that.
Inside the Annotation Editor the listeners should be notified from the
doSetInput method. Then the
code path can be used for both cases:
- Document content replaced
- Editor is reused by eclipse
Jörn