public void setActivePart(IAction action, IWorkbenchPart targetPart) {
workbenchPart = targetPart;
}
-
-// public static void open(final URL url, final Shell shell, final String dialogTitle) {
-// IHelp help= WorkbenchHelp.getHelpSupport();
-// if (help != null) {
-// WorkbenchHelp.getHelpSupport().displayHelpResource(url.toExternalForm());
-// } else {
-// showMessage(shell, dialogTitle, ActionMessages.getString("OpenBrowserUtil.help_not_available"), false); //$NON-NLS-1$
-// }
-// }
-
+
+ // public static void open(final URL url, final Shell shell, final String dialogTitle) {
+ // IHelp help= WorkbenchHelp.getHelpSupport();
+ // if (help != null) {
+ // WorkbenchHelp.getHelpSupport().displayHelpResource(url.toExternalForm());
+ // } else {
+ // showMessage(shell, dialogTitle, ActionMessages.getString("OpenBrowserUtil.help_not_available"), false); //$NON-NLS-1$
+ // }
+ // }
+
public void run(IAction action) {
ISelectionProvider selectionProvider = null;
selectionProvider = workbenchPart.getSite().getSelectionProvider();
// }
String fileName = file.getLocation().toString();
+ String lowerCaseFileName = fileName.toLowerCase();
// fileName = "http://localhost"+fileName.replaceAll("c:", "");
- fileName = store.getString(PHPeclipsePlugin.LOCALHOST_PREF) + fileName.replaceAll("C:", "");
+ String documentRoot = store.getString(PHPeclipsePlugin.DOCUMENTROOT_PREF);
+ documentRoot = documentRoot.replace('\\', '/');
+ documentRoot = documentRoot.toLowerCase();
+ MessageDialog.openInformation(shell, "lowerCaseFileName", "lowerCaseFileName: " + lowerCaseFileName);
+
+ if ( lowerCaseFileName.startsWith(documentRoot) ) {
+ fileName = fileName.substring(documentRoot.length());
+ } else {
+ MessageDialog.openInformation(shell, "Wrong DocumentRoot", "Adjust DocumentRoot: " + documentRoot);
+ return;
+ }
+
+ fileName = store.getString(PHPeclipsePlugin.LOCALHOST_PREF) + fileName.replaceAll(documentRoot, "");
try {
if (store.getBoolean(PHPeclipsePlugin.USE_EXTERNAL_BROWSER_PREF)) {
}
}
} /**
- * @see IActionDelegate#selectionChanged(IAction, ISelection)
- */
+ * @see IActionDelegate#selectionChanged(IAction, ISelection)
+ */
public void selectionChanged(IAction action, ISelection selection) {
}