01: /*******************************************************************************
02: * Copyright (c) 2005, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.core;
11:
12: import java.util.Locale;
13:
14: import org.eclipse.core.runtime.Platform;
15: import org.eclipse.core.runtime.Preferences;
16: import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
17: import org.eclipse.pde.core.plugin.TargetPlatform;
18:
19: public class PreferenceInitializer extends
20: 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()
29: .getPluginPreferences();
30: preferences.setDefault(ICoreConstants.TARGET_MODE,
31: ICoreConstants.VALUE_USE_THIS);
32: preferences.setDefault(ICoreConstants.CHECKED_PLUGINS,
33: ICoreConstants.VALUE_SAVED_ALL);
34: if (preferences.getString(ICoreConstants.TARGET_MODE).equals(
35: ICoreConstants.VALUE_USE_THIS))
36: preferences.setValue(ICoreConstants.PLATFORM_PATH,
37: TargetPlatform.getDefaultLocation());
38: else
39: preferences.setDefault(ICoreConstants.PLATFORM_PATH,
40: TargetPlatform.getDefaultLocation());
41:
42: // set defaults for the target environment variables.
43: preferences.setDefault(ICoreConstants.OS, Platform.getOS());
44: preferences.setDefault(ICoreConstants.WS, Platform.getWS());
45: preferences.setDefault(ICoreConstants.NL, Locale.getDefault()
46: .toString());
47: preferences.setDefault(ICoreConstants.ARCH, Platform
48: .getOSArch());
49: }
50:
51: }
|