*/
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();
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;
}
page.bringToTop(part);
}
}
- ((BrowserView) part).refresh();
-
+ if (part != null) {
+ ((BrowserView) part).refresh();
+ }
} catch (Exception e) {
// PHPeclipsePlugin.log(e);
}