blob: 61b56d9265947a0b769704b78fb6eb5941fabed8 [file] [log] [blame]
nitindafbeaa42004-11-29 19:53:33 +00001/*******************************************************************************
2 * Copyright (c) 2001, 2004 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 *******************************************************************************/
12package org.eclipse.wst.sse.ui.internal;
13
14import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
15import org.eclipse.jface.action.Action;
16import org.eclipse.jface.preference.IPreferenceStore;
17import org.eclipse.jface.preference.PreferenceConverter;
18import org.eclipse.swt.SWT;
19import org.eclipse.swt.graphics.RGB;
20import org.eclipse.ui.editors.text.EditorsUI;
david_williams9bbeecc2005-03-10 19:47:16 +000021import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
david_williamsb1f75052005-02-18 00:25:37 +000022import org.eclipse.wst.sse.ui.internal.projection.IStructuredTextFoldingProvider;
david_williams4ad020f2005-04-18 08:00:30 +000023import org.eclipse.wst.sse.ui.internal.provisional.preferences.CommonEditorPreferenceNames;
nitindafbeaa42004-11-29 19:53:33 +000024
25
26public class PreferenceInitializer extends AbstractPreferenceInitializer {
27 /* (non-Javadoc)
28 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
29 */
30 public void initializeDefaultPreferences() {
david_williams425ffe72004-12-07 21:46:39 +000031 IPreferenceStore store = SSEUIPlugin.getDefault().getPreferenceStore();
nitindafbeaa42004-11-29 19:53:33 +000032
33 // use the base annotation & quick diff preference page
34 EditorsUI.useAnnotationsPreferencePage(store);
35 EditorsUI.useQuickDiffPreferencePage(store);
36
nitindafbeaa42004-11-29 19:53:33 +000037 // let annotations show up in the vertical ruler if that's what the
38 // preference is
39 // // these annotation preferences have a different default value than
40 // the one the base provides
41 // store.setDefault("errorIndicationInVerticalRuler", false);
42 // //$NON-NLS-1$
43 // store.setDefault("warningIndicationInVerticalRuler", false);
44 // //$NON-NLS-1$
45
46 // these annotation preferences are not part of base text editor
47 // preference
48 store.setDefault(CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS, true);
nitindafbeaa42004-11-29 19:53:33 +000049
david_williams0b2ed522005-01-30 06:19:40 +000050 setMatchingBracketsPreferences(store);
nitindafbeaa42004-11-29 19:53:33 +000051
nitindafbeaa42004-11-29 19:53:33 +000052 // hover help preferences are not part of base text editor preference
53 String mod2Name = Action.findModifierString(SWT.MOD2); // SWT.COMMAND
54 // on Mac;
55 // SWT.CONTROL
56 // elsewhere
david_williams9bbeecc2005-03-10 19:47:16 +000057 store.setDefault(EditorPreferenceNames.EDITOR_TEXT_HOVER_MODIFIERS, "combinationHover|true|0;problemHover|false|0;documentationHover|false|0;annotationHover|true|" + mod2Name); //$NON-NLS-1$
nitindafbeaa42004-11-29 19:53:33 +000058
nitindafbeaa42004-11-29 19:53:33 +000059 // set default read-only foreground color scale value
david_williams9bbeecc2005-03-10 19:47:16 +000060 store.setDefault(EditorPreferenceNames.READ_ONLY_FOREGROUND_SCALE, 30);
david_williamsb1f75052005-02-18 00:25:37 +000061
62 // set default enable folding value
63 store.setDefault(IStructuredTextFoldingProvider.FOLDING_ENABLED, false);
nitind70ad8c62005-08-24 17:15:24 +000064
65 // set default for show message dialog when unknown content type in editor
66 store.setDefault(EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG, true);
nitindafbeaa42004-11-29 19:53:33 +000067 }
david_williams0b2ed522005-01-30 06:19:40 +000068
69 private void setMatchingBracketsPreferences(IPreferenceStore store) {
70 // matching brackets is not part of base text editor preference
david_williams9bbeecc2005-03-10 19:47:16 +000071 store.setDefault(EditorPreferenceNames.MATCHING_BRACKETS, true);
72 PreferenceConverter.setDefault(store, EditorPreferenceNames.MATCHING_BRACKETS_COLOR, new RGB(192, 192, 192));
david_williams0b2ed522005-01-30 06:19:40 +000073 }
nitindafbeaa42004-11-29 19:53:33 +000074}