Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-08-19 11:56:50 -0400
committerJean Michel-Lemieux2003-08-19 11:56:50 -0400
commit57565cccfd4559815cc13e91c562e7b27c8751c0 (patch)
treeb583ff902a6c3fd69cd84e1da4866345675599b1
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.
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.properties5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml21
-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
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java10
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java7
10 files changed, 106 insertions, 22 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.properties b/bundles/org.eclipse.team.cvs.ui/plugin.properties
index 5578d3cd7..2cae29824 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.properties
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.properties
@@ -176,7 +176,10 @@ CVSWorkspaceSubscriber.commit.label=&Commit
CVSWorkspaceSubscriber.commit.tooltip=Perform a commit on the visible resources
CVSWorkspaceSubscriber.overcommit.label=&Override and Commit
-CVSWorkspaceSubscriber.overcommit.tooltip=Perform an override and commit on the visible resources. This will make the remote contents equal to the local.
+CVSWorkspaceSubscriber.overcommit.tooltip=Perform an override and commit on the visible resources. This will make the remote contents equal to the local ignoring any remote changes.
+
+CVSWorkspaceSubscriber.overupdate.label=O&verride and Update
+CVSWorkspaceSubscriber.overupdate.tooltip=Perform an override and update on the visible resources. This will make the local contents equal to the remote ignoring any local changes.
CVSWorkspaceSubscriber.confirmMerged.label=&Mark as Merged
CVSWorkspaceSubscriber.confirmMerged.tooltip=Mark the conflict as merged by upgrading the base to match the remote
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 8994a5754..8d79739e8 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -572,7 +572,7 @@
<action
label="%CVSWorkspaceSubscriber.confirmMerged.label"
- menubarPath="SubscriberActions"
+ menubarPath="SubscriberActionsGroup2"
tooltip="%CVSWorkspaceSubscriber.confirmMerged.tooltip"
class="org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberConfirmMergedAction"
helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_confirm_merged_action"
@@ -581,16 +581,25 @@
<action
label="%CVSWorkspaceSubscriber.overcommit.label"
- menubarPath="SubscriberActions"
+ menubarPath="SubscriberActionsGroup2"
tooltip="%CVSWorkspaceSubscriber.overcommit.tooltip"
class="org.eclipse.team.internal.ccvs.ui.subscriber.OverrideAndCommitAction"
helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_overcommit_action"
id="org.eclipse.team.ccvs.ui.CVSWorkspaceSubscriber.overcommit">
</action>
+
+ <action
+ label="%CVSWorkspaceSubscriber.overupdate.label"
+ menubarPath="SubscriberActionsGroup2"
+ tooltip="%CVSWorkspaceSubscriber.overupdate.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.subscriber.OverrideAndUpdateAction"
+ helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_overupdate_action"
+ id="org.eclipse.team.ccvs.ui.CVSWorkspaceSubscriber.overupdate">
+ </action>
<action
label="%CVSWorkspaceSubscriber.commit.label"
- menubarPath="SubscriberActions"
+ menubarPath="SubscriberActionsGroup1"
tooltip="%CVSWorkspaceSubscriber.commit.tooltip"
class="org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction"
overrideActionId="org.eclipse.team.ccvs.ui.commit"
@@ -600,7 +609,7 @@
<action
label="%CVSWorkspaceSubscriber.update.label"
- menubarPath="SubscriberActions"
+ menubarPath="SubscriberActionsGroup1"
tooltip="%CVSWorkspaceSubscriber.update.tooltip"
class="org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceUpdateAction"
overrideActionId="org.eclipse.team.ccvs.ui.update"
@@ -618,7 +627,7 @@
<action
label="%CVSWorkspaceSubscriber.confirmMerged.label"
- menubarPath="SubscriberActions"
+ menubarPath="SubscriberActionsGroup1"
tooltip="%CVSWorkspaceSubscriber.confirmMerged.tooltip"
class="org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberConfirmMergedAction"
helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_confirm_merged_action"
@@ -627,7 +636,7 @@
<action
label="%CVSWorkspaceSubscriber.merge.label"
- menubarPath="SubscriberActions"
+ menubarPath="SubscriberActionsGroup1"
tooltip="%CVSWorkspaceSubscriber.merge.tooltip"
class="org.eclipse.team.internal.ccvs.ui.subscriber.MergeUpdateAction"
overrideActionId="org.eclipse.team.ccvs.ui.update"
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
- }
-
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
index 76b205c0a..1b9ccc68e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
@@ -197,7 +197,15 @@ public class SyncViewerActions extends SyncViewerActionGroup {
manager.add(expandAll);
manager.add(new Separator());
manager.add(refreshSelectionAction);
- manager.add(new Separator("SubscriberActions")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup1")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup2")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup3")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup4")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup5")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup6")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup7")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup8")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup9")); //$NON-NLS-1$
// Other plug-ins can contribute there actions here
manager.add(new Separator("Additions")); //$NON-NLS-1$
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java
index 33df73130..5ea7464f8 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java
@@ -20,6 +20,13 @@ class TestWorkspaceUpdateAction extends WorkspaceUpdateAction {
boolean allowOverwrite = false;
/* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateAction#warnAboutFailedResources(org.eclipse.team.ui.sync.SyncInfoSet)
+ */
+ protected void warnAboutFailedResources(SyncInfoSet syncSet) {
+ return;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateAction#getOverwriteLocalChanges()
*/
protected boolean getOverwriteLocalChanges() {

Back to the top