|Team API: How to obtain a reference to ISynchronizationContext [message #659994]
||Wed, 16 March 2011 14:10
| Johnny Mongiat
Registered: December 2009
I'm trying to find a way to obtain a reference to the underlying ISynchronizationContext from my IMoveDeleteHook implementation. The reason I need access to the ISynchronizationContext is so that I can obtain the IResourceDiffTree to gain access to the out-of-sync resources, and ultimately perform some business logic on these resources upon a delete hook method call.
The only solution I have found thus far (but I'm not sure if this really the right way to approach it - if somebody can provide some guidance on this???):
ISynchronizeParticipantReference refs = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
for (ISynchronizeParticipantReference ref : refs)
MySynchronizeParticipant p = (MySynchronizeParticipant) ref.getParticipant();
ISynchronizationContext context = p.getContext();
IResourceDiffTree diffTree = context.getDiffTree();
IResource members = diffTree.members(folder);
// perform business logic on the out-of-sync members...
The rationale behind wanting to access the out-of-sync resources is due to the fact that when a user deletes an IFolder resource from their IProject (we have defined our own custom project nature), if the synchronization view is currently displaying the folder (with INCOMING-ADDITION child files), then we want to force that the corresponding folder (and it's children) be removed from the sync tree/view (i.e. flush the corresponding cached sync bytes via ThreeWaySynchronizer.flush(...)).
Powered by FUDForum
. Page generated in 0.02024 seconds