Eclipse Platform
Release 3.2

org.eclipse.team.ui.mapping
Class SynchronizationCompareAdapter

java.lang.Object
  extended byorg.eclipse.team.ui.mapping.SynchronizationCompareAdapter
All Implemented Interfaces:
ISynchronizationCompareAdapter
Direct Known Subclasses:
AbstractCompareAdapter

public class SynchronizationCompareAdapter
extends Object
implements ISynchronizationCompareAdapter

A abstract implementation of ISynchronizationCompareAdapter. Most of the methods are no-ops except for the asCompareInput(ISynchronizationContext, Object) which will convert file objects to an appropriate compare input.

EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is a guarantee neither that this API will work nor that it will remain the same. Please do not use this API without consulting with the Platform/Team team.

Since:
3.2

Constructor Summary
SynchronizationCompareAdapter()
           
 
Method Summary
 ICompareInput asCompareInput(ISynchronizationContext context, Object o)
          Return a compare input for the given model object.
 long countFor(ISynchronizationContext context, int state, int mask)
          Return the number of out-of-sync elements in the given context whose synchronization state matches the given mask.
 IPath getFullPath(org.eclipse.core.resources.mapping.ResourceMapping mapping)
          Get the path associated with the model object of the given mapping.
 String getName(org.eclipse.core.resources.mapping.ResourceMapping mapping)
          Get the name associated with the model object of the given mapping.
 boolean hasCompareInput(ISynchronizationContext context, Object object)
          Return whether their is a compare input associated with the given object.
 org.eclipse.core.resources.mapping.ResourceMapping[] restore(IMemento memento)
          Restore the previosuly saved resource mappings.
 void save(org.eclipse.core.resources.mapping.ResourceMapping[] mappings, IMemento memento)
          Save the given resource mappings from this adapters model provider into the given memento in a form that can be restored at a future time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizationCompareAdapter

public SynchronizationCompareAdapter()
Method Detail

asCompareInput

public ICompareInput asCompareInput(ISynchronizationContext context,
                                    Object o)
Description copied from interface: ISynchronizationCompareAdapter
Return a compare input for the given model object. Creation of the input should be fast. Synchronization information calculations that are longer running should be performed up front in the #prepareContext(ISynchronizationContext, IProgressMonitor) method. Clients should call this method once per context before obtaining any compare inputs from the adapter. A null should be returned if the model object is in-sync or otherwise cannot be compared.

Model paroviders can choose to return an instance of IModelCompareInput if they wish to tailor the compare editor used to show the compare input of provide an ISaveableCompareModel in order to have more contol over the save lifecycle during a merge.

Specified by:
asCompareInput in interface ISynchronizationCompareAdapter
Parameters:
context - the synchronization context
o - the model object
Returns:
a compare input or null if the model object is in-sync or otherwise cannot be compared.

hasCompareInput

public boolean hasCompareInput(ISynchronizationContext context,
                               Object object)
Description copied from interface: ISynchronizationCompareAdapter
Return whether their is a compare input associated with the given object. In otherwords, return true if ISynchronizationCompareAdapter.asCompareInput(ISynchronizationContext, Object) would return a value and false if it would return null.

Specified by:
hasCompareInput in interface ISynchronizationCompareAdapter
Parameters:
context - the synchronization context
object - the object.
Returns:
whether their is a compare input associated with the given object

countFor

public long countFor(ISynchronizationContext context,
                     int state,
                     int mask)
Description copied from interface: ISynchronizationCompareAdapter
Return the number of out-of-sync elements in the given context whose synchronization state matches the given mask. A state of 0 assumes a count of all changes. A mask of 0 assumes a direct match of the given state. This method is used to determine if there are changes of interest in the given context. Implementations can obtain the count from the diff tree of the context using IDiffTree.countFor(int, int) or perform the calculation themselves.

For example, this will return the number of outgoing changes in the set:

  long outgoing =  countFor(context, IThreeWayDiff.OUTGOING, IThreeWayDiff.DIRECTION_MASK);
 

Specified by:
countFor in interface ISynchronizationCompareAdapter
Parameters:
context - the synchronization context
state - the sync state
mask - the sync state mask
Returns:
the number of matching resources in the set.

getName

public String getName(org.eclipse.core.resources.mapping.ResourceMapping mapping)
Description copied from interface: ISynchronizationCompareAdapter
Get the name associated with the model object of the given mapping. This name sould be suitable for display to the user.

Specified by:
getName in interface ISynchronizationCompareAdapter
Parameters:
mapping - the mapping
Returns:
the name of the mapping's model object

getFullPath

public IPath getFullPath(org.eclipse.core.resources.mapping.ResourceMapping mapping)
Description copied from interface: ISynchronizationCompareAdapter
Get the path associated with the model object of the given mapping. Ths path sould be suitable for display to the user.

Specified by:
getFullPath in interface ISynchronizationCompareAdapter
Parameters:
mapping - the mapping
Returns:
the path of the model object of the mapping

save

public void save(org.eclipse.core.resources.mapping.ResourceMapping[] mappings,
                 IMemento memento)
Description copied from interface: ISynchronizationCompareAdapter
Save the given resource mappings from this adapters model provider into the given memento in a form that can be restored at a future time.

Specified by:
save in interface ISynchronizationCompareAdapter
Parameters:
mappings - the resource mappings to save
memento - the memento where the mappings should be saved

restore

public org.eclipse.core.resources.mapping.ResourceMapping[] restore(IMemento memento)
Description copied from interface: ISynchronizationCompareAdapter
Restore the previosuly saved resource mappings.

Specified by:
restore in interface ISynchronizationCompareAdapter
Parameters:
memento - a memento
Returns:
the mappings restored from the given memento

Eclipse Platform
Release 3.2

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.