Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2011-02-14 08:10:37 -0500
committerTomasz Zarna2011-02-14 08:10:37 -0500
commitc82d5c49fda1e30a7af2034aa3c08798032dd4e4 (patch)
tree60538effc1bda64d5dddaaa824d866b3e576492a
parent1d90145e4d497190850b3a257132c9931f2775fc (diff)
downloadeclipse.platform.team-c82d5c49fda1e30a7af2034aa3c08798032dd4e4.tar.gz
eclipse.platform.team-c82d5c49fda1e30a7af2034aa3c08798032dd4e4.tar.xz
eclipse.platform.team-c82d5c49fda1e30a7af2034aa3c08798032dd4e4.zip
bug 330490: API and UI to configure SCM URLs for import -- work in progress
-rw-r--r--bundles/org.eclipse.team.core/plugin.properties3
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml8
-rw-r--r--bundles/org.eclipse.team.core/schema/bundleImporters.exsd12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java11
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/IBundleImporter.java8
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/IBundleImporterDelegate.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/plugin.properties3
-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.java (renamed from bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/CvsBundleImporterDelegate.java)5
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java4
-rw-r--r--bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd22
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ProjectSetImporterTests.java37
12 files changed, 92 insertions, 36 deletions
diff --git a/bundles/org.eclipse.team.core/plugin.properties b/bundles/org.eclipse.team.core/plugin.properties
index 497dfea6b..5fd317343 100644
--- a/bundles/org.eclipse.team.core/plugin.properties
+++ b/bundles/org.eclipse.team.core/plugin.properties
@@ -18,5 +18,4 @@ Repository=Repository Providers
DefaultValidator=Default File Modification Validator
StorageMergers = Storage Mergers
-expoint.bundleImporters.name = Bundle Importers
-bundleImporter.cvs = CVS Bundle Importer
+expoint.bundleImporters.name = 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 1d58b6d45..b7bf6fccb 100644
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ b/bundles/org.eclipse.team.core/plugin.xml
@@ -158,12 +158,4 @@
<adapter type="org.eclipse.core.resources.mapping.ResourceMapping"/>
</factory>
</extension>
- <extension
- point="org.eclipse.team.core.bundleImporters">
- <importer
- class="org.eclipse.team.internal.core.importing.CvsBundleImporterDelegate"
- name="%bundleImporter.cvs"
- id="org.eclipse.team.core.cvs.importer">
- </importer>
- </extension>
</plugin>
diff --git a/bundles/org.eclipse.team.core/schema/bundleImporters.exsd b/bundles/org.eclipse.team.core/schema/bundleImporters.exsd
index 8cfffbd4f..747a545ab 100644
--- a/bundles/org.eclipse.team.core/schema/bundleImporters.exsd
+++ b/bundles/org.eclipse.team.core/schema/bundleImporters.exsd
@@ -6,7 +6,7 @@
<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 PDE team.
+ &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;
@@ -55,10 +55,10 @@ A bundle importer is capable of creating a project in the workspace based on a b
<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.pde.internal.core.importing.provisional.IBundleImporterDelegate&lt;/code&gt; for this handler.
+ 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.pde.internal.core.importing.provisional.IBundleImporterDelegate"/>
+ <meta.attribute kind="java" basedOn=":org.eclipse.team.core.importing.provisional.IBundleImporterDelegate"/>
</appInfo>
</annotation>
</attribute>
@@ -110,7 +110,7 @@ A bundle importer is capable of creating a project in the workspace based on a b
&lt;p&gt;
&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.pde.core.bundleImporters&quot;&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;
@@ -126,7 +126,7 @@ A bundle importer is capable of creating a project in the workspace based on a b
<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.pde.internal.core.importing.provisional.IBundleImporterDelegate&lt;/b&gt;.
+ 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>
@@ -135,7 +135,7 @@ A bundle importer is capable of creating a project in the workspace based on a b
<meta.section type="implementation"/>
</appInfo>
<documentation>
- PDE provides a bundle importer extension capable of importing projects from CVS referenced by &apos;Eclipse-SourceReferences&apos; headers.
+ CVS provides a bundle importer extension capable of importing projects from CVS referenced by &apos;Eclipse-SourceReferences&apos; headers.
</documentation>
</annotation>
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 67c4275f6..43f6965e6 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
@@ -529,6 +529,15 @@ public final class Team {
}
/**
+ * 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
*/
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
index c53a64ae0..3269706e4 100644
--- 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
@@ -19,7 +19,13 @@ package org.eclipse.team.core.importing.provisional;
* Clients contributing a bundle importer extension are intended to implement
* {@link IBundleImporterDelegate}.
* </p>
- * @since 3.7
+ * <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.
*/
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
index b69e40e9b..bc6458ac5 100644
--- 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
@@ -22,7 +22,7 @@ import org.eclipse.team.core.ScmUrlImportDescription;
* <p>
* Following is an example extension:
* <pre>
- * &lt;extension point=&quot;org.eclipse.pde.core.bundleImporters&quot;&gt;
+ * &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;
@@ -37,9 +37,9 @@ import org.eclipse.team.core.ScmUrlImportDescription;
* <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.
+ * consulting with the Team team.
* </p>
- * @since 3.7
+ * @since 3.6
* @noextend This interface is not intended to be extended by clients.
*/
public interface IBundleImporterDelegate {
diff --git a/bundles/org.eclipse.team.cvs.core/plugin.properties b/bundles/org.eclipse.team.cvs.core/plugin.properties
index bed5d0913..2c07ce7a8 100644
--- a/bundles/org.eclipse.team.cvs.core/plugin.properties
+++ b/bundles/org.eclipse.team.cvs.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
@@ -17,3 +17,4 @@ Authenticator=Authenticator
ConnectionMethods=ConnectionMethods
FileModificationValidator=FileModificationValidator
ChangeSets=Change Sets
+bundleImporter.cvs = CVS Bundle Importer
diff --git a/bundles/org.eclipse.team.cvs.core/plugin.xml b/bundles/org.eclipse.team.cvs.core/plugin.xml
index f563ca4a7..c44bf3a35 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="%bundleImporter.cvs"
+ id="org.eclipse.team.core.cvs.importer">
+ </importer>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/CvsBundleImporterDelegate.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CvsBundleImporterDelegate.java
index 121e1d9a0..8fb3c073a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/CvsBundleImporterDelegate.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CvsBundleImporterDelegate.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.core.importing;
+package org.eclipse.team.internal.ccvs.core;
import java.util.*;
@@ -16,6 +16,7 @@ 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.core.importing.provisional.IBundleImporterDelegate;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
@@ -29,7 +30,7 @@ import org.osgi.framework.Constants;
* </pre>
* @since 3.7
*/
-public class CvsBundleImporterDelegate implements org.eclipse.team.core.importing.provisional.IBundleImporterDelegate {
+public class CvsBundleImporterDelegate implements IBundleImporterDelegate {
private static Set SUPPORTED_VALUES;
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 1d9b36df2..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
@@ -175,9 +175,9 @@ public class CVSURI {
private static String getProjectName(URI uri) {
String f = uri.getFragment();
if (f != null) {
- int i = f.indexOf(',');
+ int i = f.lastIndexOf(',');
if (i != -1) {
- String s = f.substring(0, i);
+ String s = f.substring(i + 1);
if (!s.equals("")) //$NON-NLS-1$
return s;
}
diff --git a/bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd b/bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd
index 0de841ea6..7ba8e186c 100644
--- a/bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd
+++ b/bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd
@@ -6,9 +6,15 @@
<meta.schema plugin="org.eclipse.team.ui" id="scmUrlImportPages" name="SCM URLs Import Pages"/>
</appInfo>
<documentation>
- This extension point is used to register a page to import a project basing on its SCM URL.
+ &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>
@@ -92,13 +98,13 @@ Providers may provide an extension for this extension point, and an implementati
&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;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;
+&lt;/p&gt;
</documentation>
</annotation>
@@ -107,7 +113,7 @@ Providers may provide an extension for this extension point, and an implementati
<meta.section type="apiinfo"/>
</appInfo>
<documentation>
- [Enter API information here.]
+ 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>
@@ -116,7 +122,7 @@ Providers may provide an extension for this extension point, and an implementati
<meta.section type="implementation"/>
</appInfo>
<documentation>
- [Enter information about supplied implementation of this extension point.]
+ CVS UI provides a page extension capable of configuring import from CVS.
</documentation>
</annotation>
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ProjectSetImporterTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ProjectSetImporterTests.java
index 8b1dcac6d..bb4b0870f 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ProjectSetImporterTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ProjectSetImporterTests.java
@@ -17,7 +17,9 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -34,9 +36,12 @@ import org.eclipse.team.core.ProjectSetCapability;
import org.eclipse.team.core.ProjectSetSerializationContext;
import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.ScmUrlImportDescription;
+import org.eclipse.team.core.Team;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.importing.provisional.IBundleImporter;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.CvsBundleImporterDelegate;
import org.eclipse.team.internal.ccvs.ui.wizards.CVSScmUrlImportWizardPage;
import org.eclipse.team.internal.ui.ProjectSetImporter;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
@@ -266,7 +271,7 @@ public class ProjectSetImporterTests extends EclipseTest {
// this is what every bundle importer should do, should this be in PDE?
List references = new ArrayList();
for (int i = 0; i < selection.length; i++) {
- references.add(c.asReference(selection[i].getUri(), selection[i].getProject()));
+ references.add(c.asReference(selection[i].getUri(), /*selection[i].getProject()*/ null));
}
c.addToWorkspace((String[]) references.toArray(new String[references.size()]), new ProjectSetSerializationContext(), null);
IProject project1 = ResourcesPlugin.getWorkspace().getRoot().getProject("project1");
@@ -315,4 +320,34 @@ public class ProjectSetImporterTests extends EclipseTest {
// expecting the project to be checked out from HEAD
assertEquals(project, copy, false, false);
}
+
+ public void testCvsBundleImporter() throws TeamException, CoreException {
+ IBundleImporter[] bundleImporters = Team.getBundleImporters();
+ assertEquals(1, bundleImporters.length);
+ IBundleImporter cvsBundleImporter = null;
+ for (int i = 0; i < bundleImporters.length; i++) {
+ if (bundleImporters[i].getId().equals("org.eclipse.team.core.cvs.importer")) {
+ cvsBundleImporter = bundleImporters[i];
+ }
+ }
+ // CVS Bundle Importer should be available
+ assertNotNull(cvsBundleImporter);
+
+ IProject project = createProject("ProjectSetImporterTests-testCvsBundleImporter", new String[0]);
+ project.delete(true, true, null);
+ ensureDoesNotExistInWorkspace(project);
+
+ String s = ProjectSetCapability.SCHEME_SCM + ":cvs:" + CVSTestSetup.REPOSITORY_LOCATION + ":" + project.getName();
+
+ Map[] manifests = new Map[1];
+ Map map = new HashMap();
+ map.put(CvsBundleImporterDelegate.ECLIPSE_SOURCE_REFERENCES, s);
+ manifests[0] = map;
+
+ ScmUrlImportDescription[] descriptions = cvsBundleImporter.validateImport(manifests);
+ assertEquals(1, descriptions.length);
+
+ cvsBundleImporter.performImport(descriptions, null);
+ assertExistsInWorkspace(project);
+ }
}

Back to the top