KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 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.core.internal.resources;
12
13 import org.eclipse.core.resources.ResourcesPlugin;
14 import org.eclipse.core.runtime.preferences.*;
15
16 /**
17  * @since 3.1
18  */

19 public class PreferenceInitializer extends AbstractPreferenceInitializer {
20
21     // internal preference keys
22
public static final String JavaDoc PREF_OPERATIONS_PER_SNAPSHOT = "snapshots.operations"; //$NON-NLS-1$
23
public static final String JavaDoc PREF_DELTA_EXPIRATION = "delta.expiration"; //$NON-NLS-1$
24

25     // DEFAULTS
26
public static final boolean PREF_AUTO_REFRESH_DEFAULT = false;
27     public static final boolean PREF_DISABLE_LINKING_DEFAULT = false;
28     public static final String JavaDoc PREF_ENCODING_DEFAULT = ""; //$NON-NLS-1$
29
public static final boolean PREF_AUTO_BUILDING_DEFAULT = true;
30     public static final String JavaDoc PREF_BUILD_ORDER_DEFAULT = ""; //$NON-NLS-1$
31
public static final int PREF_MAX_BUILD_ITERATIONS_DEFAULT = 10;
32     public static final boolean PREF_DEFAULT_BUILD_ORDER_DEFAULT = true;
33     public final static long PREF_SNAPSHOT_INTERVAL_DEFAULT = 5 * 60 * 1000l; // 5 min
34
public static final int PREF_OPERATIONS_PER_SNAPSHOT_DEFAULT = 100;
35     public static final long PREF_FILE_STATE_LONGEVITY_DEFAULT = 7 * 24 * 3600 * 1000l; // 7 days
36
public static final long PREF_MAX_FILE_STATE_SIZE_DEFAULT = 1024 * 1024l; // 1 MB
37
public static final int PREF_MAX_FILE_STATES_DEFAULT = 50;
38     public static final long PREF_DELTA_EXPIRATION_DEFAULT = 30 * 24 * 3600 * 1000l; // 30 days
39

40     public PreferenceInitializer() {
41         super();
42     }
43
44     /* (non-Javadoc)
45      * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
46      */

47     public void initializeDefaultPreferences() {
48         IEclipsePreferences node = new DefaultScope().getNode(ResourcesPlugin.PI_RESOURCES);
49         // auto-refresh default
50
node.putBoolean(ResourcesPlugin.PREF_AUTO_REFRESH, PREF_AUTO_REFRESH_DEFAULT);
51
52         // linked resources default
53
node.putBoolean(ResourcesPlugin.PREF_DISABLE_LINKING, PREF_DISABLE_LINKING_DEFAULT);
54
55         // build manager defaults
56
node.putBoolean(ResourcesPlugin.PREF_AUTO_BUILDING, PREF_AUTO_BUILDING_DEFAULT);
57         node.put(ResourcesPlugin.PREF_BUILD_ORDER, PREF_BUILD_ORDER_DEFAULT);
58         node.putInt(ResourcesPlugin.PREF_MAX_BUILD_ITERATIONS, PREF_MAX_BUILD_ITERATIONS_DEFAULT);
59         node.putBoolean(ResourcesPlugin.PREF_DEFAULT_BUILD_ORDER, PREF_DEFAULT_BUILD_ORDER_DEFAULT);
60
61         // history store defaults
62
node.putLong(ResourcesPlugin.PREF_FILE_STATE_LONGEVITY, PREF_FILE_STATE_LONGEVITY_DEFAULT);
63         node.putLong(ResourcesPlugin.PREF_MAX_FILE_STATE_SIZE, PREF_MAX_FILE_STATE_SIZE_DEFAULT);
64         node.putInt(ResourcesPlugin.PREF_MAX_FILE_STATES, PREF_MAX_FILE_STATES_DEFAULT);
65
66         // save manager defaults
67
node.putLong(ResourcesPlugin.PREF_SNAPSHOT_INTERVAL, PREF_SNAPSHOT_INTERVAL_DEFAULT);
68         node.putInt(PREF_OPERATIONS_PER_SNAPSHOT, PREF_OPERATIONS_PER_SNAPSHOT_DEFAULT);
69         node.putLong(PREF_DELTA_EXPIRATION, PREF_DELTA_EXPIRATION_DEFAULT);
70
71         // encoding defaults
72
node.put(ResourcesPlugin.PREF_ENCODING, PREF_ENCODING_DEFAULT);
73     }
74
75 }
76
Popular Tags