org.eclipse.compare.structuremergeviewer.IDiffElement Java Examples

The following examples show how to use org.eclipse.compare.structuremergeviewer.IDiffElement. 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: SVNLocalCompareSummaryInput.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException {
	ITypedElement left= node.getLeft();
	if (left instanceof BufferedResourceNode)
		((BufferedResourceNode) left).commit(pm);
		
	ITypedElement right= node.getRight();
	if (right instanceof BufferedResourceNode)
		((BufferedResourceNode) right).commit(pm);

	IDiffElement[] children= node.getChildren();
	if (children != null) {
		for (int i= 0; i < children.length; i++) {
			IDiffElement element= children[i];
			if (element instanceof DiffNode)
				commit(pm, (DiffNode) element);
		}
	}
}
 
Example #2
Source File: SVNLocalBaseCompareInput.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException {
	ITypedElement left= node.getLeft();
	if (left instanceof BufferedResourceNode)
		((BufferedResourceNode) left).commit(pm);
		
	ITypedElement right= node.getRight();
	if (right instanceof BufferedResourceNode)
		((BufferedResourceNode) right).commit(pm);

	IDiffElement[] children= node.getChildren();
	if (children != null) {
		for (int i= 0; i < children.length; i++) {
			IDiffElement element= children[i];
			if (element instanceof DiffNode)
				commit(pm, (DiffNode) element);
		}
	}
}
 
Example #3
Source File: SVNLocalCompareInput.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException {
	ITypedElement left= node.getLeft();
	if (left instanceof BufferedResourceNode)
		((BufferedResourceNode) left).commit(pm);
		
	ITypedElement right= node.getRight();
	if (right instanceof BufferedResourceNode)
		((BufferedResourceNode) right).commit(pm);

	IDiffElement[] children= node.getChildren();
	if (children != null) {
		for (int i= 0; i < children.length; i++) {
			IDiffElement element= children[i];
			if (element instanceof DiffNode)
				commit(pm, (DiffNode) element);
		}
	}
}
 
Example #4
Source File: CommitSynchronizeAction.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Return the selected diff element for which this action is enabled.
 * @return the list of selected diff elements for which this action is
 *               enabled.
 */
protected final IDiffElement[] getFilteredDiffElementsOverride() {
	List selected = getStructuredSelection().toList();
	Set result = new HashSet();
	for (int i = 0; i < selected.size(); i++) {
		Object object = selected.get(i);
		if(object instanceof IDiffElement) {
			collectAllNodes((IDiffElement)object, result, selected);
		}
	}
	Iterator it = result.iterator();
	List filtered = new ArrayList();
	while(it.hasNext()) {
		IDiffElement e = (IDiffElement) it.next();
		if (e instanceof SyncInfoModelElement) {
			SyncInfo info = ((SyncInfoModelElement) e).getSyncInfo();
			if (info != null && getSyncInfoFilter().select(info)) {
				filtered.add(e);
			}
		}
	}
	return (IDiffElement[]) filtered.toArray(new IDiffElement[filtered.size()]);
}
 
Example #5
Source File: GenerateDiffFileSynchronizeAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
	List selectedResources = new ArrayList();
	Iterator iter = getStructuredSelection().iterator();
	while(iter.hasNext()) {
    	ISynchronizeModelElement element = (ISynchronizeModelElement)iter.next();
    	IResource resource = element.getResource();
    	selectedResources.add(resource);
	}
	IResource[] resourceArray = new IResource[selectedResources.size()];
	selectedResources.toArray(resourceArray);
	GenerateDiffFileSynchronizeOperation generateDiffFileSynchronizeOperation = new GenerateDiffFileSynchronizeOperation(configuration, elements);
	generateDiffFileSynchronizeOperation.setSelectedResources(resourceArray);
	return generateDiffFileSynchronizeOperation;
}
 
Example #6
Source File: IgnoreSynchronizeAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
ArrayList selectedElements = new ArrayList();
IStructuredSelection selection = getStructuredSelection();
Iterator iter = selection.iterator();
while (iter.hasNext()) {
	ISynchronizeModelElement synchronizeModelElement = (ISynchronizeModelElement)iter.next();
	IResource resource = synchronizeModelElement.getResource();
	selectedElements.add(resource);
}
IResource[] resources = new IResource[selectedElements.size()];
selectedElements.toArray(resources);      
return new IgnoreSynchronizeOperation(configuration, elements, resources);
  }
 
Example #7
Source File: UpdateSynchronizeAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
	List selectedResources = new ArrayList(elements.length);
	for (int i=0; i<elements.length; i++) {
		if (elements[i] instanceof ISynchronizeModelElement) {
			selectedResources.add(((ISynchronizeModelElement)elements[i]).getResource());
		}
	}
	IResource[] resources = new IResource[selectedResources.size()];
	selectedResources.toArray(resources);
	UpdateSynchronizeOperation operation = new UpdateSynchronizeOperation(configuration, elements, resources);
	operation.setConfirmNeeded(confirm);
	return operation;
}
 
Example #8
Source File: ShowHistorySynchronizeAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
     ISynchronizeModelElement element = (ISynchronizeModelElement)getStructuredSelection().getFirstElement();
     IResource resource = element.getResource();
     if (!resource.exists()) {
     	try {
     		ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
	return new ShowHistorySynchronizeOperation(configuration, elements, svnResource.getLatestRemoteResource());
     	} catch (SVNException e) {
     		SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
}
     }
     return new ShowHistorySynchronizeOperation(configuration, elements, resource);
 }
 
Example #9
Source File: CommitSynchronizeAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
	changeSets = new ArrayList();
	// override the elemenents (this has to be done this way because of final methods in eclipse api)
	elements = getFilteredDiffElementsOverride();
	String url = null;
	ChangeSet changeSet = null;
    IStructuredSelection selection = getStructuredSelection();
	Iterator iter = selection.iterator();
	String proposedComment = "";
	while (iter.hasNext()) {
		ISynchronizeModelElement synchronizeModelElement = (ISynchronizeModelElement)iter.next();
		proposedComment = getProposedComment(proposedComment, synchronizeModelElement);
		if (!(synchronizeModelElement instanceof ChangeSetDiffNode)) {
			if (url == null && selection.size() == 1) {
			    IResource resource = synchronizeModelElement.getResource();
			    if (resource != null) {
				    ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
		            try {
		                url = svnResource.getStatus().getUrlString();
		                if ((url == null) || (resource.getType() == IResource.FILE)) url = Util.getParentUrl(svnResource);
		            } catch (SVNException e) {
		            	if (!e.operationInterrupted()) {
		            		SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
		            	}
		            }	    
			    }
			}
		} else {
			if (selection.size() == 1) {
				ChangeSetDiffNode changeSetDiffNode = (ChangeSetDiffNode)synchronizeModelElement;
				changeSet = changeSetDiffNode.getSet();
			}
		}
	}
	CommitSynchronizeOperation operation = new CommitSynchronizeOperation(configuration, elements, url, proposedComment);
    operation.setChangeSet(changeSet);
	return operation;
}
 
Example #10
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 #11
Source File: BonitaCompareEditorInput.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void getAllNodes(final List<DiffNode> nodes, final DiffNode root) {
    if (root.hasChildren()) {
        nodes.addAll((Collection<? extends DiffNode>) Arrays.asList(root.getChildren()));
        for (final IDiffElement child : root.getChildren()) {
            getAllNodes(nodes, (DiffNode) child);
        }
    }

}
 
Example #12
Source File: OverrideAndUpdateSynchronizeAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
	List selectedResources = new ArrayList(elements.length);
	for (int i=0; i<elements.length; i++) {
		if (elements[i] instanceof ISynchronizeModelElement) {
			selectedResources.add(((ISynchronizeModelElement)elements[i]).getResource());
		}
	}
	IResource[] resources = new IResource[selectedResources.size()];
	selectedResources.toArray(resources);
	return new OverrideAndUpdateSynchronizeOperation(configuration, elements, resources, resources);
}
 
Example #13
Source File: GenerateDiffFileSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public GenerateDiffFileSynchronizeOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
	super(configuration, elements);
}
 
Example #14
Source File: AddSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public AddSynchronizeOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
	super(configuration, elements);
}
 
Example #15
Source File: CommitSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
protected CommitSynchronizeOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, String url, String proposedComment) {
	super(configuration, elements);
	this.configuration = configuration;
	this.url = url;
	this.proposedComment = proposedComment;
}
 
Example #16
Source File: JavaStructureCreator.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
void add(IDiffElement diff) {
	fChildren.add(diff);
}
 
Example #17
Source File: EditConflictsSynchronizeAction.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
    return new EditConflictsSynchronizeOperation(configuration, elements);
}
 
Example #18
Source File: UpdateSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public UpdateSynchronizeOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, IResource[] resources) {
	super(configuration, elements);
	this.resources = resources;
}
 
Example #19
Source File: BonitaCompareEditorInput.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private void addChildrenToParent(final DiffNode parent, final IDiffElement[] children) {
    for (final IDiffElement child : children) {
        parent.add(child);
    }
}
 
Example #20
Source File: ResolveSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public ResolveSynchronizeOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
    super(configuration, elements);
}
 
Example #21
Source File: OverrideAndUpdateSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public OverrideAndUpdateSynchronizeOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, IResource[] modifiedResources, IResource[] resources) {
	super(configuration, elements);
	this.modifiedResources = modifiedResources;
	this.resources = resources;
}
 
Example #22
Source File: IgnoreSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public IgnoreSynchronizeOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, IResource[] resources) {
	super(configuration, elements);
	this.resources = resources;
}
 
Example #23
Source File: MarkMergedSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public MarkMergedSynchronizeOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
    super(configuration, elements);
}
 
Example #24
Source File: ShowPropertiesSynchronizeAction.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
       ISynchronizeModelElement element = (ISynchronizeModelElement)getStructuredSelection().getFirstElement();
       IResource resource = element.getResource();		
	return new ShowPropertiesSynchronizeOperation(configuration, elements, resource);
}
 
Example #25
Source File: SVNSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
protected SVNSynchronizeOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
	super(configuration, elements);
}
 
Example #26
Source File: EditConflictsSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public EditConflictsSynchronizeOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
    super(configuration, elements);
}
 
Example #27
Source File: ResolveSynchronizeAction.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
    return new ResolveSynchronizeOperation(configuration, elements);
}
 
Example #28
Source File: ShowPropertiesSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public ShowPropertiesSynchronizeOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, IResource resource) {
	super(configuration, elements);
	this.resource = resource;
}
 
Example #29
Source File: MarkMergedSynchronizeAction.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
    return new MarkMergedSynchronizeOperation(configuration, elements);
}
 
Example #30
Source File: ShowHistorySynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public ShowHistorySynchronizeOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, ISVNRemoteResource remoteResource) {
    super(configuration, elements);
    this.remoteResource = remoteResource;
}