"Open SQL Table View" actiun (right mouse click in editor on table fragment-string)
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / ShowExternalPreviewAction.java
index 9b53e0e..13fc4dd 100644 (file)
@@ -35,7 +35,8 @@ public class ShowExternalPreviewAction extends TextEditorAction {
     super(PHPEditorMessages.getResourceBundle(), "ParserAction.", null); //$NON-NLS-1$
     update();
   }
-  public static ShowExternalPreviewAction getInstance() {
+  
+public static ShowExternalPreviewAction getInstance() {
     return instance;
   }
   /**
@@ -68,6 +69,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);
       }