* 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
*/
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.
*/
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) {
/**
* 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()) {
}
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;
}
*/
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();
list.add(f);
}
setInternalWebBrowserFavorites(list);
-
+
StringBuffer sb = new StringBuffer();
iterator = WebBrowserUtil.getUnlockedFavorites().iterator();
while (iterator.hasNext()) {
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) {
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) {
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