diff options
author | Tomasz Zarna | 2011-02-22 16:50:58 +0000 |
---|---|---|
committer | Tomasz Zarna | 2011-02-22 16:50:58 +0000 |
commit | e84b9443d953fa1b0a72fc3d49e5a4a04c2114b6 (patch) | |
tree | 9a035245fe7bca0559ce6d957f70bc1ca5f3dbd2 /bundles/org.eclipse.team.ui | |
parent | 6f0c2d32b065cc58829803e09272e60981d93486 (diff) | |
download | eclipse.platform.team-e84b9443d953fa1b0a72fc3d49e5a4a04c2114b6.tar.gz eclipse.platform.team-e84b9443d953fa1b0a72fc3d49e5a4a04c2114b6.tar.xz eclipse.platform.team-e84b9443d953fa1b0a72fc3d49e5a4a04c2114b6.zip |
bug 330490: API and UI to configure SCM URLs for import -- Team part
Diffstat (limited to 'bundles/org.eclipse.team.ui')
6 files changed, 289 insertions, 3 deletions
diff --git a/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF index 6da90f51e..c2ea2e96b 100644 --- a/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.team.ui; singleton:=true -Bundle-Version: 3.5.200.qualifier +Bundle-Version: 3.6.100.qualifier Bundle-Activator: org.eclipse.team.internal.ui.TeamUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.team.ui/plugin.properties b/bundles/org.eclipse.team.ui/plugin.properties index 0b8476ba3..fc7136ae5 100644 --- a/bundles/org.eclipse.team.ui/plugin.properties +++ b/bundles/org.eclipse.team.ui/plugin.properties @@ -15,6 +15,7 @@ Team=Team configurationWizards=Configuration Wizards synchronizeParticipants=Synchronize Participants synchronizeWizards=Synchronize Wizards +scmUrlImportPages=SCM URLs Import Pages logicalViews=Logical Synchronize Views PreferenceKeywords.Team=team apply patch synchronize compare diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml index efd2a8e28..f5b450718 100644 --- a/bundles/org.eclipse.team.ui/plugin.xml +++ b/bundles/org.eclipse.team.ui/plugin.xml @@ -7,6 +7,7 @@ <extension-point id="synchronizeWizards" name="%synchronizeWizards" schema="schema/synchronizeWizards.exsd"/> <extension-point id="teamContentProviders" name="%TeamContentProvider" schema="schema/teamContentProviders.exsd"/> <extension-point id="teamDecorators" name="%TeamDecorators" schema="schema/teamDecorators.exsd"/> + <extension-point id="scmUrlImportPages" name="%scmUrlImportPages" schema="schema/scmUrlImportPages.exsd"/> <!-- **************** PREFERENCES ******************* --> <extension diff --git a/bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd b/bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd new file mode 100644 index 000000000..e36c5dde6 --- /dev/null +++ b/bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd @@ -0,0 +1,137 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.team.ui" xmlns="http://www.w3.org/2001/XMLSchema"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.team.ui" id="scmUrlImportPages" name="SCM URLs Import Pages"/> + </appInfo> + <documentation> + <strong>EXPERIMENTAL</strong>. This extension point 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 in future releases. Please do not use this API without consulting with the Team team. +<p> +This extension point is used to register a page to import projects basing on their SCM URLs. +</p> +<p> +Providers may provide an extension for this extension point, and an implementation of <samp>org.eclipse.team.ui.IScmUrlImportWizardPage</samp> which allows to set and retrive project import descriptions. +</p> + </documentation> + </annotation> + + <element name="extension"> + <annotation> + <appInfo> + <meta.element /> + </appInfo> + </annotation> + <complexType> + <sequence> + <element ref="scmUrlImportPage"/> + </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="scmUrlImportPage"> + <complexType> + <attribute name="page" type="string" use="required"> + <annotation> + <documentation> + A wizard page that can be displayed by wizards that import projects basing on information from SCM URLs. + </documentation> + <appInfo> + <meta.attribute kind="java" basedOn=":org.eclipse.team.ui.IScmUrlImportWizardPage"/> + </appInfo> + </annotation> + </attribute> + <attribute name="repository" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + <appInfo> + <meta.attribute kind="identifier" basedOn="org.eclipse.team.core.repository/repository/@id"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="since"/> + </appInfo> + <documentation> + 3.6 + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="examples"/> + </appInfo> + <documentation> + The following is an example of a import page CVS: +<p> +<pre> +<extension point="org.eclipse.team.ui.scmUrlImportPages"> + <scmUrlImportPage + page="org.eclipse.team.internal.ccvs.ui.wizards.CVSScmUrlImportWizardPage" + repository="org.eclipse.team.cvs.core.cvsnature"> + </scmUrlImportPage> +</extension> +</pre> +</p> + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="apiinfo"/> + </appInfo> + <documentation> + Value of a page's <b>page</b> attribute must be a fully qualified name of a Java class that implements the interface <b>org.eclipse.team.ui.IScmUrlImportWizardPage</b>. + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="implementation"/> + </appInfo> + <documentation> + CVS UI provides a page extension capable of configuring import from CVS. + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="copyright"/> + </appInfo> + <documentation> + Copyright (c) 2011 IBM Corporation and others. +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 <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> + </documentation> + </annotation> + +</schema> diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IScmUrlImportWizardPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IScmUrlImportWizardPage.java new file mode 100644 index 000000000..ad8fc4cd5 --- /dev/null +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IScmUrlImportWizardPage.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2011 IBM Corporation and others. + * 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.team.ui; + +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.team.core.RepositoryProviderType; +import org.eclipse.team.core.ScmUrlImportDescription; + +/** + * IScmUrlImportWizardPage defines the interface that users of the extension + * point <code>org.eclipse.team.ui.scmUrlImportPages</code> must implement. + * + * <strong>EXPERIMENTAL</strong>. This class 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 Team + * team. + * + * @since 3.6 + */ +public interface IScmUrlImportWizardPage extends IWizardPage { + + public static final String ATT_EXTENSION = "scmUrlImportPages"; //$NON-NLS-1$ + public static final String ATT_PAGE = "page"; //$NON-NLS-1$ + public static final String ATT_REPOSITORY = "repository"; //$NON-NLS-1$ + + /** + * Called when the import wizard is closed by selecting the finish button. + * Implementers may store the page result (new/changed bundle import + * descriptions in getSelection) here. + * + * @return if the operation was successful. The wizard will only close when + * <code>true</code> is returned. + */ + public boolean finish(); + + /** + * Return the import descriptions for the page. The descriptions may differ + * from those initially set using + * {@link #setSelection(ScmUrlImportDescription[])} if the user modified + * import configuration. + * + * @return the SCM URLs descriptions for the page. + */ + public ScmUrlImportDescription[] getSelection(); + + /** + * Sets the import descriptions to be edited on the page. The passed + * descriptions can be edited and should be returned in + * {@link #getSelection()}. + * + * @param descriptions + * the SCM URLs descriptions edited on the page. + */ + public void setSelection(ScmUrlImportDescription[] descriptions); + + /** + * Sets the RepositoryProviderType for the page. + * + * @param provider + * to set + */ + public void setProvider(RepositoryProviderType provider); + + /** + * Return the RepositoryProviderType associated with the page. + * + * @return a RepositoryProviderType for the current page + */ + public RepositoryProviderType getProvider(); + +} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java index bd581b83a..c175e9a70 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * 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 @@ -10,7 +10,12 @@ *******************************************************************************/ package org.eclipse.team.ui; +import java.net.URI; +import java.util.*; + +import org.eclipse.core.runtime.*; import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.team.core.*; import org.eclipse.team.internal.ui.TeamUIPlugin; import org.eclipse.team.internal.ui.history.GenericHistoryView; import org.eclipse.team.internal.ui.registry.TeamContentProviderManager; @@ -127,7 +132,7 @@ public class TeamUI { /** * Return the team content provider manager which gives access to the team - * content proivders registered with the + * content providers registered with the * <code>org.eclipse.team.ui.teamContentProviders</code> extension point. * * @return the team content provider manager @@ -136,4 +141,67 @@ public class TeamUI { public static ITeamContentProviderManager getTeamContentProviderManager() { return TeamContentProviderManager.getInstance(); } + + /** + * Return a set of wizard pages for the given descriptions. If no wizard + * page is registered for a SCM URL scheme from a description then a page + * will not be created. If an extension exits, a page will be created and + * initialized with a set of corresponding descriptions. + * + * <strong>EXPERIMENTAL</strong>. This class 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 Team team. + * + * @param descriptions + * descriptions with SCM URLs + * @return initialized wizard pages + * @throws CoreException + * if an error occurs while trying to create a page extension + * @since 3.6 + */ + public static IScmUrlImportWizardPage[] getPages(ScmUrlImportDescription[] descriptions) throws CoreException { + // TODO: check scmUrls + IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(TeamUIPlugin.PLUGIN_ID, IScmUrlImportWizardPage.ATT_EXTENSION); + if (elements.length > 0) { + Set/*<IScmUrlImportWizardPage>*/ pages = new HashSet(); + for (int i = 0; i < elements.length; i++) { + String repository = elements[i].getAttribute(IScmUrlImportWizardPage.ATT_REPOSITORY); + RepositoryProviderType providerType = RepositoryProviderType.getProviderType(repository); + String providerScheme = providerType.getFileSystemScheme(); + Set/*<URI>*/ schemeUris = new HashSet(); + // filter out descriptions for which provider is not known + for (int j = 0; j < descriptions.length; j++) { + URI scmUri = descriptions[j].getUri(); + if (scmUri != null) { + if (ProjectSetCapability.SCHEME_SCM.equals(scmUri.getScheme())) { + if (scmUri.getSchemeSpecificPart().startsWith(providerScheme)) { + schemeUris.add(scmUri); + } + } + } + } + if (schemeUris.size() > 0) { + Object ext = TeamUIPlugin.createExtension(elements[i], IScmUrlImportWizardPage.ATT_PAGE); + if (ext instanceof IScmUrlImportWizardPage) { + IScmUrlImportWizardPage page = (IScmUrlImportWizardPage) ext; + page.setProvider(providerType); + Set/*<ScmUrlImportDescription>*/ set = new HashSet(); + for (Iterator iterator = schemeUris.iterator(); iterator.hasNext();) { + URI uri = (URI) iterator.next(); + for (int j = 0; j < descriptions.length; j++) { + if (descriptions[j].getUri().equals(uri)) { + set.add(descriptions[j]); + } + } + } + page.setSelection((ScmUrlImportDescription[]) set.toArray(new ScmUrlImportDescription[0])); + pages.add(page); + } + } + } + return (IScmUrlImportWizardPage[]) pages.toArray(new IScmUrlImportWizardPage[0]); + } + return null; + } } |