Keeping custom (non text) editor in sync with underlying resource changes [message #333003] |
Wed, 19 November 2008 11:04 |
Laurent Petit![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=lpetit%40yseop.com) Messages: 35 Registered: July 2009 |
Member |
|
|
Hello,
I have a custom editor (not based on AbstractTextEditor or one of its derivatives).
I'm now trying to finish the integration work of correctly behaving if the underlying edited resource is changed in the worskpace : deleted/moved/renamed from the navigator, and also changed by the
user directly on the filesystem (when reported when a refresh is triggered via the navigator view).
My questions are:
- how do I prevent my EditorPart to react to ResourceChangedEvents coming from itself ? That is when doSave() is called on my editor, the editor saves the content via the IFile of its FileEditorInput,
and eventually receives a ResourceChangedEvents related to this saving. Is there an existing mechanism / pattern ? What I have in mind if I'm left alone in this area is to store some sort of "last
synched with file system" timestamp in my editor, and in my IResourceChangedListener.resourceChanged() method always verify if there is something to do, based on the comparison of the "last synched
with file system" timestamp, and the current timestamp of the resource.
- how to react to a move if my editor is dirty ? I think it is something along the way to close the editor and open a new with the new EditorInput, but what would be the standard way of not loosing
the current changes ?
Precisions:
I've tried to figure out how things are done in TextEditors, but I currently don't know anything about TextEditors and related API, and I'm lost.
What I've currently done is : make my custom EditorPart implement IResourceChangedListener.
I'm currently correctly behaving to deleted items and deleted/closed enclosing project : I close the editor without saving anything.
Thanks in advance, any help appreciated,
--
Laurent
|
|
|
Powered by
FUDForum. Page generated in 0.03282 seconds