Skip to main content
summaryrefslogtreecommitdiffstats
blob: e4cdd8b10c643583f4991204f32dcd84377c83a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*******************************************************************************
 * Copyright (c) 2000, 2011 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.help.internal.base;

import java.util.Locale;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.osgi.service.prefs.BackingStoreException;

/**
 */
public class HelpBasePreferenceInitializer extends
		AbstractPreferenceInitializer {

	/*
	 * (non-Javadoc)
	 *
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
	 */
	@Override
	public void initializeDefaultPreferences() {
		IEclipsePreferences prefs = DefaultScope.INSTANCE.getNode(HelpBasePlugin.PLUGIN_ID);

		String os = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); //$NON-NLS-1$

		if (os.indexOf("windows") != -1) { //$NON-NLS-1$
			prefs
					.put("custom_browser_path", //$NON-NLS-1$
							"\"C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE\" %1"); //$NON-NLS-1$
		} else if (os.indexOf("linux") != -1) { //$NON-NLS-1$
			prefs.put("custom_browser_path", //$NON-NLS-1$
					"konqueror %1"); //$NON-NLS-1$
		} else {
			prefs.put("custom_browser_path", "mozilla %1"); //$NON-NLS-1$ //$NON-NLS-2$
		}
		try {
			prefs.flush();
		} catch (BackingStoreException e) {
		}
	}

}

Back to the top