Class IdenticalResourceMinimizer
java.lang.Object
org.eclipse.emf.compare.ide.ui.internal.logical.IdenticalResourceMinimizer
- All Implemented Interfaces:
IModelMinimizer
public class IdenticalResourceMinimizer extends java.lang.Object implements IModelMinimizer
Instances of this class will be used by EMF Compare to minimize the scope to parts of a logical model that
can be considered valid candidates for a difference.
This default implementation will consider that all files that are binary identical between the two (or three) sides of the comparison can be safely removed from the scope. Likewise, unmatched read-only files will be removed from the scope.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.emf.compare.ide.ui.logical.IModelMinimizer
IModelMinimizer.Registry
-
Constructor Summary
Constructors Constructor Description IdenticalResourceMinimizer()
-
Method Summary
Modifier and Type Method Description protected boolean
equals(org.eclipse.core.resources.IStorage left, org.eclipse.core.resources.IStorage right)
Checks whether the two given (non-null
) resources are identical.protected boolean
equals(org.eclipse.core.resources.IStorage left, org.eclipse.core.resources.IStorage right, org.eclipse.core.resources.IStorage origin)
Checks whether the three given (non-null
) resources are identical.void
minimize(org.eclipse.core.resources.IFile file, SynchronizationModel syncModel, org.eclipse.core.runtime.IProgressMonitor monitor)
This will be called to reduce the number of resources in this model's traversals based on the given starting point of the left logical model.void
minimize(SynchronizationModel syncModel, org.eclipse.core.runtime.IProgressMonitor monitor)
This will be called to reduce the number of resources in this model's traversals.protected org.eclipse.core.resources.IStorage
removeLikeNamedStorageFrom(org.eclipse.core.resources.IStorage reference, java.util.Set<? extends org.eclipse.core.resources.IStorage> candidates)
Looks up into thecandidates
set for a storage which name matches that of thereference
storage, removing it if there is one.
-
Constructor Details
-
IdenticalResourceMinimizer
public IdenticalResourceMinimizer()
-
-
Method Details
-
minimize
public void minimize(SynchronizationModel syncModel, org.eclipse.core.runtime.IProgressMonitor monitor)This will be called to reduce the number of resources in this model's traversals. Specifically, we'll remove all resources that can be seen as binary identical (we match resources through exact equality of their names).- Specified by:
minimize
in interfaceIModelMinimizer
- Parameters:
syncModel
- The synchronization model to be minimized.monitor
- Monitor on which to report progress to the user.- See Also:
IModelMinimizer.minimize(org.eclipse.emf.compare.ide.ui.logical.SynchronizationModel, org.eclipse.core.runtime.IProgressMonitor)
-
minimize
public void minimize(org.eclipse.core.resources.IFile file, SynchronizationModel syncModel, org.eclipse.core.runtime.IProgressMonitor monitor)This will be called to reduce the number of resources in this model's traversals based on the given starting point of the left logical model. Specifically, this minimizer does not consider the selected file and performs the same operation as it does without the file.- Specified by:
minimize
in interfaceIModelMinimizer
- Parameters:
file
- The file that has been used as the starting point to resolve the left logical model.syncModel
- The synchronization model to be minimized.monitor
- Monitor on which to report progress to the user.- See Also:
IModelMinimizer.minimize(IFile, SynchronizationModel, IProgressMonitor)
-
equals
protected boolean equals(org.eclipse.core.resources.IStorage left, org.eclipse.core.resources.IStorage right, org.eclipse.core.resources.IStorage origin)Checks whether the three given (non-null
) resources are identical. This default implementation only checks that the three are identical binary-wise.Identical resources will be filtered out of the comparison scope.
- Parameters:
left
- Left of the resources to consider.right
- Right of the resources to consider.origin
- Common ancestor of the left and right resources.- Returns:
true
if the given resources are to be considered identical,false
otherwise.
-
equals
protected boolean equals(org.eclipse.core.resources.IStorage left, org.eclipse.core.resources.IStorage right)Checks whether the two given (non-null
) resources are identical. This default implementation only checks that the two are identical binary-wise.Identical resources will be filtered out of the comparison scope.
- Parameters:
left
- Left of the resources to consider.rightRight
- of the resources to consider.- Returns:
true
if the given resources are to be considered identical,false
otherwise.
-
removeLikeNamedStorageFrom
protected org.eclipse.core.resources.IStorage removeLikeNamedStorageFrom(org.eclipse.core.resources.IStorage reference, java.util.Set<? extends org.eclipse.core.resources.IStorage> candidates)Looks up into thecandidates
set for a storage which name matches that of thereference
storage, removing it if there is one.- Parameters:
reference
- The storage for which we'll seek a match intocandidates
.candidates
- The set of candidates into which to look up for a match toreference
.- Returns:
- The first storage from the set of candidates that matches the
reference
, if any.null
if none match.
-