Workaround for feature request #1154254 (sticky browser URL) that solves bug #1827766...
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / internal / BrowserSearcher.java
index 7884159..6e6d30b 100644 (file)
@@ -1,11 +1,12 @@
 package net.sourceforge.phpeclipse.webbrowser.internal;
+
 /**********************************************************************
  * Copyright (c) 2003 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Common Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/cpl-v10.html
-  *
+ �*
  * Contributors:
  *    IBM - Initial API and implementation
  **********************************************************************/
@@ -23,11 +24,13 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.swt.widgets.DirectoryDialog;
 import org.eclipse.swt.widgets.Shell;
+
 /**
  * 
  */
 public class BrowserSearcher {
        private static boolean cancelled;
+
        private BrowserSearcher() {
                super();
        }
@@ -47,17 +50,17 @@ public class BrowserSearcher {
                String path = dialog.open();
                if (path == null)
                        return null;
-               
+
                cancelled = false;
-               
+
                final File rootDir = new File(path);
                ProgressMonitorDialog pm = new ProgressMonitorDialog(shell);
 
                IRunnableWithProgress r = new IRunnableWithProgress() {
                        public void run(IProgressMonitor monitor) {
-                               monitor.beginTask(
-                                       WebBrowserUIPlugin.getResource("%searchingTaskName"),
-                                       IProgressMonitor.UNKNOWN);
+                               monitor.beginTask(WebBrowserUIPlugin
+                                               .getResource("%searchingTaskName"),
+                                               IProgressMonitor.UNKNOWN);
                                search(rootDir, existingPaths, foundBrowsers, monitor);
                                monitor.done();
                                if (monitor.isCanceled())
@@ -68,23 +71,26 @@ public class BrowserSearcher {
                try {
                        pm.run(true, true, r);
                } catch (InvocationTargetException e) {
-                       Trace.trace(Trace.SEVERE, "Invocation Exception occured running monitor: " + e);
+                       Trace.trace(Trace.SEVERE,
+                                       "Invocation Exception occured running monitor: " + e);
                } catch (InterruptedException e) {
-                       Trace.trace(Trace.SEVERE, "Interrupted exception occured running monitor: " + e);
+                       Trace.trace(Trace.SEVERE,
+                                       "Interrupted exception occured running monitor: " + e);
                        return null;
                }
-               
+
                if (cancelled)
                        return null;
 
                return foundBrowsers;
        }
-       
+
        protected static void setCancelled(boolean b) {
                cancelled = b;
        }
 
-       protected static void search(File directory, List existingPaths, List foundBrowsers, IProgressMonitor monitor) {
+       protected static void search(File directory, List existingPaths,
+                       List foundBrowsers, IProgressMonitor monitor) {
                if (monitor.isCanceled())
                        return;
 
@@ -96,18 +102,20 @@ public class BrowserSearcher {
                                return;
 
                        File file = new File(directory, names[i]);
-                       
+
                        if (existingPaths.contains(file.getAbsolutePath().toLowerCase()))
                                continue;
 
-                       IExternalWebBrowserWorkingCopy wc = WebBrowserUtil.createExternalBrowser(file);
+                       IExternalWebBrowserWorkingCopy wc = WebBrowserUtil
+                                       .createExternalBrowser(file);
                        if (wc != null)
                                foundBrowsers.add(wc);
 
                        try {
-                               monitor.subTask(
-                                       MessageFormat.format(WebBrowserUIPlugin.getResource("%searching"),
-                                               new String[] { Integer.toString(foundBrowsers.size()), file.getCanonicalPath()}));
+                               monitor.subTask(MessageFormat.format(WebBrowserUIPlugin
+                                               .getResource("%searching"), new String[] {
+                                               Integer.toString(foundBrowsers.size()),
+                                               file.getCanonicalPath() }));
                        } catch (IOException ioe) {
                        }