From 47dd3dc302cf3f38fed41bae89f4f7c2ae00e9c0 Mon Sep 17 00:00:00 2001 From: David Inglis Date: Thu, 10 Jun 2004 17:38:50 +0000 Subject: last changes for runtime.compatiblity dependency removal --- core/org.eclipse.cdt.core.win32/fragment.xml | 1 - .../src/org/eclipse/cdt/core/CCorePlugin.java | 49 +++------------------- .../eclipse/cdt/core/CCorePreferenceConstants.java | 35 ++++++++++++++++ .../internal/core/CCorePreferenceInitializer.java | 37 ++++++++++++++++ .../eclipse/cdt/internal/ui/editor/CEditor.java | 3 +- .../ui/preferences/TodoTaskConfigurationBlock.java | 5 ++- .../cdt/internal/ui/text/CCommentScanner.java | 8 +--- 7 files changed, 85 insertions(+), 53 deletions(-) create mode 100644 core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java create mode 100644 core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java (limited to 'core') diff --git a/core/org.eclipse.cdt.core.win32/fragment.xml b/core/org.eclipse.cdt.core.win32/fragment.xml index d55ad2c9faf..73826c62cc3 100644 --- a/core/org.eclipse.cdt.core.win32/fragment.xml +++ b/core/org.eclipse.cdt.core.win32/fragment.xml @@ -13,7 +13,6 @@ - diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java index 037fee6a105..3ecf9cff633 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java @@ -87,12 +87,11 @@ public class CCorePlugin extends Plugin { public final static String BUILD_SCANNER_INFO_SIMPLE_ID = "ScannerInfoProvider"; //$NON-NLS-1$ public final static String BUILD_SCANNER_INFO_UNIQ_ID = PLUGIN_ID + "." + BUILD_SCANNER_INFO_SIMPLE_ID; //$NON-NLS-1$ - - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String TRANSLATION_TASK_PRIORITIES = PLUGIN_ID + ".translation.taskPriorities"; //$NON-NLS-1$ + /** + * Possible configurable option value for TRANSLATION_TASK_PRIORITIES. + * @see #getDefaultOptions + */ + public static final String TRANSLATION_TASK_PRIORITY_NORMAL = "NORMAL"; //$NON-NLS-1$ /** * Possible configurable option value for TRANSLATION_TASK_PRIORITIES. * @see #getDefaultOptions @@ -103,25 +102,6 @@ public class CCorePlugin extends Plugin { * @see #getDefaultOptions */ public static final String TRANSLATION_TASK_PRIORITY_LOW = "LOW"; //$NON-NLS-1$ - /** - * Possible configurable option value for TRANSLATION_TASK_PRIORITIES. - * @see #getDefaultOptions - */ - public static final String TRANSLATION_TASK_PRIORITY_NORMAL = "NORMAL"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String TRANSLATION_TASK_TAGS = PLUGIN_ID + ".translation.taskTags"; //$NON-NLS-1$ - - /** - * Default task tag - */ - public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$ - /** - * Default task priority - */ - public static final String DEFAULT_TASK_PRIORITY = TRANSLATION_TASK_PRIORITY_NORMAL; /** * Possible configurable option ID. * @see #getDefaultOptions @@ -346,24 +326,7 @@ public class CCorePlugin extends Plugin { return defaultOptions; } - - /** - * Initializes the default preferences settings for this plug-in. - * TODO: Add all options here - */ - protected void initializeDefaultPluginPreferences() - { - Preferences preferences = getPluginPreferences(); - HashSet optionNames = CModelManager.OptionNames; - - // Compiler settings - preferences.setDefault(TRANSLATION_TASK_TAGS, DEFAULT_TASK_TAG); - optionNames.add(TRANSLATION_TASK_TAGS); - - preferences.setDefault(TRANSLATION_TASK_PRIORITIES, DEFAULT_TASK_PRIORITY); - optionNames.add(TRANSLATION_TASK_PRIORITIES); - } - + /** * Helper method for returning one option value only. Equivalent to (String)CCorePlugin.getOptions().get(optionName) * Note that it may answer null if this option does not exist. diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java new file mode 100644 index 00000000000..463c29bbdfb --- /dev/null +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePreferenceConstants.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Common Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: QNX Software Systems - initial API and implementation + ******************************************************************************/ +package org.eclipse.cdt.core; + + +public class CCorePreferenceConstants { + + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String TRANSLATION_TASK_TAGS = CCorePlugin.PLUGIN_ID + ".translation.taskTags"; //$NON-NLS-1$ + + /** + * Default task tag + */ + public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$ + + /** + * Default task priority + */ + public static final String DEFAULT_TASK_PRIORITY = CCorePlugin.TRANSLATION_TASK_PRIORITY_NORMAL; + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String TRANSLATION_TASK_PRIORITIES = CCorePlugin.PLUGIN_ID + ".translation.taskPriorities"; //$NON-NLS-1$ + +} diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java new file mode 100644 index 00000000000..9a9b2f56bef --- /dev/null +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Common Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: QNX Software Systems - initial API and implementation + ******************************************************************************/ +package org.eclipse.cdt.internal.core; + +import java.util.HashSet; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.CCorePreferenceConstants; +import org.eclipse.cdt.internal.core.model.CModelManager; +import org.eclipse.core.runtime.Preferences; +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; + + +public class CCorePreferenceInitializer extends AbstractPreferenceInitializer { + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() + */ + public void initializeDefaultPreferences() { + Preferences preferences = CCorePlugin.getDefault().getPluginPreferences(); + HashSet optionNames = CModelManager.OptionNames; + + // Compiler settings + preferences.setDefault(CCorePreferenceConstants.TRANSLATION_TASK_TAGS, CCorePreferenceConstants.DEFAULT_TASK_TAG); + optionNames.add(CCorePreferenceConstants.TRANSLATION_TASK_TAGS); + + preferences.setDefault(CCorePreferenceConstants.TRANSLATION_TASK_PRIORITIES, CCorePreferenceConstants.DEFAULT_TASK_PRIORITY); + optionNames.add(CCorePreferenceConstants.TRANSLATION_TASK_PRIORITIES); + } + +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java index aa0fa668286..b7f09eb6003 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java @@ -11,6 +11,7 @@ import java.util.List; import java.util.StringTokenizer; import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.CCorePreferenceConstants; import org.eclipse.cdt.core.filetype.ICFileType; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; @@ -136,7 +137,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS public final static String LINKED_POSITION_COLOR = "linkedPositionColor"; //$NON-NLS-1$ /** Preference key for compiler task tags */ - private final static String TRANSLATION_TASK_TAGS= CCorePlugin.TRANSLATION_TASK_TAGS; + private final static String TRANSLATION_TASK_TAGS= CCorePreferenceConstants.TRANSLATION_TASK_TAGS; /** Preference key for hyperlink enablement */ public final static String HYPERLINK_ENABLED = "hyperlinkEnable"; //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TodoTaskConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TodoTaskConfigurationBlock.java index 072e300e04f..cab3f4568a2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TodoTaskConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TodoTaskConfigurationBlock.java @@ -27,6 +27,7 @@ import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.CCorePreferenceConstants; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.internal.ui.dialogs.StatusInfo; @@ -43,8 +44,8 @@ import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener; */ public class TodoTaskConfigurationBlock extends OptionsConfigurationBlock { - private static final String PREF_TRANSLATION_TASK_TAGS= CCorePlugin.TRANSLATION_TASK_TAGS; - private static final String PREF_TRANSLATION_TASK_PRIORITIES= CCorePlugin.TRANSLATION_TASK_PRIORITIES; + private static final String PREF_TRANSLATION_TASK_TAGS= CCorePreferenceConstants.TRANSLATION_TASK_TAGS; + private static final String PREF_TRANSLATION_TASK_PRIORITIES= CCorePreferenceConstants.TRANSLATION_TASK_PRIORITIES; private static final String PRIORITY_HIGH= CCorePlugin.TRANSLATION_TASK_PRIORITY_HIGH; private static final String PRIORITY_NORMAL= CCorePlugin.TRANSLATION_TASK_PRIORITY_NORMAL; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCommentScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCommentScanner.java index 190522f2ce4..b8aadf0cc00 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCommentScanner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCommentScanner.java @@ -15,12 +15,8 @@ import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; +import org.eclipse.cdt.core.CCorePreferenceConstants; import org.eclipse.core.runtime.Preferences; -import org.eclipse.cdt.core.CCorePlugin; - -import org.eclipse.cdt.internal.ui.text.IColorManager; -import org.eclipse.cdt.internal.ui.text.ICColorConstants; - import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.rules.IToken; import org.eclipse.jface.text.rules.IWordDetector; @@ -78,7 +74,7 @@ public class CCommentScanner extends AbstractCScanner } } - private static final String TRANSLATION_TASK_TAGS= CCorePlugin.TRANSLATION_TASK_TAGS; + private static final String TRANSLATION_TASK_TAGS= CCorePreferenceConstants.TRANSLATION_TASK_TAGS; protected static final String TASK_TAG= ICColorConstants.TASK_TAG; private TaskTagRule fTaskTagRule; -- cgit v1.2.3