X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/ShowExternalPreviewAction.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/ShowExternalPreviewAction.java index 6bcfc33..776e992 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/ShowExternalPreviewAction.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/ShowExternalPreviewAction.java @@ -28,8 +28,11 @@ import org.eclipse.ui.texteditor.TextEditorAction; */ public class ShowExternalPreviewAction extends TextEditorAction { public final static int XML_TYPE = 1; + public final static int HTML_TYPE = 2; + public final static int SMARTY_TYPE = 3; + public final static int PHP_TYPE = 4; private static ShowExternalPreviewAction instance = new ShowExternalPreviewAction(); @@ -63,14 +66,16 @@ public class ShowExternalPreviewAction extends TextEditorAction { boolean autoPreview = Util.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT); boolean bringToTopPreview = Util.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT); boolean showHTMLFilesLocal = Util.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_SHOW_HTML_FILES_LOCAL); - boolean isHTMLFileName = "xml".equals(extension) - || "html".equals(extension) - || "htm".equals(extension) - || "xhtml".equals(extension); + boolean showXMLFilesLocal = Util.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_SHOW_XML_FILES_LOCAL); + boolean isHTMLFileName = "html".equals(extension) || "htm".equals(extension) || "xhtml".equals(extension); + boolean isXMLFileName = "xml".equals(extension) || "xsd".equals(extension) || "dtd".equals(extension); + if (autoPreview) { String localhostURL; if (showHTMLFilesLocal && isHTMLFileName) { localhostURL = previewFile.getLocation().toString(); + } else if (showXMLFilesLocal && isXMLFileName) { + localhostURL = previewFile.getLocation().toString(); } else if ((localhostURL = getLocalhostURL(null, previewFile)) == null) { return; } @@ -112,8 +117,9 @@ public class ShowExternalPreviewAction extends TextEditorAction { page.bringToTop(part); } } - ((BrowserView) part).refresh(); - + if (part != null) { + ((BrowserView) part).refresh(); + } } catch (Exception e) { // PHPeclipsePlugin.log(e); }