Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Keeping custom (non text) editor in sync with underlying resource changes
Keeping custom (non text) editor in sync with underlying resource changes [message #333003] Wed, 19 November 2008 11:04
Laurent Petit is currently offline Laurent PetitFriend
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
Previous Topic:Example Pessimistic file system provider code?
Next Topic:How to correlate the ant-runtime location with the current eclipse home?
Goto Forum:
  


Current Time: Sun Sep 01 08:27:19 GMT 2024

Powered by FUDForum. Page generated in 0.03282 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top