Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Team API: How to obtain a reference to ISynchronizationContext
Team API: How to obtain a reference to ISynchronizationContext [message #659994] Wed, 16 March 2011 14:10
Johnny Mongiat is currently offline Johnny Mongiat
Messages: 7
Registered: December 2009
Junior Member
Hello,

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)
{
        if (MySynchronizeParticipant.ID.equals(ref.getId()))
        {
		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(...)).

Thanks,
Johnny
Previous Topic:Resource Marker to open custom editor with custom EditorInput
Next Topic:template proposals (ctrl+space)
Goto Forum:
  


Current Time: Tue Sep 23 08:24:50 GMT 2014

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

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