diff options
author | Stefan Lay | 2012-01-30 14:31:18 +0000 |
---|---|---|
committer | Matthias Sohn | 2012-01-30 15:52:58 +0000 |
commit | 03a7b6c0a88bf734272cfe3283939a33b75cbf30 (patch) | |
tree | c1ef38d34021b26f70acd59b7f8735ce74e5ad10 | |
parent | d6abf675f2b9af548ff647f47d2d6ac2ab24e1ca (diff) | |
download | egit-03a7b6c0a88bf734272cfe3283939a33b75cbf30.tar.gz egit-03a7b6c0a88bf734272cfe3283939a33b75cbf30.tar.xz egit-03a7b6c0a88bf734272cfe3283939a33b75cbf30.zip |
Add an extension point to provide repository search
The new extension point can be used to contribute the ability to search
for repositories on a remote server. It will be used in a new version
of an import wizard. For this use case an implementor can provide a
Wizard page implementing such a search.
Bug: 361251
Change-Id: I4e3a3ff88dbb5642dd61c55d751f4be12e93f720
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
15 files changed, 845 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/fragment.xml b/org.eclipse.egit.ui.test/fragment.xml index 9af43158bd..0ee4181b7c 100644 --- a/org.eclipse.egit.ui.test/fragment.xml +++ b/org.eclipse.egit.ui.test/fragment.xml @@ -15,5 +15,36 @@ <test property="org.eclipse.core.resources.name" value="*.model" /> </enablement> </extension> + <!-- ================================================================================ --> + <!-- Repository provider for the GitImportWizardTest --> + <!-- ================================================================================ --> + <extension + point="org.eclipse.egit.ui.cloneSourceProvider"> + <source + label="ServerWithoutPage1" + hasFixLocation="true"> + </source> + <repositoryServerProvider + class="org.eclipse.egit.ui.wizards.clone.TestRepositoryServerProvider"> + </repositoryServerProvider> + </extension> + <extension + point="org.eclipse.egit.ui.cloneSourceProvider"> + <source + label="TestServer" + hasFixLocation="false"> + </source> + <repositoryServerProvider + class="org.eclipse.egit.ui.wizards.clone.TestRepositoryServerProvider"> + </repositoryServerProvider> + <repositorySearchPage + class="org.eclipse.egit.ui.wizards.clone.TestRepositorySearchPage"></repositorySearchPage> + </extension> + <extension + point="org.eclipse.egit.ui.cloneSourceProvider"> + <source + label="ServerWithoutPage2"> + </source> + </extension> </fragment> diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitCloneSourceProviderExtensionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitCloneSourceProviderExtensionTest.java new file mode 100644 index 0000000000..90513d59d3 --- /dev/null +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitCloneSourceProviderExtensionTest.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2012 SAP AG. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Stefan Lay (SAP AG) - initial implementation + *******************************************************************************/ +package org.eclipse.egit.ui.wizards.clone; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; + +import java.util.List; + +import org.eclipse.egit.ui.internal.clone.GitCloneSourceProviderExtension; +import org.eclipse.egit.ui.internal.clone.GitCloneSourceProviderExtension.CloneSourceProvider; +import org.junit.Test; + +public class GitCloneSourceProviderExtensionTest { + + @SuppressWarnings("boxing") + @Test + public void testGetRepositoryImports() throws Exception { + List<CloneSourceProvider> repositoryImports = GitCloneSourceProviderExtension + .getCloneSourceProvider(); + assertThat(repositoryImports, is(notNullValue())); + assertThat(repositoryImports.size(), is(4)); + assertThat(repositoryImports.get(1).getLabel(), + is("ServerWithoutPage1")); + assertThat(repositoryImports.get(1).hasFixLocation(), is(true)); + assertThat(repositoryImports.get(1).getRepositoryServerProvider(), + is(TestRepositoryServerProvider.class)); + assertThat(repositoryImports.get(2).getLabel(), is("TestServer")); + assertThat(repositoryImports.get(2).hasFixLocation(), is(false)); + assertThat(repositoryImports.get(2).getRepositoryServerProvider(), + is(TestRepositoryServerProvider.class)); + assertThat(repositoryImports.get(2).getRepositorySearchPage(), + is(TestRepositorySearchPage.class)); + assertThat(repositoryImports.get(3).getLabel(), + is("ServerWithoutPage2")); + assertThat(repositoryImports.get(3).hasFixLocation(), is(false)); + } +} diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/TestRepositorySearchPage.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/TestRepositorySearchPage.java new file mode 100644 index 0000000000..5e6e15719b --- /dev/null +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/TestRepositorySearchPage.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2012 SAP AG. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Stefan Lay (SAP AG) - initial implementation + *******************************************************************************/ +package org.eclipse.egit.ui.wizards.clone; + +import org.eclipse.egit.ui.internal.provisional.wizards.GitRepositoryInfo; +import org.eclipse.egit.ui.internal.provisional.wizards.IRepositorySearchResult; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +public class TestRepositorySearchPage extends WizardPage implements + IRepositorySearchResult { + + public TestRepositorySearchPage() { + super(TestRepositorySearchPage.class.getName()); + setTitle("Find Repository"); + setMessage("Do the needful"); + } + + public void createControl(Composite parent) { + Composite main = new Composite(parent, SWT.NONE); + new Label(main, SWT.NULL).setText("Search for Repos"); + setControl(main); + } + + public GitRepositoryInfo getGitRepositoryInfo() { + return new GitRepositoryInfo( + "http://egit.eclipse.org/r/p/egit-training"); + } + +} diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/TestRepositoryServerProvider.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/TestRepositoryServerProvider.java new file mode 100644 index 0000000000..9195d652f5 --- /dev/null +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/TestRepositoryServerProvider.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2012 SAP AG. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Stefan Lay (SAP AG) - initial implementation + *******************************************************************************/ +package org.eclipse.egit.ui.wizards.clone; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.egit.ui.Activator; +import org.eclipse.egit.ui.internal.provisional.wizards.IRepositoryServerProvider; +import org.eclipse.egit.ui.internal.provisional.wizards.RepositoryServerInfo; + +public class TestRepositoryServerProvider implements IRepositoryServerProvider { + + public Collection<RepositoryServerInfo> getRepositoryServerInfos() { + List<RepositoryServerInfo> info = new ArrayList<RepositoryServerInfo>(); + try { + info.add(new RepositoryServerInfo("EGit Gerrit", new URI( + "http://egit.eclipse.org/r"))); + info.add(new RepositoryServerInfo("Local Gerrit", new URI( + "http://localhost:8080"))); + } catch (URISyntaxException e) { + Activator.error(e.getLocalizedMessage(), e); + } + + return info; + } + +} diff --git a/org.eclipse.egit.ui/META-INF/MANIFEST.MF b/org.eclipse.egit.ui/META-INF/MANIFEST.MF index 1dbdd8333b..7684a89d58 100644 --- a/org.eclipse.egit.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.egit.ui/META-INF/MANIFEST.MF @@ -84,6 +84,7 @@ Export-Package: org.eclipse.egit.ui;version="1.3.0", org.eclipse.egit.ui.internal.history.command;version="1.3.0";x-internal:=true, org.eclipse.egit.ui.internal.merge;version="1.3.0";x-internal:=true, org.eclipse.egit.ui.internal.preferences;version="1.3.0";x-internal:=true, + org.eclipse.egit.ui.internal.provisional.wizards;version="1.3.0";x-internal:=true, org.eclipse.egit.ui.internal.pull;version="1.3.0";x-internal:=true, org.eclipse.egit.ui.internal.push;version="1.3.0";x-internal:=true, org.eclipse.egit.ui.internal.rebase;version="1.3.0";x-internal:=true, diff --git a/org.eclipse.egit.ui/plugin.properties b/org.eclipse.egit.ui/plugin.properties index b8e27776b2..306092fc04 100644 --- a/org.eclipse.egit.ui/plugin.properties +++ b/org.eclipse.egit.ui/plugin.properties @@ -289,6 +289,7 @@ OpenInCommitViewerCommand.name = Open in Commit Viewer ConfigureFetchFromUpstreamCommand.label = Configure F&etch from Upstream... ConfigurePushToUpstreamCommand.label = Configure P&ush to Upstream... CommitMessageProviderExtension-point.name = CommitMessageProvider +CloneSourceProviderExtension-point.name = CloneSourceProvider FetchFromGerritCommand.name = Fetch From Gerrit FetchFromGerritCommand.label = Fetch from &Gerrit... diff --git a/org.eclipse.egit.ui/plugin.xml b/org.eclipse.egit.ui/plugin.xml index 9642e79a59..52d6335af7 100644 --- a/org.eclipse.egit.ui/plugin.xml +++ b/org.eclipse.egit.ui/plugin.xml @@ -2,6 +2,7 @@ <?eclipse version="3.0"?> <plugin> <extension-point id="commitMessageProvider" name="%CommitMessageProviderExtension-point.name" schema="schema/commitMessageProvider.exsd"/> + <extension-point id="cloneSourceProvider" name="%CloneSourceProviderExtension-point.name" schema="schema/cloneSourceProvider.exsd"/> <extension point="org.eclipse.core.runtime.preferences"> <initializer class="org.eclipse.egit.ui.PluginPreferenceInitializer"/> </extension> @@ -4296,4 +4297,13 @@ <property name="component" value="Mylyn"/> </mapping> </extension> + <extension + point="org.eclipse.egit.ui.cloneSourceProvider"> + <source + hasFixLocation="true" + label="URI"> + </source> + <repositorySearchPage + class="org.eclipse.egit.ui.internal.components.RepositorySelectionPage"></repositorySearchPage> + </extension> </plugin> diff --git a/org.eclipse.egit.ui/schema/cloneSourceProvider.exsd b/org.eclipse.egit.ui/schema/cloneSourceProvider.exsd new file mode 100644 index 0000000000..9a1549c3dc --- /dev/null +++ b/org.eclipse.egit.ui/schema/cloneSourceProvider.exsd @@ -0,0 +1,155 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.egit.ui" xmlns="http://www.w3.org/2001/XMLSchema"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.egit.ui" id="repositoryImportPage" name="%CloneSourceProviderExtension-point.name"/> + </appInfo> + <documentation> + This extension point provides the ability to add repository search functionality. An extender can specify a server type and a repository search for servers of this type. The server must provide a means to search for git repositories and to clone such repositories. + </documentation> + </annotation> + + <element name="extension"> + <annotation> + <appInfo> + <meta.element /> + </appInfo> + </annotation> + <complexType> + <sequence> + <element ref="source"/> + <element ref="repositoryServerProvider" minOccurs="0" maxOccurs="1"/> + <element ref="repositorySearchPage" minOccurs="0" maxOccurs="1"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + </documentation> + <appInfo> + <meta.attribute translatable="true"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="source"> + <annotation> + <documentation> + Description of the server type. Used to configure the node in the Wizard page where a user can choose the server type. + </documentation> + </annotation> + <complexType> + <attribute name="label" type="string" use="required"> + <annotation> + <documentation> + The human readable name of a type of servers containing repositories + </documentation> + </annotation> + </attribute> + <attribute name="hasFixLocation" type="boolean"> + <annotation> + <documentation> + If true there will be no ability to add different servers of this type. +The provided repositoryImportPage has to know where to look for the repositories. + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <element name="repositoryServerProvider"> + <annotation> + <documentation> + Provides a list of servers which host git repositories + </documentation> + </annotation> + <complexType> + <attribute name="class" type="string" use="required"> + <annotation> + <documentation> + The class needs to have a default (no arguments) constructor. + </documentation> + <appInfo> + <meta.attribute kind="java" basedOn=":org.eclipse.egit.ui.internal.provisional.wizards.IRepositoryServerProvider"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="repositorySearchPage"> + <annotation> + <documentation> + A wizard page which can can return information of a git repository + </documentation> + </annotation> + <complexType> + <attribute name="class" type="string"> + <annotation> + <documentation> + The class needs to have a default (no arguments) constructor. + </documentation> + <appInfo> + <meta.attribute kind="java" basedOn="org.eclipse.jface.wizard.WizardPage:org.eclipse.egit.ui.internal.provisional.wizards.IRepositorySearchResult"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="since"/> + </appInfo> + <documentation> + 1.3 + </documentation> + </annotation> + + + <annotation> + <appInfo> + <meta.section type="apiinfo"/> + </appInfo> + <documentation> + The following classes belong to the api: + +org.eclipse.egit.ui.internal.provisional.wizards.IRepositoryServerProvider +org.eclipse.egit.ui.internal.provisional.wizards.GitRepositoryInfo.java +org.eclipse.egit.ui.internal.provisional.wizards.IRepositorySearchResult +org.eclipse.egit.ui.internal.provisional.wizards.RepositoryServerInfo + </documentation> + </annotation> + + + <annotation> + <appInfo> + <meta.section type="copyright"/> + </appInfo> + <documentation> + Copyright (c) 2011 SAP AG. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Stefan Lay (SAP AG) - initial implementation + </documentation> + </annotation> + +</schema> 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 b8c1ac72e3..0d8a0361ec 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 @@ -301,6 +301,9 @@ public class UIText extends NLS { public static String ExistingOrNewPage_WrongPathErrorDialogTitle; /** */ + public static String GitCloneSourceProviderExtension_Local; + + /** */ public static String GitCloneWizard_abortingCloneMsg; /** */ diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneSourceProviderExtension.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneSourceProviderExtension.java new file mode 100644 index 0000000000..50044c7715 --- /dev/null +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneSourceProviderExtension.java @@ -0,0 +1,161 @@ +/******************************************************************************* + * Copyright (c) 2012 SAP AG. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Stefan Lay (SAP AG) - initial implementation + *******************************************************************************/ +package org.eclipse.egit.ui.internal.clone; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.egit.ui.UIText; +import org.eclipse.egit.ui.internal.provisional.wizards.IRepositorySearchResult; +import org.eclipse.egit.ui.internal.provisional.wizards.IRepositoryServerProvider; +import org.eclipse.jface.wizard.WizardPage; + +/** + * Provides access to the extensions of the cloneSourceProvider extension point + */ +public class GitCloneSourceProviderExtension { + + private static final String CLONE_SOURCE_PROVIDER_ID = "org.eclipse.egit.ui.cloneSourceProvider"; //$NON-NLS-1$ + + /** + * @return the list of {@code CloneSourceProvider} read from the extension + * point registry + */ + public static List<CloneSourceProvider> getCloneSourceProvider() { + List<CloneSourceProvider> cloneSourceProvider = new ArrayList<CloneSourceProvider>(); + + IExtensionRegistry registry = Platform.getExtensionRegistry(); + IConfigurationElement[] config = registry + .getConfigurationElementsFor(CLONE_SOURCE_PROVIDER_ID); + if (config.length > 0) + addCloneSourceProvider(cloneSourceProvider, config, 0); + + return cloneSourceProvider; + } + + private static void addCloneSourceProvider( + List<CloneSourceProvider> cloneSourceProvider, + IConfigurationElement[] config, int index) { + int myIndex = index; + String label = config[myIndex].getAttribute("label"); //$NON-NLS-1$ + boolean hasFixLocation = Boolean.valueOf( + config[myIndex].getAttribute("hasFixLocation")).booleanValue(); //$NON-NLS-1$ + myIndex++; + IConfigurationElement serverProviderElement = null; + if (myIndex < config.length + && config[myIndex].getName().equals("repositoryServerProvider")) { //$NON-NLS-1$ + serverProviderElement = config[myIndex]; + myIndex++; + } + IConfigurationElement pageElement = null; + if (myIndex < config.length + && config[myIndex].getName().equals("repositorySearchPage")) { //$NON-NLS-1$ + pageElement = config[myIndex]; + myIndex++; + } + cloneSourceProvider.add(new CloneSourceProvider(label, + serverProviderElement, pageElement, hasFixLocation)); + if (myIndex == config.length) + return; + addCloneSourceProvider(cloneSourceProvider, config, myIndex); + } + + /** + * Encapsulates a clone source provided by an extension of the extension + * point "org.eclipse.egit.ui.cloneSourceProvider" + */ + public static class CloneSourceProvider { + + /** + * The constant provider used for local repositories + */ + public static final CloneSourceProvider LOCAL = new CloneSourceProvider( + UIText.GitCloneSourceProviderExtension_Local, null, null, true); + + private final String label; + + private final IConfigurationElement repositoryServerProviderElement; + + private final IConfigurationElement repositorySearchPageELement; + + private boolean hasFixLocation = false; + + private CloneSourceProvider(String label, + IConfigurationElement repositoryServerProviderElement, + IConfigurationElement repositorySearchPageElement, + boolean hasFixLocation) { + this.label = label; + this.repositoryServerProviderElement = repositoryServerProviderElement; + this.repositorySearchPageELement = repositorySearchPageElement; + this.hasFixLocation = hasFixLocation; + } + + /** + * @return label the human readable name of a type of servers which + * contain repositories + */ + public String getLabel() { + return label; + } + + /** + * @return a class which provides a list of servers which host git + * repositories. This class is newly created on each invocation + * of this method. Clients are responsible to cache this + * class. + * @throws CoreException + */ + public IRepositoryServerProvider getRepositoryServerProvider() + throws CoreException { + if (repositoryServerProviderElement == null) + return null; + Object object = repositoryServerProviderElement + .createExecutableExtension("class"); //$NON-NLS-1$ + IRepositoryServerProvider provider = null; + if (object instanceof IRepositoryServerProvider) + provider = (IRepositoryServerProvider) object; + return provider; + } + + /** + * @return A wizard page which can return information of a git + * repository. This class is newly created on each invocation of + * this method. Clients are responsible to cache this + * class. + * @throws CoreException + */ + public WizardPage getRepositorySearchPage() throws CoreException { + if (repositorySearchPageELement == null) + return null; + Object object = repositorySearchPageELement + .createExecutableExtension("class"); //$NON-NLS-1$ + WizardPage page = null; + if (object instanceof WizardPage + && object instanceof IRepositorySearchResult) + page = (WizardPage) object; + return page; + } + + /** + * @return true if there will be no ability to add different servers of + * this type. The provided repositoryImportPage has to know + * where to look for the repositories. + */ + public boolean hasFixLocation() { + return hasFixLocation; + } + } + +} diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/provisional/wizards/GitRepositoryInfo.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/provisional/wizards/GitRepositoryInfo.java new file mode 100644 index 0000000000..16a5e24946 --- /dev/null +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/provisional/wizards/GitRepositoryInfo.java @@ -0,0 +1,217 @@ +/******************************************************************************* + * Copyright (c) 2012 SAP AG. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Stefan Lay (SAP AG) - initial implementation + *******************************************************************************/ +package org.eclipse.egit.ui.internal.provisional.wizards; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.egit.core.securestorage.UserPasswordCredentials; + +/** + * <p> + * <strong>EXPERIMENTAL</strong>. This class or interface has been added as part + * of a work in progress. There is no guarantee that this API will work or that + * it will remain the same. Please do not use this API without consulting with + * the egit team. + * </p> + * + * Encapsulates info of a git repository + */ +public class GitRepositoryInfo { + + private final String cloneUri; + private UserPasswordCredentials credentials; + private String repositoryName; + private final List<String> fetchRefSpecs = new ArrayList<String>(); + + /** + * Describes settings for git push + */ + public static class PushInfo { + + private String pushRefSpec; + private String pushUri; + + /** + * @param pushRefSpec + * @param pushUri + */ + public PushInfo(String pushRefSpec, String pushUri) { + this.pushRefSpec = pushRefSpec; + this.pushUri = pushUri; + } + + /** + * @return the push ref spec + */ + public String getPushRefSpec() { + return pushRefSpec; + } + + /** + * @return the push URI + */ + public String getPushUri() { + return pushUri; + } + } + + private List<PushInfo> pushInfos = new ArrayList<PushInfo>(); + + /** */ + public static class RepositoryConfigProperty { + + private String section; + private String subsection; + private String name; + private String value; + + /** + * @param section the config section + * @param subsection the config sub section + * @param name the name of the config parameter + * @param value the value of the config parameter + */ + public RepositoryConfigProperty(String section, String subsection, String name, String value) { + this.section = section; + this.subsection = subsection; + this.name = name; + this.value = value; + } + + /** + * @return the config section + */ + public String getSection() { + return section; + } + + /** + * @return the config sub section + */ + public String getSubsection() { + return subsection; + } + + /** + * @return the name of the config parameter + */ + public String getName() { + return name; + } + + /** + * @return the value of the config parameter + */ + public String getValue() { + return value; + } + } + + private final List<RepositoryConfigProperty> repositoryConfigProperties = new ArrayList<RepositoryConfigProperty>(); + + + /** + * @param cloneUri + * the URI where the repository can be cloned from + */ + public GitRepositoryInfo(String cloneUri) { + this.cloneUri = cloneUri; + } + + /** + * @return the URI where the repository can be cloned from + */ + public String getCloneUri() { + return cloneUri; + } + + /** + * @param user + * @param password + */ + public void setCredentials(String user, String password) { + credentials = new UserPasswordCredentials(user, password); + } + + /** + * @return the credentials needed to log in + */ + public UserPasswordCredentials getCredentials() { + return credentials; + } + + /** + * @param repositoryName + * the name of the git repository + */ + public void setRepositoryName(String repositoryName) { + this.repositoryName = repositoryName; + } + + /** + * @return the name of the git repository + */ + public String getRepositoryName() { + return repositoryName; + } + + /** + * Adds a fetch specification to the cloned repository + * @param fetchRefSpec the fetch ref spec which will be added + */ + public void addFetchRefSpec(String fetchRefSpec) { + this.fetchRefSpecs.add(fetchRefSpec); + } + + /** + * @return the fetch ref specs + */ + public List<String> getFetchRefSpecs() { + return fetchRefSpecs; + } + + /** + * Adds a push information to the cloned repository + * @param pushRefSpec the push ref spec which will be added + * @param pushUri the push uri which will be added + */ + public void addPushInfo(String pushRefSpec, String pushUri) { + this.pushInfos.add(new PushInfo(pushRefSpec, pushUri)); + } + + /** + * @return the push information + */ + public List<PushInfo> getPushInfos() { + return pushInfos; + } + + /** + * Add an entry in the configuration of the cloned repository + * + * @param section + * @param subsection + * @param name + * @param value + */ + public void addRepositoryConfigProperty(String section, String subsection, String name, String value) { + repositoryConfigProperties.add(new RepositoryConfigProperty(section, subsection, name, value)); + } + + /** + * @return the repository config property entries + */ + public List<RepositoryConfigProperty> getRepositoryConfigProperties() { + return repositoryConfigProperties; + } + +} diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/provisional/wizards/IRepositorySearchResult.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/provisional/wizards/IRepositorySearchResult.java new file mode 100644 index 0000000000..17739ed5ba --- /dev/null +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/provisional/wizards/IRepositorySearchResult.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2012 SAP AG. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Stefan Lay (SAP AG) - initial implementation + *******************************************************************************/ +package org.eclipse.egit.ui.internal.provisional.wizards; + +/** + * <p> + * <strong>EXPERIMENTAL</strong>. This class or interface has been added as part + * of a work in progress. There is no guarantee that this API will work or that + * it will remain the same. Please do not use this API without consulting with + * the egit team. + * </p> + * + * Provides information of a Git repository + */ +public interface IRepositorySearchResult { + + /** + * @return an object encapsulating info about a git repository + */ + public GitRepositoryInfo getGitRepositoryInfo(); + +} diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/provisional/wizards/IRepositoryServerProvider.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/provisional/wizards/IRepositoryServerProvider.java new file mode 100644 index 0000000000..e69b2571a4 --- /dev/null +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/provisional/wizards/IRepositoryServerProvider.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2012 SAP AG. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Stefan Lay (SAP AG) - initial implementation + *******************************************************************************/ +package org.eclipse.egit.ui.internal.provisional.wizards; + +import java.util.Collection; + +/** + * <p> + * <strong>EXPERIMENTAL</strong>. This class or interface has been added as part + * of a work in progress. There is no guarantee that this API will work or that + * it will remain the same. Please do not use this API without consulting with + * the egit team. + * </p> + * + * Provides info about servers which host git repositories. + */ +public interface IRepositoryServerProvider { + + /** + * @return List of server infos + */ + public Collection<RepositoryServerInfo> getRepositoryServerInfos(); + +} diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/provisional/wizards/RepositoryServerInfo.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/provisional/wizards/RepositoryServerInfo.java new file mode 100644 index 0000000000..0105b88b9f --- /dev/null +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/provisional/wizards/RepositoryServerInfo.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2012 SAP AG. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Stefan Lay (SAP AG) - initial implementation + *******************************************************************************/ +package org.eclipse.egit.ui.internal.provisional.wizards; + +import java.net.URI; + +import org.eclipse.egit.core.securestorage.UserPasswordCredentials; + +/** + * <p> + * <strong>EXPERIMENTAL</strong>. This class or interface has been added as part + * of a work in progress. There is no guarantee that this API will work or that + * it will remain the same. Please do not use this API without consulting with + * the egit team. + * </p> + * + * Contains info of a server which hosts git repositories. + */ +public class RepositoryServerInfo { + + private final String label; + + private final URI uri; + + private UserPasswordCredentials credentials; + + /** + * @param label + * the human readable label of the repository server to be shown + * in the UI + * @param uri + * the URI of the repository server + */ + public RepositoryServerInfo(String label, URI uri) { + this.label = label; + this.uri = uri; + } + + /** + * @return label the human readable label of the repository server to be + * shown in the UI + */ + public String getLabel() { + return label; + } + + /** + * @return the URI of the repository server which can be used for queries + * for repositories + */ + public URI getUri() { + return uri; + } + + /** + * @param user the user name needed to log in + * @param password the password needed to log in + */ + public void setCredentials(String user, String password) { + credentials = new UserPasswordCredentials(user, password); + } + + /** + * @return the credentials needed to log in + */ + public UserPasswordCredentials getCredentials() { + return credentials; + } + +} 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 b39bcd7545..b50a590923 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 @@ -113,6 +113,7 @@ ExistingOrNewPage_WorkingDirectoryLabel=Working directory: ExistingOrNewPage_WrongPathErrorDialogMessage=The selected path is not a child of the repository working tree ExistingOrNewPage_WrongPathErrorDialogTitle=Wrong Path +GitCloneSourceProviderExtension_Local=Local GitCloneWizard_abortingCloneMsg=A partial or complete clone was already made. Do you want to delete it? GitCloneWizard_abortingCloneTitle=Aborting Clone GitCloneWizard_title=Clone Git Repository |