Made all bundles require a Java 1.4 EE, and backported some classescode to Java 1.4
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / internal / WebBrowserPreference.java
index f8eea79..5c83893 100644 (file)
@@ -4,7 +4,7 @@
  * 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
  */
@@ -18,16 +18,21 @@ import java.util.StringTokenizer;
 
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.preference.IPreferenceStore;
+
 /**
  * Preferences for the Web browser.
  */
 public class WebBrowserPreference {
        protected static final String PREF_BROWSER_HISTORY = "webBrowserHistory";
+
        protected static final String PREF_INTERNAL_WEB_BROWSER_HISTORY = "internalWebBrowserHistory";
+
        protected static final String PREF_INTERNAL_WEB_BROWSER_FAVORITES = "internalWebBrowserFavorites";
+
        protected static final String PREF_INTERNAL_WEB_BROWSER_OLD_FAVORITES = "internalWebBrowserOldFavorites";
+
        protected static final String URL_PARAMETER = "%URL%";
-       
+
        /**
         * WebBrowserPreference constructor comment.
         */
@@ -43,7 +48,8 @@ public class WebBrowserPreference {
        public static String getHomePageURL() {
                try {
                        // get the default home page
-                       URL url = WebBrowserUIPlugin.getInstance().getBundle().getEntry("home/home.html");
+                       URL url = WebBrowserUIPlugin.getInstance().getBundle().getEntry(
+                                       "home/home.html");
                        url = Platform.resolve(url);
                        return url.toExternalForm();
                } catch (Exception e) {
@@ -53,20 +59,21 @@ public class WebBrowserPreference {
 
        /**
         * Returns the preference store.
-        *
+        * 
         * @return org.eclipse.jface.preference.IPreferenceStore
         */
        protected static IPreferenceStore getPreferenceStore() {
                return WebBrowserUIPlugin.getInstance().getPreferenceStore();
        }
-       
+
        /**
         * Returns the Web browser history list.
         * 
         * @return java.util.List
         */
        public static List getInternalWebBrowserHistory() {
-               String temp = getPreferenceStore().getString(PREF_INTERNAL_WEB_BROWSER_HISTORY);
+               String temp = getPreferenceStore().getString(
+                               PREF_INTERNAL_WEB_BROWSER_HISTORY);
                StringTokenizer st = new StringTokenizer(temp, "|*|");
                List l = new ArrayList();
                while (st.hasMoreTokens()) {
@@ -75,22 +82,23 @@ public class WebBrowserPreference {
                }
                return l;
        }
-       
+
        /**
         * Returns the Web browser favorites.
         * 
         * @return java.util.List
         */
        public static List getInternalWebBrowserFavorites() {
-               String temp = getPreferenceStore().getString(PREF_INTERNAL_WEB_BROWSER_FAVORITES);
+               String temp = getPreferenceStore().getString(
+                               PREF_INTERNAL_WEB_BROWSER_FAVORITES);
                StringTokenizer st = new StringTokenizer(temp, "|*|");
                List l = new ArrayList();
                try {
-                   while (st.hasMoreTokens()) {
-                           l.add(new Favorite(st.nextToken(), st.nextToken()));
-                   }
+                       while (st.hasMoreTokens()) {
+                               l.add(new Favorite(st.nextToken(), st.nextToken()));
+                       }
                } catch (Exception e) {
-                 // ignore 
+                       // ignore
                }
                return l;
        }
@@ -100,18 +108,18 @@ public class WebBrowserPreference {
         */
        public static void initializeDefaultPreferences() {
                IPreferenceStore store = getPreferenceStore();
-               
+
                String temp = store.getString(PREF_INTERNAL_WEB_BROWSER_OLD_FAVORITES);
                StringTokenizer st = new StringTokenizer(temp, "|*|");
                List def = new ArrayList();
                try {
-                   while (st.hasMoreTokens()) {
-                           def.add(new Favorite(st.nextToken(), st.nextToken()));
-                   }
-           } catch (Exception e) {
-             // ignore 
-           }
-               List list = getInternalWebBrowserFavorites(); 
+                       while (st.hasMoreTokens()) {
+                               def.add(new Favorite(st.nextToken(), st.nextToken()));
+                       }
+               } catch (Exception e) {
+                       // ignore
+               }
+               List list = getInternalWebBrowserFavorites();
                Iterator iterator = WebBrowserUtil.getUnlockedFavorites().iterator();
                while (iterator.hasNext()) {
                        Favorite f = (Favorite) iterator.next();
@@ -119,7 +127,7 @@ public class WebBrowserPreference {
                                list.add(f);
                }
                setInternalWebBrowserFavorites(list);
-               
+
                StringBuffer sb = new StringBuffer();
                iterator = WebBrowserUtil.getUnlockedFavorites().iterator();
                while (iterator.hasNext()) {
@@ -132,10 +140,10 @@ public class WebBrowserPreference {
                store.setValue(PREF_INTERNAL_WEB_BROWSER_OLD_FAVORITES, sb.toString());
                WebBrowserUIPlugin.getInstance().savePluginPreferences();
        }
-       
+
        /**
         * Sets the Web browser history.
-        *
+        * 
         * @param java.util.List
         */
        public static void setInternalWebBrowserHistory(List list) {
@@ -148,13 +156,14 @@ public class WebBrowserPreference {
                                sb.append("|*|");
                        }
                }
-               getPreferenceStore().setValue(PREF_INTERNAL_WEB_BROWSER_HISTORY, sb.toString());
+               getPreferenceStore().setValue(PREF_INTERNAL_WEB_BROWSER_HISTORY,
+                               sb.toString());
                WebBrowserUIPlugin.getInstance().savePluginPreferences();
        }
-       
+
        /**
         * Sets the Web browser favorites.
-        *
+        * 
         * @param java.util.List
         */
        public static void setInternalWebBrowserFavorites(List list) {
@@ -169,7 +178,8 @@ public class WebBrowserPreference {
                                sb.append("|*|");
                        }
                }
-               getPreferenceStore().setValue(PREF_INTERNAL_WEB_BROWSER_FAVORITES, sb.toString());
+               getPreferenceStore().setValue(PREF_INTERNAL_WEB_BROWSER_FAVORITES,
+                               sb.toString());
                WebBrowserUIPlugin.getInstance().savePluginPreferences();
        }
 }
\ No newline at end of file