diff options
| author | Jens Baumgart | 2010-09-21 16:02:06 +0000 |
|---|---|---|
| committer | Jens Baumgart | 2010-09-21 16:02:06 +0000 |
| commit | 164ba1bf9895209c9db4ea912bf9495dd81df38b (patch) | |
| tree | c4a99d473e3ee0517f62b75623ccac73eeb2a075 | |
| parent | fe3fb7058a4f95b77739752e6bc99e2d43773a74 (diff) | |
| download | egit-164ba1bf9895209c9db4ea912bf9495dd81df38b.tar.gz egit-164ba1bf9895209c9db4ea912bf9495dd81df38b.tar.xz egit-164ba1bf9895209c9db4ea912bf9495dd81df38b.zip | |
Fix disabled next button in import projects from git wizard
After cloning a repository the repository was selected but the next
button was disabled.
Bug: 325845
Change-Id: Iac4ebe4c64481d5894694e02d7cb5ae76cf59128
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
| -rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneWizard.java | 62 | ||||
| -rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitSelectRepositoryPage.java | 5 |
2 files changed, 33 insertions, 34 deletions
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 1a08ed6759..18fc83ddcb 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 @@ -36,7 +36,6 @@ 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.swt.widgets.Display; /** * Import Git Repository Wizard. A front end to a git clone operation. @@ -56,7 +55,9 @@ public class GitCloneWizard extends Wizard { private String alreadyClonedInto; - private IWizardContainer parentContainer; + private boolean callerRunsCloneOperation; + + private CloneOperation cloneOperation; /** * The default constructor @@ -89,12 +90,13 @@ public class GitCloneWizard extends Wizard { } /** - * Sets the parent {@link IWizardContainer} to run the clone job. - * - * @param parentContainer + * @param newValue + * if true the clone wizard just creates a clone operation. The + * caller has to run this operation using runCloneOperation. If + * false the clone operation is performed using a job. */ - public void setParentContainer(IWizardContainer parentContainer) { - this.parentContainer = parentContainer; + public void setCallerRunsCloneOperation(boolean newValue) { + callerRunsCloneOperation = newValue; } @Override @@ -182,36 +184,32 @@ public class GitCloneWizard extends Wizard { alreadyClonedInto = workdir.getPath(); cloneSource.saveUriInPrefs(); - if (parentContainer == null) { + if (!callerRunsCloneOperation) runAsJob(uri, op); - } else { - runInParentContainer(op); - } + else + cloneOperation = op; return true; } - private void runInParentContainer(final CloneOperation op) { - Runnable runInParentContainer = new Runnable() { - public void run() { - try { - parentContainer.run(true, true, - new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, - InterruptedException { - executeCloneOperation(op, monitor); - } - }); - } catch (InvocationTargetException e) { - Activator.handleError(UIText.GitCloneWizard_failed, - e.getCause(), true); - } catch (InterruptedException e) { - // nothing to do - } + /** + * @param container + */ + public void runCloneOperation(IWizardContainer container) { + try { + container.run(true, true, + new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) + throws InvocationTargetException, + InterruptedException { + executeCloneOperation(cloneOperation, monitor); + } + }); + } catch (InvocationTargetException e) { + Activator.handleError(UIText.GitCloneWizard_failed, + e.getCause(), true); + } catch (InterruptedException e) { + // nothing to do } - }; - // we need to run this async in order to cleanly close the inner wizard - Display.getCurrent().asyncExec(runInParentContainer); } private void runAsJob(final URIish uri, final CloneOperation op) { diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitSelectRepositoryPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitSelectRepositoryPage.java index d0af81a14a..338f3c4312 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitSelectRepositoryPage.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitSelectRepositoryPage.java @@ -112,11 +112,12 @@ public class GitSelectRepositoryPage extends WizardPage { @Override public void widgetSelected(SelectionEvent event) { GitCloneWizard cloneWizard = new GitCloneWizard(); - cloneWizard.setParentContainer(getContainer()); + cloneWizard.setCallerRunsCloneOperation(true); WizardDialog dlg = new WizardDialog(getShell(), cloneWizard); - dlg.open(); + cloneWizard.runCloneOperation(getContainer()); + checkPage(); } }); |
