mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Moved two previously hidden preferences to CCorePreferenceConstants.java and made them public.
This commit is contained in:
parent
de4fdf198f
commit
717dfc08a6
5 changed files with 46 additions and 21 deletions
|
@ -150,14 +150,6 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
ILinkage.CPP_LINKAGE_ID, ILinkage.C_LINKAGE_ID, ILinkage.FORTRAN_LINKAGE_ID
|
ILinkage.CPP_LINKAGE_ID, ILinkage.C_LINKAGE_ID, ILinkage.FORTRAN_LINKAGE_ID
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Boolean preference controlling whether paths to non-workspace files are stored in canonical
|
|
||||||
* form or not.
|
|
||||||
*/
|
|
||||||
// TODO(sprigogin): Move to CPreferencesConstants and add UI support.
|
|
||||||
public static final String PREFERENCES_CONSTANT_PATH_CANONICALIZATION =
|
|
||||||
CCorePlugin.PLUGIN_ID + ".path_canonicalization"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protects fIndexerJob, fCurrentTask and fTaskQueue.
|
* Protects fIndexerJob, fCurrentTask and fTaskQueue.
|
||||||
*/
|
*/
|
||||||
|
@ -283,7 +275,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
prop.equals(CCorePreferenceConstants.TODO_TASK_PRIORITIES) ||
|
prop.equals(CCorePreferenceConstants.TODO_TASK_PRIORITIES) ||
|
||||||
prop.equals(CCorePreferenceConstants.TODO_TASK_CASE_SENSITIVE)) {
|
prop.equals(CCorePreferenceConstants.TODO_TASK_CASE_SENSITIVE)) {
|
||||||
reindexAll();
|
reindexAll();
|
||||||
} else if (prop.equals(PREFERENCES_CONSTANT_PATH_CANONICALIZATION)) {
|
} else if (prop.equals(CCorePreferenceConstants.FILE_PATH_CANONICALIZATION)) {
|
||||||
updatePathCanonicalizationStrategy();
|
updatePathCanonicalizationStrategy();
|
||||||
reindexAll();
|
reindexAll();
|
||||||
}
|
}
|
||||||
|
@ -302,7 +294,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
|
|
||||||
private void updatePathCanonicalizationStrategy() {
|
private void updatePathCanonicalizationStrategy() {
|
||||||
IPreferencesService prefs = Platform.getPreferencesService();
|
IPreferencesService prefs = Platform.getPreferencesService();
|
||||||
boolean canonicalize = prefs.getBoolean(CCorePlugin.PLUGIN_ID, PREFERENCES_CONSTANT_PATH_CANONICALIZATION, true, null);
|
boolean canonicalize = prefs.getBoolean(CCorePlugin.PLUGIN_ID, CCorePreferenceConstants.FILE_PATH_CANONICALIZATION, true, null);
|
||||||
PathCanonicalizationStrategy.setPathCanonicalization(canonicalize);
|
PathCanonicalizationStrategy.setPathCanonicalization(canonicalize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,13 @@ public class CCorePreferenceConstants {
|
||||||
*/
|
*/
|
||||||
public static final String DEFAULT_MAX_INDEX_DB_CACHE_SIZE_MB = "64"; //$NON-NLS-1$
|
public static final String DEFAULT_MAX_INDEX_DB_CACHE_SIZE_MB = "64"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean preference controlling whether paths of non-workspace files are stored in index in canonical
|
||||||
|
* form or not. Canonicalization is performed by calling {@link java.io.File#getCanonicalPath()}.
|
||||||
|
* @since 5.2
|
||||||
|
*/
|
||||||
|
public static final String FILE_PATH_CANONICALIZATION = CCorePlugin.PLUGIN_ID + ".path_canonicalization"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Workspace-wide language mappings.
|
* Workspace-wide language mappings.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -518,7 +518,18 @@ public class DefaultCodeFormatterConstants {
|
||||||
public static final String FORMATTER_INDENT_ACCESS_SPECIFIER_COMPARE_TO_TYPE_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_access_specifier_compare_to_type_header"; //$NON-NLS-1$
|
public static final String FORMATTER_INDENT_ACCESS_SPECIFIER_COMPARE_TO_TYPE_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_access_specifier_compare_to_type_header"; //$NON-NLS-1$
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* FORMATTER / Option to indent body declarations compare to access specifiers (visibility labels)
|
* FORMATTER / Number of extra spaces in front of 'public:', 'protected:', 'private:' access specifiers.
|
||||||
|
* Enables fractional indent of access specifiers. Does not affect indentation of body declarations.
|
||||||
|
* - option id: "org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces"
|
||||||
|
* - possible values: "<n>", where n is zero or a positive integer
|
||||||
|
* - default: "0"
|
||||||
|
* </pre>
|
||||||
|
* @since 5.2
|
||||||
|
*/
|
||||||
|
public static final String FORMATTER_INDENT_ACCESS_SPECIFIER_EXTRA_SPACES = CCorePlugin.PLUGIN_ID + ".formatter.indent_access_specifier_extra_spaces"; //$NON-NLS-1$
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* FORMATTER / Option to indent body declarations relative to access specifiers (visibility labels)
|
||||||
* - option id: "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier"
|
* - option id: "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier"
|
||||||
* - possible values: { TRUE, FALSE }
|
* - possible values: { TRUE, FALSE }
|
||||||
* - default: TRUE
|
* - default: TRUE
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
* Sergey Prigogin, Google
|
* Sergey Prigogin (Google)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core;
|
package org.eclipse.cdt.internal.core;
|
||||||
|
@ -59,6 +59,7 @@ public class CCorePreferenceInitializer extends AbstractPreferenceInitializer {
|
||||||
|
|
||||||
defaultPreferences.putBoolean(CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true);
|
defaultPreferences.putBoolean(CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true);
|
||||||
defaultPreferences.putBoolean(CCorePlugin.PREF_USE_STRUCTURAL_PARSE_MODE, false);
|
defaultPreferences.putBoolean(CCorePlugin.PREF_USE_STRUCTURAL_PARSE_MODE, false);
|
||||||
|
defaultPreferences.putBoolean(CCorePreferenceConstants.FILE_PATH_CANONICALIZATION, true);
|
||||||
|
|
||||||
// indexer defaults
|
// indexer defaults
|
||||||
IndexerPreferences.initializeDefaultPreferences(defaultPreferences);
|
IndexerPreferences.initializeDefaultPreferences(defaultPreferences);
|
||||||
|
|
|
@ -12,9 +12,13 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.text;
|
package org.eclipse.cdt.internal.ui.text;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.ProjectScope;
|
||||||
import org.eclipse.core.runtime.Assert;
|
import org.eclipse.core.runtime.Assert;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.preferences.DefaultScope;
|
||||||
import org.eclipse.core.runtime.preferences.IPreferencesService;
|
import org.eclipse.core.runtime.preferences.IPreferencesService;
|
||||||
|
import org.eclipse.core.runtime.preferences.IScopeContext;
|
||||||
|
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.jface.text.IRegion;
|
import org.eclipse.jface.text.IRegion;
|
||||||
|
@ -75,6 +79,8 @@ public final class CIndenter {
|
||||||
final boolean prefHasTemplates;
|
final boolean prefHasTemplates;
|
||||||
final String prefTabChar;
|
final String prefTabChar;
|
||||||
|
|
||||||
|
private final IPreferencesService preferenceService;
|
||||||
|
private final IScopeContext[] preferenceContexts;
|
||||||
private final ICProject fProject;
|
private final ICProject fProject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,12 +90,22 @@ public final class CIndenter {
|
||||||
* @return the value of the preference
|
* @return the value of the preference
|
||||||
*/
|
*/
|
||||||
private String getCoreFormatterOption(String key) {
|
private String getCoreFormatterOption(String key) {
|
||||||
if (fProject == null)
|
return getCoreFormatterOption(key, null);
|
||||||
return CCorePlugin.getOption(key);
|
}
|
||||||
return fProject.getOption(key, true);
|
|
||||||
|
private String getCoreFormatterOption(String key, String defaultValue) {
|
||||||
|
return preferenceService.getString(CCorePlugin.PLUGIN_ID, key, defaultValue, preferenceContexts);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getCoreFormatterOption(String key, int defaultValue) {
|
||||||
|
return preferenceService.getInt(CCorePlugin.PLUGIN_ID, key, defaultValue, preferenceContexts);
|
||||||
}
|
}
|
||||||
|
|
||||||
CorePrefs(ICProject project) {
|
CorePrefs(ICProject project) {
|
||||||
|
preferenceService = Platform.getPreferencesService();
|
||||||
|
preferenceContexts = project != null ?
|
||||||
|
new IScopeContext[] { new ProjectScope(project.getProject()), new InstanceScope(), new DefaultScope() } :
|
||||||
|
new IScopeContext[] { new InstanceScope(), new DefaultScope() };
|
||||||
fProject= project;
|
fProject= project;
|
||||||
prefUseTabs= prefUseTabs();
|
prefUseTabs= prefUseTabs();
|
||||||
prefTabSize= prefTabSize();
|
prefTabSize= prefTabSize();
|
||||||
|
@ -345,9 +361,7 @@ public final class CIndenter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int prefAccessSpecifierExtraSpaces() {
|
private int prefAccessSpecifierExtraSpaces() {
|
||||||
// Hidden option that enables fractional indent of access specifiers.
|
return getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_INDENT_ACCESS_SPECIFIER_EXTRA_SPACES, 0);
|
||||||
IPreferencesService prefs = Platform.getPreferencesService();
|
|
||||||
return prefs.getInt(CCorePlugin.PLUGIN_ID, CCorePlugin.PLUGIN_ID + ".formatter.indent_access_specifier_extra_spaces", 0, null); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int prefNamespaceBodyIndent() {
|
private int prefNamespaceBodyIndent() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue