public static final String PHP_AUTO_PREVIEW_DEFAULT = "_auto_preview";
public static final String PHP_BRING_TO_TOP_PREVIEW_DEFAULT = "_bring_to_top_preview";
+
+ public static final String PHP_STICKY_BROWSER_URL_DEFAULT = "_sticky_browser_url";
// public static final String PHP_SHOW_HTML_FILES_LOCAL =
// "_show_html_files_local";
// public static final String PHP_SHOW_XML_FILES_LOCAL =
* Contributors:
* Christopher Lenz - initial implementation
*
- * $Id: WebUI.java,v 1.10 2007-08-23 06:42:09 toshihiro Exp $
+ * $Id: WebUI.java,v 1.11 2007-11-08 01:37:06 scorphus Exp $
*/
package net.sourceforge.phpeclipse.ui;
store.setDefault(PHP_AUTO_PREVIEW_DEFAULT, "false");
store.setDefault(PHP_BRING_TO_TOP_PREVIEW_DEFAULT, "false");
+ store.setDefault(PHP_STICKY_BROWSER_URL_DEFAULT, "false");
// store.setDefault(PHP_SHOW_HTML_FILES_LOCAL, "true");
// store.setDefault(PHP_SHOW_XML_FILES_LOCAL, "false");
}
}
if (view != null) {
IShowInTarget target = getShowInTarget(view);
- if (target != null && target.show(context)) {
- // success
+ boolean stickyBrowserURL = ProjectPrefUtil.getPreviewBooleanValue(
+ previewFile,
+ IPreferenceConstants.PHP_STICKY_BROWSER_URL_DEFAULT);
+ if (target != null) {
+ if (stickyBrowserURL
+ && ((BrowserView) target).getUrl() != null
+ && ((BrowserView) target).getUrl().length() > 0) {
+ ((BrowserView) target).refresh();
+ } else {
+ target.show(context);
+ }
}
((WorkbenchPage) page)
.performedShowIn(BrowserView.ID_BROWSER);
boolean bringToTopPreview = ProjectPrefUtil.getPreviewBooleanValue(
previewFile,
IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT);
+ boolean stickyBrowserURL = ProjectPrefUtil.getPreviewBooleanValue(
+ previewFile,
+ IPreferenceConstants.PHP_STICKY_BROWSER_URL_DEFAULT);
if (autoPreview) {
IWorkbenchPage page = WebUI.getActivePage();
}.schedule();
}
// ((BrowserView) part).refresh();
- String localhostURL = getLocalhostURL(null, previewFile);
- ((BrowserView) part).refresh(localhostURL);
+ if (stickyBrowserURL
+ && ((BrowserView) part).getUrl() != null
+ && ((BrowserView) part).getUrl().length() > 0) {
+ ((BrowserView) part).refresh();
+ } else {
+ String localhostURL = getLocalhostURL(null, previewFile);
+ ((BrowserView) part).refresh(localhostURL);
+ }
}
} catch (PartInitException e) {
// ad hoc
PHPPreviewProjectPreferences.auto_preview=Refresh PHP browser view when opening editor
PHPPreviewProjectPreferences.bring_to_top_preview=Show PHP browser view when opening editor
+PHPPreviewProjectPreferences.sticky_browser_url=Make PHP browser view URL sticky
PHPPreviewProjectPreferences.show_html_files_local=Show HTML files as local resources (no 'http://' url)
PHPPreviewProjectPreferences.show_xml_files_local=Show XML files as local resources (no 'http://' url)
PHPPreferencesMessages
.getString("PHPPreviewProjectPreferences.bring_to_top_preview"),
composite));
+ addField(new BooleanFieldEditor(
+ IPreferenceConstants.PHP_STICKY_BROWSER_URL_DEFAULT,
+ PHPPreferencesMessages
+ .getString("PHPPreviewProjectPreferences.sticky_browser_url"),
+ composite));
// addField(new BooleanFieldEditor(
// IPreferenceConstants.PHP_SHOW_HTML_FILES_LOCAL,
// PHPPreferencesMessages
super.dispose();
}
+ public String getUrl() {
+ if (fInstance != null) {
+ return fInstance.getURL();
+ } else {
+ return null;
+ }
+ }
+
public void setUrl(final String url) {
- if (fInstance != null) {
- if (fInstance.getURL() != null && fInstance.getURL().length() > 0) {
- fUrl = fInstance.getURL();
- fInstance.setURL(fUrl);
- } else {
- fUrl = url;
- fInstance.setURL(url);
- }
+ if (fInstance != null) {
+ fUrl = url;
+ fInstance.setURL(url);
// try {
// ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
// public void run(IProgressMonitor monitor) throws CoreException {