Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-06-12 04:10:53 +0000
committerMichael Valenta2002-06-12 04:10:53 +0000
commit549c69bef0f8a9e74ef0fbb1d0b84bb14e097f0c (patch)
tree4062a2e9fb0fc788e1793ecf74809e296ec01a48
parentd9ffea30be8076b62cb5b7820864935d271e6838 (diff)
downloadeclipse.platform.team-549c69bef0f8a9e74ef0fbb1d0b84bb14e097f0c.tar.gz
eclipse.platform.team-549c69bef0f8a9e74ef0fbb1d0b84bb14e097f0c.tar.xz
eclipse.platform.team-549c69bef0f8a9e74ef0fbb1d0b84bb14e097f0c.zip
19967: Dav: "No dirty resources" on upload incorrect
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java56
2 files changed, 49 insertions, 27 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java
index 6c2270793..84b1a623b 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/TargetProvider.java
@@ -195,4 +195,24 @@ public abstract class TargetProvider {
* compare the state of the local and remote resources.
*/
public abstract IRemoteSyncElement getRemoteSyncElement(IResource resource);
+
+ /**
+ * @see java.lang.Object#equals(Object)
+ */
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj.getClass().equals(this.getClass())) {
+ return this.getURL().toExternalForm().equals(((TargetProvider)obj).getURL().toExternalForm());
+ }
+ return super.equals(obj);
+ }
+
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return getURL().toExternalForm().hashCode();
+ }
+
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java
index 4a32899e2..91cb3a65c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java
@@ -68,6 +68,7 @@ public class UploadAction extends TargetAction {
Set keySet = table.keySet();
monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
Iterator iterator = keySet.iterator();
+ boolean hasOutgoing = false;
while (iterator.hasNext()) {
IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1024);
final TargetProvider provider = (TargetProvider)iterator.next();
@@ -75,35 +76,36 @@ public class UploadAction extends TargetAction {
IResource[] providerResources = (IResource[])((List)table.get(provider)).toArray(new IResource[0]);
IResource[] outgoingChanges = findResourcesWithOutgoingChanges(providerResources);
- if (outgoingChanges.length == 0) {
- getShell().getDisplay().syncExec(
- new Runnable() {
- public void run() {
- MessageDialog.openInformation(getShell(),
- Policy.bind("UploadAction.noDirtyTitle"), //$NON-NLS-1$
- Policy.bind("UploadAction.noDirtyMessage")); //$NON-NLS-1$
+ if (outgoingChanges.length > 0) {
+ // Prompt for any outgoing deletions
+ PromptingDialog prompt = new PromptingDialog(
+ getShell(),
+ outgoingChanges,
+ new IPromptCondition() {
+ public boolean needsPrompt(IResource resource) {
+ return ! resource.exists();
}
- });
- return;
- };
-
- // Prompt for any outgoing deletions
- PromptingDialog prompt = new PromptingDialog(
- getShell(),
- outgoingChanges,
- new IPromptCondition() {
- public boolean needsPrompt(IResource resource) {
- return ! resource.exists();
- }
- public String promptMessage(IResource resource) {
- return Policy.bind("UploadAction.confirmFileDeletionMessage", resource.getFullPath().toString()); //$NON-NLS-1$
- }
- },
- Policy.bind("UploadAction.confirmDeletionTitle"));//$NON-NLS-1$
-
- // Put the resources that were selected
- provider.put(prompt.promptForMultiple(), subMonitor);
+ public String promptMessage(IResource resource) {
+ return Policy.bind("UploadAction.confirmFileDeletionMessage", resource.getFullPath().toString()); //$NON-NLS-1$
+ }
+ },
+ Policy.bind("UploadAction.confirmDeletionTitle"));//$NON-NLS-1$
+
+ // Put the resources that were selected
+ hasOutgoing = true;
+ provider.put(prompt.promptForMultiple(), subMonitor);
+ }
}
+ if (!hasOutgoing) {
+ getShell().getDisplay().syncExec(
+ new Runnable() {
+ public void run() {
+ MessageDialog.openInformation(getShell(),
+ Policy.bind("UploadAction.noDirtyTitle"), //$NON-NLS-1$
+ Policy.bind("UploadAction.noDirtyMessage")); //$NON-NLS-1$
+ }
+ });
+ };
} catch (CoreException e) {
throw new InvocationTargetException(e);
} catch (TeamException e) {

Back to the top