Refactory: removed unnecessary local variables and imports.
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpeclipse / ui / editor / BrowserUtil.java
index 0282fd9..fa3be6f 100644 (file)
@@ -32,11 +32,11 @@ public class BrowserUtil {
 
        public static ShowInContextBrowser getShowInContext(IFile previewFile,
                        boolean forceDBGPreview, String postFix) {
-               String extension = previewFile.getFileExtension().toLowerCase();
+               //String extension = previewFile.getFileExtension().toLowerCase();
                // boolean showHTMLFilesLocal = false;
                // boolean showXMLFilesLocal = false;
-               boolean isHTMLFileName = false;
-               boolean isXMLFileName = false;
+//             boolean isHTMLFileName = false;
+//             boolean isXMLFileName = false;
                String localhostURL;
                if (!forceDBGPreview) {
                        // showHTMLFilesLocal =
@@ -45,10 +45,10 @@ public class BrowserUtil {
                        // showXMLFilesLocal =
                        // ProjectPrefUtil.getPreviewBooleanValue(previewFile,
                        // IPreferenceConstants.PHP_SHOW_XML_FILES_LOCAL);
-                       isHTMLFileName = "html".equals(extension)
-                                       || "htm".equals(extension) || "xhtml".equals(extension);
-                       isXMLFileName = "xml".equals(extension) || "xsd".equals(extension)
-                                       || "dtd".equals(extension);
+//                     isHTMLFileName = "html".equals(extension)
+//                                     || "htm".equals(extension) || "xhtml".equals(extension);
+//                     isXMLFileName = "xml".equals(extension) || "xsd".equals(extension)
+//                                     || "dtd".equals(extension);
                }
                // if (showHTMLFilesLocal && isHTMLFileName) {
                // localhostURL = previewFile.getLocation().toString();
@@ -157,8 +157,17 @@ public class BrowserUtil {
                                        }
                                        if (view != null) {
                                                IShowInTarget target = getShowInTarget(view);
-                                               if (target != null && target.show(context)) {
-                                                       // success
+                                               boolean stickyBrowserURL = ProjectPrefUtil.getPreviewBooleanValue(
+                                                               previewFile,
+                                                               IPreferenceConstants.PHP_STICKY_BROWSER_URL_DEFAULT);
+                                               if (target != null) {
+                                                       if (stickyBrowserURL
+                                                                       && ((BrowserView) target).getUrl() != null
+                                                                       && ((BrowserView) target).getUrl().length() > 0) {
+                                                               ((BrowserView) target).refresh();
+                                                       } else {
+                                                               target.show(context);
+                                                       }
                                                }
                                                ((WorkbenchPage) page)
                                                                .performedShowIn(BrowserView.ID_BROWSER);