1 package net.sourceforge.phpeclipse.xdebug.core;
3 //import java.net.MalformedURLException;
6 import org.eclipse.core.runtime.IPath;
7 import org.eclipse.core.runtime.Path;
9 public class PathMapItem {
13 // String.split() uses regular expressions
14 static final String DELIMITER_REGEX = "\\+\\*\\+";
15 static final String DELIMITER = "+*+";
17 static private String MakeStringData(IPath local, IPath remote) {
18 //IPath b = new Path("file:/var/www/index.php");
20 if(local.getDevice() == "file://") {
21 local = local.setDevice("");
23 String data = local.toString()+DELIMITER+remote.toString();
27 public PathMapItem(String newLocal, String newRemote) {
28 IPath localPath = sanitizePath(newLocal);
29 IPath remotePath = sanitizePath(newRemote);
34 private IPath sanitizePath(String newPath) {
35 IPath sanitizePath = null;
36 IPath computePath = new Path(newPath);
37 /*if(computePath.getDevice() == null) {
38 sanitizePath = new Path("file://", newPath);
40 if(computePath.getDevice() == "file:") {
41 sanitizePath = computePath;
43 sanitizePath = computePath;
49 public PathMapItem(String data) {
50 String[] strData = data.split(DELIMITER_REGEX);
51 IPath localPath = sanitizePath(strData[0]);
52 IPath remotePath = sanitizePath(strData[1]);
57 public String getStringData() {
58 return PathMapItem.MakeStringData(local, remote);
62 * Returns the local path, which serves as the key in the local/remote
63 * pair this variable represents
67 public IPath getLocalPath() {
68 return new Path(local.toString());
72 * Returns the remote path.
76 public IPath getRemotePath() {
77 return new Path(remote.toString());
83 * @throws MalformedURLException
85 public void setLocalPath(String path) {
86 this.local = sanitizePath(path);
93 public void setLocalPath(IPath path) {
98 * Sets the remote path
101 public void setRemotePath(IPath path) {
106 * Sets the remote path
108 * @throws MalformedURLException
110 public void setRemotePath(String path) {
111 this.remote = sanitizePath(path);
115 * @see java.lang.Object#toString()
117 public String toString() {
118 return local.toString()+"->"+remote.toString();
122 * @see java.lang.Object#equals(java.lang.Object)
124 public boolean equals(Object obj) {
125 boolean equal = false;
126 if (obj instanceof PathMapItem) {
127 PathMapItem var = (PathMapItem) obj;
128 equal = var.getLocalPath().equals(local);