| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2004, 2008 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 | import org.eclipse.ui.internal.views.markers.MarkerSupportInternalUtilities; |
| 20 | |
| 21 | /** |
| 22 | * The IDEPreferenceInitializer is the preference initializer for the IDE |
| 23 | * preferences. |
| 24 | */ |
| 25 | public class IDEPreferenceInitializer extends AbstractPreferenceInitializer { |
| 26 | |
| 27 | /* |
| 28 | * (non-Javadoc) |
| 29 | * |
| 30 | * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() |
| 31 | */ |
| 32 | public void initializeDefaultPreferences() { |
| 33 | |
| 34 | IEclipsePreferences node = new DefaultScope() |
| 35 | .getNode(IDEWorkbenchPlugin.getDefault().getBundle() |
| 36 | .getSymbolicName()); |
| 37 | |
| 38 | // API preferences |
| 39 | |
| 40 | node.put(IDE.Preferences.PROJECT_OPEN_NEW_PERSPECTIVE, |
| 41 | IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE); |
| 42 | |
| 43 | // Set the workspace selection dialog to open by default |
| 44 | node.putBoolean(IDE.Preferences.SHOW_WORKSPACE_SELECTION_DIALOG, true); |
| 45 | |
| 46 | // Internal preferences |
| 47 | |
| 48 | node.putBoolean(IDEInternalPreferences.SAVE_ALL_BEFORE_BUILD, false); |
| 49 | node.putInt(IDEInternalPreferences.SAVE_INTERVAL, 5); // 5 minutes |
| 50 | node.putBoolean(IDEInternalPreferences.WELCOME_DIALOG, true); |
| 51 | node.putBoolean(IDEInternalPreferences.REFRESH_WORKSPACE_ON_STARTUP, |
| 52 | false); |
| 53 | node.putBoolean( |
| 54 | IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW, true); |
| 55 | node.put(IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE, |
| 56 | IDEInternalPreferences.PSPM_PROMPT); |
| 57 | node.put(IDEInternalPreferences.OPEN_REQUIRED_PROJECTS, |
| 58 | IDEInternalPreferences.PSPM_PROMPT); |
| 59 | |
| 60 | // Turning some Help Menu separators on |
| 61 | node.putBoolean(getHelpSeparatorKey("group.main"), true); //$NON-NLS-1$ |
| 62 | node.putBoolean(getHelpSeparatorKey("group.assist"), true); //$NON-NLS-1$ |
| 63 | node.putBoolean(getHelpSeparatorKey("group.updates"), true); //$NON-NLS-1$ |
| 64 | |
| 65 | // Set up marker limits |
| 66 | node.putBoolean(IDEInternalPreferences.LIMIT_PROBLEMS, true); |
| 67 | node.putInt(IDEInternalPreferences.PROBLEMS_LIMIT, 100); |
| 68 | |
| 69 | node.putBoolean(IDEInternalPreferences.LIMIT_BOOKMARKS, true); |
| 70 | node.putInt(IDEInternalPreferences.BOOKMARKS_LIMIT, 100); |
| 71 | |
| 72 | node.putBoolean(IDEInternalPreferences.LIMIT_TASKS, true); |
| 73 | node.putInt(IDEInternalPreferences.TASKS_LIMIT, 100); |
| 74 | |
| 75 | node.putBoolean(IDEInternalPreferences.USE_MARKER_LIMITS, true); |
| 76 | node.putInt(IDEInternalPreferences.MARKER_LIMITS_VALUE, 100); |
| 77 | |
| 78 | //Filter migration |
| 79 | node.putBoolean(MarkerSupportInternalUtilities.MIGRATE_BOOKMARK_FILTERS, false); |
| 80 | node.putBoolean(MarkerSupportInternalUtilities.MIGRATE_TASK_FILTERS, false); |
| 81 | node.putBoolean(MarkerSupportInternalUtilities.MIGRATE_PROBLEM_FILTERS, false); |
| 82 | } |
| 83 | |
| 84 | private String getHelpSeparatorKey(String groupId) { |
| 85 | return "useSeparator." + IWorkbenchActionConstants.M_HELP + "." + groupId; //$NON-NLS-1$ //$NON-NLS-2$ |
| 86 | } |
| 87 | } |