Skip to content

Commit

Permalink
Add the RepositorySearchWizardPage to the EGit import wizard
Browse files Browse the repository at this point in the history
In this first version we just clone the repository without further
configuration.

Change-Id: Ia1fb391dfc18771c51a9727d7946f53403c5a3bb
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Kevin Sawicki <kevin@github.com>
  • Loading branch information
stefanlay authored and kevinsawicki committed Jan 30, 2012
1 parent a049524 commit c1f3a09
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
1 change: 1 addition & 0 deletions org.eclipse.mylyn.github.ui/META-INF/MANIFEST.MF
Expand Up @@ -36,6 +36,7 @@ Import-Package: org.eclipse.egit.core;version="[1.3.0,1.4.0)",
org.eclipse.egit.ui.internal.branch;version="[1.3.0,1.4.0)",
org.eclipse.egit.ui.internal.commit;version="[1.3.0,1.4.0)",
org.eclipse.egit.ui.internal.fetch;version="[1.3.0,1.4.0)",
org.eclipse.egit.ui.internal.provisional.wizards;version="[1.3.0,1.4.0)",
org.eclipse.egit.ui.internal.pull;version="[1.3.0,1.4.0)",
org.eclipse.jgit.errors;version="[1.3.0,1.4.0)",
org.eclipse.jgit.lib;version="[1.3.0,1.4.0)",
Expand Down
11 changes: 11 additions & 0 deletions org.eclipse.mylyn.github.ui/plugin.xml
Expand Up @@ -295,4 +295,15 @@
icon="platform:/plugin/org.eclipse.egit.ui/icons/obj16/rebase.gif">
</image>
</extension>
<extension
point="org.eclipse.egit.ui.cloneSourceProvider">
<source
hasFixLocation="true"
icon="icons/obj16/github.png"
label="%githubMenuLabel">
</source>
<repositorySearchPage
class="org.eclipse.mylyn.internal.github.ui.RepositorySearchWizardPage">
</repositorySearchPage>
</extension>
</plugin>
26 changes: 23 additions & 3 deletions ....mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/RepositorySearchWizardPage.java 100755 → 100644
Expand Up @@ -18,12 +18,16 @@

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.egit.github.core.Language;
import org.eclipse.egit.github.core.Repository;
import org.eclipse.egit.github.core.SearchRepository;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.client.IGitHubConstants;
import org.eclipse.egit.github.core.service.RepositoryService;
import org.eclipse.egit.github.core.util.UrlUtils;
import org.eclipse.egit.ui.UIIcons;
import org.eclipse.egit.ui.internal.provisional.wizards.GitRepositoryInfo;
import org.eclipse.egit.ui.internal.provisional.wizards.IRepositorySearchResult;
import org.eclipse.egit.ui.internal.provisional.wizards.NoRepositoryInfoException;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.operation.IRunnableWithProgress;
Expand All @@ -39,6 +43,7 @@
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylyn.internal.github.core.GitHub;
import org.eclipse.mylyn.internal.github.core.GitHubException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
Expand All @@ -56,7 +61,8 @@
/**
* Search for GitHub repositories wizard page.
*/
public class RepositorySearchWizardPage extends WizardPage {
@SuppressWarnings("restriction")
public class RepositorySearchWizardPage extends WizardPage implements IRepositorySearchResult {

private SearchRepository[] repositories = null;

Expand All @@ -69,9 +75,9 @@ public class RepositorySearchWizardPage extends WizardPage {
private Text searchText;

/**
*
*
*/
protected RepositorySearchWizardPage() {
public RepositorySearchWizardPage() {
super("repoSearchPage", Messages.RepositorySearchWizardPage_Title, null); //$NON-NLS-1$
setDescription(Messages.RepositorySearchWizardPage_Description);
setPageComplete(false);
Expand Down Expand Up @@ -285,4 +291,18 @@ public void run() {
GitHubUi.logError(e);
}
}

public GitRepositoryInfo getGitRepositoryInfo() throws NoRepositoryInfoException {
GitHubClient client = GitHub
.configureClient(new GitHubClient());
RepositoryService service = new RepositoryService(client);
String cloneUrl = null;
try {
Repository fullRepo = service.getRepository(repositories[0]);
cloneUrl = fullRepo.getCloneUrl();
} catch (IOException e) {
throw new NoRepositoryInfoException(e.getMessage(), e);
}
return new GitRepositoryInfo(cloneUrl);
}
}

0 comments on commit c1f3a09

Please sign in to comment.