Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-05-01 01:40:25 +0000
committerMichael Valenta2004-05-01 01:40:25 +0000
commit0ea935291cc3659139ad158f6aee0d48fe77c579 (patch)
tree8bc1bcb2ccf253b992d026accbf27cbc5c45e67e
parent9b2209c67e6d877e41d106b0adbb6a46d388d8e6 (diff)
downloadeclipse.platform.team-0ea935291cc3659139ad158f6aee0d48fe77c579.tar.gz
eclipse.platform.team-0ea935291cc3659139ad158f6aee0d48fe77c579.tar.xz
eclipse.platform.team-0ea935291cc3659139ad158f6aee0d48fe77c579.zip
25783: [CVS UI Repo View] Parent directory deleted on Checkout As
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java42
1 files changed, 37 insertions, 5 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
index 969bbe99a..605082e83 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
@@ -11,6 +11,7 @@
package org.eclipse.team.internal.ccvs.ui.operations;
import java.io.File;
+import java.io.IOException;
import java.util.*;
import org.eclipse.core.resources.*;
@@ -25,6 +26,7 @@ import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.ui.IWorkbenchPart;
/**
@@ -369,12 +371,42 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
return new File(project.getParent().getLocation().toFile(), project.getName());
}
- /**
- * @param project
- * @return
- */
private boolean promptToOverwrite(ICVSRemoteFolder remoteFolder, IProject project) {
- return promptToOverwrite(Policy.bind("CheckoutOperation.confirmOverwrite"), getOverwritePromptMessage(remoteFolder, project)); //$NON-NLS-1$
+ // First, if the project exists in the workspace, prompt
+ if (project.exists()) {
+ if (!promptToOverwrite(
+ Policy.bind("CheckoutOperation.confirmOverwrite"), //$NON-NLS-1$
+ Policy.bind("CheckoutOperation.thisResourceExists", project.getName(), getRemoteModuleName(remoteFolder)))) { //$NON-NLS-1$
+ return false;
+ }
+ }
+ // Even if the project exists, check the target location
+ IPath path = getTargetLocationFor(project);
+ File localLocation = null;
+ if (path == null) {
+ try {
+ // There is no custom location. However, still prompt
+ // if the project directory in the workspace directory
+ // would be overwritten.
+ if (!project.exists() || project.getDescription().getLocation() != null) {
+ localLocation = getFileLocation(project);
+ }
+ } catch (CoreException e) {
+ CVSUIPlugin.log(e);
+ }
+ } else {
+ localLocation = path.toFile();
+ }
+ if (localLocation != null && localLocation.exists()) {
+ try {
+ return (promptToOverwrite(
+ Policy.bind("CheckoutOperation.confirmOverwrite"), //$NON-NLS-1$
+ Policy.bind("CheckoutOperation.thisExternalFileExists", localLocation.getCanonicalPath(), getRemoteModuleName(remoteFolder)))); //$NON-NLS-1$
+ } catch (IOException e) {
+ CVSUIPlugin.log(CVSException.wrapException(e));
+ }
+ }
+ return true;
}
protected String getOverwritePromptMessage(ICVSRemoteFolder remoteFolder, IProject project) {

Back to the top