Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2006-01-25 04:19:42 +0000
committerMichael Valenta2006-01-25 04:19:42 +0000
commita257d06325277ce52d0e8a322c875a2c77a907e1 (patch)
tree0c7843b7156c27928121971baf9c012025203a77
parent8922ee9432ec8e0b790e6ce53d609c5f07c7df4e (diff)
downloadeclipse.platform.team-a257d06325277ce52d0e8a322c875a2c77a907e1.tar.gz
eclipse.platform.team-a257d06325277ce52d0e8a322c875a2c77a907e1.tar.xz
eclipse.platform.team-a257d06325277ce52d0e8a322c875a2c77a907e1.zip
First cut at API to support URIs in project sets
-rw-r--r--bundles/org.eclipse.team.core/schema/repository.exsd7
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java46
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java61
-rw-r--r--bundles/org.eclipse.team.cvs.core/plugin.xml5
4 files changed, 115 insertions, 4 deletions
diff --git a/bundles/org.eclipse.team.core/schema/repository.exsd b/bundles/org.eclipse.team.core/schema/repository.exsd
index 39c13ae0a..771f4ef2b 100644
--- a/bundles/org.eclipse.team.core/schema/repository.exsd
+++ b/bundles/org.eclipse.team.core/schema/repository.exsd
@@ -82,6 +82,13 @@ A repository provider type can also specify one or more meta-file paths (delimit
</documentation>
</annotation>
</attribute>
+ <attribute name="fileSystemScheme" type="string">
+ <annotation>
+ <documentation>
+ This field identifies the scheme of a filesystem registered with the org.eclipse.core.filesystem.filesystems extension point
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
index 71040f6a5..98d9a18aa 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
@@ -12,7 +12,9 @@
package org.eclipse.team.core;
import java.io.File;
+import java.net.URI;
import java.util.*;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.core.Messages;
@@ -268,4 +270,48 @@ public abstract class ProjectSetCapability {
void setSerializer(IProjectSetSerializer serializer) {
this.serializer = serializer;
}
+
+ /**
+ * Return the URI for the given reference string or <code>null</code>
+ * if this capability does not support file system schemes as defined by
+ * the <code>org.eclipse.core.filesystem.filesystems</code> extension
+ * point.
+ * @see #getProject(String)
+ * @param referenceString a reference string obtained from
+ * {@link #asReference(IProject[], ProjectSetSerializationContext, IProgressMonitor)}
+ * @return the URI for the given reference string or <code>null</code>
+ * @since 3.2
+ */
+ public URI getURI(String referenceString) {
+ return null;
+ }
+
+ /**
+ * Return the name of the project that is the target of the given
+ * reference string or <code>null</code> if this capability does not
+ * support parsing of reference strings.
+ * @see #getURI(String)
+ * @param referenceString reference string obtained from
+ * {@link #asReference(IProject[], ProjectSetSerializationContext, IProgressMonitor)}
+ * @return the name of the project that is the target of the given
+ * reference string or <code>null</code>
+ * @since 3.2
+ */
+ public String getProject(String referenceString) {
+ return null;
+ }
+
+ /**
+ * Convert the given URI and projectName to a reference string that can be
+ * passed to the {@link #addToWorkspace(String[], ProjectSetSerializationContext, IProgressMonitor)}
+ * method. The scheme of the provided URI must match the scheme of the
+ * repository provider type from which this capability was obtained.
+ * @param uri the uri that identifies the location of the project in the repository.
+ * @param projectName the name of the project.
+ * @return the reference string representing a project that can be loaded into the workspace
+ * @since 3.2
+ */
+ public String asReference(URI uri, String projectName) {
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java
index d6709bf05..3350d991d 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java
@@ -10,8 +10,7 @@
*******************************************************************************/
package org.eclipse.team.core;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
@@ -60,6 +59,8 @@ public abstract class RepositoryProviderType {
private String id;
+ private String scheme;
+
public RepositoryProviderType() {
}
@@ -82,6 +83,43 @@ public abstract class RepositoryProviderType {
return newProviderType(id);
}
+ /**
+ * Return the repository type for the given file system scheme or
+ * <code>null</code> if there isn't one. The scheme corresponds to
+ * the scheme used for the <code>org.eclipse.core.filesystem.filesystems</code>
+ * extension point.
+ * @param scheme the file system scheme
+ * @return the repository type for the given file system scheme or
+ * <code>null</code>
+ * @since 3.2
+ */
+ public static RepositoryProviderType getTypeForScheme(String scheme) {
+ for (Iterator iter = allProviderTypes.values().iterator(); iter.hasNext();) {
+ RepositoryProviderType type = (RepositoryProviderType) iter.next();
+ if (type.getFileSystemScheme() != null && type.getFileSystemScheme().equals(scheme))
+ return type;
+ }
+ return findProviderForScheme(scheme);
+ }
+
+ private static RepositoryProviderType findProviderForScheme(String scheme) {
+ IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.ID, 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 extensionId = configElements[j].getAttribute("id"); //$NON-NLS-1$
+ String typeScheme = configElements[j].getAttribute("fileSystemScheme"); //$NON-NLS-1$
+ if (typeScheme != null && typeScheme.equals(scheme) && extensionId != null) {
+ return newProviderType(extensionId);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
private void setID(String id) {
this.id = id;
}
@@ -107,6 +145,8 @@ public abstract class RepositoryProviderType {
providerType.setID(id);
allProviderTypes.put(id, providerType);
+ String scheme = configElements[j].getAttribute("fileSystemScheme"); //$NON-NLS-1$
+ providerType.setFileSystemScheme(scheme);
return providerType;
} catch (CoreException e) {
TeamPlugin.log(e);
@@ -122,6 +162,10 @@ public abstract class RepositoryProviderType {
return null;
}
+ private void setFileSystemScheme(String scheme) {
+ this.scheme = scheme;
+ }
+
/**
* Answer the id of this provider type. The id will be the repository
* provider type's id as defined in the provider plugin's plugin.xml.
@@ -196,4 +240,17 @@ public abstract class RepositoryProviderType {
public Subscriber getSubscriber() {
return null;
}
+
+ /**
+ * Return the file system scheme for this provider type or
+ * <code>null</code> if the type doesn't support file systems
+ * as defined by the <code>org.eclipse.core.filesystem.filesystems</code>
+ * extension point.
+ * @return the file system scheme for this provider type or
+ * <code>null</code>
+ * @since 3.2
+ */
+ public final String getFileSystemScheme() {
+ return scheme;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.core/plugin.xml b/bundles/org.eclipse.team.cvs.core/plugin.xml
index df17660cb..2afc8d4ab 100644
--- a/bundles/org.eclipse.team.cvs.core/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.core/plugin.xml
@@ -39,10 +39,11 @@
<extension
point="org.eclipse.team.core.repository">
<repository
- typeClass="org.eclipse.team.internal.ccvs.core.CVSTeamProviderType"
class="org.eclipse.team.internal.ccvs.core.CVSTeamProvider"
+ fileSystemScheme="cvs"
+ id="org.eclipse.team.cvs.core.cvsnature"
metaFilePaths="CVS/Root,CVS/Repository"
- id="org.eclipse.team.cvs.core.cvsnature">
+ typeClass="org.eclipse.team.internal.ccvs.core.CVSTeamProviderType">
</repository>
</extension>
<!-- *************** Resource patterns ignored by CVS **************** -->

Back to the top