show HTML files as local resources (no 'http://' url prefix)
authorkhartlage <khartlage>
Sun, 4 Jul 2004 17:56:49 +0000 (17:56 +0000)
committerkhartlage <khartlage>
Sun, 4 Jul 2004 17:56:49 +0000 (17:56 +0000)
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/PHPUiImages.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/ShowExternalPreviewAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPPreferencesMessages.properties
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPPreviewProjectPreferences.java

index ee12ab3..fec960b 100644 (file)
@@ -135,7 +135,7 @@ public class PHPUiImages {
        public static final String IMG_OBJS_INTERFACE= NAME_PREFIX + "int_obj.gif";                     //$NON-NLS-1$
        public static final String IMG_OBJS_INTERFACEALT= NAME_PREFIX + "intf_obj.gif";                         //$NON-NLS-1$   
        public static final String IMG_OBJS_INTERFACE_DEFAULT= NAME_PREFIX + "int_default_obj.gif";             //$NON-NLS-1$
-       public static final String IMG_OBJS_CUNIT= NAME_PREFIX + "jcu_obj.gif";                                 //$NON-NLS-1$
+       public static final String IMG_OBJS_CUNIT= NAME_PREFIX + "phpedit.gif";                                 //$NON-NLS-1$
        public static final String IMG_OBJS_CUNIT_RESOURCE= NAME_PREFIX + "jcu_resource_obj.gif";                               //$NON-NLS-1$
        public static final String IMG_OBJS_CFILE= NAME_PREFIX + "classf_obj.gif";                      //$NON-NLS-1$
        public static final String IMG_OBJS_CFILECLASS= NAME_PREFIX + "class_obj.gif";                  //$NON-NLS-1$
index 66ceacd..33497bd 100644 (file)
@@ -217,4 +217,5 @@ public interface IPreferenceConstants {
   
   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_SHOW_HTML_FILES_LOCAL = "_show_html_files_local";
 }
\ No newline at end of file
index a9cb199..ebc134d 100644 (file)
@@ -645,7 +645,8 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
 
     store.setDefault(PHP_AUTO_PREVIEW_DEFAULT, "true");
     store.setDefault(PHP_BRING_TO_TOP_PREVIEW_DEFAULT, "true");
-
+    store.setDefault(PHP_SHOW_HTML_FILES_LOCAL, "true");
+    
     String windowsSystem = Platform.getWS();
     if (jvm == WINDOWS_9x) {
       store.setDefault(EXTERNAL_BROWSER_PREF,
index e76037f..e2e76d2 100644 (file)
@@ -8,6 +8,7 @@ package net.sourceforge.phpeclipse.phpeditor;
  * Contributors: IBM Corporation - Initial implementation Klaus Hartlage -
  * www.eclipseproject.de
  ******************************************************************************/
+import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
 import net.sourceforge.phpeclipse.IPreferenceConstants;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 import net.sourceforge.phpeclipse.actions.PHPEclipseShowAction;
@@ -44,19 +45,25 @@ public static ShowExternalPreviewAction getInstance() {
    * Code called when the action is fired.
    */
   public void run() {
-    IFile fileToParse = getFile();
-    if (fileToParse == null) {
+    IFile previewFile = getFile();
+    if (previewFile == null) {
       // should never happen
       return;
     }
-    boolean autoPreview = Util.getPreviewBooleanValue(fileToParse,
+    boolean autoPreview = Util.getPreviewBooleanValue(previewFile,
         IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT);
-    boolean bringToTopPreview = Util.getPreviewBooleanValue(fileToParse,
+    boolean bringToTopPreview = Util.getPreviewBooleanValue(previewFile,
         IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT);
-    if (autoPreview) {
+    boolean showHTMLFilesLocal = Util.getPreviewBooleanValue(previewFile,
+        IPreferenceConstants.PHP_SHOW_HTML_FILES_LOCAL);
+    boolean isPHPFileName = PHPFileUtil.isPHPFileName(previewFile.getLocation().toString());
+    
+    if (autoPreview) { 
       String localhostURL;
-      if ((localhostURL = PHPEclipseShowAction.getLocalhostURL(null,
-          fileToParse)) == null) {
+      if (showHTMLFilesLocal && (!isPHPFileName)) {  
+        localhostURL = previewFile.getLocation().toString();
+      } else if ((localhostURL = PHPEclipseShowAction.getLocalhostURL(null,
+          previewFile)) == null) {
         return;
       }
       IWorkbenchPage page = PHPeclipsePlugin.getActivePage();
@@ -76,6 +83,7 @@ public static ShowExternalPreviewAction getInstance() {
       }
     }
   }
+  
   public void refresh() {
     IFile fileToParse = getFile();
     if (fileToParse == null) {
index cea46e0..1157f93 100644 (file)
@@ -20,6 +20,7 @@ PHPMiscProjectPreferences.obfuscator=Obfuscator directory:
 
 PHPPreviewProjectPreferences.auto_preview=Refresh PHP browser view when opening editor
 PHPPreviewProjectPreferences.bring_to_top_preview=Show PHP browser view when opening editor
+PHPPreviewProjectPreferences.show_html_files_local=Show HTML files as local resources (no 'http://' url)
 
 #########################################
 # Preference Pages
index b80ce3f..26f9d55 100644 (file)
@@ -43,6 +43,9 @@ public class PHPPreviewProjectPreferences extends FieldEditorOverlayPage
     addField(new BooleanFieldEditor(
         IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT, PHPPreferencesMessages
             .getString("PHPPreviewProjectPreferences.bring_to_top_preview"), composite));
+    addField(new BooleanFieldEditor(
+        IPreferenceConstants.PHP_SHOW_HTML_FILES_LOCAL, PHPPreferencesMessages
+            .getString("PHPPreviewProjectPreferences.show_html_files_local"), composite));
     //if (!isPropertyPage)) {
     //  
     //}