1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Some clean-up and JavaDoc

This commit is contained in:
Andrew Gvozdev 2011-12-16 12:07:36 -05:00
parent 271e78c6a0
commit 60239b57ca
13 changed files with 343 additions and 355 deletions

View file

@ -270,7 +270,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
@Override @Override
public void registerListener(ICConfigurationDescription cfgDescription) { public void registerListener(ICConfigurationDescription cfgDescription) {
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
LanguageSettingsLogger.logInfo(getPrefixForLog() + "registerListener [" + System.identityHashCode(this) + "] " + this); LanguageSettingsLogger.logInfo(getPrefixForLog() + "registerListener [" + System.identityHashCode(this) + "] " + this);
currentCfgDescription = cfgDescription; currentCfgDescription = cfgDescription;
@ -279,7 +279,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
@Override @Override
public void unregisterListener() { public void unregisterListener() {
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
LanguageSettingsLogger.logInfo(getPrefixForLog() + "unregisterListener [" + System.identityHashCode(this) + "] " + this); LanguageSettingsLogger.logInfo(getPrefixForLog() + "unregisterListener [" + System.identityHashCode(this) + "] " + this);
} }
@ -320,7 +320,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
job.setRule(rule); job.setRule(rule);
job.schedule(); job.schedule();
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
LanguageSettingsLogger.logInfo(getPrefixForLog() + "Execution scheduled [" + System.identityHashCode(this) + "] " + this); LanguageSettingsLogger.logInfo(getPrefixForLog() + "Execution scheduled [" + System.identityHashCode(this) + "] " + this);
} }
@ -463,7 +463,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
if (detectedSettingEntries != null && detectedSettingEntries.size() > 0) { if (detectedSettingEntries != null && detectedSettingEntries.size() > 0) {
collected = detectedSettingEntries.size(); collected = detectedSettingEntries.size();
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
LanguageSettingsLogger.logInfo(getPrefixForLog() LanguageSettingsLogger.logInfo(getPrefixForLog()
+ getClass().getSimpleName() + " collected " + detectedSettingEntries.size() + " entries" + " for language " + currentLanguageId); + getClass().getSimpleName() + " collected " + detectedSettingEntries.size() + " entries" + " for language " + currentLanguageId);

View file

@ -320,7 +320,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
protected void setSettingEntries(List<ICLanguageSettingEntry> entries) { protected void setSettingEntries(List<ICLanguageSettingEntry> entries) {
setSettingEntries(currentCfgDescription, currentResource, currentLanguageId, entries); setSettingEntries(currentCfgDescription, currentResource, currentLanguageId, entries);
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
LanguageSettingsLogger.logInfo(getPrefixForLog() LanguageSettingsLogger.logInfo(getPrefixForLog()
+ getClass().getSimpleName() + " collected " + (entries!=null ? ("" + entries.size()) : "null") + " entries for " + currentResource); + getClass().getSimpleName() + " collected " + (entries!=null ? ("" + entries.size()) : "null") + " entries for " + currentResource);
} }

View file

@ -198,7 +198,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
assertEquals(0, actual.size()); assertEquals(0, actual.size());
} }
{ {
List<ICLanguageSettingEntry> actual = LanguageSettingsManager List<ICLanguageSettingEntry> actual = LanguageSettingsProvidersSerializer
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, 0); .getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, 0);
assertNotNull(actual); assertNotNull(actual);
assertEquals(0, actual.size()); assertEquals(0, actual.size());
@ -226,7 +226,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
assertEquals(1, actual.size()); assertEquals(1, actual.size());
} }
{ {
List<ICLanguageSettingEntry> actual = LanguageSettingsManager List<ICLanguageSettingEntry> actual = LanguageSettingsProvidersSerializer
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, 0); .getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, 0);
assertNotNull(actual); assertNotNull(actual);
assertEquals(0, actual.size()); assertEquals(0, actual.size());
@ -486,14 +486,14 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
cfgDescription.setLanguageSettingProviders(providers); cfgDescription.setLanguageSettingProviders(providers);
// retrieve entries by kind // retrieve entries by kind
List<ICLanguageSettingEntry> includes = LanguageSettingsManager List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH); .getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
assertEquals(new CIncludePathEntry("path0", 0),includes.get(0)); assertEquals(new CIncludePathEntry("path0", 0),includes.get(0));
assertEquals(new CIncludePathEntry("path1", 0),includes.get(1)); assertEquals(new CIncludePathEntry("path1", 0),includes.get(1));
assertEquals(new CIncludePathEntry("path2", 0),includes.get(2)); assertEquals(new CIncludePathEntry("path2", 0),includes.get(2));
assertEquals(3, includes.size()); assertEquals(3, includes.size());
List<ICLanguageSettingEntry> macros = LanguageSettingsManager List<ICLanguageSettingEntry> macros = LanguageSettingsProvidersSerializer
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.MACRO); .getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.MACRO);
assertEquals(new CMacroEntry("MACRO0", "value0",0), macros.get(0)); assertEquals(new CMacroEntry("MACRO0", "value0",0), macros.get(0));
assertEquals(new CMacroEntry("MACRO1", "value1",0), macros.get(1)); assertEquals(new CMacroEntry("MACRO1", "value1",0), macros.get(1));
@ -518,8 +518,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
cfgDescription.setLanguageSettingProviders(providers); cfgDescription.setLanguageSettingProviders(providers);
// retrieve entries by kind, only first entry should be returned // retrieve entries by kind, only first entry should be returned
List<ICLanguageSettingEntry> includes = LanguageSettingsManager List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
assertEquals(1, includes.size()); assertEquals(1, includes.size());
assertEquals(entries.get(0),includes.get(0)); assertEquals(entries.get(0),includes.get(0));
} }
@ -541,7 +540,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
cfgDescription.setLanguageSettingProviders(providers); cfgDescription.setLanguageSettingProviders(providers);
// retrieve entries by kind, no entries should be returned // retrieve entries by kind, no entries should be returned
List<ICLanguageSettingEntry> includes = LanguageSettingsManager List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH); .getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
assertEquals(0, includes.size()); assertEquals(0, includes.size());
} }
@ -619,7 +618,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
cfgDescription.setLanguageSettingProviders(providers); cfgDescription.setLanguageSettingProviders(providers);
// retrieve entries by kind // retrieve entries by kind
List<ICLanguageSettingEntry> includes = LanguageSettingsManager List<ICLanguageSettingEntry> includes = LanguageSettingsProvidersSerializer
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH); .getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH);
// path0 is taken from higher priority provider // path0 is taken from higher priority provider
assertEquals(entriesHigh.get(0),includes.get(0)); assertEquals(entriesHigh.get(0),includes.get(0));
@ -828,7 +827,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
LanguageSettingsSerializableProvider provider = new LanguageSettingsSerializableProvider(PROVIDER_1, PROVIDER_NAME_1); LanguageSettingsSerializableProvider provider = new LanguageSettingsSerializableProvider(PROVIDER_1, PROVIDER_NAME_1);
provider.setSettingEntries(null, file, null, entries); provider.setSettingEntries(null, file, null, entries);
// build the hierarchy // build the hierarchy
LanguageSettingsManager.buildResourceTree(provider, null, null, project); LanguageSettingsProvidersSerializer.buildResourceTree(provider, null, null, project);
// check that entries go to highest possible level // check that entries go to highest possible level
assertEquals(entries, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file, null)); assertEquals(entries, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file, null));
@ -857,7 +856,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
provider.setSettingEntries(null, file1, null, entries1); provider.setSettingEntries(null, file1, null, entries1);
provider.setSettingEntries(null, file2, null, entries2); provider.setSettingEntries(null, file2, null, entries2);
// build the hierarchy // build the hierarchy
LanguageSettingsManager.buildResourceTree(provider, null, null, project); LanguageSettingsProvidersSerializer.buildResourceTree(provider, null, null, project);
// check that entries go to highest possible level // check that entries go to highest possible level
assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file1, null)); assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file1, null));
@ -891,7 +890,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
provider.setSettingEntries(null, file1, null, entries1); provider.setSettingEntries(null, file1, null, entries1);
provider.setSettingEntries(null, file2, null, entries1); provider.setSettingEntries(null, file2, null, entries1);
// build the hierarchy // build the hierarchy
LanguageSettingsManager.buildResourceTree(provider, null, null, project); LanguageSettingsProvidersSerializer.buildResourceTree(provider, null, null, project);
// double-check where the entries go // double-check where the entries go
assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file1, null)); assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file1, null));
assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file2, null)); assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file2, null));
@ -901,7 +900,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
provider.setSettingEntries(null, file2, null, entries2); provider.setSettingEntries(null, file2, null, entries2);
provider.setSettingEntries(null, file3, null, entries2); provider.setSettingEntries(null, file3, null, entries2);
// build the hierarchy // build the hierarchy
LanguageSettingsManager.buildResourceTree(provider, null, null, project); LanguageSettingsProvidersSerializer.buildResourceTree(provider, null, null, project);
// check where the entries go, it should not lose entries for the first file // check where the entries go, it should not lose entries for the first file
assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file1, null)); assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file1, null));
assertEquals(entries2, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file2, null)); assertEquals(entries2, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file2, null));
@ -926,7 +925,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
LanguageSettingsSerializableProvider provider = new LanguageSettingsSerializableProvider(PROVIDER_1, PROVIDER_NAME_1); LanguageSettingsSerializableProvider provider = new LanguageSettingsSerializableProvider(PROVIDER_1, PROVIDER_NAME_1);
provider.setSettingEntries(null, file, LANG_CPP, entries); provider.setSettingEntries(null, file, LANG_CPP, entries);
// build the hierarchy // build the hierarchy
LanguageSettingsManager.buildResourceTree(provider, null, LANG_CPP, project); LanguageSettingsProvidersSerializer.buildResourceTree(provider, null, LANG_CPP, project);
// check that entries go to highest possible level // check that entries go to highest possible level
assertEquals(entries, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file, LANG_CPP)); assertEquals(entries, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file, LANG_CPP));

View file

@ -14,12 +14,11 @@ import java.util.List;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
/** /**
* This interface is to be implemented by providers which want to broadcast the changes in their setting entries * This interface is to be implemented by providers which want to broadcast the changes in their setting entries
* by {@link LanguageSettingsProvidersSerializer#notifyLanguageSettingsChangeListeners(ILanguageSettingsChangeEvent)} * with {@link ILanguageSettingsChangeEvent}.
*/ */
public interface ILanguageSettingsBroadcastingProvider extends ILanguageSettingsProvider { public interface ILanguageSettingsBroadcastingProvider extends ILanguageSettingsProvider {
@Override @Override

View file

@ -14,13 +14,14 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
/** /**
* Contains the details of changes that occurred as a result of modifying * Contains the details of changes that occurred as a result of modifying
* language settings entries {@link ICLanguageSettingEntry}. The event is * language settings entries {@link ICLanguageSettingEntry}. This event is
* associated with a project. * intended to be fired for changes in entries, not necessarily providers.
* The event is associated with a project.
* *
* <p> * <p>
* <strong>EXPERIMENTAL</strong>. This class interface is not stable yet as * <strong>EXPERIMENTAL</strong>. This class interface is not stable yet as
* it is not currently clear how it may need to be used in future. Only bare * it is not currently clear how it may need to be used in future. Only bare
* minimum is provided here at this point (CDT 9.0). * minimum is provided here at this point (CDT 9.0, Juno).
* There is no guarantee that this API will work or that it will remain the same. * There is no guarantee that this API will work or that it will remain the same.
* Please do not use this API without consulting with the CDT team. * Please do not use this API without consulting with the CDT team.
* </p> * </p>

View file

@ -24,11 +24,9 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICResourceDescription; import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager; import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer; import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -42,7 +40,7 @@ public class LanguageSettingsManager {
* Returns the list of setting entries of the given provider * Returns the list of setting entries of the given provider
* for the given configuration description, resource and language. * for the given configuration description, resource and language.
* This method reaches to the parent folder of the resource recursively * This method reaches to the parent folder of the resource recursively
* in case the resource does not define the entries for the given provider. * if the resource does not define the entries for the given provider.
* *
* @param provider - language settings provider. * @param provider - language settings provider.
* @param cfgDescription - configuration description. * @param cfgDescription - configuration description.
@ -57,51 +55,8 @@ public class LanguageSettingsManager {
} }
/** /**
* Builds for the provider a nice looking resource tree to present hierarchical view to the user. * Get Language Settings Provider from the list of workspace providers,
* * see {@link #getWorkspaceProviders()}.
* TODO - Note that after using this method for a while for BOP parsers it appears that disadvantages
* outweigh benefits. In particular, it doesn't result in saving memory as the language settings
* (and the lists itself) are not duplicated in memory anyway but optimized with using WeakHashSet
* and SafeStringInterner.
*
* @param provider - language settings provider to build the tree for.
* @param cfgDescription - configuration description.
* @param languageId - language ID.
* @param project - the project which is considered the root of the resource tree.
*/
public static void buildResourceTree(LanguageSettingsSerializableProvider provider,
ICConfigurationDescription cfgDescription, String languageId, IProject project) {
LanguageSettingsProvidersSerializer.buildResourceTree(provider, cfgDescription, languageId, project);
}
/**
* Returns the list of setting entries of a certain kind (such as include paths)
* for the given configuration description, resource and language. This is a
* combined list for all providers taking into account settings of parent folder
* if settings for the given resource are not defined.
*
* @param cfgDescription - configuration description.
* @param rc - resource such as file or folder.
* @param languageId - language id.
* @param kind - kind of language settings entries, such as
* {@link ICSettingEntry#INCLUDE_PATH} etc. This is a binary flag
* and it is possible to specify composite kind.
* Use {@link ICSettingEntry#ALL} to get all kinds.
*
* @return the list of setting entries.
*/
// FIXME: get rid of callers PathEntryTranslator and DescriptionScannerInfoProvider
public static List<ICLanguageSettingEntry> getSettingEntriesByKind(ICConfigurationDescription cfgDescription, IResource rc, String languageId, int kind) {
return LanguageSettingsProvidersSerializer.getSettingEntriesByKind(cfgDescription, rc, languageId, kind);
}
/**
* Get Language Settings Provider defined in the workspace. That includes user-defined
* providers and after that providers defined as extensions via
* {@code org.eclipse.cdt.core.LanguageSettingsProvider} extension point.
* That returns actual object, any modifications will affect any configuration
* referring to the provider.
* *
* @param id - id of provider to find. * @param id - id of provider to find.
* @return the provider or {@code null} if provider is not defined. * @return the provider or {@code null} if provider is not defined.
@ -111,10 +66,14 @@ public class LanguageSettingsManager {
} }
/** /**
* @return a list of language settings providers defined on workspace level. * Get Language Settings Providers defined in the workspace. That includes
* That includes user-defined providers and after that providers defined as * user-defined providers and after that providers defined as extensions via
* extensions via {@code org.eclipse.cdt.core.LanguageSettingsProvider} * {@code org.eclipse.cdt.core.LanguageSettingsProvider} extension point.
* extension point. * Note that this returns wrappers around workspace provider so underlying
* provider could be replaced internally without need to change configuration.
* See also {@link #getRawProvider(ILanguageSettingsProvider)}.
*
* @return list of workspace providers.
*/ */
public static List<ILanguageSettingsProvider> getWorkspaceProviders() { public static List<ILanguageSettingsProvider> getWorkspaceProviders() {
return LanguageSettingsProvidersSerializer.getWorkspaceProviders(); return LanguageSettingsProvidersSerializer.getWorkspaceProviders();
@ -344,5 +303,4 @@ public class LanguageSettingsManager {
public static void serializeLanguageSettingsWorkspace() throws CoreException { public static void serializeLanguageSettingsWorkspace() throws CoreException {
LanguageSettingsProvidersSerializer.serializeLanguageSettingsWorkspace(); LanguageSettingsProvidersSerializer.serializeLanguageSettingsWorkspace();
} }
} }

View file

@ -26,7 +26,6 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.cdtvariables.CdtVariableException; import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
import org.eclipse.cdt.core.cdtvariables.ICdtVariable; import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager; import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport; import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
@ -71,6 +70,7 @@ import org.eclipse.cdt.internal.core.cdtvariables.CoreVariableSubstitutor;
import org.eclipse.cdt.internal.core.cdtvariables.DefaultVariableContextInfo; import org.eclipse.cdt.internal.core.cdtvariables.DefaultVariableContextInfo;
import org.eclipse.cdt.internal.core.cdtvariables.ICoreVariableContextInfo; import org.eclipse.cdt.internal.core.cdtvariables.ICoreVariableContextInfo;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsLogger; import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsLogger;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
import org.eclipse.cdt.internal.core.model.APathEntry; import org.eclipse.cdt.internal.core.model.APathEntry;
import org.eclipse.cdt.internal.core.model.CModelStatus; import org.eclipse.cdt.internal.core.model.CModelStatus;
import org.eclipse.cdt.internal.core.model.PathEntry; import org.eclipse.cdt.internal.core.model.PathEntry;
@ -2041,7 +2041,7 @@ public class PathEntryTranslator {
public boolean visit(PathSettingsContainer container) { public boolean visit(PathSettingsContainer container) {
CResourceData data = (CResourceData)container.getValue(); CResourceData data = (CResourceData)container.getValue();
if (data != null) { if (data != null) {
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
temporaryLog(des, kinds, data); temporaryLog(des, kinds, data);
PathEntryCollector child = cr.createChild(container.getPath()); PathEntryCollector child = cr.createChild(container.getPath());
@ -2056,7 +2056,7 @@ public class PathEntryTranslator {
return true; return true;
} }
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
@Deprecated @Deprecated
private void temporaryLog(final ICConfigurationDescription des, final int[] kinds, CResourceData data) { private void temporaryLog(final ICConfigurationDescription des, final int[] kinds, CResourceData data) {
String kindsStr=""; String kindsStr="";
@ -2099,7 +2099,7 @@ public class PathEntryTranslator {
if (ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project)) { if (ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project)) {
IResource rc = getResource(project, data.getPath()); IResource rc = getResource(project, data.getPath());
for (CLanguageData lData : lDatas) { for (CLanguageData lData : lDatas) {
list.addAll(LanguageSettingsManager.getSettingEntriesByKind(des, rc, lData.getLanguageId(), kind)); list.addAll(LanguageSettingsProvidersSerializer.getSettingEntriesByKind(des, rc, lData.getLanguageId(), kind));
} }
return list.size()>0; return list.size()>0;

View file

@ -24,7 +24,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
* <p> * <p>
* <strong>EXPERIMENTAL</strong>. This class interface is not stable yet as * <strong>EXPERIMENTAL</strong>. This class interface is not stable yet as
* it is not currently clear how it may need to be used in future. Only bare * it is not currently clear how it may need to be used in future. Only bare
* minimum is provided here at this point (CDT 9.0). * minimum is provided here at this point (CDT 9.0, Juno).
* There is no guarantee that this API will work or that it will remain the same. * There is no guarantee that this API will work or that it will remain the same.
* Please do not use this API without consulting with the CDT team. * Please do not use this API without consulting with the CDT team.
* </p> * </p>

View file

@ -9,7 +9,7 @@ import org.eclipse.core.runtime.Status;
/** /**
* AG FIXME -Temporary class for logging language settings providers development. * AG FIXME -Temporary class for logging language settings providers development.
* To remove before CDT 9.0 release * To remove before CDT Juno release
* *
*/ */
@Deprecated @Deprecated

View file

@ -71,7 +71,7 @@ public class LanguageSettingsProvidersSerializer {
public static final String ELEM_PROVIDER = LanguageSettingsExtensionManager.ELEM_PROVIDER; public static final String ELEM_PROVIDER = LanguageSettingsExtensionManager.ELEM_PROVIDER;
public static final String ELEM_LANGUAGE_SCOPE = LanguageSettingsExtensionManager.ELEM_LANGUAGE_SCOPE; public static final String ELEM_LANGUAGE_SCOPE = LanguageSettingsExtensionManager.ELEM_LANGUAGE_SCOPE;
private static final String PREFERENCE_WORSPACE_PROVIDERS_SET = "language.settings.providers.set.for.workspace"; //$NON-NLS-1$ private static final String PREFERENCE_WORSPACE_PROVIDERS_SET = "language.settings.providers.workspace.prefs.toggle"; //$NON-NLS-1$
private static final String STORAGE_WORKSPACE_LANGUAGE_SETTINGS = "language.settings.xml"; //$NON-NLS-1$ private static final String STORAGE_WORKSPACE_LANGUAGE_SETTINGS = "language.settings.xml"; //$NON-NLS-1$
private static final String SETTINGS_FOLDER_NAME = ".settings/"; //$NON-NLS-1$ private static final String SETTINGS_FOLDER_NAME = ".settings/"; //$NON-NLS-1$
private static final String STORAGE_PROJECT_LANGUAGE_SETTINGS = "language.settings.xml"; //$NON-NLS-1$ private static final String STORAGE_PROJECT_LANGUAGE_SETTINGS = "language.settings.xml"; //$NON-NLS-1$
@ -87,13 +87,13 @@ public class LanguageSettingsProvidersSerializer {
private static final String VALUE_WORKSPACE = "workspace"; //$NON-NLS-1$ private static final String VALUE_WORKSPACE = "workspace"; //$NON-NLS-1$
private static final String VALUE_PROJECT = "project"; //$NON-NLS-1$ private static final String VALUE_PROJECT = "project"; //$NON-NLS-1$
private static ILock serializingLock = Job.getJobManager().newLock(); /** Cache of true (raw) workspace providers */
/** Cache of globally available providers to be consumed by calling clients */
private static Map<String, ILanguageSettingsProvider> rawGlobalWorkspaceProviders = new HashMap<String, ILanguageSettingsProvider>(); private static Map<String, ILanguageSettingsProvider> rawGlobalWorkspaceProviders = new HashMap<String, ILanguageSettingsProvider>();
/** Cache of workspace providers wrappers */
private static Map<String, ILanguageSettingsProvider> globalWorkspaceProviders = new HashMap<String, ILanguageSettingsProvider>(); private static Map<String, ILanguageSettingsProvider> globalWorkspaceProviders = new HashMap<String, ILanguageSettingsProvider>();
private static ListenerList fLanguageSettingsChangeListeners = new ListenerList(ListenerList.IDENTITY); private static ListenerList fLanguageSettingsChangeListeners = new ListenerList(ListenerList.IDENTITY);
private static ILock serializingLock = Job.getJobManager().newLock();
/** /**
* language settings provider listener-cfgDescription association * language settings provider listener-cfgDescription association
@ -269,11 +269,35 @@ public class LanguageSettingsProvidersSerializer {
try { try {
loadLanguageSettingsWorkspace(); loadLanguageSettingsWorkspace();
} catch (Throwable e) { } catch (Throwable e) {
// log and swallow any exception // log but swallow any exception
CCorePlugin.log("Error loading workspace language settings providers", e); //$NON-NLS-1$ CCorePlugin.log("Error loading workspace language settings providers", e); //$NON-NLS-1$
} }
} }
/**
* Tells if language settings entries of the provider are persisted with the project
* (under .settings/ folder) or in workspace area. Persistence in the project area lets
* the entries migrate with the project.
*
* @param provider - provider to check the persistence mode.
* @return {@code true} if LSE persisted with the project or {@code false} if in the workspace.
*/
public static boolean isStoringEntriesInProjectArea(LanguageSettingsSerializableProvider provider) {
String value = provider.getProperty(ATTR_STORE_ENTRIES);
return VALUE_PROJECT.equals(value);
}
/**
* Define where language settings are persisted for the provider.
*
* @param provider - provider to set the persistence mode.
* @param storeEntriesWithProject - {@code true} if with the project,
* {@code false} if in workspace area.
*/
public static void setStoringEntriesInProjectArea(LanguageSettingsSerializableProvider provider, boolean storeEntriesWithProject) {
provider.setProperty(ATTR_STORE_ENTRIES, storeEntriesWithProject ? VALUE_PROJECT : VALUE_WORKSPACE);
}
/** /**
* Determine location of the project store of language settings providers in the plug-in state area. * Determine location of the project store of language settings providers in the plug-in state area.
* *
@ -309,7 +333,7 @@ public class LanguageSettingsProvidersSerializer {
public static void setWorkspaceProviders(List<ILanguageSettingsProvider> providers) throws CoreException { public static void setWorkspaceProviders(List<ILanguageSettingsProvider> providers) throws CoreException {
setWorkspaceProvidersInternal(providers); setWorkspaceProvidersInternal(providers);
serializeLanguageSettingsWorkspace(); serializeLanguageSettingsWorkspace();
// generate preference change event // generate preference change event for preference change listeners (value is not intended to be used)
IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID); IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
prefs.putBoolean(PREFERENCE_WORSPACE_PROVIDERS_SET, ! prefs.getBoolean(PREFERENCE_WORSPACE_PROVIDERS_SET, false)); prefs.putBoolean(PREFERENCE_WORSPACE_PROVIDERS_SET, ! prefs.getBoolean(PREFERENCE_WORSPACE_PROVIDERS_SET, false));
} }
@ -437,7 +461,7 @@ public class LanguageSettingsProvidersSerializer {
* @throws CoreException * @throws CoreException
*/ */
public static void serializeLanguageSettingsWorkspace() throws CoreException { public static void serializeLanguageSettingsWorkspace() throws CoreException {
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
LanguageSettingsLogger.logWarning("LanguageSettingsProvidersSerializer.serializeLanguageSettingsWorkspace()"); LanguageSettingsLogger.logWarning("LanguageSettingsProvidersSerializer.serializeLanguageSettingsWorkspace()");
URI uriStoreWsp = getStoreInWorkspaceArea(STORAGE_WORKSPACE_LANGUAGE_SETTINGS); URI uriStoreWsp = getStoreInWorkspaceArea(STORAGE_WORKSPACE_LANGUAGE_SETTINGS);
@ -540,8 +564,7 @@ public class LanguageSettingsProvidersSerializer {
* @noreference This method is not intended to be referenced by clients. * @noreference This method is not intended to be referenced by clients.
* It is public solely for benefit of JUnit testing. * It is public solely for benefit of JUnit testing.
*/ */
public static void serializeLanguageSettingsInternal(Element projectElementPrjStore, Element projectElementWspStore, ICProjectDescription prjDescription) throws CoreException { public static void serializeLanguageSettingsInternal(Element projectElementPrjStore, Element projectElementWspStore, ICProjectDescription prjDescription) {
ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations(); ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations();
for (ICConfigurationDescription cfgDescription : cfgDescriptions) { for (ICConfigurationDescription cfgDescription : cfgDescriptions) {
if (!(cfgDescription instanceof ILanguageSettingsProvidersKeeper)) if (!(cfgDescription instanceof ILanguageSettingsProvidersKeeper))
@ -552,11 +575,13 @@ public class LanguageSettingsProvidersSerializer {
ATTR_NAME, cfgDescription.getName(), ATTR_NAME, cfgDescription.getName(),
}); });
Element elementConfigurationWsp = null; Element elementConfigurationWsp = null;
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders(); List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
if (providers.size()>0) { if (providers.size()>0) {
Element elementExtension = XmlUtil.appendElement(elementConfiguration, ELEM_EXTENSION, new String[] { Element elementExtension = XmlUtil.appendElement(elementConfiguration, ELEM_EXTENSION, new String[] {
ATTR_EXTENSION_POINT, PROVIDER_EXTENSION_POINT_ID}); ATTR_EXTENSION_POINT, PROVIDER_EXTENSION_POINT_ID});
Element elementExtensionWsp = null; Element elementExtensionWsp = null;
for (ILanguageSettingsProvider provider : providers) { for (ILanguageSettingsProvider provider : providers) {
if (isWorkspaceProvider(provider)) { if (isWorkspaceProvider(provider)) {
// Element elementProviderReference = // Element elementProviderReference =
@ -565,15 +590,14 @@ public class LanguageSettingsProvidersSerializer {
continue; continue;
} }
if (provider instanceof LanguageSettingsSerializableProvider) { if (provider instanceof LanguageSettingsSerializableProvider) {
try {
LanguageSettingsSerializableProvider lss = (LanguageSettingsSerializableProvider) provider; LanguageSettingsSerializableProvider lss = (LanguageSettingsSerializableProvider) provider;
boolean useWsp = projectElementWspStore!=null && projectElementPrjStore!=projectElementWspStore; boolean isWspStorageAvailable = (projectElementWspStore != null) && (projectElementPrjStore != projectElementWspStore);
if (isStoringEntriesInProjectArea(lss) || !useWsp) { if (isStoringEntriesInProjectArea(lss) || !isWspStorageAvailable) {
lss.serialize(elementExtension); lss.serialize(elementExtension);
} else { } else {
lss.serializeAttributes(elementExtension); // lazy initialization of wsp storage elements - to avoid serialization of no-data file
// lazy initialization of elements - to avoid serialization of no-data file
if (elementExtensionWsp == null) { if (elementExtensionWsp == null) {
if (elementConfigurationWsp == null) { if (elementConfigurationWsp == null) {
elementConfigurationWsp = XmlUtil.appendElement(projectElementWspStore, ELEM_CONFIGURATION, new String[] { elementConfigurationWsp = XmlUtil.appendElement(projectElementWspStore, ELEM_CONFIGURATION, new String[] {
@ -586,8 +610,15 @@ public class LanguageSettingsProvidersSerializer {
} }
Element elementProviderWsp = XmlUtil.appendElement(elementExtensionWsp, ELEM_PROVIDER, new String[] { Element elementProviderWsp = XmlUtil.appendElement(elementExtensionWsp, ELEM_PROVIDER, new String[] {
ATTR_ID, provider.getId()}); ATTR_ID, provider.getId()});
// split storage
lss.serializeAttributes(elementExtension);
lss.serializeEntries(elementProviderWsp); lss.serializeEntries(elementProviderWsp);
} }
} catch (Throwable e) {
// protect from any exceptions from implementers
CCorePlugin.log("Exception trying serialize provider "+provider.getId(), e); //$NON-NLS-1$
}
} else { } else {
// Element elementProvider = // Element elementProvider =
XmlUtil.appendElement(elementExtension, ELEM_PROVIDER, new String[] { XmlUtil.appendElement(elementExtension, ELEM_PROVIDER, new String[] {
@ -609,10 +640,13 @@ public class LanguageSettingsProvidersSerializer {
*/ */
public static void serializeLanguageSettings(ICProjectDescription prjDescription) throws CoreException { public static void serializeLanguageSettings(ICProjectDescription prjDescription) throws CoreException {
IProject project = prjDescription.getProject(); IProject project = prjDescription.getProject();
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
LanguageSettingsLogger.logWarning("LanguageSettingsProvidersSerializer.serializeLanguageSettings() for " + project); LanguageSettingsLogger.logWarning("LanguageSettingsProvidersSerializer.serializeLanguageSettings() for " + project);
try { try {
// The storage could be split in two, one for provider properties, another one for entries,
// depending on provider flag
// Document to store in project area // Document to store in project area
Document docStorePrj = XmlUtil.newDocument(); Document docStorePrj = XmlUtil.newDocument();
Element projectElementStorePrj = XmlUtil.appendElement(docStorePrj, ELEM_PROJECT); Element projectElementStorePrj = XmlUtil.appendElement(docStorePrj, ELEM_PROJECT);
@ -620,7 +654,7 @@ public class LanguageSettingsProvidersSerializer {
Document docStoreWsp = XmlUtil.newDocument(); Document docStoreWsp = XmlUtil.newDocument();
Element projectElementStoreWsp = XmlUtil.appendElement(docStoreWsp, ELEM_PROJECT); Element projectElementStoreWsp = XmlUtil.appendElement(docStoreWsp, ELEM_PROJECT);
// The project store should not be absent. Absent store means legacy project, not 0 providers. // The project store should not be absent. Currently absent store means legacy project, not 0 providers.
IFile fileStorePrj = getStoreInProjectArea(project); IFile fileStorePrj = getStoreInProjectArea(project);
URI uriStoreWsp = getStoreInWorkspaceArea(project.getName()+'.'+STORAGE_WORKSPACE_LANGUAGE_SETTINGS); URI uriStoreWsp = getStoreInWorkspaceArea(project.getName()+'.'+STORAGE_WORKSPACE_LANGUAGE_SETTINGS);
@ -629,17 +663,17 @@ public class LanguageSettingsProvidersSerializer {
try { try {
serializingLock.acquire(); serializingLock.acquire();
// Note that need for serialization may exist even if LSE event delta is empty, // Note that need for serialization may exist even if LS *entries* event delta is empty,
// as number or properties of providers may differ // as set of providers or their properties may differ
serializeLanguageSettingsInternal(projectElementStorePrj, projectElementStoreWsp, prjDescription); serializeLanguageSettingsInternal(projectElementStorePrj, projectElementStoreWsp, prjDescription);
XmlUtil.serializeXml(docStorePrj, fileStorePrj); XmlUtil.serializeXml(docStorePrj, fileStorePrj);
// project-specific location in workspace area // project-specific location in workspace area
boolean isWorkspaceStoreEmpty = projectElementStoreWsp.getChildNodes().getLength() == 0; boolean isWorkspaceStoreEmpty = projectElementStoreWsp.getChildNodes().getLength() == 0;
if (!isWorkspaceStoreEmpty) { if (isWorkspaceStoreEmpty) {
XmlUtil.serializeXml(docStoreWsp, uriStoreWsp);
} else {
new java.io.File(uriStoreWsp).delete(); new java.io.File(uriStoreWsp).delete();
} else {
XmlUtil.serializeXml(docStoreWsp, uriStoreWsp);
} }
// manufacture the event only if serialization was successful // manufacture the event only if serialization was successful
@ -679,32 +713,29 @@ public class LanguageSettingsProvidersSerializer {
NodeList configurationNodes = projectElementPrj.getChildNodes(); NodeList configurationNodes = projectElementPrj.getChildNodes();
for (int ic = 0; ic < configurationNodes.getLength(); ic++) { for (int ic = 0; ic < configurationNodes.getLength(); ic++) {
Node cfgNode = configurationNodes.item(ic); Node cfgNode = configurationNodes.item(ic);
if (!(cfgNode instanceof Element && cfgNode.getNodeName().equals(ELEM_CONFIGURATION)) ) if (!isElementWithName(cfgNode, ELEM_CONFIGURATION)) {
continue; continue;
}
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>(); List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
String cfgId = XmlUtil.determineAttributeValue(cfgNode, ATTR_ID); String cfgId = XmlUtil.determineAttributeValue(cfgNode, ATTR_ID);
@SuppressWarnings("unused")
String cfgName = XmlUtil.determineAttributeValue(cfgNode, ATTR_NAME);
NodeList extensionAndReferenceNodes = cfgNode.getChildNodes(); NodeList extensionNodes = cfgNode.getChildNodes();
for (int ie=0;ie<extensionAndReferenceNodes.getLength();ie++) { for (int ie = 0; ie < extensionNodes.getLength(); ie++) {
Node extNode = extensionAndReferenceNodes.item(ie); Node extNode = extensionNodes.item(ie);
if (!(extNode instanceof Element)) if (!isElementWithName(extNode, ELEM_EXTENSION)) {
continue; continue;
}
if (extNode.getNodeName().equals(ELEM_EXTENSION)) {
NodeList providerNodes = extNode.getChildNodes(); NodeList providerNodes = extNode.getChildNodes();
for (int ip = 0; ip < providerNodes.getLength(); ip++) {
for (int i=0;i<providerNodes.getLength();i++) {
Node providerNode = providerNodes.item(i);
if (!(providerNode instanceof Element))
continue;
ILanguageSettingsProvider provider = null; ILanguageSettingsProvider provider = null;
if (providerNode.getNodeName().equals(ELEM_PROVIDER_REFERENCE)) {
Node providerNode = providerNodes.item(ip);
if (isElementWithName(providerNode, ELEM_PROVIDER_REFERENCE)) {
String providerId = XmlUtil.determineAttributeValue(providerNode, ATTR_ID); String providerId = XmlUtil.determineAttributeValue(providerNode, ATTR_ID);
provider = getWorkspaceProvider(providerId); provider = getWorkspaceProvider(providerId);
} else if (providerNode.getNodeName().equals(ELEM_PROVIDER)) { } else if (isElementWithName(providerNode, ELEM_PROVIDER)) {
provider = loadProvider(providerNode); provider = loadProvider(providerNode);
if (provider instanceof LanguageSettingsSerializableProvider) { if (provider instanceof LanguageSettingsSerializableProvider) {
LanguageSettingsSerializableProvider lss = (LanguageSettingsSerializableProvider) provider; LanguageSettingsSerializableProvider lss = (LanguageSettingsSerializableProvider) provider;
@ -718,7 +749,6 @@ public class LanguageSettingsProvidersSerializer {
} }
} }
} }
}
ICConfigurationDescription cfgDescription = prjDescription.getConfigurationById(cfgId); ICConfigurationDescription cfgDescription = prjDescription.getConfigurationById(cfgId);
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
@ -734,8 +764,18 @@ public class LanguageSettingsProvidersSerializer {
} }
} }
/**
* Check if the node is {@code Element} and that the name matches.
*/
private static boolean isElementWithName(Node cfgNode, String name) {
return cfgNode instanceof Element && cfgNode.getNodeName().equals(name);
}
/**
* Load provider entries for the given configuration from XML Element.
*/
private static void loadProviderEntries(LanguageSettingsSerializableProvider provider, private static void loadProviderEntries(LanguageSettingsSerializableProvider provider,
String cfgId, Element projectElementWsp) { String cfgId, Element projectElement) {
/* /*
<project> <project>
<configuration id="cfg.id"> <configuration id="cfg.id">
@ -746,52 +786,51 @@ public class LanguageSettingsProvidersSerializer {
</configuration> </configuration>
</project> </project>
*/ */
NodeList configurationNodes = projectElementWsp.getChildNodes(); NodeList configurationNodes = projectElement.getChildNodes();
for (int ic = 0; ic < configurationNodes.getLength(); ic++) { for (int ic = 0; ic < configurationNodes.getLength(); ic++) {
Node cfgNode = configurationNodes.item(ic); Node cfgNode = configurationNodes.item(ic);
if (!(cfgNode instanceof Element && cfgNode.getNodeName().equals(ELEM_CONFIGURATION)) ) if (!isElementWithName(cfgNode, ELEM_CONFIGURATION)) {
continue; continue;
}
String cfgIdXml = XmlUtil.determineAttributeValue(cfgNode, ATTR_ID); String cfgIdXml = XmlUtil.determineAttributeValue(cfgNode, ATTR_ID);
if (!cfgId.equals(cfgIdXml)) if (!cfgId.equals(cfgIdXml)) {
continue; continue;
}
NodeList extensionAndReferenceNodes = cfgNode.getChildNodes(); NodeList extensionNodes = cfgNode.getChildNodes();
for (int ie=0;ie<extensionAndReferenceNodes.getLength();ie++) { for (int ie = 0; ie < extensionNodes.getLength(); ie++) {
Node extNode = extensionAndReferenceNodes.item(ie); Node extNode = extensionNodes.item(ie);
if (!(extNode instanceof Element)) if (!isElementWithName(extNode, ELEM_EXTENSION)) {
continue; continue;
}
if (extNode.getNodeName().equals(ELEM_EXTENSION)) {
NodeList providerNodes = extNode.getChildNodes(); NodeList providerNodes = extNode.getChildNodes();
for (int ip = 0; ip < providerNodes.getLength(); ip++) {
Node providerNode = providerNodes.item(ip);
if (!isElementWithName(providerNode, ELEM_PROVIDER)) {
continue;
}
for (int i=0;i<providerNodes.getLength();i++) { String id = XmlUtil.determineAttributeValue(providerNode, ATTR_ID);
Node providerNode = providerNodes.item(i); if (provider.getId().equals(id)) {
if (!(providerNode instanceof Element))
continue;
if (!providerNode.getNodeName().equals(ELEM_PROVIDER))
continue;
String providerIdXml = XmlUtil.determineAttributeValue(providerNode, ATTR_ID);
if (!provider.getId().equals(providerIdXml))
continue;
provider.loadEntries((Element) providerNode); provider.loadEntries((Element) providerNode);
return; return;
} }
} }
} }
} }
} }
/**
* Load provider from provider node.
*/
private static ILanguageSettingsProvider loadProvider(Node providerNode) { private static ILanguageSettingsProvider loadProvider(Node providerNode) {
String attrClass = XmlUtil.determineAttributeValue(providerNode, ATTR_CLASS); String attrClass = XmlUtil.determineAttributeValue(providerNode, ATTR_CLASS);
ILanguageSettingsProvider provider = LanguageSettingsExtensionManager.instantiateProviderClass(attrClass); ILanguageSettingsProvider provider = LanguageSettingsExtensionManager.instantiateProviderClass(attrClass);
if (provider instanceof LanguageSettingsSerializableProvider) if (provider instanceof LanguageSettingsSerializableProvider) {
((LanguageSettingsSerializableProvider)provider).load((Element) providerNode); ((LanguageSettingsSerializableProvider)provider).load((Element) providerNode);
}
return provider; return provider;
} }
@ -801,19 +840,20 @@ public class LanguageSettingsProvidersSerializer {
*/ */
public static void loadLanguageSettings(ICProjectDescription prjDescription) { public static void loadLanguageSettings(ICProjectDescription prjDescription) {
IProject project = prjDescription.getProject(); IProject project = prjDescription.getProject();
IFile storePrj = project.getFile(SETTINGS_FOLDER_NAME+STORAGE_PROJECT_LANGUAGE_SETTINGS); IFile storeInPrjArea = project.getFile(SETTINGS_FOLDER_NAME + STORAGE_PROJECT_LANGUAGE_SETTINGS);
// AG: FIXME not sure about that one // AG: FIXME investigate this one
// Causes java.lang.IllegalArgumentException: Attempted to beginRule: P/cdt312, does not match outer scope rule: org.eclipse.cdt.internal.ui.text.c.hover.CSourceHover$SingletonRule@6f34fb // Causes java.lang.IllegalArgumentException: Attempted to beginRule: P/cdt312, does not match outer scope rule: org.eclipse.cdt.internal.ui.text.c.hover.CSourceHover$SingletonRule@6f34fb
try { try {
storePrj.refreshLocal(IResource.DEPTH_ZERO, null); storeInPrjArea.refreshLocal(IResource.DEPTH_ZERO, null);
} catch (CoreException e) { } catch (CoreException e) {
// ignore failure // ignore failure
CCorePlugin.log(e);
} }
if (storePrj.exists() && storePrj.isAccessible()) { if (storeInPrjArea.exists()) {
Document doc = null; Document doc = null;
try { try {
doc = XmlUtil.loadXml(storePrj); doc = XmlUtil.loadXml(storeInPrjArea);
Element rootElementPrj = doc.getDocumentElement(); // <project/> Element rootElementPrj = doc.getDocumentElement(); // <project>
URI uriStoreWsp = getStoreInWorkspaceArea(project.getName()+'.'+STORAGE_WORKSPACE_LANGUAGE_SETTINGS); URI uriStoreWsp = getStoreInWorkspaceArea(project.getName()+'.'+STORAGE_WORKSPACE_LANGUAGE_SETTINGS);
Document docWsp = null; Document docWsp = null;
@ -824,18 +864,14 @@ public class LanguageSettingsProvidersSerializer {
serializingLock.release(); serializingLock.release();
} }
Element rootElementWsp = null; // <project/> Element rootElementWsp = null; // <project>
if (docWsp != null) { if (docWsp != null) {
rootElementWsp = docWsp.getDocumentElement(); rootElementWsp = docWsp.getDocumentElement();
} }
loadLanguageSettingsInternal(rootElementPrj, rootElementWsp, prjDescription); loadLanguageSettingsInternal(rootElementPrj, rootElementWsp, prjDescription);
} catch (Exception e) { } catch (Exception e) {
CCorePlugin.log("Can't load preferences from file "+storePrj.getLocation(), e); //$NON-NLS-1$ CCorePlugin.log("Can't load preferences from file " + storeInPrjArea.getLocation(), e); //$NON-NLS-1$
}
if (doc!=null) {
} }
} else { } else {
@ -854,11 +890,8 @@ public class LanguageSettingsProvidersSerializer {
} }
/** /**
* FIXME Get Language Settings Provider defined in the workspace. That includes user-defined * Get Language Settings Provider from the list of workspace providers,
* providers and after that providers defined as extensions via * see {@link #getWorkspaceProviders()}.
* {@code org.eclipse.cdt.core.LanguageSettingsProvider} extension point.
* That returns actual object, any modifications will affect any configuration
* referring to the provider.
* *
* @param id - ID of provider to find. * @param id - ID of provider to find.
* @return the provider or {@code null} if provider is not defined. * @return the provider or {@code null} if provider is not defined.
@ -873,9 +906,9 @@ public class LanguageSettingsProvidersSerializer {
} }
/** /**
* Helper method to get to real underlying provider collecting entries as opposed to wrapper * Helper method to get to real underlying provider collecting entries as opposed
* which is normally used for workspace provider. * to wrapper which is normally used for workspace provider.
* @see LanguageSettingsProvidersSerializer#isWorkspaceProvider(ILanguageSettingsProvider) * @see #isWorkspaceProvider(ILanguageSettingsProvider)
* *
* @param id - ID of the provider. * @param id - ID of the provider.
* @return raw underlying provider. * @return raw underlying provider.
@ -885,9 +918,14 @@ public class LanguageSettingsProvidersSerializer {
} }
/** /**
* TODO * Get Language Settings Providers defined in the workspace. That includes
* @return ordered set of providers defined in the workspace which include contributed through extension + user defined ones * user-defined providers and after that providers defined as extensions via
* {@code 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 {@link #getRawWorkspaceProvider(String)}.
* *
* @return list of workspace providers.
*/ */
public static List<ILanguageSettingsProvider> getWorkspaceProviders() { public static List<ILanguageSettingsProvider> getWorkspaceProviders() {
ArrayList<ILanguageSettingsProvider> workspaceProviders = new ArrayList<ILanguageSettingsProvider>(); ArrayList<ILanguageSettingsProvider> workspaceProviders = new ArrayList<ILanguageSettingsProvider>();
@ -911,9 +949,10 @@ public class LanguageSettingsProvidersSerializer {
} }
/** /**
* TODO - remove me * Reports inconsistency in log.
* Temporary method to report inconsistency in log. * AG FIXME - temporary method to remove before CDT Juno release
*/ */
@SuppressWarnings("nls")
@Deprecated @Deprecated
public static void assertConsistency(ICProjectDescription prjDescription) { public static void assertConsistency(ICProjectDescription prjDescription) {
if (prjDescription != null) { if (prjDescription != null) {
@ -1029,33 +1068,35 @@ public class LanguageSettingsProvidersSerializer {
*/ */
public static void reRegisterListeners(ICProjectDescription oldPrjDescription, ICProjectDescription newPrjDescription) { public static void reRegisterListeners(ICProjectDescription oldPrjDescription, ICProjectDescription newPrjDescription) {
if (oldPrjDescription == newPrjDescription) { if (oldPrjDescription == newPrjDescription) {
assertConsistency(oldPrjDescription); // TODO - remove me assertConsistency(oldPrjDescription);
return; return;
} }
assertConsistency(oldPrjDescription); // TODO - remove me assertConsistency(oldPrjDescription);
assertConsistency(newPrjDescription); // TODO - remove me assertConsistency(newPrjDescription);
List<ICListenerAgent> oldListeners = getListeners(oldPrjDescription); List<ICListenerAgent> oldListeners = getListeners(oldPrjDescription);
List<ListenerAssociation> newAssociations = getListenersAssociations(newPrjDescription); List<ListenerAssociation> newAssociations = getListenersAssociations(newPrjDescription);
// unregister old listeners
for (ICListenerAgent oldListener : oldListeners) { for (ICListenerAgent oldListener : oldListeners) {
if (!isListenerInTheListOfAssociations(newAssociations, oldListener)) { if (!isListenerInTheListOfAssociations(newAssociations, oldListener)) {
int count = 0; int count = 0;
if (oldListener instanceof LanguageSettingsWorkspaceProvider) { if (oldListener instanceof LanguageSettingsWorkspaceProvider) {
count = ((LanguageSettingsWorkspaceProvider) oldListener).decrementProjectCount(); count = ((LanguageSettingsWorkspaceProvider) oldListener).decrementProjectCount();
} }
if (count == 0) { if (count <= 0) {
try { try {
oldListener.unregisterListener(); oldListener.unregisterListener();
} catch (Throwable e) { } catch (Throwable e) {
// protect from any exceptions from implementers // protect from any exceptions from implementers
CCorePlugin.log(e); CCorePlugin.log("Exception trying unregister listener "+((ILanguageSettingsProvider) oldListener).getId(), e); //$NON-NLS-1$
} }
} }
} }
} }
// register new listeners
for (ListenerAssociation newListenerAssociation : newAssociations) { for (ListenerAssociation newListenerAssociation : newAssociations) {
ICListenerAgent newListener = newListenerAssociation.listener; ICListenerAgent newListener = newListenerAssociation.listener;
if (!isInList(oldListeners, newListener)) { if (!isInList(oldListeners, newListener)) {
@ -1068,7 +1109,7 @@ public class LanguageSettingsProvidersSerializer {
newListener.registerListener(newListenerAssociation.cfgDescription); newListener.registerListener(newListenerAssociation.cfgDescription);
} catch (Throwable e) { } catch (Throwable e) {
// protect from any exceptions from implementers // protect from any exceptions from implementers
CCorePlugin.log(e); CCorePlugin.log("Exception trying register listener "+((ILanguageSettingsProvider) newListener).getId(), e); //$NON-NLS-1$
} }
} }
} }
@ -1076,30 +1117,10 @@ public class LanguageSettingsProvidersSerializer {
} }
/**
* Deep clone of a list of language settings providers.
*
* @param baseProviders - list of providers to clone.
* @return newly cloned list.
*/
public static List<ILanguageSettingsProvider> cloneProviders(List<ILanguageSettingsProvider> baseProviders) {
List<ILanguageSettingsProvider> newProviders = new ArrayList<ILanguageSettingsProvider>();
for (ILanguageSettingsProvider provider : baseProviders) {
if (provider instanceof ILanguageSettingsEditableProvider) {
ILanguageSettingsEditableProvider newProvider = LanguageSettingsManager.getProviderCopy((ILanguageSettingsEditableProvider) provider, true);
if (newProvider != null) {
provider = newProvider;
}
}
newProviders.add(provider);
}
return new ArrayList<ILanguageSettingsProvider>(newProviders);
}
/** /**
* Adds a listener that will be notified of changes in language settings. * Adds a listener that will be notified of changes in language settings.
* *
* @param listener the listener to add * @param listener - the listener to add
*/ */
public static void registerLanguageSettingsChangeListener(ILanguageSettingsChangeListener listener) { public static void registerLanguageSettingsChangeListener(ILanguageSettingsChangeListener listener) {
fLanguageSettingsChangeListeners.add(listener); fLanguageSettingsChangeListeners.add(listener);
@ -1108,30 +1129,31 @@ public class LanguageSettingsProvidersSerializer {
/** /**
* Removes a language settings change listener. * Removes a language settings change listener.
* *
* @param listener the listener to remove. * @param listener - the listener to remove.
*/ */
public static void unregisterLanguageSettingsChangeListener(ILanguageSettingsChangeListener listener) { public static void unregisterLanguageSettingsChangeListener(ILanguageSettingsChangeListener listener) {
fLanguageSettingsChangeListeners.remove(listener); fLanguageSettingsChangeListeners.remove(listener);
} }
/** /**
* Notifies all language settings change listeners of a change. * Notifies all language settings change listeners of a change in language settings entries.
* *
* @param event the ILanguageSettingsChangeEvent event to be broadcast. * @param event - the {@link ILanguageSettingsChangeEvent} event to be broadcast.
*/ */
public static void notifyLanguageSettingsChangeListeners(ILanguageSettingsChangeEvent event) { private static void notifyLanguageSettingsChangeListeners(ILanguageSettingsChangeEvent event) {
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
LanguageSettingsLogger.logWarning("Firing " + event); LanguageSettingsLogger.logWarning("Firing " + event);
Object[] listeners = fLanguageSettingsChangeListeners.getListeners(); for (Object listener : fLanguageSettingsChangeListeners.getListeners()) {
for (Object listener : listeners) {
((ILanguageSettingsChangeListener) listener).handleEvent(event); ((ILanguageSettingsChangeListener) listener).handleEvent(event);
} }
} }
/**
* Get list of setting entries from the pool in {@link LanguageSettingsStorage}.
*/
private static List<ICLanguageSettingEntry> getSettingEntriesPooled(ILanguageSettingsProvider provider, private static List<ICLanguageSettingEntry> getSettingEntriesPooled(ILanguageSettingsProvider provider,
ICConfigurationDescription cfgDescription, IResource rc, String languageId) { ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
try { try {
return LanguageSettingsStorage.getPooledList(provider.getSettingEntries(cfgDescription, rc, languageId)); return LanguageSettingsStorage.getPooledList(provider.getSettingEntries(cfgDescription, rc, languageId));
} catch (Throwable e) { } catch (Throwable e) {
@ -1148,7 +1170,7 @@ public class LanguageSettingsProvidersSerializer {
* Returns the list of setting entries of the given provider * Returns the list of setting entries of the given provider
* for the given configuration description, resource and language. * for the given configuration description, resource and language.
* This method reaches to the parent folder of the resource recursively * This method reaches to the parent folder of the resource recursively
* in case the resource does not define the entries for the given provider. * if the resource does not define the entries for the given provider.
* *
* @param provider - language settings provider. * @param provider - language settings provider.
* @param cfgDescription - configuration description. * @param cfgDescription - configuration description.
@ -1170,7 +1192,7 @@ public class LanguageSettingsProvidersSerializer {
if (parentFolder != null) { if (parentFolder != null) {
return getSettingEntriesUpResourceTree(provider, cfgDescription, parentFolder, languageId); return getSettingEntriesUpResourceTree(provider, cfgDescription, parentFolder, languageId);
} }
// if out of parent resources - get default entries for the applicable language scope // if out of parent resources - get default entries
entries = getSettingEntriesPooled(provider, null, null, languageId); entries = getSettingEntriesPooled(provider, null, null, languageId);
if (entries != null) { if (entries != null) {
return entries; return entries;
@ -1182,99 +1204,8 @@ public class LanguageSettingsProvidersSerializer {
} }
/** /**
* Builds for the provider a nice looking resource tree to present hierarchical view to the user. * Test if the binary flag contains a particular bit.
* Note that it is not advisable to "compact" the tree because of potential loss of information
* which is especially important during partial or incremental builds.
*
* @param provider - language settings provider to build the tree for.
* @param cfgDescription - configuration description.
* @param languageId - language ID.
* @param folder - container where the tree roots.
*/ */
public static void buildResourceTree(LanguageSettingsSerializableProvider provider,
ICConfigurationDescription cfgDescription, String languageId, IContainer folder) {
IResource[] members = null;
try {
members = folder.members();
} catch (Exception e) {
CCorePlugin.log(e);
}
if (members==null)
return;
for (IResource rc : members) {
if (rc instanceof IContainer) {
buildResourceTree(provider, cfgDescription, languageId, (IContainer) rc);
}
}
int rcNumber = members.length;
Map<List<ICLanguageSettingEntry>, Integer> listMap = new HashMap<List<ICLanguageSettingEntry>, Integer>();
// on the first pass find majority entries
List<ICLanguageSettingEntry> majorityEntries = null;
List<ICLanguageSettingEntry> candidate = null;
int candidateCount = 0;
for (IResource rc : members) {
if (!isLanguageInScope(rc, cfgDescription, languageId)) {
rcNumber--;
} else {
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, rc, languageId);
if (entries==null && rc instanceof IContainer) {
rcNumber--;
} else {
Integer count = listMap.get(entries);
if (count==null) {
count = 0;
}
count++;
if (count>candidateCount) {
candidateCount = count;
candidate = entries;
}
listMap.put(entries, count);
}
}
if (candidateCount > rcNumber/2) {
majorityEntries = candidate;
break;
}
}
if (majorityEntries!=null) {
provider.setSettingEntries(cfgDescription, folder, languageId, majorityEntries);
}
// second pass - assign the entries to the folders
for (IResource rc : members) {
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, rc, languageId);
if (entries!=null && entries==majorityEntries) {
if (!(rc instanceof IFile)) { // preserve information which files were collected
provider.setSettingEntries(cfgDescription, rc, languageId, null);
}
}
}
}
private static boolean isLanguageInScope(IResource rc, ICConfigurationDescription cfgDescription, String languageId) {
if (rc instanceof IFile) {
ILanguage lang = null;
try {
lang = LanguageManager.getInstance().getLanguageForFile((IFile) rc, cfgDescription);
} catch (CoreException e) {
CCorePlugin.log("Error loading language settings providers extensions", e); //$NON-NLS-1$
}
if (lang==null || (languageId!=null && !languageId.equals(lang.getId()))) {
return false;
}
}
return true;
}
private static boolean checkBit(int flags, int bit) { private static boolean checkBit(int flags, int bit) {
return (flags & bit) == bit; return (flags & bit) == bit;
} }
@ -1315,7 +1246,7 @@ public class LanguageSettingsProvidersSerializer {
for (ICLanguageSettingEntry entry : providerEntries) { for (ICLanguageSettingEntry entry : providerEntries) {
if (entry != null) { if (entry != null) {
String entryName = entry.getName(); String entryName = entry.getName();
boolean isRightKind = (entry.getKind() & kind) != 0; boolean isRightKind = checkBit(entry.getKind(), kind);
// Only first entry is considered // Only first entry is considered
// Entry flagged as "UNDEFINED" prevents adding entry with the same name down the line // Entry flagged as "UNDEFINED" prevents adding entry with the same name down the line
if (isRightKind && !alreadyAdded.contains(entryName)) { if (isRightKind && !alreadyAdded.contains(entryName)) {
@ -1397,28 +1328,128 @@ public class LanguageSettingsProvidersSerializer {
} }
/** /**
* Tells if language settings entries of the provider are persisted with the project * Deep clone of a list of language settings providers.
* (under .settings/ folder) or in workspace area. Persistence in the project area lets
* the entries migrate with the project.
* *
* @param provider - provider to check the persistence mode. * @param baseProviders - list of providers to clone.
* @return {@code true} if LSE persisted with the project or {@code false} if in the workspace. * @return newly cloned list.
*/ */
public static boolean isStoringEntriesInProjectArea(LanguageSettingsSerializableProvider provider) { public static List<ILanguageSettingsProvider> cloneProviders(List<ILanguageSettingsProvider> baseProviders) {
String value = provider.getProperty(ATTR_STORE_ENTRIES); List<ILanguageSettingsProvider> newProviders = new ArrayList<ILanguageSettingsProvider>();
return VALUE_PROJECT.equals(value); for (ILanguageSettingsProvider provider : baseProviders) {
if (provider instanceof ILanguageSettingsEditableProvider) {
ILanguageSettingsEditableProvider newProvider = LanguageSettingsManager.getProviderCopy((ILanguageSettingsEditableProvider) provider, true);
if (newProvider != null) {
provider = newProvider;
}
}
newProviders.add(provider);
}
return new ArrayList<ILanguageSettingsProvider>(newProviders);
} }
/** /**
* Define where language settings are persisted for the provider. * Check if the language is applicable for the file.
*
* @param provider - provider to set the persistence mode.
* @param storeEntriesWithProject - {@code true} if with the project,
* {@code false} if in workspace area.
*/ */
public static void setStoringEntriesInProjectArea(LanguageSettingsSerializableProvider provider, boolean storeEntriesWithProject) { private static boolean isLanguageInScope(IResource rc, ICConfigurationDescription cfgDescription, String languageId) {
provider.setProperty(ATTR_STORE_ENTRIES, storeEntriesWithProject ? VALUE_PROJECT : VALUE_WORKSPACE); if (rc instanceof IFile) {
ILanguage lang = null;
try {
lang = LanguageManager.getInstance().getLanguageForFile((IFile) rc, cfgDescription);
} catch (CoreException e) {
CCorePlugin.log("Error while determining language for a file", e); //$NON-NLS-1$
}
if (lang == null || (languageId != null && !languageId.equals(lang.getId()))) {
return false;
}
}
return true;
} }
/**
* Builds for the provider a nicer-looking resource tree to present hierarchical view to the user.
*
* Note that it is not advisable to "compact" the tree because of potential loss of information
* which is especially important during partial or incremental builds.
*
* Note also that after using this method for a while for BOP parsers it appears that disadvantages
* outweigh benefits. In particular, it doesn't result in saving memory as the language settings
* (and the lists itself) are not duplicated in memory anyway but optimized with using WeakHashSet
* and SafeStringInterner.
*
* This method is a candidate for removal.
*
* @param provider - language settings provider to build the tree for.
* @param cfgDescription - configuration description.
* @param languageId - language ID.
* @param folder - container where the tree roots.
*/
public static void buildResourceTree(LanguageSettingsSerializableProvider provider,
ICConfigurationDescription cfgDescription, String languageId, IContainer folder) {
IResource[] members = null;
try {
members = folder.members();
} catch (Exception e) {
CCorePlugin.log(e);
}
if (members==null)
return;
for (IResource rc : members) {
if (rc instanceof IContainer) {
buildResourceTree(provider, cfgDescription, languageId, (IContainer) rc);
}
}
int rcNumber = members.length;
Map<List<ICLanguageSettingEntry>, Integer> listMap = new HashMap<List<ICLanguageSettingEntry>, Integer>();
// on the first pass find majority entry list, i.e. list present most often
List<ICLanguageSettingEntry> majorityEntries = null;
List<ICLanguageSettingEntry> candidate = null;
int candidateCount = 0;
for (IResource rc : members) {
if (!isLanguageInScope(rc, cfgDescription, languageId)) {
rcNumber--;
} else {
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, rc, languageId);
if (entries==null && rc instanceof IContainer) {
rcNumber--;
} else {
Integer count = listMap.get(entries);
if (count==null) {
count = 0;
}
count++;
if (count>candidateCount) {
candidateCount = count;
candidate = entries;
}
listMap.put(entries, count);
}
}
if (candidateCount > rcNumber/2) {
majorityEntries = candidate;
break;
}
}
if (majorityEntries!=null) {
provider.setSettingEntries(cfgDescription, folder, languageId, majorityEntries);
}
// second pass - assign the entries to the folders
for (IResource rc : members) {
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, rc, languageId);
if (entries!=null && entries==majorityEntries) {
if (!(rc instanceof IFile)) { // preserve information which files were collected
provider.setSettingEntries(cfgDescription, rc, languageId, null);
}
}
}
}
} }

View file

@ -52,7 +52,7 @@ public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider
@Override @Override
public ExtendedScannerInfo getScannerInformation(IResource rc) { public ExtendedScannerInfo getScannerInformation(IResource rc) {
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
LanguageSettingsLogger.logScannerInfoProvider(rc, this); LanguageSettingsLogger.logScannerInfoProvider(rc, this);
IProject project = rc.getProject(); IProject project = rc.getProject();

View file

@ -78,7 +78,7 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
@Override @Override
public IScannerInfo getScannerInformation(IResource resource) { public IScannerInfo getScannerInformation(IResource resource) {
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
LanguageSettingsLogger.logScannerInfoProvider(resource, this); LanguageSettingsLogger.logScannerInfoProvider(resource, this);
if(!fInited) if(!fInited)

View file

@ -98,7 +98,7 @@ public class ScannerProvider extends AbstractCExtension implements IScannerInfoP
*/ */
@Override @Override
public IScannerInfo getScannerInformation(IResource resource) { public IScannerInfo getScannerInformation(IResource resource) {
// AG FIXME - temporary log to remove before CDT 9.0 release // AG FIXME - temporary log to remove before CDT Juno release
if (resource instanceof IFile) { if (resource instanceof IFile) {
LanguageSettingsLogger.logInfo("rc="+resource+" (ScannerProvider.getScannerInformation())"); LanguageSettingsLogger.logInfo("rc="+resource+" (ScannerProvider.getScannerInformation())");
} else { } else {