Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-08-19 15:56:50 +0000
committerJean Michel-Lemieux2003-08-19 15:56:50 +0000
commit57565cccfd4559815cc13e91c562e7b27c8751c0 (patch)
treeb583ff902a6c3fd69cd84e1da4866345675599b1 /bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team
parentf79be2546048a908f5febd25e9edc473df17ffe9 (diff)
downloadeclipse.platform.team-57565cccfd4559815cc13e91c562e7b27c8751c0.tar.gz
eclipse.platform.team-57565cccfd4559815cc13e91c562e7b27c8751c0.tar.xz
eclipse.platform.team-57565cccfd4559815cc13e91c562e7b27c8751c0.zip
Added override and update command.
Added a message dialog that warns the user on an update if changes conflicts cannot be merged by the update. Added subscriber action groups to the synchronize view.
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team')
-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/subscriber/OverrideAndUpdateAction.java26
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java41
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java3
6 files changed, 71 insertions, 14 deletions
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 55b2f597b..8121e91da 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
@@ -1006,9 +1006,12 @@ HasProjectMetaFile.taskName=Looking for a remote meta file
TagFromWorkspace.taskName=Tagging from workspace
TagFromRepository.taskName=Tagging from repository
UpdateOnlyMergeable.taskName=Updating mergeable changes
-UpdateDialog.overwriteTitle=Overwrite Unmergable Resources?
-UpdateDialog.overwriteMessage=All mergable resources have been updated. However, some non-mergable resources remain. Should these resources be updated, overwriting any local changes?
+UpdateDialog.overwriteTitle=Overwrite Local Changes?
+UpdateDialog.overwriteMessage=Some conflicting files cannot be merged automatically with the update action. Should these resources be updated, overwriting any local changes?
ReplaceOperation.taskName=Replacing...
+SafeUpdateAction.warnFilesWithConflictsTitle=Non-mergeable files
+SafeUpdateAction.warnFilesWithConflictsDescription=Some conflicting files cannot be merged automatically with the update action. They contain conflicting changes that will have to be merged manually. Use the Synchronize View to find the conflicts then merge the changes in a compare editor.
+
Error.unableToShowSyncView=Error opening Synchronize View. Please ensure that the Team plugin is installed correctly.
ShowAnnotationAction.1=Unexpected response from CVS Server: {0}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java
new file mode 100644
index 000000000..885849d79
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.subscriber;
+
+/**
+ * Runs an update command that will prompt the user for overwritting local
+ * changes to files that have non-mergeable conflicts. All the prompting logic
+ * is in the super class.
+ */
+public class OverrideAndUpdateAction extends WorkspaceUpdateAction {
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateAction#getOverwriteLocalChanges()
+ */
+ protected boolean getOverwriteLocalChanges() {
+ // allow overriding of local changes with this update
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java
index d2d54e130..02b747705 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java
@@ -21,6 +21,7 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
@@ -37,7 +38,10 @@ import org.eclipse.team.ui.sync.SyncInfoSet;
/**
* This update action will update all mergable resources first and then prompt the
- * user to iverwrite any resources that failed the safe update
+ * user to overwrite any resources that failed the safe update.
+ *
+ * Subclasses should determine how the update should handle conflicts by implementing
+ * the getOverwriteLocalChanges() method.
*/
public abstract class SafeUpdateAction extends CVSSubscriberAction {
@@ -71,12 +75,19 @@ public abstract class SafeUpdateAction extends CVSSubscriberAction {
return failedSet.getNodeFor(info.getLocal()) != null;
}
});
-
- // Ask the user if a replace should be performed on the remaining nodes
- if(getOverwriteLocalChanges()) {
- if (!failedSet.isEmpty() && promptForOverwrite(failedSet)) {
- overwriteUpdate(failedSet, Policy.subMonitorFor(monitor, willFail.length * 100));
- syncSet.addAll(failedSet);
+
+ // Handle conflicting files that can't be merged, ask the user what should be done.
+ if(! failedSet.isEmpty()) {
+ if(getOverwriteLocalChanges()) {
+ // Ask the user if a replace should be performed on the remaining nodes
+ if(promptForOverwrite(failedSet)) {
+ overwriteUpdate(failedSet, Policy.subMonitorFor(monitor, willFail.length * 100));
+ syncSet.addAll(failedSet);
+ }
+ } else {
+ // Warn the user that some nodes could not be updated. This can happen if there are
+ // files with conflicts that are not auto-mergeable.
+ warnAboutFailedResources(failedSet);
}
}
@@ -263,6 +274,22 @@ public abstract class SafeUpdateAction extends CVSSubscriberAction {
}
/**
+ * Warn user that some files could not be updated.
+ * Note: This method is designed to be overridden by test cases.
+ */
+ protected void warnAboutFailedResources(final SyncInfoSet syncSet) {
+ final int[] result = new int[] {Dialog.CANCEL};
+ final Shell shell = getShell();
+ shell.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ MessageDialog.openInformation(shell,
+ Policy.bind("SafeUpdateAction.warnFilesWithConflictsTitle"), //$NON-NLS-1$
+ Policy.bind("SafeUpdateAction.warnFilesWithConflictsDescription")); //$NON-NLS-1$
+ }
+ });
+ }
+
+ /**
* This method is invoked for all resources in the sync set that are incoming deletions.
* It is done separately to allow deletions to be performed before additions that may
* be the same name with different letter case.
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java
index 9fa679b23..24db713ef 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java
@@ -46,14 +46,16 @@ public abstract class SyncInfoSetDetailsDialog extends DetailsDialog {
private SyncInfoSet syncSet;
private Object[] selectedResources;
+ private String detailsTitle;
/**
* @param parentShell
* @param dialogTitle
*/
- public SyncInfoSetDetailsDialog(Shell parentShell, String dialogTitle, SyncInfoSet syncSet) {
+ public SyncInfoSetDetailsDialog(Shell parentShell, String dialogTitle, String detailsTitle, SyncInfoSet syncSet) {
super(parentShell, dialogTitle);
this.syncSet = syncSet;
+ this.detailsTitle = detailsTitle;
}
/* (non-Javadoc)
@@ -74,7 +76,7 @@ public abstract class SyncInfoSetDetailsDialog extends DetailsDialog {
* @param composite
*/
private void addResourcesArea(Composite composite) {
- createWrappingLabel(composite, "The following resources will be effected by the update");
+ createWrappingLabel(composite, detailsTitle);
// add the selectable checkbox list
listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java
index 5d088fcf9..9513ff072 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java
@@ -28,7 +28,7 @@ public class UpdateDialog extends SyncInfoSetDetailsDialog {
public static final int YES = IDialogConstants.YES_ID;
public UpdateDialog(Shell parentShell, SyncInfoSet syncSet) {
- super(parentShell, Policy.bind("UpdateDialog.overwriteTitle"), syncSet); //$NON-NLS-1$
+ super(parentShell, Policy.bind("UpdateDialog.overwriteTitle"), Policy.bind("UpdateDialog.overwriteDetailsTitle"), syncSet); //$NON-NLS-1$
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java
index a8bd65767..0746d84e3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java
@@ -98,6 +98,5 @@ public class WorkspaceUpdateAction extends SafeUpdateAction {
*/
protected void updated(IResource[] resources) throws TeamException {
// Do nothing
- }
-
+ }
}

Back to the top