public class LanguageSettingsManager extends Object
ILanguageSettingsProvider
.Constructor and Description |
---|
LanguageSettingsManager() |
Modifier and Type | Method and Description |
---|---|
static List<ILanguageSettingsProvider> |
createLanguageSettingsProviders(String[] ids)
Create a list of providers with intention to assign to a configuration description.
|
static ILanguageSettingsProvider |
getExtensionProviderCopy(String id,
boolean deep)
Get language settings provider defined via extension point
org.eclipse.cdt.core.LanguageSettingsProvider . |
static Set<String> |
getExtensionProviderIds()
Returns list of provider id-s contributed by all extensions.
|
static List<String> |
getLanguages(ICResourceDescription rcDescription)
Find language IDs for the resource represented by resource description.
|
static List<String> |
getLanguages(org.eclipse.core.resources.IResource resource,
ICConfigurationDescription cfgDescription)
Find language IDs for the resource in given build configuration.
|
static ILanguageSettingsEditableProvider |
getProviderCopy(ILanguageSettingsEditableProvider provider,
boolean deep)
Copy language settings provider.
|
static ILanguageSettingsProvider |
getRawProvider(ILanguageSettingsProvider provider)
Helper method to get to real underlying provider collecting entries as opposed to wrapper
which is normally used for workspace provider.
|
static List<ICLanguageSettingEntry> |
getSettingEntriesByKind(ICConfigurationDescription cfgDescription,
org.eclipse.core.resources.IResource rc,
String languageId,
int kind)
Returns the list of setting entries of a certain kind (such as include paths)
for the given configuration description, resource and language.
|
static List<ICLanguageSettingEntry> |
getSettingEntriesUpResourceTree(ILanguageSettingsProvider provider,
ICConfigurationDescription cfgDescription,
org.eclipse.core.resources.IResource rc,
String languageId)
Returns the list of setting entries of the given provider
for the given configuration description, resource and language.
|
static ILanguageSettingsProvider |
getWorkspaceProvider(String id)
Get Language Settings Provider from the list of workspace providers,
see
getWorkspaceProviders() . |
static List<ILanguageSettingsProvider> |
getWorkspaceProviders()
Get Language Settings Providers defined in the workspace.
|
static boolean |
isEqualExtensionProvider(ILanguageSettingsProvider provider,
boolean deep)
Test if the provider is equal to the one defined via extension point
org.eclipse.cdt.core.LanguageSettingsProvider . |
static boolean |
isPreferShared(String id)
Tells if the provider is meant to be shared between projects in workspace
or belong to a specific configuration.
|
static boolean |
isStoringEntriesInProjectArea(LanguageSettingsSerializableProvider provider)
Tells if language settings entries of the provider are persisted with the project
(under .settings/ folder) or in workspace area.
|
static boolean |
isWorkspaceProvider(ILanguageSettingsProvider provider)
Checks if the provider is a workspace level provider.
|
static void |
registerLanguageSettingsChangeListener(ILanguageSettingsChangeListener listener)
Adds a listener that will be notified of changes in language settings.
|
static void |
serializeLanguageSettings(ICProjectDescription prjDescription)
Save language settings providers of a project to persistent storage.
|
static void |
serializeLanguageSettingsInBackground(ICProjectDescription prjDescription)
Save language settings providers of a project to persistent storage in a background job.
|
static void |
serializeLanguageSettingsWorkspace()
Save language settings providers of the workspace (global providers) to persistent storage.
|
static void |
serializeLanguageSettingsWorkspaceInBackground()
Save language settings providers of the workspace (global providers) to persistent storage
in a background job.
|
static void |
setStoringEntriesInProjectArea(LanguageSettingsSerializableProvider provider,
boolean storeEntriesWithProject)
Define where language settings are persisted for the provider.
|
static void |
setWorkspaceProviders(List<ILanguageSettingsProvider> providers)
Set and store in workspace area user defined providers.
|
static void |
unregisterLanguageSettingsChangeListener(ILanguageSettingsChangeListener listener)
Removes a language settings change listener.
|
public static List<ICLanguageSettingEntry> getSettingEntriesByKind(ICConfigurationDescription cfgDescription, org.eclipse.core.resources.IResource rc, String languageId, int kind)
cfgDescription
- - configuration description.rc
- - resource such as file or folder.languageId
- - language id.kind
- - kind of language settings entries, such as
ICSettingEntry.INCLUDE_PATH
etc. This is a binary flag
and it is possible to specify composite kind.
Use ICSettingEntry.ALL
to get all kinds.public static List<ICLanguageSettingEntry> getSettingEntriesUpResourceTree(ILanguageSettingsProvider provider, ICConfigurationDescription cfgDescription, org.eclipse.core.resources.IResource rc, String languageId)
provider
- - language settings provider.cfgDescription
- - configuration description.rc
- - resource such as file or folder.languageId
- - language id.null
although individual providers return null
if no settings defined.public static ILanguageSettingsProvider getWorkspaceProvider(String id)
getWorkspaceProviders()
.id
- - id of provider to find.public static List<ILanguageSettingsProvider> getWorkspaceProviders()
org.eclipse.cdt.core.LanguageSettingsProvider
extension point.
Note that this returns wrappers around workspace provider so underlying
provider could be replaced internally without need to change configuration.
See also getRawProvider(ILanguageSettingsProvider)
.public static boolean isWorkspaceProvider(ILanguageSettingsProvider provider)
getRawProvider(ILanguageSettingsProvider)
are not considered as workspace providers.provider
- - provider to check.true
if the given provider is workspace provider, false
otherwise.public static ILanguageSettingsProvider getRawProvider(ILanguageSettingsProvider provider)
provider
- - the provider to get raw provider for. Can be either workspace provider
or regular one.LanguageSettingsProvidersSerializer.isWorkspaceProvider(ILanguageSettingsProvider)
public static void setWorkspaceProviders(List<ILanguageSettingsProvider> providers) throws org.eclipse.core.runtime.CoreException
providers
- - array of user defined workspace providers.
Note that those providers will shadow extension providers with the same ID.
All not shadowed extension providers will be added to the list to be present
as workspace providers. null
is equivalent to passing an empty array
and so will reset workspace providers to match extension providers.org.eclipse.core.runtime.CoreException
- in case of problems (such as problems with persistence).public static ILanguageSettingsEditableProvider getProviderCopy(ILanguageSettingsEditableProvider provider, boolean deep)
CloneNotSupportedException
but returns null
instead.provider
- - language settings provider to copy.deep
- - true
to request deep copy including copying settings entries
or false
to return shallow copy with no settings entries.public static Set<String> getExtensionProviderIds()
public static ILanguageSettingsProvider getExtensionProviderCopy(String id, boolean deep)
org.eclipse.cdt.core.LanguageSettingsProvider
.
A new copy of the extension provider is returned.id
- - ID of the extension provider.deep
- - true
to request deep copy including copying settings entries
or false
to return shallow copy with no settings entries.ILanguageSettingsEditableProvider
)
or null
if provider is not copyable.public static boolean isEqualExtensionProvider(ILanguageSettingsProvider provider, boolean deep)
org.eclipse.cdt.core.LanguageSettingsProvider
.provider
- - the provider to test.deep
- - true
to check for deep equality testing also settings entries
or false
to test shallow copy with no settings entries.true
if the provider matches the extension or false
otherwise.public static List<String> getLanguages(ICResourceDescription rcDescription)
rcDescription
- - resource descriptionnull
ID.
Never returns null
but empty list if no languages can be found.public static List<String> getLanguages(org.eclipse.core.resources.IResource resource, ICConfigurationDescription cfgDescription)
resource
- - the resource to find languages for.cfgDescription
- null
but empty list if no languages can be found.public static void registerLanguageSettingsChangeListener(ILanguageSettingsChangeListener listener)
listener
- the listener to addpublic static void unregisterLanguageSettingsChangeListener(ILanguageSettingsChangeListener listener)
listener
- the listener to remove.public static boolean isPreferShared(String id)
org.eclipse.cdt.core.LanguageSettingsProvider
extension point.
ILanguageSettingsEditableProvider
can be owned by
a configuration.id
- - ID of the provider to inquire.true
if the provider is designed to be shared,
false
if configuration-owned.public static boolean isStoringEntriesInProjectArea(LanguageSettingsSerializableProvider provider)
provider
- - provider to check the persistence mode.true
if LSE persisted with the project or false
if in the workspace.public static void setStoringEntriesInProjectArea(LanguageSettingsSerializableProvider provider, boolean storeEntriesWithProject)
provider
- - provider to set the persistence mode.storeEntriesWithProject
- - true
if with the project,
false
if in workspace area.public static void serializeLanguageSettings(ICProjectDescription prjDescription) throws org.eclipse.core.runtime.CoreException
prjDescription
- - project description of the project.org.eclipse.core.runtime.CoreException
- if something goes wrong.public static void serializeLanguageSettingsWorkspace() throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
- if something goes wrong.public static void serializeLanguageSettingsInBackground(ICProjectDescription prjDescription)
prjDescription
- - project description of the project.public static void serializeLanguageSettingsWorkspaceInBackground()
public static List<ILanguageSettingsProvider> createLanguageSettingsProviders(String[] ids)
true
and a new copy for those where attribute "prefer-non-shared" is false
. Attribute "prefer-non-shared"
is defined in extension point org.eclipse.cdt.core.LanguageSettingsProvider
.ids
- - list of providers id which cannot be null
.Copyright (c) IBM Corp. and others 2004, 2020. All Rights Reserved.