aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Baumgart2010-02-26 08:11:07 -0500
committerJens Baumgart2010-03-02 07:29:09 -0500
commitbb09d6c3e95336d46eed700a2f1ac31e09f40ccd (patch)
tree6c4df2125d6cd0a5b61d6f0a1a0c16fba184da7a
parent95d7c4d12750d198f6ac18eae211a4e5346e18cd (diff)
downloadegit-bb09d6c3e95336d46eed700a2f1ac31e09f40ccd.zip
egit-bb09d6c3e95336d46eed700a2f1ac31e09f40ccd.tar.gz
egit-bb09d6c3e95336d46eed700a2f1ac31e09f40ccd.tar.xz
Fix freeze of repository import wizard progress dialog.
The import is now performed outside the UI thread. Progress reporting is done on the wizard page. Error handling for cancelation was corrected. Bug: 301414 Change-Id: I3a9ef2d750de4f5653366331e02f6f6d9ecabd49 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneWizard.java27
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties2
3 files changed, 24 insertions, 11 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
index b09624d..d4a0ec5 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
@@ -96,6 +96,12 @@ public class UIText extends NLS {
public static String ExistingOrNewPage_SymbolicValueEmptyMapping;
/** */
+ public static String GitCloneWizard_CloneFailedHeading;
+
+ /** */
+ public static String GitCloneWizard_CloneCanceledMessage;
+
+ /** */
public static String GitCloneWizard_title;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneWizard.java
index 3d9103e..d69f489 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneWizard.java
@@ -28,12 +28,11 @@ import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.transport.URIish;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IImportWizard;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.jgit.lib.Ref;
-import org.eclipse.jgit.transport.URIish;
/**
* Import Git Repository Wizard. A front end to a git clone operation.
@@ -59,9 +58,9 @@ public class GitCloneWizard extends Wizard implements IImportWizard {
public void setVisible(boolean visible) {
if (visible) {
if (cloneDestination.alreadyClonedInto == null) {
- performClone(false);
- cloneDestination.alreadyClonedInto = cloneDestination
- .getDestinationFile().getAbsolutePath();
+ if (performClone(false))
+ cloneDestination.alreadyClonedInto = cloneDestination
+ .getDestinationFile().getAbsolutePath();
}
setProjectsList(cloneDestination.alreadyClonedInto);
}
@@ -163,13 +162,19 @@ public class GitCloneWizard extends Wizard implements IImportWizard {
return true;
} else {
try {
- PlatformUI.getWorkbench().getProgressService().run(false, true,
- op);
+ // Perform clone in ModalContext thread with progress
+ // reporting on the wizard.
+ getContainer().run(true, true, op);
return true;
+ } catch (InterruptedException e) {
+ MessageDialog.openInformation(getShell(),
+ UIText.GitCloneWizard_CloneFailedHeading,
+ UIText.GitCloneWizard_CloneCanceledMessage);
+ return false;
} catch (Exception e) {
- Activator.logError("Failed to clone", e);
- MessageDialog.openError(getShell(), "Failed clone", e
- .toString());
+ Activator.logError(UIText.GitCloneWizard_CloneFailedHeading, e);
+ MessageDialog.openError(getShell(),
+ UIText.GitCloneWizard_CloneFailedHeading, e.toString());
return false;
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
index 64fa5b4..85e401f 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
@@ -37,6 +37,8 @@ ExistingOrNewPage_HeaderProject=Project
ExistingOrNewPage_HeaderRepository=Repository
ExistingOrNewPage_SymbolicValueEmptyMapping=<empty repository mapping>
+GitCloneWizard_CloneFailedHeading=Cloning Git Repository failed
+GitCloneWizard_CloneCanceledMessage=Clone operation was canceled by the user
GitCloneWizard_title=Import Git Repository
GitCloneWizard_jobName=Cloning from {0}
GitCloneWizard_failed=Git repository clone failed.