Commiting more changes to fix RSE issues with PHP projects.
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpeclipse / ui / editor / ShowExternalPreviewAction.java
index 5fb9670..2679fb4 100644 (file)
@@ -146,12 +146,14 @@ public class ShowExternalPreviewAction extends TextEditorAction {
                                store = WebUI.getDefault().getPreferenceStore();
                        }
                        // IPath path = file.getFullPath();
-                       String localhostURL = file.getLocation().toString();
+                       String localhostURL = file.getFullPath().toString();
                        String lowerCaseFileName = localhostURL.toLowerCase();
+                       //removed by ed_mann for RSE fixes testing
                        // String documentRoot =
                        // store.getString(PHPeclipsePlugin.DOCUMENTROOT_PREF);
-                       IPath documentRootPath = ProjectPrefUtil.getDocumentRoot(file
-                                       .getProject());
+                       //IPath documentRootPath = ProjectPrefUtil.getDocumentRoot(file
+                       //              .getProject());
+                       IPath documentRootPath = file.getProject().getFullPath();
                        String documentRoot = documentRootPath.toString().toLowerCase();
                        if (lowerCaseFileName.startsWith(documentRoot)) {
                                localhostURL = localhostURL.substring(documentRoot.length());
@@ -160,9 +162,12 @@ public class ShowExternalPreviewAction extends TextEditorAction {
                        }
                        // return store.getString(PHPeclipsePlugin.LOCALHOST_PREF) +
                        // localhostURL;
-                       return ProjectPrefUtil.getMiscProjectsPreferenceValue(file
-                                       .getProject(), IPreferenceConstants.PHP_LOCALHOST_PREF)
-                                       + localhostURL;
+                       String projectPath = ProjectPrefUtil.getMiscProjectsPreferenceValue(file
+                    .getProject(), IPreferenceConstants.PHP_LOCALHOST_PREF);
+                       if(projectPath.endsWith("/") && localhostURL.startsWith("/")) {
+                           localhostURL = localhostURL.substring(1);
+                       }
+                       return projectPath + localhostURL;
                }
                return "http://localhost";
        }