KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > ide > IDEPreferenceInitializer


1 /*******************************************************************************
2  * Copyright (c) 2004, 2006 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.ui.internal.ide;
12
13 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
14 import org.eclipse.core.runtime.preferences.DefaultScope;
15 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
16 import org.eclipse.ui.IWorkbenchActionConstants;
17 import org.eclipse.ui.IWorkbenchPreferenceConstants;
18 import org.eclipse.ui.ide.IDE;
19
20 /**
21  * The IDEPreferenceInitializer is the preference initializer for the IDE
22  * preferences.
23  */

24 public class IDEPreferenceInitializer extends AbstractPreferenceInitializer {
25
26     /*
27      * (non-Javadoc)
28      *
29      * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
30      */

31     public void initializeDefaultPreferences() {
32
33         IEclipsePreferences node = new DefaultScope()
34                 .getNode(IDEWorkbenchPlugin.getDefault().getBundle()
35                         .getSymbolicName());
36
37         // API preferences
38

39         node.put(IDE.Preferences.PROJECT_OPEN_NEW_PERSPECTIVE,
40                 IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);
41
42         // Set the workspace selection dialog to open by default
43
node.putBoolean(IDE.Preferences.SHOW_WORKSPACE_SELECTION_DIALOG, true);
44
45         // Internal preferences
46

47         node.putBoolean(IDEInternalPreferences.SAVE_ALL_BEFORE_BUILD, false);
48         node.putInt(IDEInternalPreferences.SAVE_INTERVAL, 5); // 5 minutes
49
node.putBoolean(IDEInternalPreferences.WELCOME_DIALOG, true);
50         node.putBoolean(IDEInternalPreferences.REFRESH_WORKSPACE_ON_STARTUP,
51                 false);
52         node.putBoolean(
53                 IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW, true);
54         node.put(IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE,
55                 IDEInternalPreferences.PSPM_PROMPT);
56         node.put(IDEInternalPreferences.OPEN_REQUIRED_PROJECTS,
57                 IDEInternalPreferences.PSPM_PROMPT);
58
59         // Turning some Help Menu separators on
60
node.putBoolean(getHelpSeparatorKey("group.main"), true); //$NON-NLS-1$
61
node.putBoolean(getHelpSeparatorKey("group.assist"), true); //$NON-NLS-1$
62
node.putBoolean(getHelpSeparatorKey("group.updates"), true); //$NON-NLS-1$
63

64         // Set up marker limits
65
node.putBoolean(IDEInternalPreferences.LIMIT_PROBLEMS, true);
66         node.putInt(IDEInternalPreferences.PROBLEMS_LIMIT, 100);
67         
68         node.putBoolean(IDEInternalPreferences.LIMIT_BOOKMARKS, true);
69         node.putInt(IDEInternalPreferences.BOOKMARKS_LIMIT, 100);
70
71         node.putBoolean(IDEInternalPreferences.LIMIT_TASKS, true);
72         node.putInt(IDEInternalPreferences.TASKS_LIMIT, 100);
73     }
74
75     private String JavaDoc getHelpSeparatorKey(String JavaDoc groupId) {
76         return "useSeparator." + IWorkbenchActionConstants.M_HELP + "." + groupId; //$NON-NLS-1$ //$NON-NLS-2$
77
}
78 }
79
Popular Tags