1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Removed use of a deprecated constructor.

This commit is contained in:
Sergey Prigogin 2011-03-07 03:14:49 +00:00
parent 34f8e32373
commit b42e687828
3 changed files with 24 additions and 26 deletions

View file

@ -7,7 +7,7 @@
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core; package org.eclipse.cdt.internal.core;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
@ -27,10 +27,10 @@ public class CCoreInternals {
public static PDOMManager getPDOMManager() { public static PDOMManager getPDOMManager() {
return (PDOMManager) CCorePlugin.getIndexManager(); return (PDOMManager) CCorePlugin.getIndexManager();
} }
/** /**
* Saves the local project preferences, shared project preferences and the * Saves the local project preferences, shared project preferences and the
* scope preferences for the core plugin. * scope preferences for the core plugin.
* @param project the project for which to save preferences, may be <code>null</code> * @param project the project for which to save preferences, may be <code>null</code>
* @since 4.0 * @since 4.0
*/ */
@ -45,7 +45,7 @@ public class CCoreInternals {
new ProjectScope(project).getNode(CCorePlugin.PLUGIN_ID).flush(); new ProjectScope(project).getNode(CCorePlugin.PLUGIN_ID).flush();
} }
} }
new InstanceScope().getNode(CCorePlugin.PLUGIN_ID).flush(); InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).flush();
} catch (BackingStoreException e) { } catch (BackingStoreException e) {
CCorePlugin.log(e); CCorePlugin.log(e);
} }

View file

@ -14,9 +14,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core; package org.eclipse.cdt.internal.core;
import java.util.HashSet;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CCorePreferenceConstants; import org.eclipse.cdt.core.CCorePreferenceConstants;
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants; import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
@ -26,7 +23,9 @@ import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.DefaultScope; import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import java.util.HashSet;
import java.util.Map;
public class CCorePreferenceInitializer extends AbstractPreferenceInitializer { public class CCorePreferenceInitializer extends AbstractPreferenceInitializer {
@ -37,22 +36,22 @@ public class CCorePreferenceInitializer extends AbstractPreferenceInitializer {
@Override @Override
public void initializeDefaultPreferences() { public void initializeDefaultPreferences() {
HashSet<String> optionNames = CModelManager.OptionNames; HashSet<String> optionNames = CModelManager.OptionNames;
// Formatter settings // Formatter settings
Map<String, String> defaultOptionsMap = DefaultCodeFormatterConstants.getDefaultSettings(); // code formatter defaults Map<String, String> defaultOptionsMap = DefaultCodeFormatterConstants.getDefaultSettings(); // code formatter defaults
// Compiler settings // Compiler settings
defaultOptionsMap.put(CCorePreferenceConstants.TODO_TASK_TAGS, CCorePreferenceConstants.DEFAULT_TASK_TAGS); defaultOptionsMap.put(CCorePreferenceConstants.TODO_TASK_TAGS, CCorePreferenceConstants.DEFAULT_TASK_TAGS);
defaultOptionsMap.put(CCorePreferenceConstants.TODO_TASK_PRIORITIES, CCorePreferenceConstants.DEFAULT_TASK_PRIORITY); defaultOptionsMap.put(CCorePreferenceConstants.TODO_TASK_PRIORITIES, CCorePreferenceConstants.DEFAULT_TASK_PRIORITY);
defaultOptionsMap.put(CCorePreferenceConstants.TODO_TASK_CASE_SENSITIVE, CCorePreferenceConstants.DEFAULT_TASK_CASE_SENSITIVE); defaultOptionsMap.put(CCorePreferenceConstants.TODO_TASK_CASE_SENSITIVE, CCorePreferenceConstants.DEFAULT_TASK_CASE_SENSITIVE);
defaultOptionsMap.put(CCorePreferenceConstants.CODE_FORMATTER, CCorePreferenceConstants.DEFAULT_CODE_FORMATTER); defaultOptionsMap.put(CCorePreferenceConstants.CODE_FORMATTER, CCorePreferenceConstants.DEFAULT_CODE_FORMATTER);
defaultOptionsMap.put(CCorePreferenceConstants.INDEX_DB_CACHE_SIZE_PCT, CCorePreferenceConstants.DEFAULT_INDEX_DB_CACHE_SIZE_PCT); defaultOptionsMap.put(CCorePreferenceConstants.INDEX_DB_CACHE_SIZE_PCT, CCorePreferenceConstants.DEFAULT_INDEX_DB_CACHE_SIZE_PCT);
defaultOptionsMap.put(CCorePreferenceConstants.MAX_INDEX_DB_CACHE_SIZE_MB, CCorePreferenceConstants.DEFAULT_MAX_INDEX_DB_CACHE_SIZE_MB); defaultOptionsMap.put(CCorePreferenceConstants.MAX_INDEX_DB_CACHE_SIZE_MB, CCorePreferenceConstants.DEFAULT_MAX_INDEX_DB_CACHE_SIZE_MB);
defaultOptionsMap.put(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, CCorePreferenceConstants.DEFAULT_WORKSPACE_LANGUAGE_MAPPINGS); defaultOptionsMap.put(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, CCorePreferenceConstants.DEFAULT_WORKSPACE_LANGUAGE_MAPPINGS);
defaultOptionsMap.put(CodeReaderCache.CODE_READER_BUFFER, CodeReaderCache.DEFAULT_CACHE_SIZE_IN_MB_STRING); defaultOptionsMap.put(CodeReaderCache.CODE_READER_BUFFER, CodeReaderCache.DEFAULT_CACHE_SIZE_IN_MB_STRING);
// Store default values to default preferences // Store default values to default preferences
IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(CCorePlugin.PLUGIN_ID); IEclipsePreferences defaultPreferences = DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
for (Map.Entry<String,String> entry : defaultOptionsMap.entrySet()) { for (Map.Entry<String,String> entry : defaultOptionsMap.entrySet()) {
String optionName = entry.getKey(); String optionName = entry.getKey();
defaultPreferences.put(optionName, entry.getValue()); defaultPreferences.put(optionName, entry.getValue());
@ -67,10 +66,10 @@ public class CCorePreferenceInitializer extends AbstractPreferenceInitializer {
// build defaults // build defaults
defaultPreferences.putBoolean(CCorePreferenceConstants.PREF_BUILD_ALL_CONFIGS, false); defaultPreferences.putBoolean(CCorePreferenceConstants.PREF_BUILD_ALL_CONFIGS, false);
defaultPreferences.putBoolean(CCorePreferenceConstants.PREF_BUILD_CONFIGS_RESOURCE_CHANGES, false); defaultPreferences.putBoolean(CCorePreferenceConstants.PREF_BUILD_CONFIGS_RESOURCE_CHANGES, false);
// indexer defaults // indexer defaults
IndexerPreferences.initializeDefaultPreferences(defaultPreferences); IndexerPreferences.initializeDefaultPreferences(defaultPreferences);
// content assist defaults // content assist defaults
defaultPreferences.putBoolean(CCorePreferenceConstants.SHOW_CAMEL_CASE_MATCHES, true); defaultPreferences.putBoolean(CCorePreferenceConstants.SHOW_CAMEL_CASE_MATCHES, true);
} }

View file

@ -7,8 +7,7 @@
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core; package org.eclipse.cdt.internal.core;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
@ -24,7 +23,7 @@ public class LocalProjectScope implements IScopeContext {
private static final String QUALIFIER_EXT = ".prj-"; //$NON-NLS-1$ private static final String QUALIFIER_EXT = ".prj-"; //$NON-NLS-1$
/** /**
* String constant (value of <code>"project-local"</code>) used for the * String constant (value of <code>"project-local"</code>) used for the
* scope name for this preference scope. * scope name for this preference scope.
*/ */
public static final String SCOPE = "project-local"; //$NON-NLS-1$ public static final String SCOPE = "project-local"; //$NON-NLS-1$
@ -34,7 +33,7 @@ public class LocalProjectScope implements IScopeContext {
/** /**
* Create and return a new local project scope for the given project. The given * Create and return a new local project scope for the given project. The given
* project must not be <code>null</code>. * project must not be <code>null</code>.
* *
* @param context the project * @param context the project
* @exception IllegalArgumentException if the project is <code>null</code> * @exception IllegalArgumentException if the project is <code>null</code>
*/ */
@ -47,7 +46,7 @@ public class LocalProjectScope implements IScopeContext {
/** /**
* Create and return a new local project scope for the given project. The given * Create and return a new local project scope for the given project. The given
* project must not be <code>null</code>. * project must not be <code>null</code>.
* *
* @param projectName the name of the project * @param projectName the name of the project
* @exception IllegalArgumentException if the project is <code>null</code> * @exception IllegalArgumentException if the project is <code>null</code>
*/ */
@ -66,9 +65,9 @@ public class LocalProjectScope implements IScopeContext {
} }
public IEclipsePreferences getNode(String qualifier) { public IEclipsePreferences getNode(String qualifier) {
return new InstanceScope().getNode(qualifier + QUALIFIER_EXT + fContext); return InstanceScope.INSTANCE.getNode(qualifier + QUALIFIER_EXT + fContext);
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj)
@ -86,7 +85,7 @@ public class LocalProjectScope implements IScopeContext {
return fContext.hashCode(); return fContext.hashCode();
} }
private static Preferences getPPP(String name) { private static Preferences getPPP(String name) {
return new LocalProjectScope(name).getNode(CCorePlugin.PLUGIN_ID); return new LocalProjectScope(name).getNode(CCorePlugin.PLUGIN_ID);
} }