mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-07 00:05:53 +02:00
bug 401961: Use more general CConfigurationDataProvider facilities to initialize language settings providers rather than do it in each New Project Wizard
This commit is contained in:
parent
4a20097fd3
commit
9002a13eb1
22 changed files with 292 additions and 208 deletions
|
@ -59,6 +59,7 @@ public class CfgScannerConfigProfileManagerTests extends BaseTestCase {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public void testBasicCfgScannerConfigProfileChanges() throws CoreException {
|
public void testBasicCfgScannerConfigProfileChanges() throws CoreException {
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(fProject, false);
|
||||||
ICProjectDescription prjDesc = CoreModel.getDefault().getProjectDescription(fProject);
|
ICProjectDescription prjDesc = CoreModel.getDefault().getProjectDescription(fProject);
|
||||||
ICConfigurationDescription[] cfgDescs = prjDesc.getConfigurations();
|
ICConfigurationDescription[] cfgDescs = prjDesc.getConfigurations();
|
||||||
assertTrue(cfgDescs.length > 0);
|
assertTrue(cfgDescs.length > 0);
|
||||||
|
@ -107,7 +108,6 @@ public class CfgScannerConfigProfileManagerTests extends BaseTestCase {
|
||||||
Assert.isTrue("dummyFile".equals(scbi.getBuildOutputFilePath()));
|
Assert.isTrue("dummyFile".equals(scbi.getBuildOutputFilePath()));
|
||||||
|
|
||||||
// Test restore defaults
|
// Test restore defaults
|
||||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(fProject, false);
|
|
||||||
scbis.applyInfo(cic, null);
|
scbis.applyInfo(cic, null);
|
||||||
// Save the project description
|
// Save the project description
|
||||||
CoreModel.getDefault().setProjectDescription(fProject, prjDesc);
|
CoreModel.getDefault().setProjectDescription(fProject, prjDesc);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.core.tests;
|
package org.eclipse.cdt.managedbuilder.core.tests;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -95,6 +96,27 @@ public class ManagedBuildCoreTests20 extends TestCase {
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert path to OS specific representation
|
||||||
|
*/
|
||||||
|
private String toOSLocation(String path) {
|
||||||
|
java.io.File file = new java.io.File(path);
|
||||||
|
try {
|
||||||
|
path = file.getCanonicalPath();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert path to OS specific representation
|
||||||
|
*/
|
||||||
|
private String toOSString(String path) {
|
||||||
|
return new Path(path).toOSString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigates through the build info as defined in the extensions
|
* Navigates through the build info as defined in the extensions
|
||||||
* defined in this plugin
|
* defined in this plugin
|
||||||
|
@ -218,18 +240,37 @@ public class ManagedBuildCoreTests20 extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//These are the expected path settings
|
//These are the expected path settings
|
||||||
final String[] expectedPaths = new String[5];
|
IPath buildCWD = project.getLocation().append("Sub Config");
|
||||||
|
final String[] expectedPaths;
|
||||||
// This first path is a built-in, so it will not be manipulated by build manager
|
if (new Path("C:\\home\\tester/include").isAbsolute()) {
|
||||||
expectedPaths[0] = (new Path("/usr/include")).toOSString();
|
// Windows
|
||||||
expectedPaths[1] = (new Path("/opt/gnome/include")).toOSString();
|
expectedPaths = new String[] {
|
||||||
IPath path = new Path("C:\\home\\tester/include");
|
toOSLocation("/usr/include"),
|
||||||
if(path.isAbsolute()) // for win32 path is treated as absolute
|
toOSLocation("/opt/gnome/include"),
|
||||||
expectedPaths[2] = path.toOSString();
|
toOSLocation("C:\\home\\tester/include"),
|
||||||
else // for Linux path is relative
|
// relative paths from MBS will make 3 entries
|
||||||
expectedPaths[2] = project.getLocation().append("Sub Config").append(path).toOSString();
|
project.getLocation().append("includes").toOSString(),
|
||||||
expectedPaths[3] = project.getLocation().append( "includes" ).toOSString();
|
buildCWD.append("includes").toOSString(),
|
||||||
expectedPaths[4] = (new Path("/usr/gnu/include")).toOSString();
|
toOSString("includes"),
|
||||||
|
"/usr/gnu/include", // Not converted to OS string due to being flagged as ICSettingEntry.RESOLVED
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Unix
|
||||||
|
expectedPaths = new String[] {
|
||||||
|
toOSLocation("/usr/include"),
|
||||||
|
toOSLocation("/opt/gnome/include"),
|
||||||
|
// on unix "C:\\home\\tester/include" is relative path
|
||||||
|
// looks like nonsense but it this way due to MBS converting entry to keep "Sub Config/C:\\home\\tester/include" in its storage
|
||||||
|
project.getLocation().append("Sub Config/C:\\home\\tester/include").toOSString(),
|
||||||
|
buildCWD.append("Sub Config/C:\\home\\tester/include").toOSString(),
|
||||||
|
toOSString("Sub Config/C:\\home\\tester/include"),
|
||||||
|
// relative paths from MBS will make 3 entries
|
||||||
|
project.getLocation().append("includes").toOSString(),
|
||||||
|
buildCWD.append("includes").toOSString(),
|
||||||
|
toOSString("includes"),
|
||||||
|
"/usr/gnu/include", // Not converted to OS string due to being flagged as ICSettingEntry.RESOLVED
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Create a new managed project based on the sub project type
|
// Create a new managed project based on the sub project type
|
||||||
IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.sub");
|
IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.sub");
|
||||||
|
|
|
@ -22,13 +22,9 @@ import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
|
||||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
|
|
||||||
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test creation of a new project in respect with language settings providers.
|
* Test creation of a new project in respect with language settings providers.
|
||||||
|
@ -52,37 +48,12 @@ public class LanguageSettingsProvidersMBSTest extends BaseTestCase {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Imitate a new Project Wizard. New Project Wizards really do these things in CDT.
|
|
||||||
*/
|
|
||||||
private static IProject imitateNewProjectWizard(String name, String projectTypeId) throws CoreException {
|
|
||||||
IProject project = ManagedBuildTestHelper.createProject(name, projectTypeId);
|
|
||||||
ManagedBuildTestHelper.addManagedBuildNature(project);
|
|
||||||
|
|
||||||
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, true);
|
|
||||||
assertNotNull(prjDescription);
|
|
||||||
ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations();
|
|
||||||
for (ICConfigurationDescription cfgDescription : cfgDescriptions) {
|
|
||||||
assertNotNull(cfgDescription);
|
|
||||||
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
|
||||||
|
|
||||||
IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDescription);
|
|
||||||
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(project, cfg, cfgDescription);
|
|
||||||
|
|
||||||
assertTrue(((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders().size() > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
CoreModel.getDefault().setProjectDescription(project, prjDescription);
|
|
||||||
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test new GNU Executable project.
|
* Test new GNU Executable project.
|
||||||
*/
|
*/
|
||||||
public void testGnuToolchainProviders() throws Exception {
|
public void testGnuToolchainProviders() throws Exception {
|
||||||
// create a new project imitating wizard
|
// create a new project
|
||||||
IProject project = imitateNewProjectWizard(this.getName(), PROJECT_TYPE_EXECUTABLE_GNU);
|
IProject project = ManagedBuildTestHelper.createProject(this.getName(), PROJECT_TYPE_EXECUTABLE_GNU);
|
||||||
|
|
||||||
// check that the language settings providers are in place.
|
// check that the language settings providers are in place.
|
||||||
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, false);
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, false);
|
||||||
|
@ -123,8 +94,8 @@ public class LanguageSettingsProvidersMBSTest extends BaseTestCase {
|
||||||
* of language settings providers.
|
* of language settings providers.
|
||||||
*/
|
*/
|
||||||
public void testProjectPersistence_Defaults() throws Exception {
|
public void testProjectPersistence_Defaults() throws Exception {
|
||||||
// create a new project imitating wizard
|
// create a new project
|
||||||
IProject project = imitateNewProjectWizard(this.getName(), PROJECT_TYPE_EXECUTABLE_GNU);
|
IProject project = ManagedBuildTestHelper.createProject(this.getName(), PROJECT_TYPE_EXECUTABLE_GNU);
|
||||||
|
|
||||||
// double-check that the project contains language settings providers
|
// double-check that the project contains language settings providers
|
||||||
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, false);
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, false);
|
||||||
|
@ -158,8 +129,8 @@ public class LanguageSettingsProvidersMBSTest extends BaseTestCase {
|
||||||
* Test that storage file is created for language settings for empty set of language settings providers.
|
* Test that storage file is created for language settings for empty set of language settings providers.
|
||||||
*/
|
*/
|
||||||
public void testProjectPersistence_NoProviders() throws Exception {
|
public void testProjectPersistence_NoProviders() throws Exception {
|
||||||
// create a new project imitating wizard
|
// create a new project
|
||||||
IProject project = imitateNewProjectWizard(this.getName(), PROJECT_TYPE_EXECUTABLE_GNU);
|
IProject project = ManagedBuildTestHelper.createProject(this.getName(), PROJECT_TYPE_EXECUTABLE_GNU);
|
||||||
|
|
||||||
// remove language settings providers from the project
|
// remove language settings providers from the project
|
||||||
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, true);
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, true);
|
||||||
|
|
|
@ -505,6 +505,11 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
||||||
if(baseCfg.sourceEntries != null)
|
if(baseCfg.sourceEntries != null)
|
||||||
sourceEntries = baseCfg.sourceEntries.clone();
|
sourceEntries = baseCfg.sourceEntries.clone();
|
||||||
|
|
||||||
|
defaultLanguageSettingsProvidersAttribute = baseCfg.defaultLanguageSettingsProvidersAttribute;
|
||||||
|
if(baseCfg.defaultLanguageSettingsProviderIds != null) {
|
||||||
|
defaultLanguageSettingsProviderIds = baseCfg.defaultLanguageSettingsProviderIds.clone();
|
||||||
|
}
|
||||||
|
|
||||||
// enableInternalBuilder(baseCfg.isInternalBuilderEnabled());
|
// enableInternalBuilder(baseCfg.isInternalBuilderEnabled());
|
||||||
// setInternalBuilderIgnoreErr(baseCfg.getInternalBuilderIgnoreErr());
|
// setInternalBuilderIgnoreErr(baseCfg.getInternalBuilderIgnoreErr());
|
||||||
// setInternalBuilderParallel(baseCfg.getInternalBuilderParallel());
|
// setInternalBuilderParallel(baseCfg.getInternalBuilderParallel());
|
||||||
|
@ -646,6 +651,10 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
||||||
if(cloneConfig.sourceEntries != null) {
|
if(cloneConfig.sourceEntries != null) {
|
||||||
sourceEntries = cloneConfig.sourceEntries.clone();
|
sourceEntries = cloneConfig.sourceEntries.clone();
|
||||||
}
|
}
|
||||||
|
defaultLanguageSettingsProvidersAttribute = cloneConfig.defaultLanguageSettingsProvidersAttribute;
|
||||||
|
if(cloneConfig.defaultLanguageSettingsProviderIds != null) {
|
||||||
|
defaultLanguageSettingsProviderIds = cloneConfig.defaultLanguageSettingsProviderIds.clone();
|
||||||
|
}
|
||||||
|
|
||||||
// enableInternalBuilder(cloneConfig.isInternalBuilderEnabled());
|
// enableInternalBuilder(cloneConfig.isInternalBuilderEnabled());
|
||||||
// setInternalBuilderIgnoreErr(cloneConfig.getInternalBuilderIgnoreErr());
|
// setInternalBuilderIgnoreErr(cloneConfig.getInternalBuilderIgnoreErr());
|
||||||
|
@ -1352,7 +1361,6 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String[] getDefaultLanguageSettingsProviderIds() {
|
public String[] getDefaultLanguageSettingsProviderIds() {
|
||||||
defaultLanguageSettingsProviderIds = null;
|
|
||||||
if (defaultLanguageSettingsProviderIds == null) {
|
if (defaultLanguageSettingsProviderIds == null) {
|
||||||
defaultLanguageSettingsProvidersAttribute = getDefaultLanguageSettingsProvidersAttribute();
|
defaultLanguageSettingsProvidersAttribute = getDefaultLanguageSettingsProvidersAttribute();
|
||||||
if (defaultLanguageSettingsProvidersAttribute != null) {
|
if (defaultLanguageSettingsProvidersAttribute != null) {
|
||||||
|
|
|
@ -158,19 +158,45 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
|
|
||||||
BuildConfigurationData baseCfgData = (BuildConfigurationData)baseData;
|
BuildConfigurationData baseCfgData = (BuildConfigurationData)baseData;
|
||||||
IConfiguration baseCfg = baseCfgData.getConfiguration();
|
IConfiguration baseCfg = baseCfgData.getConfiguration();
|
||||||
BuildConfigurationData appliedCfg;
|
BuildConfigurationData appliedCfgData;
|
||||||
if(context.isBaseDataCached() && !baseCfg.isDirty()){
|
if(context.isBaseDataCached() && !baseCfg.isDirty()){
|
||||||
appliedCfg = baseCfgData;
|
appliedCfgData = baseCfgData;
|
||||||
context.setConfigurationSettingsFlags(IModificationContext.CFG_DATA_STORAGE_UNMODIFIED | IModificationContext.CFG_DATA_SETTINGS_UNMODIFIED);
|
context.setConfigurationSettingsFlags(IModificationContext.CFG_DATA_STORAGE_UNMODIFIED | IModificationContext.CFG_DATA_SETTINGS_UNMODIFIED);
|
||||||
} else {
|
} else {
|
||||||
appliedCfg = writeConfiguration(cfgDescription, baseCfgData);
|
appliedCfgData = writeConfiguration(cfgDescription, baseCfgData);
|
||||||
|
|
||||||
IManagedBuildInfo info = getBuildInfo(cfgDescription);
|
IManagedBuildInfo info = getBuildInfo(cfgDescription);
|
||||||
ManagedProject mProj = (ManagedProject)info.getManagedProject();
|
ManagedProject mProj = (ManagedProject)info.getManagedProject();
|
||||||
mProj.applyConfiguration((Configuration)appliedCfg.getConfiguration());
|
mProj.applyConfiguration((Configuration)appliedCfgData.getConfiguration());
|
||||||
writeManagedProjectInfo(cfgDescription.getProjectDescription(), mProj);
|
writeManagedProjectInfo(cfgDescription.getProjectDescription(), mProj);
|
||||||
|
if (baseCfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
String[] defaultIds = ((ILanguageSettingsProvidersKeeper)baseCfgDescription).getDefaultLanguageSettingsProvidersIds();
|
||||||
|
List<ILanguageSettingsProvider> providers;
|
||||||
|
if (defaultIds == null) {
|
||||||
|
ICProjectDescription prjDescription = baseCfgDescription.getProjectDescription();
|
||||||
|
if (prjDescription != null) {
|
||||||
|
IProject project = prjDescription.getProject();
|
||||||
|
// propagate the preference to project properties
|
||||||
|
ScannerDiscoveryLegacySupport.defineLanguageSettingsEnablement(project);
|
||||||
|
}
|
||||||
|
|
||||||
|
IConfiguration cfg = appliedCfgData.getConfiguration();
|
||||||
|
defaultIds = cfg != null ? cfg.getDefaultLanguageSettingsProviderIds() : null;
|
||||||
|
if (defaultIds == null) {
|
||||||
|
defaultIds = ScannerDiscoveryLegacySupport.getDefaultProviderIdsLegacy(baseCfgDescription);
|
||||||
|
}
|
||||||
|
providers = LanguageSettingsManager.createLanguageSettingsProviders(defaultIds);
|
||||||
|
} else {
|
||||||
|
providers = ((ILanguageSettingsProvidersKeeper)baseCfgDescription).getLanguageSettingProviders();
|
||||||
|
}
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
((ILanguageSettingsProvidersKeeper)cfgDescription).setDefaultLanguageSettingsProvidersIds(defaultIds);
|
||||||
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CfgScannerConfigInfoFactory2.save(appliedCfg, cfgDescription.getProjectDescription(), baseCfgDescription.getProjectDescription(), !isPersistedCfg(cfgDescription));
|
CfgScannerConfigInfoFactory2.save(appliedCfgData, cfgDescription.getProjectDescription(), baseCfgDescription.getProjectDescription(), !isPersistedCfg(cfgDescription));
|
||||||
} catch (CoreException e){
|
} catch (CoreException e){
|
||||||
ManagedBuilderCorePlugin.log(e);
|
ManagedBuilderCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
@ -184,7 +210,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cfgDescription.isActive()){
|
if(cfgDescription.isActive()){
|
||||||
IConfiguration cfg = appliedCfg.getConfiguration();
|
IConfiguration cfg = appliedCfgData.getConfiguration();
|
||||||
IBuilder builder = cfg.getEditableBuilder();
|
IBuilder builder = cfg.getEditableBuilder();
|
||||||
IProject project = context.getProject();
|
IProject project = context.getProject();
|
||||||
IProjectDescription eDes = context.getEclipseProjectDescription();
|
IProjectDescription eDes = context.getEclipseProjectDescription();
|
||||||
|
@ -199,7 +225,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return appliedCfg;
|
return appliedCfgData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPersistedFlag(ICConfigurationDescription cfgDescription){
|
private void setPersistedFlag(ICConfigurationDescription cfgDescription){
|
||||||
|
@ -530,66 +556,28 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
IManagedBuildInfo info = getBuildInfo(cfgDescription);
|
IManagedBuildInfo info = getBuildInfo(cfgDescription);
|
||||||
Configuration cfg = load(cfgDescription, (ManagedProject)info.getManagedProject(), false);
|
Configuration cfg = load(cfgDescription, (ManagedProject)info.getManagedProject(), false);
|
||||||
|
|
||||||
if(cfg != null) {
|
if (cfg != null) {
|
||||||
|
IProject project = cfgDescription.getProjectDescription().getProject();
|
||||||
cfg.setConfigurationDescription(cfgDescription);
|
cfg.setConfigurationDescription(cfgDescription);
|
||||||
info.setValid(true);
|
info.setValid(true);
|
||||||
setPersistedFlag(cfgDescription);
|
setPersistedFlag(cfgDescription);
|
||||||
cacheNaturesIdsUsedOnCache(cfgDescription);
|
cacheNaturesIdsUsedOnCache(cfgDescription);
|
||||||
// Update the ManagedBuildInfo in the ManagedBuildManager map. Doing this creates a barrier for subsequent
|
// Update the ManagedBuildInfo in the ManagedBuildManager map. Doing this creates a barrier for subsequent
|
||||||
// ManagedBuildManager#getBuildInfo(...) see Bug 305146 for more
|
// ManagedBuildManager#getBuildInfo(...) see Bug 305146 for more
|
||||||
ManagedBuildManager.setLoaddedBuildInfo(cfgDescription.getProjectDescription().getProject(), info);
|
ManagedBuildManager.setLoaddedBuildInfo(project, info);
|
||||||
setDefaultLanguageSettingsProvidersIds(cfg, cfgDescription);
|
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
String[] defaultIds = cfg.getDefaultLanguageSettingsProviderIds();
|
||||||
|
if (defaultIds != null) {
|
||||||
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setDefaultLanguageSettingsProvidersIds(defaultIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return cfg.getConfigurationData();
|
return cfg.getConfigurationData();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ILanguageSettingsProvider> getDefaultLanguageSettingsProviders(IConfiguration cfg) {
|
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
|
||||||
String[] ids = cfg != null ? cfg.getDefaultLanguageSettingsProviderIds() : null;
|
|
||||||
if (ids != null) {
|
|
||||||
for (String id : ids) {
|
|
||||||
ILanguageSettingsProvider provider = null;
|
|
||||||
if (!LanguageSettingsManager.isPreferShared(id)) {
|
|
||||||
provider = LanguageSettingsManager.getExtensionProviderCopy(id, false);
|
|
||||||
}
|
|
||||||
if (provider == null) {
|
|
||||||
provider = LanguageSettingsManager.getWorkspaceProvider(id);
|
|
||||||
}
|
|
||||||
providers.add(provider);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
providers = ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy();
|
|
||||||
}
|
|
||||||
|
|
||||||
return providers;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void setDefaultLanguageSettingsProvidersIds(IConfiguration cfg, ICConfigurationDescription cfgDescription) {
|
|
||||||
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
|
||||||
List<ILanguageSettingsProvider> providers = getDefaultLanguageSettingsProviders(cfg);
|
|
||||||
String[] ids = new String[providers.size()];
|
|
||||||
for (int i = 0; i < ids.length; i++) {
|
|
||||||
ILanguageSettingsProvider provider = providers.get(i);
|
|
||||||
ids[i] = provider.getId();
|
|
||||||
}
|
|
||||||
((ILanguageSettingsProvidersKeeper) cfgDescription).setDefaultLanguageSettingsProvidersIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setDefaultLanguageSettingsProviders(IProject project, IConfiguration cfg, ICConfigurationDescription cfgDescription) {
|
|
||||||
// propagate the preference to project properties
|
|
||||||
boolean isPreferenceEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(null);
|
|
||||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isPreferenceEnabled);
|
|
||||||
|
|
||||||
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
|
||||||
ConfigurationDataProvider.setDefaultLanguageSettingsProvidersIds(cfg, cfgDescription);
|
|
||||||
List<ILanguageSettingsProvider> providers = ConfigurationDataProvider.getDefaultLanguageSettingsProviders(cfg);
|
|
||||||
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isPersistedCfg(ICConfigurationDescription cfgDescription) {
|
private boolean isPersistedCfg(ICConfigurationDescription cfgDescription) {
|
||||||
return cfgDescription.getSessionProperty(CFG_PERSISTED_PROPERTY) != null;
|
return cfgDescription.getSessionProperty(CFG_PERSISTED_PROPERTY) != null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
|
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
|
@ -616,9 +615,6 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
cfgDebug = cfgDes;
|
cfgDebug = cfgDes;
|
||||||
if (cfgFirst == null) // select at least first configuration
|
if (cfgFirst == null) // select at least first configuration
|
||||||
cfgFirst = cfgDes;
|
cfgFirst = cfgDes;
|
||||||
|
|
||||||
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(project, config, cfgDes);
|
|
||||||
|
|
||||||
monitor.worked(work);
|
monitor.worked(work);
|
||||||
}
|
}
|
||||||
mngr.setProjectDescription(project, des);
|
mngr.setProjectDescription(project, des);
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
|
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -112,10 +111,7 @@ public class NewMakeProjFromExisting extends Wizard implements IImportWizard, IN
|
||||||
IBuilder builder = config.getEditableBuilder();
|
IBuilder builder = config.getEditableBuilder();
|
||||||
builder.setManagedBuildOn(false);
|
builder.setManagedBuildOn(false);
|
||||||
CConfigurationData data = config.getConfigurationData();
|
CConfigurationData data = config.getConfigurationData();
|
||||||
ICConfigurationDescription cfgDes = projDesc.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
projDesc.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||||
|
|
||||||
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(project, config, cfgDes);
|
|
||||||
|
|
||||||
monitor.worked(1);
|
monitor.worked(1);
|
||||||
|
|
||||||
pdMgr.setProjectDescription(project, projDesc);
|
pdMgr.setProjectDescription(project, projDesc);
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
|
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -102,10 +101,7 @@ public class STDWizardHandler extends MBSWizardHandler {
|
||||||
}
|
}
|
||||||
cfg.setArtifactName(mProj.getDefaultArtifactName());
|
cfg.setArtifactName(mProj.getDefaultArtifactName());
|
||||||
CConfigurationData data = cfg.getConfigurationData();
|
CConfigurationData data = cfg.getConfigurationData();
|
||||||
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||||
|
|
||||||
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(project, cfg, cfgDes);
|
|
||||||
|
|
||||||
monitor.worked(work);
|
monitor.worked(work);
|
||||||
}
|
}
|
||||||
mngr.setProjectDescription(project, des);
|
mngr.setProjectDescription(project, des);
|
||||||
|
|
|
@ -695,12 +695,16 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
||||||
assertTrue(cfgDescription instanceof CConfigurationDescription);
|
assertTrue(cfgDescription instanceof CConfigurationDescription);
|
||||||
|
|
||||||
|
// Select a sample workspace provider for the test
|
||||||
ILanguageSettingsProvider workspaceProvider = LanguageSettingsManager.getWorkspaceProvider(EXTENSION_BASE_PROVIDER_ID);
|
ILanguageSettingsProvider workspaceProvider = LanguageSettingsManager.getWorkspaceProvider(EXTENSION_BASE_PROVIDER_ID);
|
||||||
assertNotNull(workspaceProvider);
|
assertNotNull(workspaceProvider);
|
||||||
|
|
||||||
{
|
{
|
||||||
// ensure no test provider is set yet
|
// ensure no test provider is set yet but default providers
|
||||||
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
assertEquals(0, providers.size());
|
assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, providers.get(0).getId());
|
||||||
|
assertEquals(ScannerDiscoveryLegacySupport.PATH_ENTRY_MANAGER_LANGUAGE_SETTINGS_PROVIDER_ID, providers.get(1).getId());
|
||||||
|
assertEquals(2, providers.size());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// set test provider
|
// set test provider
|
||||||
|
|
|
@ -457,23 +457,34 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
|
|
||||||
public void test160281_1() throws Exception {
|
public void test160281_1() throws Exception {
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
IFile include= TestSourceReader.createFile(fCProject.getProject(), "inc/test160281_1.h", "");
|
IProject project = fCProject.getProject();
|
||||||
|
IFile include= TestSourceReader.createFile(project, "inc/test160281_1.h", "");
|
||||||
TestScannerProvider.sIncludes= new String[]{include.getLocation().removeLastSegments(1).toString()};
|
TestScannerProvider.sIncludes= new String[]{include.getLocation().removeLastSegments(1).toString()};
|
||||||
TestScannerProvider.sIncludeFiles= new String[]{include.getName()};
|
TestScannerProvider.sIncludeFiles= new String[]{include.getName()};
|
||||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test160281_1.cpp", "");
|
IFile file= TestSourceReader.createFile(project, "test160281_1.cpp", "");
|
||||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||||
|
|
||||||
fIndex.acquireReadLock();
|
fIndex.acquireReadLock();
|
||||||
try {
|
try {
|
||||||
IIndexFile ifile= getIndexFile(file);
|
IIndexFile ifile= getIndexFile(file);
|
||||||
IIndexInclude[] includes= ifile.getIncludes();
|
IIndexInclude[] includes= ifile.getIncludes();
|
||||||
assertEquals(1, includes.length);
|
|
||||||
IIndexInclude i= includes[0];
|
// the first directory searched for file is the preprocessor's working directory (build directory), see gcc manual -include option
|
||||||
assertEquals(file.getLocationURI(), i.getIncludedByLocation().getURI());
|
IIndexInclude i1= includes[0];
|
||||||
assertEquals(include.getLocationURI(), i.getIncludesLocation().getURI());
|
assertEquals(file.getLocationURI(), i1.getIncludedByLocation().getURI());
|
||||||
assertEquals(true, i.isSystemInclude());
|
assertEquals(project.getFile(TestScannerProvider.sIncludeFiles[0]).getLocation(), new Path(i1.getFullName()));
|
||||||
assertEquals(0, i.getNameOffset());
|
// the include file is not in the working directory
|
||||||
assertEquals(0, i.getNameLength());
|
assertEquals(null, i1.getIncludesLocation());
|
||||||
|
|
||||||
|
// the second directory is the directory containing the main source file
|
||||||
|
IIndexInclude i2= includes[1];
|
||||||
|
assertEquals(file.getLocationURI(), i2.getIncludedByLocation().getURI());
|
||||||
|
assertEquals(include.getLocationURI(), i2.getIncludesLocation().getURI());
|
||||||
|
assertEquals(true, i2.isSystemInclude());
|
||||||
|
assertEquals(0, i2.getNameOffset());
|
||||||
|
assertEquals(0, i2.getNameLength());
|
||||||
|
|
||||||
|
assertEquals(2, includes.length);
|
||||||
} finally {
|
} finally {
|
||||||
fIndex.releaseReadLock();
|
fIndex.releaseReadLock();
|
||||||
}
|
}
|
||||||
|
@ -481,26 +492,37 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
|
|
||||||
public void test160281_2() throws Exception {
|
public void test160281_2() throws Exception {
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
IFile include= TestSourceReader.createFile(fCProject.getProject(), "inc/test160281_2.h", "#define X y\n");
|
IProject project = fCProject.getProject();
|
||||||
|
IFile include= TestSourceReader.createFile(project, "inc/test160281_2.h", "#define X y\n");
|
||||||
TestScannerProvider.sIncludes= new String[]{include.getLocation().removeLastSegments(1).toString()};
|
TestScannerProvider.sIncludes= new String[]{include.getLocation().removeLastSegments(1).toString()};
|
||||||
TestScannerProvider.sMacroFiles= new String[]{include.getName()};
|
TestScannerProvider.sMacroFiles= new String[]{include.getName()};
|
||||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test160281_2.cpp", "int X;");
|
IFile file= TestSourceReader.createFile(project, "test160281_2.cpp", "int X;");
|
||||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, INDEXER_TIMEOUT_SEC * 1000);
|
||||||
|
|
||||||
fIndex.acquireReadLock();
|
fIndex.acquireReadLock();
|
||||||
try {
|
try {
|
||||||
IIndexFile ifile= getIndexFile(file);
|
IIndexFile ifile= getIndexFile(file);
|
||||||
IIndexInclude[] includes= ifile.getIncludes();
|
IIndexInclude[] includes= ifile.getIncludes();
|
||||||
assertEquals(1, includes.length);
|
|
||||||
IIndexInclude i= includes[0];
|
// the first directory searched for file is the preprocessor's working directory (build directory), see gcc manual -imacros option
|
||||||
assertEquals(file.getLocationURI(), i.getIncludedByLocation().getURI());
|
IIndexInclude i1= includes[0];
|
||||||
assertEquals(include.getLocationURI(), i.getIncludesLocation().getURI());
|
assertEquals(file.getLocationURI(), i1.getIncludedByLocation().getURI());
|
||||||
assertEquals(true, i.isSystemInclude());
|
assertEquals(project.getFile(TestScannerProvider.sMacroFiles[0]).getLocation(), new Path(i1.getFullName()));
|
||||||
assertEquals(0, i.getNameOffset());
|
// the include file is not in the working directory
|
||||||
assertEquals(0, i.getNameLength());
|
assertEquals(null, i1.getIncludesLocation());
|
||||||
|
|
||||||
|
// the second directory is the directory containing the main source file
|
||||||
|
IIndexInclude i2= includes[1];
|
||||||
|
assertEquals(file.getLocationURI(), i2.getIncludedByLocation().getURI());
|
||||||
|
assertEquals(include.getLocationURI(), i2.getIncludesLocation().getURI());
|
||||||
|
assertEquals(true, i2.isSystemInclude());
|
||||||
|
assertEquals(0, i2.getNameOffset());
|
||||||
|
assertEquals(0, i2.getNameLength());
|
||||||
IIndexBinding[] bindings= fIndex.findBindings("y".toCharArray(), IndexFilter.ALL, npm());
|
IIndexBinding[] bindings= fIndex.findBindings("y".toCharArray(), IndexFilter.ALL, npm());
|
||||||
assertEquals(1, bindings.length);
|
assertEquals(1, bindings.length);
|
||||||
assertTrue(bindings[0] instanceof IVariable);
|
assertTrue(bindings[0] instanceof IVariable);
|
||||||
|
|
||||||
|
assertEquals(2, includes.length);
|
||||||
} finally {
|
} finally {
|
||||||
fIndex.releaseReadLock();
|
fIndex.releaseReadLock();
|
||||||
}
|
}
|
||||||
|
|
11
core/org.eclipse.cdt.core/.settings/.api_filters
Normal file
11
core/org.eclipse.cdt.core/.settings/.api_filters
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<component id="org.eclipse.cdt.core" version="2">
|
||||||
|
<resource path="model/org/eclipse/cdt/core/language/settings/providers/ScannerDiscoveryLegacySupport.java" type="org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport">
|
||||||
|
<filter comment="Former @noreference metod has been discontinued" id="338792546">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport"/>
|
||||||
|
<message_argument value="getDefaultProvidersLegacy()"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
</resource>
|
||||||
|
</component>
|
|
@ -130,7 +130,7 @@ public class LanguageSettingsManager {
|
||||||
* @return raw underlying provider for workspace provider or provider itself if no wrapper is used.
|
* @return raw underlying provider for workspace provider or provider itself if no wrapper is used.
|
||||||
*/
|
*/
|
||||||
public static ILanguageSettingsProvider getRawProvider(ILanguageSettingsProvider provider) {
|
public static ILanguageSettingsProvider getRawProvider(ILanguageSettingsProvider provider) {
|
||||||
if (LanguageSettingsManager.isWorkspaceProvider(provider)) {
|
if (isWorkspaceProvider(provider)) {
|
||||||
provider = LanguageSettingsProvidersSerializer.getRawWorkspaceProvider(provider.getId());
|
provider = LanguageSettingsProvidersSerializer.getRawWorkspaceProvider(provider.getId());
|
||||||
}
|
}
|
||||||
return provider;
|
return provider;
|
||||||
|
@ -376,4 +376,32 @@ public class LanguageSettingsManager {
|
||||||
public static void serializeLanguageSettingsWorkspaceInBackground() {
|
public static void serializeLanguageSettingsWorkspaceInBackground() {
|
||||||
LanguageSettingsProvidersSerializer.serializeLanguageSettingsWorkspaceInBackground();
|
LanguageSettingsProvidersSerializer.serializeLanguageSettingsWorkspaceInBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a list of providers with intention to assign to a configuration description.
|
||||||
|
*
|
||||||
|
* The list will contain global providers for ones where attribute "prefer-non-shared" is {@code true}
|
||||||
|
* and a new copy for those where attribute "prefer-non-shared" is {@code false}. Attribute "prefer-non-shared"
|
||||||
|
* is defined in extension point {@code org.eclipse.cdt.core.LanguageSettingsProvider}.
|
||||||
|
*
|
||||||
|
* @param ids - list of providers id which cannot be {@code null}.
|
||||||
|
* @return a list of language settings providers with given ids.
|
||||||
|
*
|
||||||
|
* @since 5.5
|
||||||
|
*/
|
||||||
|
public static List<ILanguageSettingsProvider> createLanguageSettingsProviders(String[] ids) {
|
||||||
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
||||||
|
for (String id : ids) {
|
||||||
|
ILanguageSettingsProvider provider = null;
|
||||||
|
if (!isPreferShared(id)) {
|
||||||
|
provider = getExtensionProviderCopy(id, false);
|
||||||
|
}
|
||||||
|
if (provider == null) {
|
||||||
|
provider = getWorkspaceProvider(id);
|
||||||
|
}
|
||||||
|
providers.add(provider);
|
||||||
|
}
|
||||||
|
return providers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.core.language.settings.providers;
|
package org.eclipse.cdt.core.language.settings.providers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -21,8 +20,6 @@ import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.internal.core.LocalProjectScope;
|
import org.eclipse.cdt.internal.core.LocalProjectScope;
|
||||||
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.ScannerInfoExtensionLanguageSettingsProvider;
|
import org.eclipse.cdt.internal.core.language.settings.providers.ScannerInfoExtensionLanguageSettingsProvider;
|
||||||
import org.eclipse.cdt.internal.core.model.PathEntryManager;
|
import org.eclipse.cdt.internal.core.model.PathEntryManager;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||||
|
@ -144,10 +141,9 @@ public class ScannerDiscoveryLegacySupport {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if legacy Scanner Discovery should be active.
|
* Check if legacy Scanner Discovery should be active.
|
||||||
* @noreference This is internal helper method to support compatibility with previous versions
|
|
||||||
* which is not intended to be referenced by clients.
|
* which is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
public static boolean isLegacyProviderOn(ICConfigurationDescription cfgDescription) {
|
private static boolean isLegacyProviderOn(ICConfigurationDescription cfgDescription) {
|
||||||
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
List<ILanguageSettingsProvider> lsProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
List<ILanguageSettingsProvider> lsProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
for (ILanguageSettingsProvider lsp : lsProviders) {
|
for (ILanguageSettingsProvider lsp : lsProviders) {
|
||||||
|
@ -237,19 +233,17 @@ public class ScannerDiscoveryLegacySupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list containing User and MBS providers. Used to initialize older MBS tool-chains (backward compatibility).
|
* If not defined yet, define property that controls if language settings providers functionality enabled for a given project.
|
||||||
|
* Workspace preference is checked and the project property is set to match it.
|
||||||
*
|
*
|
||||||
* @noreference This is internal helper method to support compatibility with previous versions
|
* @param project - project to define enablement.
|
||||||
* which is not intended to be referenced by clients.
|
* @since 5.5
|
||||||
*/
|
*/
|
||||||
public static List<ILanguageSettingsProvider> getDefaultProvidersLegacy() {
|
public static void defineLanguageSettingsEnablement(IProject project) {
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>(2);
|
if (project != null && ! ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityDefined(project)) {
|
||||||
ILanguageSettingsProvider provider = LanguageSettingsExtensionManager.getExtensionProviderCopy((USER_LANGUAGE_SETTINGS_PROVIDER_ID), false);
|
boolean isPreferenceEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(null);
|
||||||
if (provider != null) {
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isPreferenceEnabled);
|
||||||
providers.add(provider);
|
|
||||||
}
|
}
|
||||||
providers.add(LanguageSettingsProvidersSerializer.getWorkspaceProvider(MBS_LANGUAGE_SETTINGS_PROVIDER_ID));
|
|
||||||
return providers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,9 +10,16 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.settings.model.extension;
|
package org.eclipse.cdt.core.settings.model.extension;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.IModificationContext;
|
import org.eclipse.cdt.core.settings.model.IModificationContext;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
|
@ -108,7 +115,28 @@ public abstract class CConfigurationDataProvider {
|
||||||
ICConfigurationDescription baseCfgDescription, CConfigurationData baseData,
|
ICConfigurationDescription baseCfgDescription, CConfigurationData baseData,
|
||||||
IModificationContext context, IProgressMonitor monitor) throws CoreException {
|
IModificationContext context, IProgressMonitor monitor) throws CoreException {
|
||||||
|
|
||||||
return applyConfiguration(cfgDescription, baseCfgDescription, baseData, monitor);
|
CConfigurationData data = applyConfiguration(cfgDescription, baseCfgDescription, baseData, monitor);
|
||||||
|
if (baseCfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
String[] defaultIds = ((ILanguageSettingsProvidersKeeper)baseCfgDescription).getDefaultLanguageSettingsProvidersIds();
|
||||||
|
List<ILanguageSettingsProvider> providers;
|
||||||
|
if (defaultIds != null) {
|
||||||
|
providers = ((ILanguageSettingsProvidersKeeper)baseCfgDescription).getLanguageSettingProviders();
|
||||||
|
} else {
|
||||||
|
ICProjectDescription prjDescription = baseCfgDescription.getProjectDescription();
|
||||||
|
if (prjDescription != null) {
|
||||||
|
IProject project = prjDescription.getProject();
|
||||||
|
// propagate the preference to project properties
|
||||||
|
ScannerDiscoveryLegacySupport.defineLanguageSettingsEnablement(project);
|
||||||
|
}
|
||||||
|
defaultIds = ScannerDiscoveryLegacySupport.getDefaultProviderIdsLegacy(baseCfgDescription);
|
||||||
|
providers = LanguageSettingsManager.createLanguageSettingsProviders(defaultIds);
|
||||||
|
}
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
((ILanguageSettingsProvidersKeeper)cfgDescription).setDefaultLanguageSettingsProvidersIds(defaultIds);
|
||||||
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -35,7 +35,6 @@ 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.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
|
||||||
import org.eclipse.cdt.internal.core.XmlUtil;
|
import org.eclipse.cdt.internal.core.XmlUtil;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.CConfigurationSpecSettings;
|
import org.eclipse.cdt.internal.core.settings.model.CConfigurationSpecSettings;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
|
import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
|
||||||
|
@ -834,11 +833,6 @@ public class LanguageSettingsProvidersSerializer {
|
||||||
try {
|
try {
|
||||||
// Add the storage module to .cpoject and persist on disk as a side effect of adding
|
// Add the storage module to .cpoject and persist on disk as a side effect of adding
|
||||||
prjDescription.getStorage(CPROJECT_STORAGE_MODULE_LANGUAGE_SETTINGS_PROVIDERS, true);
|
prjDescription.getStorage(CPROJECT_STORAGE_MODULE_LANGUAGE_SETTINGS_PROVIDERS, true);
|
||||||
if (!ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityDefined(project)) {
|
|
||||||
// set the flag if was not previously set by the user - to the default value
|
|
||||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project,
|
|
||||||
ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project));
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log("Internal error while trying to serialize language settings", e); //$NON-NLS-1$
|
CCorePlugin.log("Internal error while trying to serialize language settings", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -1136,7 +1130,6 @@ public class LanguageSettingsProvidersSerializer {
|
||||||
IProject project = prjDescription.getProject();
|
IProject project = prjDescription.getProject();
|
||||||
IFile storeInPrjArea = getStoreInProjectArea(project);
|
IFile storeInPrjArea = getStoreInProjectArea(project);
|
||||||
boolean isStoreInProjectAreaExist = storeInPrjArea.exists();
|
boolean isStoreInProjectAreaExist = storeInPrjArea.exists();
|
||||||
boolean enableLSP = isStoreInProjectAreaExist;
|
|
||||||
if (isStoreInProjectAreaExist) {
|
if (isStoreInProjectAreaExist) {
|
||||||
Document doc = null;
|
Document doc = null;
|
||||||
try {
|
try {
|
||||||
|
@ -1161,17 +1154,8 @@ public class LanguageSettingsProvidersSerializer {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
CCorePlugin.log("Can't load preferences from file " + storeInPrjArea.getLocation(), e); //$NON-NLS-1$
|
CCorePlugin.log("Can't load preferences from file " + storeInPrjArea.getLocation(), e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
} else { // Storage in project area does not exist
|
// If storage in project area does not exist set default providers defined in the tool-chain
|
||||||
ICStorageElement lspStorageModule = null;
|
|
||||||
try {
|
|
||||||
lspStorageModule = prjDescription.getStorage(CPROJECT_STORAGE_MODULE_LANGUAGE_SETTINGS_PROVIDERS, false);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
String msg = "Internal error while trying to load language settings"; //$NON-NLS-1$
|
|
||||||
CCorePlugin.log(msg, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set default providers defined in the tool-chain
|
|
||||||
for (ICConfigurationDescription cfgDescription : prjDescription.getConfigurations()) {
|
for (ICConfigurationDescription cfgDescription : prjDescription.getConfigurations()) {
|
||||||
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
String[] ids = ((ILanguageSettingsProvidersKeeper) cfgDescription).getDefaultLanguageSettingsProvidersIds();
|
String[] ids = ((ILanguageSettingsProvidersKeeper) cfgDescription).getDefaultLanguageSettingsProvidersIds();
|
||||||
|
@ -1188,15 +1172,10 @@ public class LanguageSettingsProvidersSerializer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enableLSP = lspStorageModule != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityDefined(project)) {
|
|
||||||
// set the flag if was not previously set by the user
|
|
||||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, enableLSP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// propagate the preference to project properties
|
||||||
|
ScannerDiscoveryLegacySupport.defineLanguageSettingsEnablement(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class ScannerInfoExtensionLanguageSettingsProvider extends LanguageSettin
|
||||||
* @return an instance of ScannerInfoProvider or {@code null}.
|
* @return an instance of ScannerInfoProvider or {@code null}.
|
||||||
*/
|
*/
|
||||||
public IScannerInfoProvider getScannerInfoProvider(ICConfigurationDescription cfgDescription) {
|
public IScannerInfoProvider getScannerInfoProvider(ICConfigurationDescription cfgDescription) {
|
||||||
if (cfgDescription == null) {
|
if (cfgDescription == null || cfgDescription.isPreferenceConfiguration()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Intel Corporation and others.
|
* Copyright (c) 2007, 2013 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -20,6 +20,8 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
|
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.settings.model.CConfigurationStatus;
|
import org.eclipse.cdt.core.settings.model.CConfigurationStatus;
|
||||||
import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent;
|
import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent;
|
||||||
import org.eclipse.cdt.core.settings.model.ICBuildSetting;
|
import org.eclipse.cdt.core.settings.model.ICBuildSetting;
|
||||||
|
@ -158,6 +160,14 @@ public class CConfigurationDescription extends CDataProxyContainer
|
||||||
CConfigurationDataProvider dataProvider = CProjectDescriptionManager.getInstance().getProvider(this);
|
CConfigurationDataProvider dataProvider = CProjectDescriptionManager.getInstance().getProvider(this);
|
||||||
CConfigurationData data = dataProvider.loadConfiguration(this, new NullProgressMonitor());
|
CConfigurationData data = dataProvider.loadConfiguration(this, new NullProgressMonitor());
|
||||||
setData(data);
|
setData(data);
|
||||||
|
|
||||||
|
if (!fCfgSpecSettings.isLanguageSettingProvidersLoaded()) {
|
||||||
|
// default ids would come from the preference configuration, ensure sensible defaults
|
||||||
|
String[] defaultIds = ScannerDiscoveryLegacySupport.getDefaultProviderIdsLegacy(this);
|
||||||
|
List<ILanguageSettingsProvider> providers = LanguageSettingsManager.createLanguageSettingsProviders(defaultIds);
|
||||||
|
setDefaultLanguageSettingsProvidersIds(defaultIds);
|
||||||
|
setLanguageSettingProviders(providers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void doWritable() throws CoreException {
|
void doWritable() throws CoreException {
|
||||||
|
|
|
@ -135,6 +135,18 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
||||||
CConfigurationDataProvider dataProvider = CProjectDescriptionManager.getInstance().getProvider(this);
|
CConfigurationDataProvider dataProvider = CProjectDescriptionManager.getInstance().getProvider(this);
|
||||||
fData = dataProvider.loadConfiguration(this, new NullProgressMonitor());
|
fData = dataProvider.loadConfiguration(this, new NullProgressMonitor());
|
||||||
|
|
||||||
|
if (getDefaultLanguageSettingsProvidersIds() == null) {
|
||||||
|
// default ids would come from toolchain configuration, ensure sensible defaults
|
||||||
|
String[] defaultIds = ScannerDiscoveryLegacySupport.getDefaultProviderIdsLegacy(this);
|
||||||
|
setDefaultLanguageSettingsProvidersIds(defaultIds);
|
||||||
|
}
|
||||||
|
if (!fSpecSettings.isLanguageSettingProvidersLoaded()) {
|
||||||
|
// when loading - providers come from xml file, ensure defaults if no xml file present
|
||||||
|
String[] defaultIds = getDefaultLanguageSettingsProvidersIds();
|
||||||
|
List<ILanguageSettingsProvider> providers = LanguageSettingsManager.createLanguageSettingsProviders(defaultIds);
|
||||||
|
setLanguageSettingProviders(providers);
|
||||||
|
}
|
||||||
|
|
||||||
copySettingsFrom(fData, true);
|
copySettingsFrom(fData, true);
|
||||||
|
|
||||||
fSpecSettings.reconcileExtensionSettings(true);
|
fSpecSettings.reconcileExtensionSettings(true);
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class CConfigurationSpecSettings implements ICSettingsStorage, ILanguageS
|
||||||
// private CConfigBasedDescriptor fDescriptor;
|
// private CConfigBasedDescriptor fDescriptor;
|
||||||
// private Map fExternalSettingsProviderMap;
|
// private Map fExternalSettingsProviderMap;
|
||||||
|
|
||||||
private List<ILanguageSettingsProvider> fLanguageSettingsProviders = new ArrayList<ILanguageSettingsProvider>(0);
|
private List<ILanguageSettingsProvider> fLanguageSettingsProviders = null;
|
||||||
private LinkedHashMap<String /*provider*/, LanguageSettingsStorage> lspPersistedState = new LinkedHashMap<String, LanguageSettingsStorage>();
|
private LinkedHashMap<String /*provider*/, LanguageSettingsStorage> lspPersistedState = new LinkedHashMap<String, LanguageSettingsStorage>();
|
||||||
private String[] defaultLanguageSettingsProvidersIds = null;
|
private String[] defaultLanguageSettingsProvidersIds = null;
|
||||||
|
|
||||||
|
@ -195,7 +195,16 @@ public class CConfigurationSpecSettings implements ICSettingsStorage, ILanguageS
|
||||||
|
|
||||||
copyExtensionInfo(base);
|
copyExtensionInfo(base);
|
||||||
|
|
||||||
fLanguageSettingsProviders = LanguageSettingsProvidersSerializer.cloneProviders(base.getLanguageSettingProviders());
|
if (base.defaultLanguageSettingsProvidersIds != null) {
|
||||||
|
defaultLanguageSettingsProvidersIds = base.defaultLanguageSettingsProvidersIds.clone();
|
||||||
|
} else {
|
||||||
|
defaultLanguageSettingsProvidersIds = null;
|
||||||
|
}
|
||||||
|
if (base.fLanguageSettingsProviders != null) {
|
||||||
|
fLanguageSettingsProviders = LanguageSettingsProvidersSerializer.cloneProviders(base.fLanguageSettingsProviders);
|
||||||
|
} else {
|
||||||
|
fLanguageSettingsProviders = base.fLanguageSettingsProviders;
|
||||||
|
}
|
||||||
for (String providerId : base.lspPersistedState.keySet()) {
|
for (String providerId : base.lspPersistedState.keySet()) {
|
||||||
try {
|
try {
|
||||||
LanguageSettingsStorage clone = base.lspPersistedState.get(providerId).clone();
|
LanguageSettingsStorage clone = base.lspPersistedState.get(providerId).clone();
|
||||||
|
@ -204,11 +213,6 @@ public class CConfigurationSpecSettings implements ICSettingsStorage, ILanguageS
|
||||||
CCorePlugin.log("Not able to clone language settings storage:" + e); //$NON-NLS-1$
|
CCorePlugin.log("Not able to clone language settings storage:" + e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (base.defaultLanguageSettingsProvidersIds != null) {
|
|
||||||
defaultLanguageSettingsProvidersIds = base.defaultLanguageSettingsProvidersIds.clone();
|
|
||||||
} else {
|
|
||||||
defaultLanguageSettingsProvidersIds = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void copyRefInfos(Map infosMap){
|
// private void copyRefInfos(Map infosMap){
|
||||||
|
@ -1035,7 +1039,8 @@ public class CConfigurationSpecSettings implements ICSettingsStorage, ILanguageS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ILanguageSettingsProvider> getLanguageSettingProviders() {
|
public List<ILanguageSettingsProvider> getLanguageSettingProviders() {
|
||||||
return Collections.unmodifiableList(fLanguageSettingsProviders);
|
List<ILanguageSettingsProvider> providers = isLanguageSettingProvidersLoaded() ? fLanguageSettingsProviders : new ArrayList<ILanguageSettingsProvider>(0);
|
||||||
|
return Collections.unmodifiableList(providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1043,6 +1048,15 @@ public class CConfigurationSpecSettings implements ICSettingsStorage, ILanguageS
|
||||||
defaultLanguageSettingsProvidersIds = ids;
|
defaultLanguageSettingsProvidersIds = ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if language settings providers loaded into configuration settings yet
|
||||||
|
*
|
||||||
|
* @return {@code true} if loaded, {@code false} otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isLanguageSettingProvidersLoaded() {
|
||||||
|
return fLanguageSettingsProviders != null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getDefaultLanguageSettingsProvidersIds() {
|
public String[] getDefaultLanguageSettingsProvidersIds() {
|
||||||
return defaultLanguageSettingsProvidersIds;
|
return defaultLanguageSettingsProvidersIds;
|
||||||
|
|
|
@ -52,7 +52,6 @@ import javax.xml.transform.stream.StreamResult;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
||||||
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.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||||
|
@ -2470,7 +2469,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNewStyleCfg(ICConfigurationDescription cfgDes){
|
public boolean isNewStyleCfg(ICConfigurationDescription cfgDes){
|
||||||
if(cfgDes == null)
|
if(cfgDes == null || cfgDes.isPreferenceConfiguration())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CConfigurationData data = ((IInternalCCfgInfo)cfgDes).getConfigurationData(false);
|
CConfigurationData data = ((IInternalCCfgInfo)cfgDes).getConfigurationData(false);
|
||||||
|
|
|
@ -490,9 +490,9 @@ public class XmlProjectDescriptionStorage extends AbstractCProjectDescriptionSto
|
||||||
CProjectDescription des = new CProjectDescription(project, new XmlStorage(storage), storage, true, false);
|
CProjectDescription des = new CProjectDescription(project, new XmlStorage(storage), storage, true, false);
|
||||||
try {
|
try {
|
||||||
setThreadLocalProjectDesc(des);
|
setThreadLocalProjectDesc(des);
|
||||||
des.loadDatas();
|
|
||||||
|
|
||||||
LanguageSettingsProvidersSerializer.loadLanguageSettings(des);
|
LanguageSettingsProvidersSerializer.loadLanguageSettings(des);
|
||||||
|
des.loadDatas();
|
||||||
des.doneLoading();
|
des.doneLoading();
|
||||||
} finally {
|
} finally {
|
||||||
setThreadLocalProjectDesc(null);
|
setThreadLocalProjectDesc(null);
|
||||||
|
|
|
@ -1136,20 +1136,7 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab {
|
||||||
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
List<ILanguageSettingsProvider> cfgProviders = new ArrayList<ILanguageSettingsProvider>(((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders());
|
List<ILanguageSettingsProvider> cfgProviders = new ArrayList<ILanguageSettingsProvider>(((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders());
|
||||||
String[] defaultIds = ((ILanguageSettingsProvidersKeeper) cfgDescription).getDefaultLanguageSettingsProvidersIds();
|
String[] defaultIds = ((ILanguageSettingsProvidersKeeper) cfgDescription).getDefaultLanguageSettingsProvidersIds();
|
||||||
|
List<ILanguageSettingsProvider> newProviders = LanguageSettingsManager.createLanguageSettingsProviders(defaultIds);
|
||||||
List<ILanguageSettingsProvider> newProviders = new ArrayList<ILanguageSettingsProvider>(defaultIds.length);
|
|
||||||
for (String id : defaultIds) {
|
|
||||||
boolean preferShared = LanguageSettingsManager.isPreferShared(id);
|
|
||||||
ILanguageSettingsProvider newProvider = null;
|
|
||||||
if (!preferShared) {
|
|
||||||
newProvider = LanguageSettingsManager.getExtensionProviderCopy(id, true);
|
|
||||||
}
|
|
||||||
if (newProvider == null) {
|
|
||||||
newProvider = LanguageSettingsManager.getWorkspaceProvider(id);
|
|
||||||
}
|
|
||||||
newProviders.add(newProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cfgProviders.equals(newProviders)) {
|
if (!cfgProviders.equals(newProviders)) {
|
||||||
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(newProviders);
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(newProviders);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue