org.eclipse.compare.structuremergeviewer.IDiffContainer Java Examples

The following examples show how to use org.eclipse.compare.structuremergeviewer.IDiffContainer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CompareInputResourceProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private List<String> getPath(ITypedElement typedElement) {
	List<String> names = Lists.newArrayList(typedElement.getName());
	ITypedElement current = typedElement;
	while (current instanceof IDiffContainer) {
		names.add(current.getName());
		current = ((IDiffContainer) current).getParent();
	}
	Collections.reverse(names);
	List<String> segments = Lists.newArrayList();
	for (String name : names)
		if (!Strings.isEmpty(name))
			for (String seg : name.split("/"))
				segments.add(seg);
	return segments;
}
 
Example #2
Source File: CommitSynchronizeAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private static void collectAllNodes(IDiffElement element, Set nodes, List selected) {
	boolean added = false;
	if(element.getKind() != SyncInfo.IN_SYNC) {
		nodes.add(element);
		added = true;
	}
	if(element instanceof IDiffContainer) {
		if (added)
		{
			// if a container itself was changed/added then check if there is a selection inside it. 
			// Then only take that one and not auto all its children
			for (int i = 0; i < selected.size(); i++) {
				Object object = selected.get(i);
				if(object instanceof IDiffElement && object != element) {
					IDiffContainer parent = ((IDiffElement)object).getParent();
					while (parent != null)
					{
						if (parent == element) return;
						parent = parent.getParent();
					}
				}
			}
		}
		IDiffElement[] children = ((IDiffContainer)element).getChildren();
		for (int i = 0; i < children.length; i++) {
			collectAllNodes(children[i], nodes,selected);
		}
	}
}
 
Example #3
Source File: JavaStructureDiffViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void postDiffHook(Differencer differencer, IDiffContainer root, IProgressMonitor monitor) {
	if (fStructureCreator.canRewriteTree()) {
		boolean smart= JavaCompareUtilities.getBoolean(getCompareConfiguration(), SMART, false);
		if (smart && root != null)
			fStructureCreator.rewriteTree(differencer, root);
	}
}
 
Example #4
Source File: ConflictsCompareInput.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public MyDiffNode(IDiffContainer parent, int kind, ITypedElement ancestor, ITypedElement left, ITypedElement right) {
    super(parent, kind, ancestor, left, right);
}
 
Example #5
Source File: BuiltInConflictsCompareInput.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public MyDiffNode(IDiffContainer parent, int kind, ITypedElement ancestor, ITypedElement left, ITypedElement right) {
    super(parent, kind, ancestor, left, right);
}