From af2fdc4914e92c3c2aabb0f71d0de284e5d1c0ec Mon Sep 17 00:00:00 2001 From: Robin Rosenberg Date: Sun, 22 Jun 2008 19:46:36 +0200 Subject: [PATCH] Clone: Handle cancel in clone dialog specially Signed-off-by: Robin Rosenberg --- .../src/org/spearce/egit/ui/UIText.java | 3 +++ .../egit/ui/internal/clone/SourceBranchPage.java | 18 ++++++++++++------ .../src/org/spearce/egit/ui/uitext.properties | 2 ++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java index 9ccf606e..4adb99cd 100644 --- a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java +++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java @@ -122,6 +122,9 @@ public class UIText extends NLS { public static String SourceBranchPage_cannotListBranches; /** */ + public static String SourceBranchPage_remoteListingCancelled; + + /** */ public static String CloneDestinationPage_title; /** */ diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/SourceBranchPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/SourceBranchPage.java index b2f1a18b..615be32e 100644 --- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/SourceBranchPage.java +++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/SourceBranchPage.java @@ -20,6 +20,7 @@ import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.operation.IRunnableWithProgress; @@ -269,12 +270,17 @@ class SourceBranchPage extends WizardPage { }); } catch (InvocationTargetException e) { Throwable why = e.getCause(); - ErrorDialog.openError(getShell(), - UIText.SourceBranchPage_transportError, - UIText.SourceBranchPage_cannotListBranches, new Status( - IStatus.ERROR, Activator.getPluginId(), 0, why - .getMessage(), why.getCause())); - transportError(why.getMessage()); + if ((why instanceof OperationCanceledException)) { + transportError(UIText.SourceBranchPage_remoteListingCancelled); + return; + } else { + ErrorDialog.openError(getShell(), + UIText.SourceBranchPage_transportError, + UIText.SourceBranchPage_cannotListBranches, new Status( + IStatus.ERROR, Activator.getPluginId(), 0, why + .getMessage(), why.getCause())); + transportError(why.getMessage()); + } return; } catch (InterruptedException e) { transportError(UIText.SourceBranchPage_interrupted); diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties index 18f8c28a..9516aa02 100644 --- a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties +++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties @@ -55,6 +55,8 @@ SourceBranchPage_errorBranchRequired=At least one branch must be selected. SourceBranchPage_transportError=Transport Error SourceBranchPage_cannotListBranches=Cannot list the available branches. SourceBranchPage_interrupted=Connection attempt interrupted. +SourceBranchPage_remoteListingCancelled=Operation cancelled + CloneDestinationPage_title=Local Destination CloneDestinationPage_description=Configure the local storage location for {0}. -- 2.11.4.GIT