Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.team.core/schema/repository.exsd16
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java47
4 files changed, 77 insertions, 13 deletions
diff --git a/bundles/org.eclipse.team.core/schema/repository.exsd b/bundles/org.eclipse.team.core/schema/repository.exsd
index e37f135cc..d13aeea74 100644
--- a/bundles/org.eclipse.team.core/schema/repository.exsd
+++ b/bundles/org.eclipse.team.core/schema/repository.exsd
@@ -13,6 +13,9 @@ Repositories that extend this extension point can provide implementations for co
<p>
A Repository type can also be specified in order to provide non-project specific funtionality such as a <samp>org.eclipse.team.core.ProjectSetCapability</samp>.
</p>
+<p>
+Optionaly, a repository provider type can designate that it can import projects from second provider, in the case where the second provider's plugin is not available in the current install. This is provided as a means to support the migration from one provider implementation to another where the resuse of the same id for the two providers was not possible.
+</p>
</documentation>
</annotation>
@@ -62,6 +65,13 @@ A Repository type can also be specified in order to provide non-project specific
</appInfo>
</annotation>
</attribute>
+ <attribute name="canImportId" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
@@ -83,7 +93,9 @@ A Repository type can also be specified in order to provide non-project specific
&lt;extension point=&quot;org.eclipse.team.core.repository&quot;&gt;
&lt;repository
class=&quot;org.eclipse.myprovider.MyRepositoryProvider&quot;
- id=&quot;org.eclipse.myprovider.myProviderID&quot;&gt;
+ typeClass=&quot;org.eclipse.myprovider.MyRepositoryProvider&quot;
+ id=&quot;org.eclipse.myprovider.myProviderID&quot;
+ canImportId=&quot;org.eclipse.myprovider.myOldProviderID&quot;&gt;
&lt;/repository&gt;
&lt;/extension&gt;
&lt;/pre&gt;
@@ -95,7 +107,7 @@ A Repository type can also be specified in order to provide non-project specific
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
- The value of the class attribute must represent a subclass of &lt;samp&gt;org.eclipse.team.core.RepositoryProvider&lt;/samp&gt;.
+ The value of the class attribute must represent a subclass of &lt;samp&gt;org.eclipse.team.core.RepositoryProvider&lt;/samp&gt; and the value of the typeClass attribute must represent a subclass of &lt;samp&gt;org.eclipse.team.core.RepositoryProviderType&lt;/samp&gt;
</documentation>
</annotation>
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 d3a77fa5c..a3173c0b1 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
@@ -13,6 +13,7 @@ package org.eclipse.team.internal.core;
import java.io.IOException;
import java.io.InputStream;
+import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.IStatus;
@@ -21,6 +22,7 @@ import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.core.runtime.content.IContentTypeManager;
+import org.eclipse.team.core.*;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.Team;
import org.eclipse.team.core.TeamException;
@@ -136,5 +138,28 @@ final public class TeamPlugin extends Plugin {
}
}
}
+
+ public static RepositoryProviderType getAliasType(String id) {
+ TeamPlugin plugin = TeamPlugin.getPlugin();
+ if (plugin != null) {
+ IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(TeamPlugin.REPOSITORY_EXTENSION);
+ if (extension != null) {
+ IExtension[] extensions = extension.getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
+ for (int j = 0; j < configElements.length; j++) {
+ String aliasId = configElements[j].getAttribute("canImportId"); //$NON-NLS-1$
+ if (aliasId != null && aliasId.equals(id)) {
+ String extensionId = configElements[j].getAttribute("id"); //$NON-NLS-1$
+ if (extensionId != null) {
+ return RepositoryProviderType.getProviderType(extensionId);
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
index 74f0359fd..0267c5d9f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
@@ -148,6 +148,8 @@ ProjectSetExportWizard.An_error_occurred_creating_the_target_directory_7=An erro
ProjectSetExportWizard.Question_8=Question
ProjectSetExportWizard.Target_already_exists._Would_you_like_to_overwrite_it__9=Target already exists. Would you like to overwrite it?
ProjectSetImportWizard.Project_Set_1=Team Project Set
+ProjectSetImportWizard.0=Projects for repository type {0} could not be loaded as the type could not be found.
+ProjectSetImportWizard.1=The following errors occurred while importing projects. Some projects may not be loaded.
ProjectSetImportWizard.Import_a_Project_Set_3=Import a Team Project Set
ProjectSetImportWizard.workingSetExistsTitle=Working Set Exists
ProjectSetImportWizard.workingSetExistsMessage=Working set ''{0}'' already exists. Overwrite?
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
index d8fa19946..fd28c79d4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
@@ -17,12 +17,13 @@ import java.util.*;
import javax.xml.parsers.*;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.*;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.team.core.*;
+import org.eclipse.team.internal.core.TeamPlugin;
import org.eclipse.team.internal.ui.*;
import org.eclipse.ui.*;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -82,17 +83,41 @@ public class ProjectSetImportWizard extends Wizard implements IImportWizard {
} else {
UIProjectSetSerializationContext context = new UIProjectSetSerializationContext(getShell(), filename);
Iterator it = map.keySet().iterator();
+ List errors = new ArrayList();
while (it.hasNext()) {
- String id = (String)it.next();
- List references = (List)map.get(id);
- RepositoryProviderType providerType = RepositoryProviderType.getProviderType(id);
- ProjectSetCapability serializer = providerType.getProjectSetCapability();
- ProjectSetCapability.ensureBackwardsCompatible(providerType, serializer);
- if (serializer != null) {
- IProject[] projects = serializer.addToWorkspace((String[])references.toArray(new String[references.size()]), context, monitor);
- if (projects != null)
- newProjects.addAll(Arrays.asList(projects));
- }
+ try {
+ String id = (String)it.next();
+ List references = (List)map.get(id);
+ RepositoryProviderType providerType = RepositoryProviderType.getProviderType(id);
+ if (providerType == null) {
+ // The provider type is absent. Perhaps there is another provider that can import this type
+ providerType = TeamPlugin.getAliasType(id);
+ }
+ if (providerType == null) {
+ throw new TeamException(new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, Policy.bind("ProjectSetImportWizard.0", id), null)); //$NON-NLS-1$
+ }
+ ProjectSetCapability serializer = providerType.getProjectSetCapability();
+ ProjectSetCapability.ensureBackwardsCompatible(providerType, serializer);
+ if (serializer != null) {
+ IProject[] projects = serializer.addToWorkspace((String[])references.toArray(new String[references.size()]), context, monitor);
+ if (projects != null)
+ newProjects.addAll(Arrays.asList(projects));
+ }
+ } catch (TeamException e) {
+ errors.add(e);
+ }
+ }
+ if (!errors.isEmpty()) {
+ if (errors.size() == 1) {
+ throw (TeamException)errors.get(0);
+ } else {
+ TeamException[] exceptions = (TeamException[]) errors.toArray(new TeamException[errors.size()]);
+ IStatus[] status = new IStatus[exceptions.length];
+ for (int i = 0; i < exceptions.length; i++) {
+ status[i] = exceptions[i].getStatus();
+ }
+ throw new TeamException(new MultiStatus(TeamUIPlugin.ID, 0, status, Policy.bind("ProjectSetImportWizard.1"), null)); //$NON-NLS-1$
+ }
}
}
if (workingSetName != null)

Back to the top