diff options
author | Tomasz Zarna | 2011-02-07 16:52:49 +0000 |
---|---|---|
committer | Tomasz Zarna | 2011-02-07 16:52:49 +0000 |
commit | 1d90145e4d497190850b3a257132c9931f2775fc (patch) | |
tree | ca098b25bd7e06fb7e82acb3fb3e0494a0fb83b9 /bundles/org.eclipse.team.core/src/org/eclipse/team/core | |
parent | 3f5f2cdc2af9419620a2e0d51e30de2d0ae550cb (diff) | |
download | eclipse.platform.team-1d90145e4d497190850b3a257132c9931f2775fc.tar.gz eclipse.platform.team-1d90145e4d497190850b3a257132c9931f2775fc.tar.xz eclipse.platform.team-1d90145e4d497190850b3a257132c9931f2775fc.zip |
bug 330490: API and UI to configure SCM URLs for import -- Fix v03 from Ankur
Diffstat (limited to 'bundles/org.eclipse.team.core/src/org/eclipse/team/core')
5 files changed, 191 insertions, 4 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ScmUrlImportDescription.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ScmUrlImportDescription.java index 1b8e797b2..e1ffd620f 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ScmUrlImportDescription.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ScmUrlImportDescription.java @@ -11,6 +11,7 @@ package org.eclipse.team.core; import java.net.URI; +import java.util.HashMap; /** @@ -32,6 +33,7 @@ import java.net.URI; public class ScmUrlImportDescription { private String url; private String project; + private HashMap properties; public ScmUrlImportDescription(String url, String project) { this.url = url; @@ -62,9 +64,34 @@ public class ScmUrlImportDescription { this.url = url; } - public Object getProperty(String plugin) { - // TODO Auto-generated method stub - // called by: org.eclipse.pde.internal.ui.wizards.imports.PluginImportWizardFirstPage.configureBundleImportPages(IPluginModelBase[]) - return null; + /** + * Sets or removes a client property. + * + * @param key property key + * @param value property value or <code>null</code> to remove the property + */ + public synchronized void setProperty(String key, Object value) { + if (properties == null) { + properties = new HashMap(); + } + if (value == null) { + properties.remove(key); + } else { + properties.put(key, value); + } + + } + + /** + * Returns the specified client property, or <code>null</code> if none. + * + * @param key property key + * @return property value or <code>null</code> + */ + public synchronized Object getProperty(String key) { + if (properties == null) { + return null; + } + return properties.get(key); } } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java index 1def5fd34..67c4275f6 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java @@ -18,8 +18,10 @@ import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.Preferences.PropertyChangeEvent; import org.eclipse.core.runtime.content.IContentType; +import org.eclipse.team.core.importing.provisional.IBundleImporter; import org.eclipse.team.core.mapping.IStorageMerger; import org.eclipse.team.internal.core.*; +import org.eclipse.team.internal.core.importing.BundleImporterExtension; /** * The Team class provides a global point of reference for the global ignore set @@ -63,6 +65,8 @@ public final class Team { private final static FileContentManager fFileContentManager; + private static List fProjectFactories; + static { fFileContentManager= new FileContentManager(); } @@ -523,4 +527,22 @@ public final class Team { public IStorageMerger createStorageMerger(String extension) { return createMerger(extension); } + + /** + * @return IBundleImporter[] returns the available bundle importers + * @since 3.6 + */ + public synchronized static IBundleImporter[] getBundleImporters() { + if (fProjectFactories == null) { + fProjectFactories = new ArrayList(); + IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.EXTENSION_POINT_BUNDLE_IMPORTERS); + if (point != null) { + IConfigurationElement[] infos = point.getConfigurationElements(); + for (int i = 0; i < infos.length; i++) { + fProjectFactories.add(new BundleImporterExtension(infos[i])); + } + } + } + return (IBundleImporter[]) fProjectFactories.toArray(new IBundleImporter[fProjectFactories.size()]); + } } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/IBundleImporter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/IBundleImporter.java new file mode 100644 index 000000000..c53a64ae0 --- /dev/null +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/IBundleImporter.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * 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.core.importing.provisional; + + +/** + * A bundle importer represents an instance of a bundle importer extension. + * Clients contributing a bundle importer extension contribute an implementation + * of {@link IBundleImporterDelegate} rather than this interface. + * <p> + * Clients contributing a bundle importer extension are intended to implement + * {@link IBundleImporterDelegate}. + * </p> + * @since 3.7 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IBundleImporter extends IBundleImporterDelegate { + + /** + * Returns this impoter's unique identifier. + * + * @return identifier + */ + public String getId(); + + /** + * Returns a short description of this importer, or <code>null</code> if unspecified. + * + * @return description or <code>null</code> + */ + public String getDescription(); + + /** + * Returns a human readable name for this importer. + * + * @return name + */ + public String getName(); +} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/IBundleImporterDelegate.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/IBundleImporterDelegate.java new file mode 100644 index 000000000..b69e40e9b --- /dev/null +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/IBundleImporterDelegate.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * 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.core.importing.provisional; + +import java.util.Map; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.team.core.ScmUrlImportDescription; + +/** + * A bundle importer delegate is contributed by a bundle importer extension and is capable + * of importing projects into the workspace from a repository based on bundle manifest entries. + * <p> + * Following is an example extension: + * <pre> + * <extension point="org.eclipse.pde.core.bundleImporters"> + * <importer + * id="com.example.ExampleIdentifier" + * class="com.example.ExampleBundleImporterDelegate"> + * </importer> + * </extension> + * </pre> + * </p> + * <p> + * Clients contributing bundle importer extensions are intended to implement this interface. + * </p> + * <p> + * <strong>EXPERIMENTAL</strong>. This 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 PDE team. + * </p> + * @since 3.7 + * @noextend This interface is not intended to be extended by clients. + */ +public interface IBundleImporterDelegate { + + /** + * Returns an array of objects describing how each given bundle (manifest headers and values) + * can be imported into a workspace project. A <code>null</code> entry in the returned array + * indicates the corresponding bundle cannot be imported by this delegate. + * + * @param manifests array of maps containing manifest headers and values of the associated bundles + * @return array of bundle import descriptions that may contain <code>null</code> entries + */ + public ScmUrlImportDescription[] validateImport(Map[] manifests); + + /** + * Imports bundles into the workspace creating a project for each import description. + * Reports progress to the given monitor, if not <code>null</code>. + * + * @param descriptions description of bundles to import + * @param monitor progress monitor or <code>null</code> + * @return collection of projects created in the workspace or <code>null</code> if none + * @throws CoreException if unable to import projects + */ + public IProject[] performImport(ScmUrlImportDescription[] descriptions, IProgressMonitor monitor) throws CoreException; +} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/package.html b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/package.html new file mode 100644 index 000000000..7cecc1194 --- /dev/null +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/package.html @@ -0,0 +1,23 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="Author" content="IBM"> + <title>Package-level Javadoc</title> +</head> +<body> +Application programming interfaces for importing projects into the workspace. +<h2> +Package Specification</h2> +<p> +Provides support for importing projects into the workspace from a repository. +</p> +<p> +A bundle manifest may contain information identifying source code for the bundle +or a project in a repository associated with the bundle. Clients may contribute +implementations of <code>org.eclipse.tea,.core.importing.provisional.IBundleImporterDelegate</code> +to the <code>org.eclipse.team.core.bundleImporters</code> extension point to participate +in the import of bundles into workspace projects based on bundle manifests. +</p> +</body> +</html> |