Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Macguire2002-05-14 02:29:37 +0000
committerKevin Macguire2002-05-14 02:29:37 +0000
commita1f77febecd0c282625a8fbb1a2c232eaaca8f47 (patch)
tree6d96846cda3538483006e0e825b69d2942cade28 /bundles
parent6b4380ba899474648f6d3adaad0b519ede66cafb (diff)
downloadeclipse.platform.team-a1f77febecd0c282625a8fbb1a2c232eaaca8f47.tar.gz
eclipse.platform.team-a1f77febecd0c282625a8fbb1a2c232eaaca8f47.tar.xz
eclipse.platform.team-a1f77febecd0c282625a8fbb1a2c232eaaca8f47.zip
*** empty log message ***
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/ISiteFactory.java (renamed from bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/ILocationFactory.java)14
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/Site.java (renamed from bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetLocation.java)14
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetManager.java62
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetProvider.java24
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java15
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java14
6 files changed, 72 insertions, 71 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/ILocationFactory.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/ISiteFactory.java
index 7fd898c34..6abe85e99 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/ILocationFactory.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/ISiteFactory.java
@@ -12,25 +12,25 @@ package org.eclipse.team.core.target;
import java.util.Properties;
-public interface ILocationFactory {
+public interface ISiteFactory {
/**
- * Returns a new target location for the given target specific
+ * Returns a new target site for the given target specific
* description.
*
* @param description the target specific description encoded
* as a string
- * @return a new target location
+ * @return a new target site
*/
- public TargetLocation newLocation(String description);
+ public Site newSite(String description);
/**
- * Returns a new target location for the given target specific
+ * Returns a new target site for the given target specific
* properties.
*
* @param properties the target specific location encoded
* in properties
- * @return a new target location
+ * @return a new target site
*/
- public TargetLocation newLocation(Properties properties);
+ public Site newSite(Properties properties);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetLocation.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/Site.java
index aa8d2686e..3e1f7f39a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetLocation.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/Site.java
@@ -3,17 +3,17 @@ package org.eclipse.team.core.target;
import org.eclipse.core.runtime.IPath;
import org.eclipse.team.core.TeamException;
-public abstract class TargetLocation {
+public abstract class Site {
/*
- * Initialize a new TargetLocation of the given type.
+ * Initialize a new Site of the given type.
*/
- public TargetLocation() {
+ public Site() {
super();
}
- public abstract TargetProvider newProvider(IPath path) throws TeamException;
+ public abstract TargetProvider newProvider(IPath intrasitePath) throws TeamException;
public abstract String getType();
@@ -23,13 +23,15 @@ public abstract class TargetLocation {
public abstract String encode();
+ public abstract IPath getPath();
+
/**
* @see Object#equals(Object)
*/
public boolean equals(Object other) {
if(this == other) return true;
- if(! (other instanceof TargetLocation)) return false;
- TargetLocation location = (TargetLocation)other;
+ if(! (other instanceof Site)) return false;
+ Site location = (Site)other;
return getType().equals(location.getType()) &&
getUniqueIdentifier().equals(location.getUniqueIdentifier());
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetManager.java
index fef56c711..b0acfba2a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetManager.java
@@ -29,40 +29,40 @@ import org.eclipse.team.internal.core.Policy;
import org.eclipse.team.internal.core.target.LocationMapping;
public class TargetManager {
- private static final String TARGET_LOCATIONS_FILE = ".targetLocations";
+ private static final String TARGET_SITES_FILE = ".targetSites";
private static QualifiedName TARGET_MAPPINGS =
new QualifiedName("org.eclipse.team.core.target", "mappings");
private static Map factories = new Hashtable();
- private static List locations = new ArrayList();
+ private static List sites = new ArrayList();
public static void startup() {
ResourcesPlugin.getWorkspace().getSynchronizer().add(TARGET_MAPPINGS);
readLocations();
}
- public static TargetLocation[] getLocations() {
- return (TargetLocation[]) locations.toArray(
- new TargetLocation[locations.size()]);
+ public static Site[] getSites() {
+ return (Site[]) sites.toArray(
+ new Site[sites.size()]);
}
- public static void addLocation(TargetLocation location) {
- locations.add(location);
+ public static void addSite(Site site) {
+ sites.add(site);
save();
}
/**
* @see TargetProvider#map(IProject)
*/
- public static void map(IProject project, TargetLocation location, IPath path) throws TeamException {
+ public static void map(IProject project, Site site, IPath path) throws TeamException {
try {
ISynchronizer s = ResourcesPlugin.getWorkspace().getSynchronizer();
byte[] mappingBytes = s.getSyncInfo(TARGET_MAPPINGS, project);
if (mappingBytes != null) {
throw new TeamException("Problems mapping project. Project is already mapped.", null);
}
- LocationMapping mapping = new LocationMapping(location, path);
+ LocationMapping mapping = new LocationMapping(site, path);
s.setSyncInfo(
TARGET_MAPPINGS,
project,
@@ -101,10 +101,10 @@ public class TargetManager {
return null;
} else {
LocationMapping mapping = new LocationMapping(mappingBytes);
- TargetLocation location =
- getLocation(mapping.getType(), mapping.getLocationId());
- if (location != null) {
- return location.newProvider(mapping.getPath());
+ Site site =
+ getSite(mapping.getType(), mapping.getLocationId());
+ if (site != null) {
+ return site.newProvider(mapping.getPath());
}
}
return null;
@@ -115,9 +115,9 @@ public class TargetManager {
}
}
- public static TargetLocation getLocation(String type, String id) {
- for (Iterator it = locations.iterator(); it.hasNext();) {
- TargetLocation element = (TargetLocation) it.next();
+ public static Site getSite(String type, String id) {
+ for (Iterator it = sites.iterator(); it.hasNext();) {
+ Site element = (Site) it.next();
if (element.getType().equals(type)
&& element.getUniqueIdentifier().equals(id)) {
return element;
@@ -130,7 +130,7 @@ public class TargetManager {
// read saved locations list from disk, only if the file exists
IPath pluginStateLocation =
TeamPlugin.getPlugin().getStateLocation().append(
- TARGET_LOCATIONS_FILE);
+ TARGET_SITES_FILE);
File f = pluginStateLocation.toFile();
if (f.exists()) {
try {
@@ -146,9 +146,9 @@ public class TargetManager {
private static void writeLocations() {
// save repositories to disk
IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation();
- File tempFile = pluginStateLocation.append(TARGET_LOCATIONS_FILE + ".tmp").toFile(); //$NON-NLS-1$
+ File tempFile = pluginStateLocation.append(TARGET_SITES_FILE + ".tmp").toFile(); //$NON-NLS-1$
File stateFile =
- pluginStateLocation.append(TARGET_LOCATIONS_FILE).toFile();
+ pluginStateLocation.append(TARGET_SITES_FILE).toFile();
try {
DataOutputStream dos =
new DataOutputStream(new FileOutputStream(tempFile));
@@ -173,30 +173,30 @@ public class TargetManager {
int repoCount = dis.readInt();
for (int i = 0; i < repoCount; i++) {
String id = dis.readUTF();
- String locationData = dis.readUTF();
- ILocationFactory factory =
- (ILocationFactory) getLocationFactory(id);
+ String siteData = dis.readUTF();
+ ISiteFactory factory =
+ (ISiteFactory) getSiteFactory(id);
if (factory == null) {
//todo: log error
return;
}
- TargetLocation loc = factory.newLocation(locationData);
- locations.add(loc);
+ Site site = factory.newSite(siteData);
+ sites.add(site);
}
}
private static void writeLocations(DataOutputStream dos)
throws IOException {
- dos.writeInt(locations.size());
- Iterator iter = locations.iterator();
+ dos.writeInt(sites.size());
+ Iterator iter = sites.iterator();
while (iter.hasNext()) {
- TargetLocation loc = (TargetLocation) iter.next();
- dos.writeUTF(loc.getType());
- dos.writeUTF(loc.encode());
+ Site site = (Site) iter.next();
+ dos.writeUTF(site.getType());
+ dos.writeUTF(site.encode());
}
}
- public static ILocationFactory getLocationFactory(String id) {
+ public static ISiteFactory getSiteFactory(String id) {
TeamPlugin plugin = TeamPlugin.getPlugin();
if (plugin != null) {
IExtensionPoint extension =
@@ -211,7 +211,7 @@ public class TargetManager {
String extensionId = configElements[j].getAttribute("id"); //$NON-NLS-1$
if (extensionId != null && extensionId.equals(id)) {
try {
- return (ILocationFactory) configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
+ return (ISiteFactory) configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
} catch (CoreException e) {
TeamPlugin.log(e.getStatus());
return null;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetProvider.java
index 855cddcaa..a07fa512b 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetProvider.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/TargetProvider.java
@@ -2,16 +2,34 @@ package org.eclipse.team.core.target;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.team.core.TeamException;
public abstract class TargetProvider {
/**
- * Answers the location for this target.
+ * Answers the site which this target is associated with
* @return a printable string
*/
- public abstract TargetLocation getLocation();
+ public abstract Site getSite();
+
+ /**
+ * Answers the path describing the place within the site itself
+ * where the provider stores/retrieves to/from (ie. the target root).
+ * @return a printable string
+ */
+ public abstract IPath getIntrasitePath();
+
+ /**
+ * Answers the full path where the provider stores/retrieves to/from.
+ * The target root is the location + the intra site path.
+ * @return a printable string
+ */
+ public IPath getFullPath() {
+ return getSite().getPath().append(getIntrasitePath());
+ }
+
/**
* Updates the local resource to have the same content as the corresponding remote
@@ -55,6 +73,6 @@ public abstract class TargetProvider {
* @see Object#toString()
*/
public String toString() {
- return getLocation().toString();
+ return getFullPath().toString();
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java
index ae60f73ea..8b1aeba24 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/LocationMapping.java
@@ -8,7 +8,7 @@ import java.io.IOException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.team.core.target.TargetLocation;
+import org.eclipse.team.core.target.Site;
public class LocationMapping {
@@ -18,9 +18,9 @@ public class LocationMapping {
private String locationId;
private IPath path;
- public LocationMapping(TargetLocation location, IPath path) {
- this.type = location.getType();
- this.locationId = location.getUniqueIdentifier();
+ public LocationMapping(Site site, IPath path) {
+ this.type = site.getType();
+ this.locationId = site.getUniqueIdentifier();
this.path = path;
}
@@ -90,13 +90,6 @@ public class LocationMapping {
return path;
}
- /**
- * Sets the path.
- * @param path The path to set
- */
- public void setPath(IPath path) {
- this.path = path;
- }
public byte[] encode() throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java
index f4fbc22d9..92b08f845 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/target/ResourceState.java
@@ -16,7 +16,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.target.TargetLocation;
+import org.eclipse.team.core.target.Site;
/**
* This abstract class implements the state of a local and corresponding remote resource,
@@ -59,8 +59,6 @@ public abstract class ResourceState {
*/
protected IResource localResource;
- protected TargetLocation location;
-
protected QualifiedName stateKey;
protected IPath root;
@@ -77,7 +75,6 @@ public abstract class ResourceState {
this.stateKey = new QualifiedName(getType(), root.toString());
SynchronizedTargetProvider.getSynchronizer().add(stateKey);
this.localResource = localResource;
- this.location = location;
}
public abstract String getType();
@@ -440,15 +437,6 @@ public abstract class ResourceState {
}
/**
- * Gets the location.
- * @return Returns a TargetLocation
- */
- public TargetLocation getLocation() {
- return location;
- }
-
-
- /**
* Gets the root.
* @return Returns a IPath
*/

Back to the top