nitind | afbeaa4 | 2004-11-29 19:53:33 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 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 | *******************************************************************************/ |
| 12 | package org.eclipse.wst.sse.ui.internal; |
| 13 | |
| 14 | import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; |
| 15 | import org.eclipse.jface.action.Action; |
| 16 | import org.eclipse.jface.preference.IPreferenceStore; |
| 17 | import org.eclipse.jface.preference.PreferenceConverter; |
| 18 | import org.eclipse.swt.SWT; |
| 19 | import org.eclipse.swt.graphics.RGB; |
| 20 | import org.eclipse.ui.editors.text.EditorsUI; |
david_williams | 9bbeecc | 2005-03-10 19:47:16 +0000 | [diff] [blame] | 21 | import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames; |
david_williams | b1f7505 | 2005-02-18 00:25:37 +0000 | [diff] [blame] | 22 | import org.eclipse.wst.sse.ui.internal.projection.IStructuredTextFoldingProvider; |
david_williams | 4ad020f | 2005-04-18 08:00:30 +0000 | [diff] [blame] | 23 | import org.eclipse.wst.sse.ui.internal.provisional.preferences.CommonEditorPreferenceNames; |
nitind | afbeaa4 | 2004-11-29 19:53:33 +0000 | [diff] [blame] | 24 | |
| 25 | |
| 26 | public class PreferenceInitializer extends AbstractPreferenceInitializer { |
| 27 | /* (non-Javadoc) |
| 28 | * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() |
| 29 | */ |
| 30 | public void initializeDefaultPreferences() { |
david_williams | 425ffe7 | 2004-12-07 21:46:39 +0000 | [diff] [blame] | 31 | IPreferenceStore store = SSEUIPlugin.getDefault().getPreferenceStore(); |
nitind | afbeaa4 | 2004-11-29 19:53:33 +0000 | [diff] [blame] | 32 | |
| 33 | // use the base annotation & quick diff preference page |
| 34 | EditorsUI.useAnnotationsPreferencePage(store); |
| 35 | EditorsUI.useQuickDiffPreferencePage(store); |
| 36 | |
nitind | afbeaa4 | 2004-11-29 19:53:33 +0000 | [diff] [blame] | 37 | // 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); |
nitind | afbeaa4 | 2004-11-29 19:53:33 +0000 | [diff] [blame] | 49 | |
david_williams | 0b2ed52 | 2005-01-30 06:19:40 +0000 | [diff] [blame] | 50 | setMatchingBracketsPreferences(store); |
nitind | afbeaa4 | 2004-11-29 19:53:33 +0000 | [diff] [blame] | 51 | |
nitind | afbeaa4 | 2004-11-29 19:53:33 +0000 | [diff] [blame] | 52 | // 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_williams | 9bbeecc | 2005-03-10 19:47:16 +0000 | [diff] [blame] | 57 | store.setDefault(EditorPreferenceNames.EDITOR_TEXT_HOVER_MODIFIERS, "combinationHover|true|0;problemHover|false|0;documentationHover|false|0;annotationHover|true|" + mod2Name); //$NON-NLS-1$ |
nitind | afbeaa4 | 2004-11-29 19:53:33 +0000 | [diff] [blame] | 58 | |
nitind | afbeaa4 | 2004-11-29 19:53:33 +0000 | [diff] [blame] | 59 | // set default read-only foreground color scale value |
david_williams | 9bbeecc | 2005-03-10 19:47:16 +0000 | [diff] [blame] | 60 | store.setDefault(EditorPreferenceNames.READ_ONLY_FOREGROUND_SCALE, 30); |
david_williams | b1f7505 | 2005-02-18 00:25:37 +0000 | [diff] [blame] | 61 | |
| 62 | // set default enable folding value |
| 63 | store.setDefault(IStructuredTextFoldingProvider.FOLDING_ENABLED, false); |
nitind | 70ad8c6 | 2005-08-24 17:15:24 +0000 | [diff] [blame] | 64 | |
| 65 | // set default for show message dialog when unknown content type in editor |
| 66 | store.setDefault(EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG, true); |
nitind | afbeaa4 | 2004-11-29 19:53:33 +0000 | [diff] [blame] | 67 | } |
david_williams | 0b2ed52 | 2005-01-30 06:19:40 +0000 | [diff] [blame] | 68 | |
| 69 | private void setMatchingBracketsPreferences(IPreferenceStore store) { |
| 70 | // matching brackets is not part of base text editor preference |
david_williams | 9bbeecc | 2005-03-10 19:47:16 +0000 | [diff] [blame] | 71 | store.setDefault(EditorPreferenceNames.MATCHING_BRACKETS, true); |
| 72 | PreferenceConverter.setDefault(store, EditorPreferenceNames.MATCHING_BRACKETS_COLOR, new RGB(192, 192, 192)); |
david_williams | 0b2ed52 | 2005-01-30 06:19:40 +0000 | [diff] [blame] | 73 | } |
nitind | afbeaa4 | 2004-11-29 19:53:33 +0000 | [diff] [blame] | 74 | } |