Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-03-06 14:21:43 +0000
committerJean Michel-Lemieux2003-03-06 14:21:43 +0000
commita50a9bfd4538d4fba673338027f0388c3b49cafe (patch)
treeb42cca6b1cf0eca01826c9e7412af384a875738e
parent6373cec222e79279ee9fb1ea90060d26feac3330 (diff)
downloadeclipse.platform.team-a50a9bfd4538d4fba673338027f0388c3b49cafe.tar.gz
eclipse.platform.team-a50a9bfd4538d4fba673338027f0388c3b49cafe.tar.xz
eclipse.platform.team-a50a9bfd4538d4fba673338027f0388c3b49cafe.zip
interim fixed
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java45
2 files changed, 33 insertions, 16 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
index 3e16902dc..3f6b7a3e8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
@@ -422,10 +422,10 @@ abstract public class CVSAction extends TeamAction {
/**
* A helper prompt condition for prompting for CVS dirty state.
*/
- public static IPromptCondition getOverwriteLocalChangesPrompt() {
+ public static IPromptCondition getOverwriteLocalChangesPrompt(final List dirtyResources) {
return new IPromptCondition() {
public boolean needsPrompt(IResource resource) {
- return CVSLightweightDecorator.isDirty(resource);
+ return dirtyResources.contains(resource);
}
public String promptMessage(IResource resource) {
return Policy.bind("ReplaceWithAction.localChanges", resource.getName());//$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
index 4de88e86e..825d8f060 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
@@ -11,6 +11,7 @@
package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@@ -24,24 +25,21 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.IPromptCondition;
import org.eclipse.team.internal.ui.PromptingDialog;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
public class ReplaceWithRemoteAction extends WorkspaceAction {
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- PromptingDialog dialog = new PromptingDialog(getShell(), getSelectedResources(),
- getPromptCondition(), Policy.bind("ReplaceWithAction.confirmOverwrite"));//$NON-NLS-1$
- final IResource[] resources = dialog.promptForMultiple();
- if(resources.length == 0) {
- // nothing to do
- return;
- }
+
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
try {
+
+ IResource resources[] = checkOverwriteOfDirtyResources(getSelectedResources());
+
// Do the replace
Hashtable table = getProviderMapping(resources);
Set keySet = table.keySet();
@@ -61,15 +59,34 @@ public class ReplaceWithRemoteAction extends WorkspaceAction {
monitor.done();
}
}
+
+
}, true /* cancelable */, PROGRESS_DIALOG);
}
-
- /**
- * Note: This method is designed to be overridden by test cases.
- */
- protected IPromptCondition getPromptCondition() {
- return getOverwriteLocalChangesPrompt();
+
+ private IResource[] checkOverwriteOfDirtyResources(IResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException {
+ List dirtyResources = new ArrayList();
+ IResource[] selectedResources = getSelectedResources();
+
+ try {
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(null, selectedResources.length * 1000);
+ for (int i = 0; i < selectedResources.length; i++) {
+ IResource resource = selectedResources[i];
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ if(cvsResource.isModified(Policy.subMonitorFor(monitor, 1000))) {
+ dirtyResources.add(resource);
+ }
+ }
+ } finally {
+ monitor.done();
+ }
+
+ PromptingDialog dialog = new PromptingDialog(getShell(), selectedResources,
+ getOverwriteLocalChangesPrompt(dirtyResources), Policy.bind("ReplaceWithAction.confirmOverwrite"));//$NON-NLS-1$
+ return dialog.promptForMultiple();
}
+
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
*/

Back to the top