public class BasicDifferenceGroupImpl extends AdapterImpl implements IDifferenceGroup
IDifferenceGroup
uses a predicate to filter the whole list of differences.
This can be subclasses or used directly instead of IDifferenceGroup
.
Modifier and Type | Class and Description |
---|---|
protected static class |
BasicDifferenceGroupImpl.ChildrenSide
An enum that represents, for a given diff, the accepted side(s) for its children and provides utilty
methods to manage sides.
|
Adapter.Internal
Modifier and Type | Field and Description |
---|---|
protected List<TreeNode> |
children
The list of children of this group.
|
protected static com.google.common.base.Function<Diff,BasicDifferenceGroupImpl.ChildrenSide> |
DIFF_TO_SIDE
Get the accepted side(s) for children of a given Diff.
|
protected static com.google.common.base.Function<EObject,Iterator<EObject>> |
E_ALL_CONTENTS
Function that returns all contents of the given EObject.
|
protected Set<Diff> |
extensionDiffProcessed
The list of already processed refined diffs.
|
protected com.google.common.base.Predicate<? super Diff> |
filter
The filter we'll use in order to filter the differences that are part of this group.
|
protected Image |
image
The icon that the EMF Compare UI will display for this group.
|
protected String |
name
The name that the EMF Compare UI will display for this group.
|
target
TREE_NODE_DATA
Constructor and Description |
---|
BasicDifferenceGroupImpl(Comparison comparison,
com.google.common.base.Predicate<? super Diff> filter,
ECrossReferenceAdapter crossReferenceAdapter)
Instantiates this group given the comparison and filter that should be used in order to determine its
list of differences.
|
BasicDifferenceGroupImpl(Comparison comparison,
com.google.common.base.Predicate<? super Diff> filter,
String name,
ECrossReferenceAdapter crossReferenceAdapter)
Instantiates this group given the comparison and filter that should be used in order to determine its
list of differences.
|
BasicDifferenceGroupImpl(Comparison comparison,
com.google.common.base.Predicate<? super Diff> filter,
String name,
Image image,
ECrossReferenceAdapter crossReferenceAdapter)
Instantiates this group given the comparison and filter that should be used in order to determine its
list of differences.
|
Modifier and Type | Method and Description |
---|---|
List<TreeNode> |
buildContainmentSubTree(Match match) |
void |
buildSubTree()
Builds the sub tree for this group.
|
protected TreeNode |
buildSubTree(Diff diff)
Build the sub tree for the given
Diff . |
protected List<TreeNode> |
buildSubTree(Match match,
boolean containment,
BasicDifferenceGroupImpl.ChildrenSide side)
Build the sub tree of the given
Match . |
List<TreeNode> |
buildSubTree(Match parentMatch,
Match match)
Build the sub tree of the given
Match . |
protected TreeNode |
buildSubTree(MatchResource matchResource)
Build the sub tree of the given
MatchResource . |
protected List<TreeNode> |
buildSubTree(MatchResource matchResource,
Match match)
Build the sub tree of the given Match that is a root of the given MatchResource.
|
protected static com.google.common.base.Predicate<? super Diff> |
compatibleSide(BasicDifferenceGroupImpl.ChildrenSide side)
This can be used to check that a given Diff is compatible with the given side.
|
protected com.google.common.base.Predicate<Diff> |
containmentReferenceForMatch(Match subMatch)
Predicate to know if the given match contains containment refernce change according to the filter of
the group.
|
protected boolean |
containsChildrenWithDataEqualsToDiff(TreeNode treeNode,
Diff diff)
Checks if the given TreeNode children contain the given diff.
|
void |
dispose()
Dispose this group provider.
|
List<? extends TreeNode> |
getChildren()
The list of TreeNode containded in this group.
|
protected Comparison |
getComparison()
Returns the comparison object.
|
Image |
getImage()
The icon that is to be used for this group in the compare UI.
|
String |
getName()
A human-readable label for this group.
|
IStyledString.IComposedStyledString |
getStyledName()
The styled label for the this group.
|
boolean |
isAdapterForType(Object type) |
protected boolean |
isRootOfResourceURI(EObject eObject,
String uri)
Check if the resource of the given object as the same uri as the given uri.
|
boolean |
matchWithLeftAndRightInDifferentContainer(Match match)
Checks, for the given Match, if the container of the left part is different from the container of the
right part (Case of a match of a move remote diff).
|
protected void |
registerCrossReferenceAdapter(List<? extends Notifier> notifiers)
Registers the CrossReferenceAdapter to all given notifiers.
|
protected static com.google.common.base.Predicate<? super Diff> |
resourceAttachmentChange()
This can be used to check whether a givan diff is a resource attachment change.
|
protected void |
unregisterCrossReferenceAdapter(List<? extends Notifier> notifiers)
Unregisters the CrossReferenceAdapter from all given notifiers.
|
protected TreeNode |
wrap(EObject data)
Creates a TreeNode form the given EObject.
|
getTarget, notifyChanged, setTarget, unsetTarget
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTarget, notifyChanged, setTarget
protected static final com.google.common.base.Function<EObject,Iterator<EObject>> E_ALL_CONTENTS
protected final com.google.common.base.Predicate<? super Diff> filter
protected final String name
protected final Image image
protected Set<Diff> extensionDiffProcessed
protected static final com.google.common.base.Function<Diff,BasicDifferenceGroupImpl.ChildrenSide> DIFF_TO_SIDE
public BasicDifferenceGroupImpl(Comparison comparison, com.google.common.base.Predicate<? super Diff> filter, ECrossReferenceAdapter crossReferenceAdapter)
This will use the default name and icon for the group.
comparison
- The comparison that is the parent of this group.filter
- The filter we'll use in order to filter the differences that are part of this group.crossReferenceAdapter
- The cross reference adapter that will be added to this group's children.public BasicDifferenceGroupImpl(Comparison comparison, com.google.common.base.Predicate<? super Diff> filter, String name, ECrossReferenceAdapter crossReferenceAdapter)
comparison
- The comparison that is the parent of this group.filter
- The filter we'll use in order to filter the differences that are part of this group.name
- The name that the EMF Compare UI will display for this group.crossReferenceAdapter
- The cross reference adapter that will be added to this group's children.public BasicDifferenceGroupImpl(Comparison comparison, com.google.common.base.Predicate<? super Diff> filter, String name, Image image, ECrossReferenceAdapter crossReferenceAdapter)
comparison
- The comparison that is the parent of this group.filter
- The filter we'll use in order to filter the differences that are part of this group.name
- The name that the EMF Compare UI will display for this group.image
- The icon that the EMF Compare UI will display for this group.crossReferenceAdapter
- Updated upstream The cross reference adapter that will be added to this group's children.protected final Comparison getComparison()
public boolean isAdapterForType(Object type)
isAdapterForType
in interface Adapter
isAdapterForType
in class AdapterImpl
AdapterImpl.isAdapterForType(java.lang.Object)
public String getName()
getName
in interface IDifferenceGroup
IDifferenceGroup.getName()
public IStyledString.IComposedStyledString getStyledName()
getStyledName
in interface IDifferenceGroup
IDifferenceGroup.getStyledName()
public Image getImage()
getImage
in interface IDifferenceGroup
null
, a default image will
be used instead.IDifferenceGroup.getImage()
public List<? extends TreeNode> getChildren()
getChildren
in interface IDifferenceGroup
IDifferenceGroup.getChildren()
protected final void registerCrossReferenceAdapter(List<? extends Notifier> notifiers)
notifiers
- the list of notifiers.protected final void unregisterCrossReferenceAdapter(List<? extends Notifier> notifiers)
notifiers
- the list of notifiers.protected TreeNode buildSubTree(MatchResource matchResource)
MatchResource
.matchResource
- the given MatchResource.protected List<TreeNode> buildSubTree(MatchResource matchResource, Match match)
matchResource
- the given MatchResource.match
- the given Match.public List<TreeNode> buildSubTree(Match parentMatch, Match match)
Match
.parentMatch
- the parent of the given Match.match
- the given Match.protected List<TreeNode> buildSubTree(Match match, boolean containment, BasicDifferenceGroupImpl.ChildrenSide side)
Match
.match
- the given Match.containment
- true if the current level represents a containment diff, false otherwise.side
- the accepted side(s) for children of current level.protected TreeNode buildSubTree(Diff diff)
Diff
.diff
- the given diff.protected boolean isRootOfResourceURI(EObject eObject, String uri)
eObject
- the given object.uri
- the given uri.protected static com.google.common.base.Predicate<? super Diff> resourceAttachmentChange()
public boolean matchWithLeftAndRightInDifferentContainer(Match match)
match
- the given Match.protected boolean containsChildrenWithDataEqualsToDiff(TreeNode treeNode, Diff diff)
treeNode
- the given TreeNode.diff
- the given diff.protected com.google.common.base.Predicate<Diff> containmentReferenceForMatch(Match subMatch)
subMatch
- the given Match.protected TreeNode wrap(EObject data)
data
- the given EObject.public void dispose()
dispose
in interface IDifferenceGroup
IDifferenceGroup.dispose()
protected static com.google.common.base.Predicate<? super Diff> compatibleSide(BasicDifferenceGroupImpl.ChildrenSide side)
source
- The side for which we accept the given Diff.public void buildSubTree()
Copyright (c) 2006, 2014 Obeo and others. All rights reserved.