Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-04-29 20:46:35 +0000
committerJean Michel-Lemieux2002-04-29 20:46:35 +0000
commit71e0138874ab464f696f6ab3bb7abd987580732b (patch)
treeba8e6463bd595647e17436361748e8a2386ed7ff
parent2c389e04f60715f975dac2991ea76e67297c3225 (diff)
downloadeclipse.platform.team-71e0138874ab464f696f6ab3bb7abd987580732b.tar.gz
eclipse.platform.team-71e0138874ab464f696f6ab3bb7abd987580732b.tar.xz
eclipse.platform.team-71e0138874ab464f696f6ab3bb7abd987580732b.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java85
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java63
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CatchupReleaseViewer.java68
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/TeamFile.java47
8 files changed, 229 insertions, 49 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java
index 128054fc1..a46a6a44b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java
@@ -281,7 +281,7 @@ public class CVSRemoteSyncElement extends RemoteSyncElement {
// special handling for folders, the generic sync algorithm doesn't work well
// with CVS because folders are not in namespaces (e.g. they exist in all versions
// and branches).
- if(isContainer()) {
+ if(isContainer() && isThreeWay()) {
int folderKind = IRemoteSyncElement.IN_SYNC;
IResource local = getLocal();
ICVSRemoteFolder remote = (ICVSRemoteFolder)getRemote();
@@ -293,7 +293,7 @@ public class CVSRemoteSyncElement extends RemoteSyncElement {
// conflicting deletion ignore
}
} else {
- if(remote == null) {
+ if(remote == null) {
if(cvsFolder.isCVSFolder()) {
folderKind = IRemoteSyncElement.INCOMING | IRemoteSyncElement.DELETION;
} else {
@@ -306,7 +306,7 @@ public class CVSRemoteSyncElement extends RemoteSyncElement {
// we aren't checking the folder mappings to ensure that they are the same.
}
}
- return isThreeWay() ? folderKind : folderKind & IRemoteSyncElement.CHANGE_MASK;
+ return folderKind;
}
// 1. Run the generic sync calculation algorithm, then handle CVS specific
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
index 836120b19..0f4208f79 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
@@ -267,6 +267,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
store.setDefault(ICVSUIConstants.PREF_DIRTY_FLAG, CVSDecoratorConfiguration.DEFAULT_DIRTY_FLAG);
store.setDefault(ICVSUIConstants.PREF_CALCULATE_DIRTY, true);
store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS, true);
+ store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_SAVING_IN_SYNC, true);
// Forward the values to the CVS plugin
CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
index ba4a674bc..da7dfe83a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
@@ -55,6 +55,7 @@ public interface ICVSUIConstants {
public final String PREF_COMPRESSION_LEVEL = "pref_compression_level"; //$NON-NLS-1$
public final String PREF_TEXT_KSUBST = "pref_text_ksubst"; //$NON-NLS-1$
public final String PREF_PROMPT_ON_MIXED_TAGS = "pref_prompt_on_mixed_tags"; //$NON-NLS-1$
+ public final String PREF_PROMPT_ON_SAVING_IN_SYNC = "pref_prompt_on_saving_in_sync"; //$NON-NLS-1$
// console preferences
public final String PREF_CONSOLE_COMMAND_COLOR = "pref_console_command_color"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index 07b8e9a15..503681418 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -69,6 +69,7 @@ CVSCatchupReleaseViewer.workspaceFile=Workspace file: {0}
CVSCatchupReleaseViewer.showInHistory=Show in Resource History
CVSCatchupReleaseViewer.fileDecoration={0} ({1})
CVSCatchupReleaseViewer.folderDecoration={0} {1}
+CVSCatchupReleaseViewer.confirmMerge=C&onfirm Merge
CVSCompareEditorInput.branchLabel=<branch-{0}>
CVSCompareEditorInput.headLabel=<HEAD>
@@ -190,6 +191,12 @@ CVSRepositoryLocationPropertySource.port=Port
CVSRepositoryLocationPropertySource.root=Root
CVSRepositoryLocationPropertySource.method=Connection Method
+CVSSyncCompareInput.confirmMergeMessageTitle=Information
+CVSSyncCompareInput.confirmMergeMessage=Your changes have been saved. You can continue merging the file \
+ and saving the changes. When when you are finished \
+ select it from the Structure Compare and select 'Confirm Merge' to make this \
+ file an outgoing change.
+
CheckoutAsAction.checkoutFailed=Problems encountered performing checkout
CheckoutAsAction.enterProjectTitle=Check Out {0} As...
CheckoutAsAction.taskname=Checking out "{0}" from CVS as "{1}"
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 4b42267b8..6ded94d76 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
@@ -6,9 +6,15 @@ package org.eclipse.team.internal.ccvs.ui.sync;
*/
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.structuremergeviewer.DiffContainer;
+import org.eclipse.compare.structuremergeviewer.DiffElement;
+import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -23,6 +29,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
@@ -66,6 +73,7 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
private IgnoreAction ignoreAction;
private HistoryAction showInHistory;
private OverrideUpdateMergeAction forceUpdateMergeAction;
+ private Action confirmMerge;
private static class DiffOverlayIcon extends OverlayIcon {
private static final int HEIGHT = 16;
@@ -218,6 +226,8 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
manager.add(updateAction);
forceUpdateAction.update(SyncView.SYNC_INCOMING);
manager.add(forceUpdateAction);
+ manager.add(new Separator());
+ manager.add(confirmMerge);
break;
case SyncView.SYNC_OUTGOING:
commitAction.update(SyncView.SYNC_OUTGOING);
@@ -226,6 +236,8 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
manager.add(forceCommitAction);
ignoreAction.update();
manager.add(ignoreAction);
+ manager.add(new Separator());
+ manager.add(confirmMerge);
break;
case SyncView.SYNC_BOTH:
commitAction.update(SyncView.SYNC_BOTH);
@@ -237,6 +249,8 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
manager.add(forceCommitAction);
forceUpdateAction.update(SyncView.SYNC_BOTH);
manager.add(forceUpdateAction);
+ manager.add(new Separator());
+ manager.add(confirmMerge);
break;
case SyncView.SYNC_MERGE:
updateMergeAction.update(SyncView.SYNC_INCOMING);
@@ -245,8 +259,11 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
manager.add(updateMergeAction);
manager.add(forceUpdateMergeAction);
manager.add(updateWithJoinAction);
+ manager.add(new Separator());
+ manager.add(confirmMerge);
break;
case SyncView.SYNC_COMPARE:
+ // no cvs specific actions
break;
}
}
@@ -267,7 +284,73 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
// Show in history view
showInHistory = new HistoryAction(Policy.bind("CVSCatchupReleaseViewer.showInHistory")); //$NON-NLS-1$
- addSelectionChangedListener(showInHistory);
+ addSelectionChangedListener(showInHistory);
+
+ // confirm merge
+ confirmMerge = new Action(Policy.bind("CVSCatchupReleaseViewer.confirmMerge"), null) { //$NON-NLS-1$
+ public void run() {
+ ISelection s = getSelection();
+ if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
+ return;
+ }
+ List needsMerge = new ArrayList();
+ for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) {
+ final Object element = it.next();
+ if(element instanceof DiffElement) {
+ mergeRecursive((IDiffElement)element, needsMerge);
+ }
+ }
+ IRemoteSyncElement[] files = (IRemoteSyncElement[]) needsMerge.toArray(new IRemoteSyncElement[needsMerge.size()]);
+ if(files.length != 0) {
+ try {
+ CVSUIPlugin.getPlugin().getRepositoryManager().merged(files);
+ } catch(TeamException e) {
+ ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus());
+ }
+ }
+ refresh();
+ }
+
+ public boolean isEnabled() {
+ ISelection s = getSelection();
+ if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
+ return false;
+ }
+ for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) {
+ Object element = (Object) it.next();
+ if(element instanceof TeamFile) {
+ TeamFile file = (TeamFile)element;
+ if(file.hasBeenSaved()) {
+ int direction = file.getChangeDirection();
+ int type = file.getChangeType();
+ if(direction == IRemoteSyncElement.INCOMING ||
+ direction == IRemoteSyncElement.CONFLICTING) {
+ continue;
+ }
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+ };
+ }
+
+ protected void mergeRecursive(IDiffElement element, List needsMerge) {
+ if(element instanceof DiffContainer) {
+ DiffContainer container = (DiffContainer)element;
+ IDiffElement[] children = container.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ mergeRecursive(children[i], needsMerge);
+ }
+ } else if(element instanceof TeamFile) {
+ TeamFile file = (TeamFile)element;
+ file.merged();
+ needsMerge.add(file.getMergeResource().getSyncElement());
+ ISelection s = getSelection();
+ setSelection(new StructuredSelection(element.getParent()));
+ setSelection(s);
+ }
}
/**
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
index 0053f240d..9b923d3dd 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
@@ -5,31 +5,27 @@ package org.eclipse.team.internal.ccvs.ui.sync;
* All Rights Reserved.
*/
-import java.lang.reflect.InvocationTargetException;
-
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
+import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.ui.AvoidableMessageDialog;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.ui.sync.CatchupReleaseViewer;
import org.eclipse.team.ui.sync.ChangedTeamContainer;
-import org.eclipse.team.ui.sync.ITeamNode;
import org.eclipse.team.ui.sync.SyncCompareInput;
import org.eclipse.team.ui.sync.TeamFile;
@@ -147,19 +143,12 @@ public class CVSSyncCompareInput extends SyncCompareInput {
*/
protected void compareInputChanged(ICompareInput source) {
super.compareInputChanged(source);
- contentsChanged(source);
- }
- protected void contentsChanged(ICompareInput source) {
- // Mark the source as merged.
- if (source instanceof TeamFile) {
- IRemoteSyncElement element = ((TeamFile)source).getMergeResource().getSyncElement();
- try {
- CVSUIPlugin.getPlugin().getRepositoryManager().merged(new IRemoteSyncElement[] {element});
- } catch (TeamException e) {
- ErrorDialog.openError(getShell(), null, null, e.getStatus());
- }
- }
+ updateView();
+
+ // prompt user with warning
+ promptForConfirmMerge(getShell());
}
+
/*
* @see SyncCompareInput#getSyncGranularity()
*/
@@ -188,4 +177,32 @@ public class CVSSyncCompareInput extends SyncCompareInput {
public IResource[] getResources() {
return resources;
}
+
+ /*
+ * Inform user that when changes are merged in the sync view that confirm
+ * merge should be called to finish the merge.
+ */
+ private void promptForConfirmMerge(final Shell shell) {
+ final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
+ if(!store.getBoolean(ICVSUIConstants.PREF_PROMPT_ON_SAVING_IN_SYNC)) {
+ return;
+ };
+
+ shell.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ AvoidableMessageDialog dialog = new AvoidableMessageDialog(
+ shell,
+ Policy.bind("CVSSyncCompareInput.confirmMergeTitle"), //$NON-NLS-1$
+ null, // accept the default window icon
+ Policy.bind("CVSSyncCompareInput.confirmMergeMessage"), //$NON-NLS-1$
+ MessageDialog.INFORMATION,
+ new String[] {IDialogConstants.OK_LABEL},
+ 0);
+ dialog.open();
+ if(dialog.isDontShowAgain()) {
+ store.setValue(ICVSUIConstants.PREF_PROMPT_ON_SAVING_IN_SYNC, false);
+ }
+ }
+ });
+ }
}
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 18be85d10..f80d4acfd 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
@@ -5,6 +5,7 @@ package org.eclipse.team.ui.sync;
* All Rights Reserved.
*/
+import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import org.eclipse.compare.BufferedContent;
@@ -18,10 +19,17 @@ 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.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -47,6 +55,7 @@ import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.views.navigator.ResourceNavigator;
import org.eclipse.ui.views.navigator.ShowInNavigatorAction;
@@ -194,11 +203,13 @@ public abstract class CatchupReleaseViewer extends DiffTreeViewer implements ISe
*/
protected void fillContextMenu(IMenuManager manager) {
manager.add(expandAll);
- manager.add(removeFromTree);
- manager.add(copyAllRightToLeft);
+ manager.add(removeFromTree);
if (showInNavigator != null) {
manager.add(showInNavigator);
}
+ if(syncMode == SyncView.SYNC_COMPARE) {
+ manager.add(copyAllRightToLeft);
+ }
}
/**
@@ -270,10 +281,7 @@ public abstract class CatchupReleaseViewer extends DiffTreeViewer implements ISe
// mark all selected nodes as in sync
for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) {
Object element = it.next();
- if(element instanceof TeamFile) {
- TeamFile f = (TeamFile)element;
- f.setKind(IRemoteSyncElement.IN_SYNC);
- }
+ setAllChildrenInSync((IDiffElement)element);
}
refresh();
}
@@ -286,9 +294,32 @@ public abstract class CatchupReleaseViewer extends DiffTreeViewer implements ISe
return;
}
for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) {
- Object element = it.next();
+ final Object element = it.next();
if(element instanceof DiffElement) {
- copyAllRightToLeft((DiffElement)element);
+ try {
+ new ProgressMonitorDialog(getTree().getShell()).run(false, false, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ try {
+ ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ try {
+ monitor.beginTask("Copying right contents into workspace", 100);
+ copyAllRightToLeft((DiffElement)element, Policy.subMonitorFor(monitor, 100));
+ } finally {
+ monitor.done();
+ }
+ }
+ }, monitor);
+ } catch(CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ } catch(InvocationTargetException e) {
+ ErrorDialog.openError(WorkbenchPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(), Policy.bind("CatchupReleaseViewer.errorCopyAllRightToLeft"), null, null); //$NON-NLS-1$
+ } catch(InterruptedException e) {
+ }
}
}
refresh();
@@ -344,16 +375,32 @@ public abstract class CatchupReleaseViewer extends DiffTreeViewer implements ISe
showOnlyConflicts.setChecked(false);
setFilters(CategoryFilter.SHOW_INCOMING| CategoryFilter.SHOW_CONFLICTS | CategoryFilter.SHOW_OUTGOING);
}
+
+ /**
+ * Method setAllChildrenInSync.
+ * @param iDiffElement
+ */
+ private void setAllChildrenInSync(IDiffElement element) {
+ if(element instanceof DiffContainer) {
+ DiffContainer container = (DiffContainer)element;
+ IDiffElement[] children = container.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ setAllChildrenInSync(children[i]);
+ }
+ }
+ ((DiffElement)element).setKind(IRemoteSyncElement.IN_SYNC);
+ }
- protected void copyAllRightToLeft(IDiffElement element) {
+ protected void copyAllRightToLeft(IDiffElement element, IProgressMonitor monitor) throws CoreException {
if(element instanceof DiffContainer) {
DiffContainer container = (DiffContainer)element;
IDiffElement[] children = container.getChildren();
for (int i = 0; i < children.length; i++) {
- copyAllRightToLeft(children[i]);
+ copyAllRightToLeft(children[i], monitor);
}
} else if(element instanceof TeamFile) {
TeamFile file = (TeamFile)element;
+ file.setProgressMonitor(monitor);
if(file.getKind() != IRemoteSyncElement.IN_SYNC) {
if(file.getRight() == null || file.getLeft() == null) {
file.copy(false /* right to left */);
@@ -370,6 +417,7 @@ public abstract class CatchupReleaseViewer extends DiffTreeViewer implements ISe
}
}
}
+ file.setProgressMonitor(null);
}
}
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 1eef54e67..ca8f4e6d2 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
@@ -11,7 +11,6 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.CompareUI;
import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.structuremergeviewer.DiffContainer;
import org.eclipse.compare.structuremergeviewer.DiffElement;
import org.eclipse.compare.structuremergeviewer.Differencer;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
@@ -60,7 +59,9 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
private TypedBufferedContent commonByteContents;
private TypedBufferedContent remoteByteContents;
- boolean modified = false;
+ boolean hasBeenSaved = false;
+
+ private IProgressMonitor monitor;
/**
* Creates a new file node.
@@ -168,8 +169,8 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
* @see ITypedInput#getName
*/
public String getName() {
- if(modified) {
- return mergeResource.getName() + " (merged)";
+ if(hasBeenSaved) {
+ return "<" + mergeResource.getName() + ">";
} else {
return mergeResource.getName();
}
@@ -274,14 +275,13 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
} else {
setKind(OUTGOING | (getKind() & Differencer.CHANGE_TYPE_MASK));
}
-
- // update the UI with the sync state change.
- fireThreeWayInputChange();
+ hasBeenSaved = false;
+ }
+
+ public void setProgressMonitor(IProgressMonitor monitor) {
+ this.monitor = monitor;
}
- /**
- * Saves cached copy to disk and clears dirty flag.
- */
private void saveChanges(final InputStream is) throws CoreException {
run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
@@ -296,8 +296,12 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
}
} else {
file.delete(false, true, monitor);
+ deleteParents(getParent(), getResource().getParent());
}
- modified = true;
+ hasBeenSaved = true;
+
+ // update the UI with the sync state change.
+ fireThreeWayInputChange();
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
@@ -315,9 +319,24 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
}
}
+ private void deleteParents(IDiffContainer parentNode, IContainer parentFolder) throws CoreException {
+ if(parentFolder.members().length == 0 && parentFolder.getType() != IResource.PROJECT) {
+ IContainer parent = parentFolder.getParent();
+ parentFolder.delete(false, null);
+ if(parentNode instanceof ChangedTeamContainer) {
+ ((ChangedTeamContainer)parentNode).setKind(IRemoteSyncElement.IN_SYNC);
+ }
+ deleteParents(parentNode.getParent(), parent);
+ }
+ }
+
private void run(IRunnableWithProgress runnable) throws CoreException {
try {
- new ProgressMonitorDialog(shell).run(false, false, runnable);
+ if(monitor == null) {
+ new ProgressMonitorDialog(shell).run(false, false, runnable);
+ } else {
+ runnable.run(monitor);
+ }
} catch (InvocationTargetException e) {
if (e.getTargetException() instanceof CoreException) {
throw (CoreException)e.getTargetException();
@@ -339,4 +358,8 @@ public class TeamFile extends DiffElement implements ICompareInput, ITeamNode {
((ICompareInputChangeListener) listenerArray[i]).compareInputChanged(this);
}
}
+
+ public boolean hasBeenSaved() {
+ return hasBeenSaved;
+ }
}

Back to the top