From: khartlage Date: Sat, 5 Jun 2004 10:43:32 +0000 (+0000) Subject: 3.x RC1 compatibility show and refresh browser preview X-Git-Url: http://secure.phpeclipse.com 3.x RC1 compatibility show and refresh browser preview --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java index 721a6a7..3c7861a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java @@ -1799,10 +1799,10 @@ public class PHPUnitEditor extends PHPEditor { //implements } else performSave(false, progressMonitor); } -// IAction a = ShowExternalPreviewAction.getInstance(); -// if (a != null) { -// a.run(); -// } + ShowExternalPreviewAction a = ShowExternalPreviewAction.getInstance(); + if (a != null) { + a.refresh(); + } } public boolean isSaveAsAllowed() { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/ShowExternalPreviewAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/ShowExternalPreviewAction.java index 9b53e0e..359084e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/ShowExternalPreviewAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/ShowExternalPreviewAction.java @@ -68,6 +68,35 @@ public class ShowExternalPreviewAction extends TextEditorAction { } } ((BrowserView) part).setUrl(localhostURL); + + } catch (PartInitException e) { + PHPeclipsePlugin.log(e); + } + } + } + public void refresh() { + IFile fileToParse = getFile(); + if (fileToParse == null) { + // should never happen + return; + } + boolean autoPreview = Util.getPreviewBooleanValue(fileToParse, + IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT); + boolean bringToTopPreview = Util.getPreviewBooleanValue(fileToParse, + IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT); + if (autoPreview) { + IWorkbenchPage page = PHPeclipsePlugin.getActivePage(); + try { + IViewPart part = page.findView(BrowserView.ID_BROWSER); + if (part == null) { + part = page.showView(BrowserView.ID_BROWSER); + } else { + if (bringToTopPreview) { + page.bringToTop(part); + } + } + ((BrowserView) part).refresh(); + } catch (PartInitException e) { PHPeclipsePlugin.log(e); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/views/browser/BrowserView.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/views/browser/BrowserView.java index a0a6023..ebc76fe 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/views/browser/BrowserView.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/views/browser/BrowserView.java @@ -48,4 +48,7 @@ public class BrowserView extends ViewPart { public void setUrl(String url) { instance.browser.setUrl(url); } + public void refresh() { + instance.browser.refresh(); + } }