Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-04-29 14:48:21 +0000
committerJean Michel-Lemieux2002-04-29 14:48:21 +0000
commit5190e66697ae2f43d38ab0a4ebcc91fba9358c3c (patch)
tree94e2c7c32881f735cdf92acff4ac448ff21796be
parent780a90425d4944b000f20e1c15a2ce44ca4561a7 (diff)
downloadeclipse.platform.team-5190e66697ae2f43d38ab0a4ebcc91fba9358c3c.tar.gz
eclipse.platform.team-5190e66697ae2f43d38ab0a4ebcc91fba9358c3c.tar.xz
eclipse.platform.team-5190e66697ae2f43d38ab0a4ebcc91fba9358c3c.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CatchupReleaseViewer.java62
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncView.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/TeamFile.java70
5 files changed, 101 insertions, 36 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java
index 3a6b8df8f..82777de59 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java
@@ -29,7 +29,7 @@ public class CVSLocalCompareEditorInput extends CVSSyncCompareInput {
public Viewer createDiffViewer(Composite parent) {
Viewer viewer = super.createDiffViewer(parent);
- getViewer().syncModeChanged(SyncView.SYNC_MERGE);
+ getViewer().syncModeChanged(SyncView.SYNC_COMPARE);
return viewer;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
index 221e09a51..4b42267b8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
@@ -246,6 +246,8 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
manager.add(forceUpdateMergeAction);
manager.add(updateWithJoinAction);
break;
+ case SyncView.SYNC_COMPARE:
+ break;
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CatchupReleaseViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CatchupReleaseViewer.java
index a057478f4..18be85d10 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CatchupReleaseViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CatchupReleaseViewer.java
@@ -7,10 +7,16 @@ package org.eclipse.team.ui.sync;
import java.util.Iterator;
+import org.eclipse.compare.BufferedContent;
import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.IEditableContent;
+import org.eclipse.compare.ITypedElement;
+import org.eclipse.compare.structuremergeviewer.DiffContainer;
+import org.eclipse.compare.structuremergeviewer.DiffElement;
import org.eclipse.compare.structuremergeviewer.DiffTreeViewer;
import org.eclipse.compare.structuremergeviewer.Differencer;
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
+import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
@@ -151,7 +157,9 @@ public abstract class CatchupReleaseViewer extends DiffTreeViewer implements ISe
private Action ignoreWhiteSpace;
// Property constant for diff mode kind
- static final String PROP_KIND = "team.ui.PropKind"; //$NON-NLS-1$
+ static final String PROP_KIND = "team.ui.PropKind";
+
+ private Action copyAllRightToLeft; //$NON-NLS-1$
/**
@@ -187,6 +195,7 @@ public abstract class CatchupReleaseViewer extends DiffTreeViewer implements ISe
protected void fillContextMenu(IMenuManager manager) {
manager.add(expandAll);
manager.add(removeFromTree);
+ manager.add(copyAllRightToLeft);
if (showInNavigator != null) {
manager.add(showInNavigator);
}
@@ -270,6 +279,29 @@ public abstract class CatchupReleaseViewer extends DiffTreeViewer implements ISe
}
};
+ copyAllRightToLeft = new Action("Copy All Right to Left", null) { //$NON-NLS-1$
+ public void run() {
+ ISelection s = getSelection();
+ if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
+ return;
+ }
+ for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) {
+ Object element = it.next();
+ if(element instanceof DiffElement) {
+ copyAllRightToLeft((DiffElement)element);
+ }
+ }
+ refresh();
+ }
+ public boolean isEnabled() {
+ ISelection s = getSelection();
+ if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
+ return false;
+ }
+ return ((IStructuredSelection)s).size() == 1;
+ }
+ };
+
// Show in navigator
if (diffModel.getViewSite() != null) {
showInNavigator = new ShowInNavigatorAction(diffModel.getViewSite(), Policy.bind("CatchupReleaseViewer.showInNavigator")); //$NON-NLS-1$
@@ -313,6 +345,34 @@ public abstract class CatchupReleaseViewer extends DiffTreeViewer implements ISe
setFilters(CategoryFilter.SHOW_INCOMING| CategoryFilter.SHOW_CONFLICTS | CategoryFilter.SHOW_OUTGOING);
}
+ protected void copyAllRightToLeft(IDiffElement element) {
+ if(element instanceof DiffContainer) {
+ DiffContainer container = (DiffContainer)element;
+ IDiffElement[] children = container.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ copyAllRightToLeft(children[i]);
+ }
+ } else if(element instanceof TeamFile) {
+ TeamFile file = (TeamFile)element;
+ if(file.getKind() != IRemoteSyncElement.IN_SYNC) {
+ if(file.getRight() == null || file.getLeft() == null) {
+ file.copy(false /* right to left */);
+ } else {
+ ITypedElement te = file.getLeft();
+ ITypedElement rte = file.getRight();
+ if(te instanceof IEditableContent) {
+ IEditableContent editable = (IEditableContent)te;
+ if(editable.isEditable()) {
+ if(rte instanceof BufferedContent) {
+ editable.setContent(((BufferedContent)rte).getContent());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
/*
* Method declared on ContentViewer.
*/
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncView.java
index a7fb4ba8c..e740db35b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncView.java
@@ -60,6 +60,7 @@ public class SyncView extends ViewPart {
public static final int SYNC_OUTGOING = 2;
public static final int SYNC_BOTH = 3;
public static final int SYNC_MERGE = 4;
+ public static final int SYNC_COMPARE = 5;
// Titles cached for efficiency
private final String CATCHUP_TITLE = Policy.bind("SyncView.incomingModeTitle"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/TeamFile.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/TeamFile.java
index 1669433ce..1eef54e67 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/TeamFile.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/TeamFile.java
@@ -60,6 +60,8 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
private TypedBufferedContent commonByteContents;
private TypedBufferedContent remoteByteContents;
+ boolean modified = false;
+
/**
* Creates a new file node.
*/
@@ -166,7 +168,11 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
* @see ITypedInput#getName
*/
public String getName() {
- return mergeResource.getName();
+ if(modified) {
+ return mergeResource.getName() + " (merged)";
+ } else {
+ return mergeResource.getName();
+ }
}
/*
@@ -230,14 +236,17 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
// don't allow editing of outgoing deletion content. To revert from the deletion the
// user should use the appropriate sync view action.
boolean outgoingDeletion = getChangeDirection() == IRemoteSyncElement.OUTGOING && getChangeType() == IRemoteSyncElement.DELETION;
-
+ final String name = getName();
return new TypedBufferedContent(this, !outgoingDeletion) {
protected InputStream createStream() throws CoreException {
return mergeResource.getLocalStream();
}
public void setContent(byte[] contents) {
- super.setContent(contents);
- merged();
+ try {
+ saveChanges(new ByteArrayInputStream(contents));
+ } catch(CoreException e) {
+ ErrorDialog.openError(WorkbenchPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(), Policy.bind("TeamFile.saveChanges", name), null, e.getStatus()); //$NON-NLS-1$
+ }
fireContentChanged();
}
public ITypedElement replace(ITypedElement child, ITypedElement other) {
@@ -249,33 +258,25 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
/**
* The local resource has beed modified (i.e. merged).
*/
- private void merged() {
- mergeResource.confirmMerge();
- try {
- // persist changes to disk (e.g. there is no buffering in the sync view).
- saveChanges(localByteContents.getContents());
-
- // calculate the new sync state based on the type of change that was merged. This
- // logic cannot be in the IRemoteSyncElement because there is no way to update the
- // base before calling getSyncKind() again.
- if(getChangeDirection()==INCOMING) {
- switch(getChangeType()) {
- case Differencer.ADDITION:
- case Differencer.CHANGE:
- setKind(OUTGOING | Differencer.CHANGE);
- break;
- case Differencer.DELETION:
- setKind(CONFLICTING | Differencer.CHANGE);
- }
- } else {
- setKind(OUTGOING | (getKind() & Differencer.CHANGE_TYPE_MASK));
- }
-
- // update the UI with the sync state change.
- fireThreeWayInputChange();
- } catch (CoreException e) {
- ErrorDialog.openError(WorkbenchPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(), Policy.bind("TeamFile.saveChanges", getName()), null, e.getStatus()); //$NON-NLS-1$
+ public void merged() {
+ // calculate the new sync state based on the type of change that was merged. This
+ // logic cannot be in the IRemoteSyncElement because there is no way to update the
+ // base before calling getSyncKind() again.
+ if(getChangeDirection()==INCOMING) {
+ switch(getChangeType()) {
+ case Differencer.ADDITION:
+ case Differencer.CHANGE:
+ setKind(OUTGOING | Differencer.CHANGE);
+ break;
+ case Differencer.DELETION:
+ setKind(CONFLICTING | Differencer.CHANGE);
+ }
+ } else {
+ setKind(OUTGOING | (getKind() & Differencer.CHANGE_TYPE_MASK));
}
+
+ // update the UI with the sync state change.
+ fireThreeWayInputChange();
}
/**
@@ -288,7 +289,7 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
IFile file = (IFile) getResource();
if (is != null) {
if (!file.exists()) {
- createParents(getParent(), (IFolder)getResource().getParent());
+ createParents(getParent(), getResource().getParent());
file.create(is, false, monitor);
} else {
file.setContents(is, false, true, monitor);
@@ -296,6 +297,7 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
} else {
file.delete(false, true, monitor);
}
+ modified = true;
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
@@ -303,10 +305,10 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
});
}
- private void createParents(IDiffContainer parentNode, IFolder parentFolder) throws CoreException {
+ private void createParents(IDiffContainer parentNode, IContainer parentFolder) throws CoreException {
if(!parentFolder.exists() && parentFolder.getType() != IResource.PROJECT) {
- createParents(parentNode.getParent(), (IFolder)parentFolder.getParent());
- parentFolder.create(false /* force */, true, null);
+ createParents(parentNode.getParent(), parentFolder.getParent());
+ ((IFolder)parentFolder).create(false /* force */, true, null);
if(parentNode instanceof ChangedTeamContainer) {
((ChangedTeamContainer)parentNode).setKind(IRemoteSyncElement.IN_SYNC);
}

Back to the top