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
.
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<EObject,Iterator<EObject>> |
E_ALL_CONTENTS
Function that returns all contents of the given EObject.
|
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 org.eclipse.swt.graphics.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,
org.eclipse.swt.graphics.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 |
---|---|
protected void |
addDiffNode(MatchNode matchNode,
Diff diff)
Add the diff in the given match.
|
protected List<TreeNode> |
buildMatchResourceTrees() |
protected List<TreeNode> |
buildMatchTrees()
Compute a subTree for each root match of the comparison.
|
void |
buildSubTree()
Builds the sub tree for this group.
|
protected MatchResourceNode |
buildSubTree(MatchResource matchResource,
Set<ResourceAttachmentChange> attachmentChanges)
Build the sub tree of the given
MatchResource . |
protected MatchNode |
buildTree(Match match)
Compute a tree for the given match.
|
protected List<TreeNode> |
createChildren()
This creates the root-level children of the group.
|
protected ConflictNode |
createConflictNode(Conflict conflict)
Create a conflict node.
|
protected DiffNode |
createDiffNode(Diff diff)
Create a diff node.
|
protected MatchNode |
createMatchNode(Match match)
Create a match node.
|
protected MatchResourceNode |
createMatchResourceNode(MatchResource matchResource)
Create a matchResource node.
|
protected void |
customize(List<? extends TreeNode> nodes)
Walk the given trees and customize each node in the tree, starting by the deeper nodes all the way up
to the root nodes.
|
protected void |
customize(TreeNode treeNode)
Allow extenders to customize a TreeNode.
|
void |
dispose()
Dispose this group provider.
|
protected void |
doBuildSubTrees()
Perform the creation of the sub-trees of the group.
|
List<? extends TreeNode> |
getChildren()
The list of TreeNode containded in this group.
|
protected Comparison |
getComparison()
Returns the comparison object.
|
org.eclipse.swt.graphics.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.
|
protected Match |
getTargetMatch(Diff diff)
Provide the Match that should directly contain the given diff.
|
protected void |
handleRefiningDiffs(DiffNode diffNode)
Handle the diffs that refine the given diff.
|
boolean |
isAdapterForType(Object type) |
protected boolean |
isContainmentRefChange(Diff diff)
Is it a containment reference change?
|
protected boolean |
mustDisplayAsDirectChildOfMatch(Diff diff)
Does the given difference have to be displayed as direct child of a Match?
|
protected void |
populateMatchNode(MatchNode matchNode)
Build the subtree for the given match.
|
protected void |
registerCrossReferenceAdapter(List<? extends Notifier> notifiers)
Registers the CrossReferenceAdapter to all given notifiers.
|
protected void |
unregisterCrossReferenceAdapter(List<? extends Notifier> notifiers)
Unregisters the CrossReferenceAdapter from all given notifiers.
|
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 org.eclipse.swt.graphics.Image image
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, org.eclipse.swt.graphics.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 org.eclipse.swt.graphics.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.public void dispose()
dispose
in interface IDifferenceGroup
IDifferenceGroup.dispose()
public void buildSubTree()
protected void doBuildSubTrees()
protected List<TreeNode> createChildren()
protected List<TreeNode> buildMatchTrees()
protected MatchNode buildTree(Match match)
match
- The given matchnull
protected void populateMatchNode(MatchNode matchNode)
matchNode
- The root matchNodeprotected Match getTargetMatch(Diff diff)
null
. For a given strategy, a diff should only be
displayed in the same Match (i.e. the DiffNode
s that represent the diff should always be
children of the MatchNode
s that represent the returned Match.diff
- The differencenull
.protected boolean mustDisplayAsDirectChildOfMatch(Diff diff)
diff
- The difftrue
if the diff's node should be a child of a MatchNode.protected boolean isContainmentRefChange(Diff diff)
diff
- The difftrue
if the diff is a ReferenceChange
whose EReference
is a
containment reference.protected MatchResourceNode buildSubTree(MatchResource matchResource, Set<ResourceAttachmentChange> attachmentChanges)
MatchResource
.matchResource
- the given MatchResource.protected void addDiffNode(MatchNode matchNode, Diff diff)
matchNode
- The given match nodediff
- The diff to addprotected DiffNode createDiffNode(Diff diff)
diff
- The given diffprotected MatchNode createMatchNode(Match match)
match
- The given matchprotected ConflictNode createConflictNode(Conflict conflict)
conflict
- The given conflictprotected MatchResourceNode createMatchResourceNode(MatchResource matchResource)
matchResource
- The given matchResourceprotected void customize(List<? extends TreeNode> nodes)
nodes
- The list of nodes to customize.protected void customize(TreeNode treeNode)
treeNode
- the TreeNode to customize.protected void handleRefiningDiffs(DiffNode diffNode)
diffNode
- The diff node to handle, which is not necessarily a child of a MatchNode since this method
is called recursively.
Copyright (c) 2006, 2015 Obeo and others. All rights reserved.