KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > PreferenceInitializer


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.core;
12
13 import java.util.Locale JavaDoc;
14
15 import org.eclipse.core.runtime.Platform;
16 import org.eclipse.core.runtime.Preferences;
17 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
18 import org.eclipse.pde.core.plugin.TargetPlatform;
19
20 public class PreferenceInitializer extends AbstractPreferenceInitializer {
21
22     /*
23      * (non-Javadoc)
24      *
25      * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
26      */

27     public void initializeDefaultPreferences() {
28         Preferences preferences = PDECore.getDefault().getPluginPreferences();
29         preferences.setDefault(
30                 ICoreConstants.TARGET_MODE,
31                 ICoreConstants.VALUE_USE_THIS);
32         preferences.setDefault(
33                 ICoreConstants.CHECKED_PLUGINS,
34                 ICoreConstants.VALUE_SAVED_ALL);
35         if (preferences.getString(ICoreConstants.TARGET_MODE).equals(ICoreConstants.VALUE_USE_THIS))
36             preferences.setValue(
37                     ICoreConstants.PLATFORM_PATH,
38                     TargetPlatform.getDefaultLocation());
39         else
40             preferences.setDefault(
41                     ICoreConstants.PLATFORM_PATH,
42                     TargetPlatform.getDefaultLocation());
43
44         // set defaults for the target environment variables.
45
preferences.setDefault(ICoreConstants.OS, Platform.getOS());
46         preferences.setDefault(ICoreConstants.WS, Platform.getWS());
47         preferences.setDefault(ICoreConstants.NL, Locale.getDefault().toString());
48         preferences.setDefault(ICoreConstants.ARCH, Platform.getOSArch());
49     }
50
51 }
52
Popular Tags