Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-vcm-dev] ISynchronizer


> Looking at the team core example, I see the StateFactory makes use of
> ISynchronizer.
> From what I can gather, this allows one to associate a "serializable"
> object (byte array) in some way with a resource.

Exactly. It's a very handy mechanism for remembering the base state with the resource tree and getting serialization for free. However you should read the API doc for the synchronizer because it handles deleted resources in interesting ways. Using the core Synchronizer facility supports the creation of what are called 'phantom' resources that don't exist in the workspace but have sync information associated with them. This is handy for differentiating incoming additions (no local resource, no base, and a remote) versus an outgoing deletion (no local resource, a base, and a remote)

> Its the "some way" that I am unsure about.  Can anyone elighten me?
> Specifically w.r.t. wether the data associated with a resource gets
> removed when the resource gets refreshed?


I think that the only way to remove sync info from the Synchronizer is to call the set method with null. If your plugin needs special handling for local refresh, I think that a resource listener would have to update the sync tree when resources change outside of Eclipse.

Another lighter weight mechanism for associating data with resources is by using IResource session properties. We make use of session properties in the CVS plugin as a cache for local resource state information, see the EclipseSynchronizer class in the CVS plugin for an example.

http://www.eclipse.org/documentation/html/plugins/org.eclipse.platform.doc.isv/doc/reference/api/org/eclipse/core/resources/IResource.html#setSessionProperty(org.eclipse.core.runtime.QualifiedName,%20java.lang.Object)

Hope this helps,

Jean-Michel

Back to the top