Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2011-02-22 16:50:58 +0000
committerTomasz Zarna2011-02-22 16:50:58 +0000
commite84b9443d953fa1b0a72fc3d49e5a4a04c2114b6 (patch)
tree9a035245fe7bca0559ce6d957f70bc1ca5f3dbd2 /bundles
parent6f0c2d32b065cc58829803e09272e60981d93486 (diff)
downloadeclipse.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')
-rw-r--r--bundles/org.eclipse.team.core/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.team.core/plugin.properties3
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml3
-rw-r--r--bundles/org.eclipse.team.core/schema/bundleImporters.exsd156
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ScmUrlImportDescription.java99
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java33
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java105
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/IBundleImporter.java55
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/IBundleImporterDelegate.java83
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/package.html23
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java5
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java94
-rw-r--r--bundles/org.eclipse.team.cvs.core/plugin.xml9
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CvsBundleImporterDelegate.java58
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSScmUrlImportWizardPage.java274
-rw-r--r--bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.team.ui/plugin.properties1
-rw-r--r--bundles/org.eclipse.team.ui/plugin.xml1
-rw-r--r--bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd137
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IScmUrlImportWizardPage.java79
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java72
26 files changed, 1308 insertions, 14 deletions
diff --git a/bundles/org.eclipse.team.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.core/META-INF/MANIFEST.MF
index 97cf318db..ab881c525 100644
--- a/bundles/org.eclipse.team.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.team.core/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@ Export-Package: org.eclipse.team.core,
org.eclipse.team.core.diff.provider,
org.eclipse.team.core.history,
org.eclipse.team.core.history.provider,
+ org.eclipse.team.core.importing.provisional;x-friends:="org.eclipse.pde.core,org.eclipse.team.cvs.core",
org.eclipse.team.core.mapping,
org.eclipse.team.core.mapping.provider,
org.eclipse.team.core.subscribers,
diff --git a/bundles/org.eclipse.team.core/plugin.properties b/bundles/org.eclipse.team.core/plugin.properties
index 3e550aafc..3308088de 100644
--- a/bundles/org.eclipse.team.core/plugin.properties
+++ b/bundles/org.eclipse.team.core/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2006 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
@@ -18,3 +18,4 @@ Repository=Repository Providers
DefaultValidator=Default File Modification Validator
StorageMergers = Storage Mergers
+BundleImporters = Bundle Importers \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/plugin.xml b/bundles/org.eclipse.team.core/plugin.xml
index 19c19023e..fc240b259 100644
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ b/bundles/org.eclipse.team.core/plugin.xml
@@ -8,7 +8,7 @@
<extension-point id="repository" name="%Repository" schema="schema/repository.exsd"/>
<extension-point id="defaultFileModificationValidator" name="%DefaultValidator" schema="schema/defaultFileModificationValidator.exsd"/>
<extension-point id="storageMergers" name="%StorageMergers" schema="schema/storageMergers.exsd"/>
-
+ <extension-point id="bundleImporters" name="%BundleImporters" schema="schema/bundleImporters.exsd"/>
<!-- Define common known file types -->
<extension
point="org.eclipse.team.core.fileTypes">
@@ -158,5 +158,4 @@
<adapter type="org.eclipse.core.resources.mapping.ResourceMapping"/>
</factory>
</extension>
-
</plugin>
diff --git a/bundles/org.eclipse.team.core/schema/bundleImporters.exsd b/bundles/org.eclipse.team.core/schema/bundleImporters.exsd
new file mode 100644
index 000000000..747a545ab
--- /dev/null
+++ b/bundles/org.eclipse.team.core/schema/bundleImporters.exsd
@@ -0,0 +1,156 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.team.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.team.core" id="bundleImporters" name="Bundle Importers"/>
+ </appInfo>
+ <documentation>
+ &lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. 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.
+&lt;p&gt;
+A bundle importer is capable of creating a project in the workspace based on a bundle manifest. For example, the CVS bundle importer leverages the &apos;Eclipse-SourceReferences&apos; header to import projects from CVS.
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element internal="true" />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="importer"/>
+ </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="importer">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ Fully qualified name of a Java class providing an implementation of &lt;code&gt;org.eclipse.team.core.importing.provisional.IBundleImporterDelegate&lt;/code&gt; for this handler.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.team.core.importing.provisional.IBundleImporterDelegate"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique identifier for this project factory extension.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ A short description of this importer suitable for display to the end user.
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ The name of this bundle importer, suitable for display to an end user.
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </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 bundle importer extension.
+
+&lt;p&gt;
+&lt;pre&gt;
+ &lt;extension point=&quot;org.eclipse.team.core.bundleImporters&quot;&gt;
+ &lt;importer
+ id=&quot;com.example.ExampleIdentifier&quot;
+ class=&quot;com.example.ExampleBundleImporter&quot;&gt;
+ &lt;/importer&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ Value of a importer&apos;s &lt;b&gt;class&lt;/b&gt; attribute must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.team.core.importing.provisional.IBundleImporterDelegate&lt;/b&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ CVS provides a bundle importer extension capable of importing projects from CVS referenced by &apos;Eclipse-SourceReferences&apos; headers.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2011 IBM Corporation and others.
+&lt;br&gt;
+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
+&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;.
+ </documentation>
+ </annotation>
+
+</schema>
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
new file mode 100644
index 000000000..34d29ffcd
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ScmUrlImportDescription.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * 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;
+
+import java.net.URI;
+import java.util.HashMap;
+
+/**
+ * Describes how a bundle import will be executed. A bundle importer delegate
+ * creates bundle import descriptions when it validates bundle manifests for
+ * importing. The result, a set of bundle import descriptions is then passed to
+ * TeamUI, which basing on the info from the descriptions instantiate and
+ * initialize IScmUrlImportWizardPage pages. The pages can be used to alter the
+ * default import configuration e.g. for bundles stored in a CVS repository the
+ * user may want to check out HEAD rather than a specific version.
+ * <p>
+ * <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 class ScmUrlImportDescription {
+ private String url;
+ private String project;
+ private HashMap properties;
+
+ public ScmUrlImportDescription(String url, String project) {
+ this.url = url;
+ this.project = project;
+ }
+
+ /**
+ * @return project name
+ */
+ public String getProject() {
+ return project;
+ }
+
+ /**
+ * SCM URL
+ *
+ * @return a string representation of the SCM URL
+ */
+ public String getUrl() {
+ return url;
+ }
+
+ public URI getUri() {
+ return URI.create(url.replaceAll("\"", "")); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ /**
+ * 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..188d28588 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 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
@@ -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 fBundleImporters;
+
static {
fFileContentManager= new FileContentManager();
}
@@ -523,4 +527,31 @@ public final class Team {
public IStorageMerger createStorageMerger(String extension) {
return createMerger(extension);
}
+
+ /**
+ * Returns the available bundle importers.
+ *
+ * <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 Team team.
+ * </p>
+ *
+ * @return IBundleImporter[] returns the available bundle importers
+ * @since 3.6
+ */
+ public synchronized static IBundleImporter[] getBundleImporters() {
+ if (fBundleImporters == null) {
+ fBundleImporters = 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++) {
+ fBundleImporters.add(new BundleImporterExtension(infos[i]));
+ }
+ }
+ }
+ return (IBundleImporter[]) fBundleImporters.toArray(new IBundleImporter[fBundleImporters.size()]);
+ }
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java
new file mode 100644
index 000000000..64805d6a7
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * 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.*;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.eclipse.osgi.util.ManifestElement;
+import org.eclipse.team.core.*;
+import org.eclipse.team.internal.core.TeamPlugin;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+
+/**
+ * Abstract implementation of {@link IBundleImporterDelegate}. It is recommended
+ * to subclass this class rather than implementing IBundleImporterDelegate
+ * directly when providing importer delegates.
+ * <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
+ * Team team.
+ * </p>
+ *
+ * @since 3.6
+ */
+public abstract class BundleImporterDelegate implements IBundleImporterDelegate {
+
+ private static final String ATTR_PROJECT = "project"; //$NON-NLS-1$
+
+ public static final String ECLIPSE_SOURCE_REFERENCES = "Eclipse-SourceReferences"; //$NON-NLS-1$
+
+ protected abstract Set getSupportedValues();
+
+ protected abstract RepositoryProviderType getProviderType();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.core.project.IBundleImporterDelegate#validateImport(java.util.Map[])
+ */
+ public ScmUrlImportDescription[] validateImport(Map[] manifests) {
+ ScmUrlImportDescription[] results = new ScmUrlImportDescription[manifests.length];
+ if (getProviderType() != null) {
+ for (int i = 0; i < manifests.length; i++) {
+ Map manifest = manifests[i];
+ String value = (String) manifest.get(ECLIPSE_SOURCE_REFERENCES);
+ if (value != null && value.length() > 8) {
+ String prefix = value.substring(0, 8);
+ if (getSupportedValues().contains(prefix)) {
+ try {
+ ManifestElement[] elements = ManifestElement.parseHeader(ECLIPSE_SOURCE_REFERENCES, value);
+ for (int j = 0; j < elements.length; j++) {
+ ManifestElement element = elements[j];
+ String url = element.toString();
+ String project = element.getAttribute(ATTR_PROJECT);
+ if (project == null) {
+ String bsn = (String) manifests[i].get(Constants.BUNDLE_SYMBOLICNAME);
+ if (bsn != null) {
+ ManifestElement[] bsnElement = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, bsn);
+ project = bsnElement[0].getValue();
+ }
+ }
+ results[i] = new ScmUrlImportDescription(url, project);
+ }
+ } catch (BundleException e) {
+ TeamPlugin.log(IStatus.ERROR, "An exception occured while parsing a manifest header", e);//$NON-NLS-1$
+ }
+ }
+ }
+ }
+ }
+ return results;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.core.importing.IBundleImporterDelegate#performImport(org.eclipse.pde.core.importing.BundleImportDescription[], org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IProject[] performImport(ScmUrlImportDescription[] descriptions, IProgressMonitor monitor) throws CoreException {
+ List references = new ArrayList();
+ ProjectSetCapability psfCapability = getProviderType().getProjectSetCapability();
+ IProject[] result = null;
+ if (psfCapability != null) {
+ // collect and validate all header values
+ for (int i = 0; i < descriptions.length; i++) {
+ ScmUrlImportDescription description = (ScmUrlImportDescription) descriptions[i];
+ references.add(psfCapability.asReference(description.getUri(), description.getProject()));
+ }
+ // create projects
+ if (!references.isEmpty()) {
+ SubMonitor subMonitor = SubMonitor.convert(monitor, references.size());
+ result = psfCapability.addToWorkspace((String[]) references.toArray(new String[references.size()]), new ProjectSetSerializationContext(), subMonitor);
+ subMonitor.done();
+ }
+ }
+ return result;
+ }
+}
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..d370fbe2f
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/IBundleImporter.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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>
+ * <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
+ * Team team.
+ * </p>
+ *
+ * @since 3.6
+ * @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..38eb22531
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/IBundleImporterDelegate.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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>
+ * &lt;extension point=&quot;org.eclipse.team.core.bundleImporters&quot;&gt;
+ * &lt;importer
+ * id=&quot;com.example.ExampleIdentifier&quot;
+ * class=&quot;com.example.ExampleBundleImporterDelegate&quot;&gt;
+ * &lt;/importer&gt;
+ * &lt;/extension&gt;
+ * </pre>
+ *
+ * </p>
+ * <p>
+ * Clients contributing bundle importer extensions are intended to implement
+ * this interface. They can also subclass {@link BundleImporterDelegate}.
+ * </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
+ * Team team.
+ * </p>
+ *
+ * @since 3.6
+ * @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..de35fa2d6
--- /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.team.core.importing.provisional.IBundleImporter</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>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
index 4c729c20d..aa898e74f 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
@@ -55,7 +55,10 @@ final public class TeamPlugin extends Plugin {
// The id used to associate a provider with a project
public final static QualifiedName PROVIDER_PROP_KEY =
new QualifiedName("org.eclipse.team.core", "repository"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
+ // The id for the Bundle Import extension point
+ public static final String EXTENSION_POINT_BUNDLE_IMPORTERS = ID + ".bundleImporters"; //$NON-NLS-1$
+
// The one and only plug-in instance
private static TeamPlugin plugin;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java
new file mode 100644
index 000000000..eb27bb5fc
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * 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.internal.core.importing;
+
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.eclipse.team.core.ScmUrlImportDescription;
+import org.eclipse.team.core.importing.provisional.IBundleImporter;
+import org.eclipse.team.core.importing.provisional.IBundleImporterDelegate;
+import org.eclipse.team.internal.core.TeamPlugin;
+
+/**
+ * A bundle importer extension.
+ *
+ * @since 3.7
+ */
+public class BundleImporterExtension implements IBundleImporter {
+
+ private IBundleImporterDelegate delegate;
+ private IConfigurationElement element;
+
+ /**
+ * Constructs a bundle importer extension on the given element.
+ *
+ * @param element contribution
+ */
+ public BundleImporterExtension(IConfigurationElement element) {
+ this.element = element;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.core.project.IBundleImporterDelegate#validateImport(java.util.Map[])
+ */
+ public ScmUrlImportDescription[] validateImport(Map[] manifests) {
+ try {
+ return getDelegate().validateImport(manifests);
+ } catch (CoreException e) {
+ TeamPlugin.log(e);
+ return null;
+ }
+ }
+
+ /**
+ * Returns underlying delegate.
+ *
+ * @return delegate
+ * @exception CoreException if unable to instantiate delegate
+ */
+ private synchronized IBundleImporterDelegate getDelegate() throws CoreException {
+ if (delegate == null) {
+ delegate = (IBundleImporterDelegate) element.createExecutableExtension("class"); //$NON-NLS-1$
+ }
+ return delegate;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.core.importing.IBundleImporterDelegate#performImport(org.eclipse.pde.core.importing.BundleImportDescription[], org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IProject[] performImport(ScmUrlImportDescription[] descriptions, IProgressMonitor monitor) throws CoreException {
+ return getDelegate().performImport(descriptions, monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.core.project.IBundleImporter#getId()
+ */
+ public String getId() {
+ return element.getAttribute("id"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.core.project.IBundleImporter#getDescription()
+ */
+ public String getDescription() {
+ return element.getAttribute("description"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.core.project.IBundleImporter#getName()
+ */
+ public String getName() {
+ return element.getAttribute("name"); //$NON-NLS-1$
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.core/plugin.xml b/bundles/org.eclipse.team.cvs.core/plugin.xml
index f563ca4a7..16f174ede 100644
--- a/bundles/org.eclipse.team.cvs.core/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.core/plugin.xml
@@ -239,5 +239,12 @@
<adapter type="org.eclipse.core.resources.mapping.ResourceMapping"/>
</factory>
</extension>
-
+ <extension
+ point="org.eclipse.team.core.bundleImporters">
+ <importer
+ class="org.eclipse.team.internal.ccvs.core.CvsBundleImporterDelegate"
+ name="%cvsBundleImporter"
+ id="org.eclipse.team.core.cvs.importer">
+ </importer>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CvsBundleImporterDelegate.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CvsBundleImporterDelegate.java
new file mode 100644
index 000000000..e4301a81e
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CvsBundleImporterDelegate.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.internal.ccvs.core;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.team.core.RepositoryProviderType;
+import org.eclipse.team.core.importing.provisional.BundleImporterDelegate;
+
+/**
+ * Handles SCM CVS headers of the following form. Tag and project name can be specified
+ * as extra attributes. When a tag is unspecified, the HEAD tag is used. When a project
+ * name is unspecified, it is generated by the module name.
+ * <pre>
+ * scm:cvs&lt;delimiter&gt;&lt;method&gt;&lt;delimiter&gt;path_to_repository&lt;delimiter&gt;module_name[;tag=version][;project=name]
+ * scm:psf&lt;delimiter&gt;&lt;method&gt;&lt;delimiter&gt;path_to_repository&lt;delimiter&gt;module_name[;tag=version][;project=name]
+ * </pre>
+ */
+public class CvsBundleImporterDelegate extends BundleImporterDelegate {
+
+ private static Set SUPPORTED_VALUES;
+
+ private static final String SCM = "scm:"; //$NON-NLS-1$
+ private static final String CVS = "cvs"; //$NON-NLS-1$
+// private static final String PSF = "psf"; //$NON-NLS-1$
+ private static final String COLON = ":"; //$NON-NLS-1$
+ private static final String PIPE = "|"; //$NON-NLS-1$
+
+ private RepositoryProviderType providerType;
+
+ static {
+ SUPPORTED_VALUES = new HashSet();
+ SUPPORTED_VALUES.add(SCM + CVS + COLON);
+ SUPPORTED_VALUES.add(SCM + CVS + PIPE);
+// SUPPORTED_VALUES.add(SCM + PSF + COLON);
+// SUPPORTED_VALUES.add(SCM + PSF + PIPE);
+ }
+
+ protected Set getSupportedValues() {
+ return SUPPORTED_VALUES;
+ }
+
+ protected RepositoryProviderType getProviderType() {
+ if (providerType == null)
+ providerType = RepositoryProviderType.getProviderType(CVSProviderPlugin.getTypeId());
+ return providerType;
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java
index 7f92030d6..8391ec399 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 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
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index b1407773b..70e6db432 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -2057,6 +2057,13 @@
<keywordReference id="org.eclipse.team.cvs.ui.cvs.annotate"/>
</page>
</extension>
+ <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>
<!-- Commented out awaiting menu support from UI
<extension
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
index dee1c2540..8554f87c3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -1187,5 +1187,9 @@ public class CVSUIMessages extends NLS {
public static String ClipboardDiffOperation_Clipboard;
public static String CVSAction_doNotShowThisAgain;
-
+ public static String CVSScmUrlImportWizardPage_0;
+ public static String CVSScmUrlImportWizardPage_1;
+ public static String CVSScmUrlImportWizardPage_2;
+ public static String CVSScmUrlImportWizardPage_3;
+ public static String CVSScmUrlImportWizardPage_4;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
index 486344efd..1002ace04 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -79,6 +79,8 @@ public interface IHelpContextIds {
public static final String COMMIT_FILE_TYPES_PAGE = PREFIX + "commit_file_types_page_context"; //$NON-NLS-1$
public static final String COMMIT_COMMENT_PAGE = PREFIX + "commit_comment_page_context"; //$NON-NLS-1$
+ public static final String CVS_SCM_URL_IMPORT_PAGE = PREFIX + "cvs_scm_url_import_page"; //$NON-NLS-1$
+
// Preference Pages
public static final String PREF_DEBUG_PROTOCOL = PREFIX + "debug_protocol_pref"; //$NON-NLS-1$
public static final String PREF_PRUNE = PREFIX + "prune_empty_directories_pref"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index dbcf8986e..f453580c3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2010 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
@@ -1209,3 +1209,9 @@ RemoveRootAction_RepositoryRemovalDialogMessageSingle=Are you sure you want to d
RemoveRootAction_RepositoryRemovalDialogMessageMultiple=Are you sure you want to discard these {0} repositories?
AddAction_confirmAddingResourcesTitle=Confirm adding resources to Version Control
AddAction_confirmAddingResourcesMessage=Are you sure you want to add selected resources to the version control?
+
+CVSScmUrlImportWizardPage_0=Import Projects from CVS
+CVSScmUrlImportWizardPage_1=Import CVS projects corresponding to plug-ins and fragments in the file system.
+CVSScmUrlImportWizardPage_2=Import from &HEAD
+CVSScmUrlImportWizardPage_3=Import specific &version(s) shown below
+CVSScmUrlImportWizardPage_4=Total: {0} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSScmUrlImportWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSScmUrlImportWizardPage.java
new file mode 100644
index 000000000..6533c5464
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSScmUrlImportWizardPage.java
@@ -0,0 +1,274 @@
+/*******************************************************************************
+ * 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.internal.ccvs.ui.wizards;
+
+import java.net.URI;
+
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.team.core.RepositoryProviderType;
+import org.eclipse.team.core.ScmUrlImportDescription;
+import org.eclipse.team.internal.ccvs.core.filesystem.CVSURI;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
+import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
+import org.eclipse.team.internal.ui.SWTUtils;
+import org.eclipse.team.ui.IScmUrlImportWizardPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+public class CVSScmUrlImportWizardPage extends WizardPage implements IScmUrlImportWizardPage {
+
+ private RepositoryProviderType provider;
+ private ScmUrlImportDescription[] descriptions;
+ private Button useHead;
+ private TableViewer bundlesViewer;
+ private Label counterLabel;
+
+ private static final String CVS_PAGE_USE_HEAD = "org.eclipse.team.cvs.ui.import.page.head"; //$NON-NLS-1$
+
+ class CVSLabelProvider extends StyledCellLabelProvider implements ILabelProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object element) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object element) {
+ return getStyledText(element).getString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.StyledCellLabelProvider#update(org.eclipse.jface.viewers.ViewerCell)
+ */
+ public void update(ViewerCell cell) {
+ StyledString string = getStyledText(cell.getElement());
+ cell.setText(string.getString());
+ cell.setStyleRanges(string.getStyleRanges());
+ cell.setImage(getImage(cell.getElement()));
+ super.update(cell);
+ }
+
+ private StyledString getStyledText(Object element) {
+ StyledString styledString = new StyledString();
+ if (element instanceof ScmUrlImportDescription) {
+ ScmUrlImportDescription description = (ScmUrlImportDescription) element;
+ String project = description.getProject();
+ URI scmUrl = description.getUri();
+ String version = getTag(scmUrl);
+ String host = getServer(scmUrl);
+ styledString.append(project);
+ if (version != null && !useHead.getSelection()) {
+ styledString.append(' ');
+ styledString.append(version, StyledString.DECORATIONS_STYLER);
+ }
+ styledString.append(' ');
+ styledString.append('[', StyledString.DECORATIONS_STYLER);
+ styledString.append(host, StyledString.DECORATIONS_STYLER);
+ styledString.append(']', StyledString.DECORATIONS_STYLER);
+ return styledString;
+ }
+ styledString.append(element.toString());
+ return styledString;
+ }
+ }
+
+ /**
+ * Constructs the page.
+ */
+ public CVSScmUrlImportWizardPage() {
+ super("cvs", CVSUIMessages.CVSScmUrlImportWizardPage_0, null); //$NON-NLS-1$
+ setDescription(CVSUIMessages.CVSScmUrlImportWizardPage_1);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite comp = SWTUtils.createHVFillComposite(parent, SWTUtils.MARGINS_NONE, 1);
+ Composite group = SWTUtils.createHFillComposite(comp, SWTUtils.MARGINS_NONE, 1);
+
+ Button versions = SWTUtils.createRadioButton(group, CVSUIMessages.CVSScmUrlImportWizardPage_3);
+ useHead = SWTUtils.createRadioButton(group, CVSUIMessages.CVSScmUrlImportWizardPage_2);
+ SelectionListener listener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ bundlesViewer.refresh(true);
+ }
+ };
+ versions.addSelectionListener(listener);
+ useHead.addSelectionListener(listener);
+
+ Table table = new Table(comp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 200;
+ gd.widthHint = 225;
+ table.setLayoutData(gd);
+
+ bundlesViewer = new TableViewer(table);
+ bundlesViewer.setLabelProvider(new CVSLabelProvider());
+ bundlesViewer.setContentProvider(new ArrayContentProvider());
+ bundlesViewer.setComparator(new ViewerComparator());
+ counterLabel = new Label(comp, SWT.NONE);
+ counterLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ setControl(comp);
+ setPageComplete(true);
+
+ // initialize versions versus HEAD
+ IDialogSettings settings = getWizard().getDialogSettings();
+ boolean head = false;
+ boolean found = false;
+ if (settings != null) {
+ String string = settings.get(CVS_PAGE_USE_HEAD);
+ if (string != null) {
+ found = true;
+ head = settings.getBoolean(CVS_PAGE_USE_HEAD);
+ }
+ }
+
+ if (!found) {
+ for (int i = 0; i < descriptions.length; i++) {
+ URI scmUrl = descriptions[i].getUri();
+ if (getTag(scmUrl) != null) {
+ head = false;
+ break;
+ }
+ }
+ }
+ useHead.setSelection(head);
+ versions.setSelection(!head);
+
+ if (descriptions != null) {
+ bundlesViewer.setInput(descriptions);
+ updateCount();
+ }
+
+ // TODO: add help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.CVS_SCM_URL_IMPORT_PAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.IScmUrlImportWizardPage#finish()
+ */
+ public boolean finish() {
+ boolean head = false;
+ if (getControl() != null) {
+ head = useHead.getSelection();
+ // store settings
+ IDialogSettings settings = getWizard().getDialogSettings();
+ if (settings != null) {
+ settings.put(CVS_PAGE_USE_HEAD, head);
+ }
+ } else {
+ // use whatever was used last time
+ IDialogSettings settings = getWizard().getDialogSettings();
+ if (settings != null) {
+ head = settings.getBoolean(CVS_PAGE_USE_HEAD);
+ }
+ }
+
+ if (head) {
+ // modify tags on bundle import descriptions
+ for (int i = 0; i < descriptions.length; i++) {
+ URI scmUri = descriptions[i].getUri();
+ descriptions[i].setUrl(removeTag(scmUri));
+ }
+ }
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.IScmUrlImportWizardPage#getSelection()
+ */
+ public ScmUrlImportDescription[] getSelection() {
+ return descriptions;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.IScmUrlImportWizardPage#getSelection()
+ */
+ public void setSelection(ScmUrlImportDescription[] descriptions) {
+ this.descriptions = descriptions;
+ // fill viewer
+ if (bundlesViewer != null) {
+ bundlesViewer.setInput(descriptions);
+ updateCount();
+ }
+ }
+
+ /**
+ * Updates the count of bundles that will be imported
+ */
+ private void updateCount() {
+ counterLabel.setText(NLS.bind(CVSUIMessages.CVSScmUrlImportWizardPage_4, new Integer(descriptions.length)));
+ counterLabel.getParent().layout();
+ }
+
+ private static String getTag(URI scmUri) {
+ return CVSURI.fromUri(scmUri).getTag().getName();
+ }
+
+ /**
+ * Remove tag attributes from the given URI reference. Results in the URI
+ * pointing to HEAD.
+ *
+ * @param scmUri
+ * a SCM URI reference to modify
+ * @return Returns the content of the stripped URI as a string.
+ */
+ private static String removeTag(URI scmUri) {
+ StringBuffer sb = new StringBuffer();
+ sb.append(scmUri.getScheme()).append(':');
+ String ssp = scmUri.getSchemeSpecificPart();
+ int j = ssp.indexOf(';');
+ if (j != -1) {
+ sb.append(ssp.substring(0, j));
+ String[] params = ssp.substring(j).split(";"); //$NON-NLS-1$
+ for (int k = 0; k < params.length; k++) {
+ // PDE way of providing tags
+ if (params[k].startsWith("tag=")) { //$NON-NLS-1$
+ // ignore
+ } else if (params[k].startsWith("version=")) { //$NON-NLS-1$
+ // ignore
+ } else {
+ sb.append(params[k]);
+ }
+ }
+ } else {
+ sb.append(ssp);
+ }
+ return sb.toString();
+ }
+
+ private static String getServer(URI scmUri) {
+ return CVSURI.fromUri(scmUri).getRepository().getHost();
+ }
+
+ public void setProvider(RepositoryProviderType provider) {
+ this.provider = provider;
+ }
+
+ public RepositoryProviderType getProvider() {
+ return provider;
+ }
+
+}
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>
+ &lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. 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.
+&lt;p&gt;
+This extension point is used to register a page to import projects basing on their SCM URLs.
+&lt;/p&gt;
+&lt;p&gt;
+Providers may provide an extension for this extension point, and an implementation of &lt;samp&gt;org.eclipse.team.ui.IScmUrlImportWizardPage&lt;/samp&gt; which allows to set and retrive project import descriptions.
+&lt;/p&gt;
+ </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:
+&lt;p&gt;
+&lt;pre&gt;
+&lt;extension point=&quot;org.eclipse.team.ui.scmUrlImportPages&quot;&gt;
+ &lt;scmUrlImportPage
+ page=&quot;org.eclipse.team.internal.ccvs.ui.wizards.CVSScmUrlImportWizardPage&quot;
+ repository=&quot;org.eclipse.team.cvs.core.cvsnature&quot;&gt;
+ &lt;/scmUrlImportPage&gt;
+&lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ Value of a page&apos;s &lt;b&gt;page&lt;/b&gt; attribute must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.team.ui.IScmUrlImportWizardPage&lt;/b&gt;.
+ </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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+ </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;
+ }
}

Back to the top