Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2005-05-16 13:12:04 +0000
committerMichael Valenta2005-05-16 13:12:04 +0000
commit5ef8dd39db2952f1c2add89b3418ee5ea0a3769a (patch)
tree733a2221fdf0e9d77612e22fae92686c089a3232
parentcd465ecbdc01807796b6378be918b28976add135 (diff)
downloadeclipse.platform.team-5ef8dd39db2952f1c2add89b3418ee5ea0a3769a.tar.gz
eclipse.platform.team-5ef8dd39db2952f1c2add89b3418ee5ea0a3769a.tar.xz
eclipse.platform.team-5ef8dd39db2952f1c2add89b3418ee5ea0a3769a.zip
Bug 94823 Project set import silently overwrites file system resources
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIProjectSetSerializationContext.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties5
4 files changed, 20 insertions, 5 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
index 2093d9aee..e790e5d51 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
@@ -227,8 +227,11 @@ public abstract class ProjectSetCapability {
final Collection existingProjects = new ArrayList();
for (int i = 0; i < projects.length; i++) {
IProject eachProj = projects[i];
- if (eachProj.exists())
+ if (eachProj.exists()) {
existingProjects.add(eachProj);
+ } else if (new File(eachProj.getParent().getLocation().toFile(), eachProj.getName()).exists()) {
+ existingProjects.add(eachProj);
+ }
}
if (existingProjects.size() == 0)
return projects;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java
index 4eca1d33d..822933cc8 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java
@@ -257,6 +257,7 @@ public class TeamUIMessages extends NLS {
public static String HierarchicalModelProvider_0;
public static String UIProjectSetSerializationContext_0;
public static String UIProjectSetSerializationContext_1;
+ public static String UIProjectSetSerializationContext_2;
public static String RemoveSynchronizeParticipantAction_0;
public static String RemoveSynchronizeParticipantAction_1;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIProjectSetSerializationContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIProjectSetSerializationContext.java
index a2380b553..7e6bdbd54 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIProjectSetSerializationContext.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIProjectSetSerializationContext.java
@@ -12,6 +12,7 @@
package org.eclipse.team.internal.ui;
+import java.io.File;
import java.util.Arrays;
import java.util.List;
@@ -82,11 +83,20 @@ public class UIProjectSetSerializationContext extends ProjectSetSerializationCon
IPromptCondition prompt = new IPromptCondition() {
List resources = Arrays.asList(projects);
public boolean needsPrompt(IResource resource) {
- return resources.contains(resource);
+ if (resource instanceof IProject) {
+ IProject project = (IProject) resource;
+ return (project.exists() || getTargetFile(project).exists()) && resources.contains(resource);
+ }
+ return false;
}
public String promptMessage(IResource resource) {
- return NLS.bind(TeamUIMessages.UIProjectSetSerializationContext_0, new String[] { resource.getName() }); //$NON-NLS-1$
+ if (resource.exists())
+ return NLS.bind(TeamUIMessages.UIProjectSetSerializationContext_0, new String[] { resource.getName() }); //$NON-NLS-1$
+ return NLS.bind(TeamUIMessages.UIProjectSetSerializationContext_2, new String[] { resource.getName(), getTargetFile((IProject)resource).getAbsolutePath() }); //$NON-NLS-1$
}
+ public File getTargetFile(IProject project) {
+ return new File(project.getParent().getLocation().toFile(), project.getName());
+ }
};
PromptingDialog dialog =
new PromptingDialog(
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
index aa31ce77e..1c6cd59a6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
@@ -62,7 +62,7 @@ TextPreferencePage_3=The extension cannot contain the . character.
TextPreferencePage_5=The file name cannot contain *
TextPreferencePage_6=New File Type
TextPreferencePage_7=Enter a file name:
-TextPreferencePage_1=Note that some of these mappings have been contributed by plugins, so they can only be changed, but not removed.
+TextPreferencePage_1=Note that some of these entries are built in and can only be changed, but not removed.
TextPreferencePage_change=&Change
TextPreferencePage_enterExtensionLong=Please enter a file extension:
TextPreferencePage_enterExtensionShort=Enter File Extension
@@ -266,8 +266,9 @@ ResourceMappingSelectionArea_1=&Deselect All
CompressedFoldersModelProvider_0=&Compressed Folders
HierarchicalModelProvider_0=&Tree
-UIProjectSetSerializationContext_0=Overwrite {0}
+UIProjectSetSerializationContext_0=Project {0} exists in the workspace. Overwrite {0}?
UIProjectSetSerializationContext_1=Overwrite projects?
+UIProjectSetSerializationContext_2=Project {0} exists in the file system. Overwrite {1}?
RemoveSynchronizeParticipantAction_0=Remove Pinned Synchronization?
RemoveSynchronizeParticipantAction_1=The current synchronization is pinned. Are you sure you want to remove it?

Back to the top