IFile previewFile = getFile();
BrowserUtil.showPreview(previewFile, false, "");
}
-
+
public void refresh(int type) {
IFile fileToParse = getFile();
if (fileToParse == null) {
}
public static String getLocalhostURL(IPreferenceStore store, IFile file) {
- if (store == null) {
- store = WebUI.getDefault().getPreferenceStore();
- }
- // IPath path = file.getFullPath();
- String localhostURL = file.getLocation().toString();
- String lowerCaseFileName = localhostURL.toLowerCase();
- // String documentRoot = store.getString(PHPeclipsePlugin.DOCUMENTROOT_PREF);
- IPath documentRootPath = ProjectPrefUtil.getDocumentRoot(file.getProject());
- String documentRoot = documentRootPath.toString().toLowerCase();
- if (lowerCaseFileName.startsWith(documentRoot)) {
- localhostURL = localhostURL.substring(documentRoot.length());
- } else {
- return null;
+ if (file != null) {
+ if (store == null) {
+ store = WebUI.getDefault().getPreferenceStore();
+ }
+ // IPath path = file.getFullPath();
+ String localhostURL = file.getLocation().toString();
+ String lowerCaseFileName = localhostURL.toLowerCase();
+ // String documentRoot = store.getString(PHPeclipsePlugin.DOCUMENTROOT_PREF);
+ IPath documentRootPath = ProjectPrefUtil.getDocumentRoot(file.getProject());
+ String documentRoot = documentRootPath.toString().toLowerCase();
+ if (lowerCaseFileName.startsWith(documentRoot)) {
+ localhostURL = localhostURL.substring(documentRoot.length());
+ } else {
+ return null;
+ }
+ // return store.getString(PHPeclipsePlugin.LOCALHOST_PREF) + localhostURL;
+ return ProjectPrefUtil.getMiscProjectsPreferenceValue(file.getProject(), IPreferenceConstants.PHP_LOCALHOST_PREF)
+ + localhostURL;
}
- // return store.getString(PHPeclipsePlugin.LOCALHOST_PREF) + localhostURL;
- return ProjectPrefUtil.getMiscProjectsPreferenceValue(file.getProject(), IPreferenceConstants.PHP_LOCALHOST_PREF)
- + localhostURL;
+ return "http://localhost";
}
}
\ No newline at end of file