mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Legacy support
This commit is contained in:
parent
eba8c57096
commit
2cd027cbb7
16 changed files with 134 additions and 89 deletions
|
@ -78,9 +78,9 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
buildInfo2 = ScannerConfigProfileManager.createScannerConfigBuildInfo2(getProject());
|
buildInfo2 = ScannerConfigProfileManager.createScannerConfigBuildInfo2(getProject());
|
||||||
autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
|
autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
|
||||||
if (autodiscoveryEnabled2) {
|
if (autodiscoveryEnabled2) {
|
||||||
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(getProject());
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(getProject());
|
||||||
ICConfigurationDescription cfgDescription = projDesc.getActiveConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getActiveConfiguration();
|
||||||
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isMbsLanguageSettingsProviderOn(cfgDescription);
|
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autodiscoveryEnabled2) {
|
if (autodiscoveryEnabled2) {
|
||||||
|
@ -137,9 +137,9 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
protected boolean build(IProject project, InfoContext context, IScannerConfigBuilderInfo2 buildInfo2, IProgressMonitor monitor){
|
protected boolean build(IProject project, InfoContext context, IScannerConfigBuilderInfo2 buildInfo2, IProgressMonitor monitor){
|
||||||
boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
|
boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
|
||||||
if (autodiscoveryEnabled2) {
|
if (autodiscoveryEnabled2) {
|
||||||
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(getProject());
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(getProject());
|
||||||
ICConfigurationDescription cfgDescription = projDesc.getActiveConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getActiveConfiguration();
|
||||||
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isMbsLanguageSettingsProviderOn(cfgDescription);
|
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autodiscoveryEnabled2) {
|
if (autodiscoveryEnabled2) {
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class ScannerInfoConsoleParserFactory {
|
||||||
if (autodiscoveryEnabled2) {
|
if (autodiscoveryEnabled2) {
|
||||||
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(currentProject);
|
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(currentProject);
|
||||||
ICConfigurationDescription cfgDescription = projDesc.getActiveConfiguration();
|
ICConfigurationDescription cfgDescription = projDesc.getActiveConfiguration();
|
||||||
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isMbsLanguageSettingsProviderOn(cfgDescription);
|
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
}
|
}
|
||||||
if (autodiscoveryEnabled2 && scBuildInfo.isBuildOutputParserEnabled()) {
|
if (autodiscoveryEnabled2 && scBuildInfo.isBuildOutputParserEnabled()) {
|
||||||
// get the make builder console parser
|
// get the make builder console parser
|
||||||
|
|
|
@ -187,7 +187,7 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
||||||
if (autodiscoveryEnabled2) {
|
if (autodiscoveryEnabled2) {
|
||||||
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(getProject());
|
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(getProject());
|
||||||
ICConfigurationDescription cfgDescription = projDesc.getActiveConfiguration();
|
ICConfigurationDescription cfgDescription = projDesc.getActiveConfiguration();
|
||||||
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isMbsLanguageSettingsProviderOn(cfgDescription);
|
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
}
|
}
|
||||||
scEnabledButton.setSelection(needsSCNature ? false
|
scEnabledButton.setSelection(needsSCNature ? false
|
||||||
: (autodiscoveryEnabled2
|
: (autodiscoveryEnabled2
|
||||||
|
|
|
@ -181,11 +181,8 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
public static SCProfileInstance build(CfgInfoContext context, IScannerConfigBuilderInfo2 buildInfo2, int flags, Properties env, IProgressMonitor monitor) throws CoreException{
|
public static SCProfileInstance build(CfgInfoContext context, IScannerConfigBuilderInfo2 buildInfo2, int flags, Properties env, IProgressMonitor monitor) throws CoreException{
|
||||||
IConfiguration cfg = context.getConfiguration();
|
IConfiguration cfg = context.getConfiguration();
|
||||||
IProject project = cfg.getOwner().getProject();
|
IProject project = cfg.getOwner().getProject();
|
||||||
boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
|
boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled() &&
|
||||||
if (autodiscoveryEnabled2) {
|
ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(ManagedBuildManager.getDescriptionForConfiguration(cfg));
|
||||||
ICConfigurationDescription cfgDescription = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
|
||||||
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isMbsLanguageSettingsProviderOn(cfgDescription);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (autodiscoveryEnabled2 || ((flags & FORCE_DISCOVERY) != 0)) {
|
if (autodiscoveryEnabled2 || ((flags & FORCE_DISCOVERY) != 0)) {
|
||||||
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
|
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
|
||||||
|
|
|
@ -426,7 +426,7 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
||||||
if (autodiscoveryEnabled2) {
|
if (autodiscoveryEnabled2) {
|
||||||
IConfiguration cfg = context.getConfiguration();
|
IConfiguration cfg = context.getConfiguration();
|
||||||
ICConfigurationDescription cfgDescription = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
ICConfigurationDescription cfgDescription = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
||||||
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isMbsLanguageSettingsProviderOn(cfgDescription);
|
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
}
|
}
|
||||||
if (autodiscoveryEnabled2 && info.isBuildOutputParserEnabled()) {
|
if (autodiscoveryEnabled2 && info.isBuildOutputParserEnabled()) {
|
||||||
|
|
||||||
|
|
|
@ -573,12 +573,9 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AG TODO - should it be when empty or when ids==null?
|
||||||
if (providers.isEmpty()) {
|
if (providers.isEmpty()) {
|
||||||
// Add MBS and User provider for unsuspecting toolchains (backward compatibility)
|
providers = ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy();
|
||||||
ILanguageSettingsProvider userProvider = LanguageSettingsManager.getExtensionProviderCopy(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, true);
|
|
||||||
ILanguageSettingsProvider mbsProvider = LanguageSettingsManager.getWorkspaceProvider(ScannerDiscoveryLegacySupport.MBS_LANGUAGE_SETTINGS_PROVIDER_ID);
|
|
||||||
providers.add(userProvider);
|
|
||||||
providers.add(mbsProvider);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return providers;
|
return providers;
|
||||||
|
|
|
@ -351,7 +351,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
private void setEnablement() {
|
private void setEnablement() {
|
||||||
IStatus status = null;
|
IStatus status = null;
|
||||||
ICConfigurationDescription cfgDescription = page.getResDesc().getConfiguration();
|
ICConfigurationDescription cfgDescription = page.getResDesc().getConfiguration();
|
||||||
boolean isEnabled = ScannerDiscoveryLegacySupport.isMbsLanguageSettingsProviderOn(cfgDescription);
|
boolean isEnabled = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
if (!isEnabled) {
|
if (!isEnabled) {
|
||||||
status = new Status(IStatus.INFO, CUIPlugin.PLUGIN_ID, "Managed Build language settings provider is not enabled.");
|
status = new Status(IStatus.INFO, CUIPlugin.PLUGIN_ID, "Managed Build language settings provider is not enabled.");
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
if (autodiscoveryEnabled2) {
|
if (autodiscoveryEnabled2) {
|
||||||
IConfiguration cfg = iContext.getConfiguration();
|
IConfiguration cfg = iContext.getConfiguration();
|
||||||
ICConfigurationDescription cfgDescription = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
ICConfigurationDescription cfgDescription = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
||||||
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isMbsLanguageSettingsProviderOn(cfgDescription);
|
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
}
|
}
|
||||||
autoDiscoveryCheckBox.setSelection(autodiscoveryEnabled2
|
autoDiscoveryCheckBox.setSelection(autodiscoveryEnabled2
|
||||||
&& !selectedProfileId.equals(ScannerConfigProfileManager.NULL_PROFILE_ID));
|
&& !selectedProfileId.equals(ScannerConfigProfileManager.NULL_PROFILE_ID));
|
||||||
|
|
|
@ -25,7 +25,6 @@ import java.util.TreeSet;
|
||||||
|
|
||||||
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.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
@ -610,9 +609,9 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
if (isTryingNewSD) {
|
if (isTryingNewSD) {
|
||||||
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(config, cfgDes);
|
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(config, cfgDes);
|
||||||
} else {
|
} else {
|
||||||
providers = new ArrayList<ILanguageSettingsProvider>();
|
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
providers.add(LanguageSettingsManager.getWorkspaceProvider(ScannerDiscoveryLegacySupport.MBS_LANGUAGE_SETTINGS_PROVIDER_ID));
|
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||||
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(providers);
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, false);
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, false);
|
||||||
|
|
|
@ -11,14 +11,10 @@
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCProjectNature;
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
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.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.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
@ -126,9 +122,9 @@ public class NewMakeProjFromExisting extends Wizard implements IImportWizard, IN
|
||||||
if (isTryingNewSD) {
|
if (isTryingNewSD) {
|
||||||
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(config, cfgDes);
|
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(config, cfgDes);
|
||||||
} else {
|
} else {
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
providers.add(LanguageSettingsManager.getWorkspaceProvider(ScannerDiscoveryLegacySupport.MBS_LANGUAGE_SETTINGS_PROVIDER_ID));
|
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||||
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(providers);
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, false);
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, false);
|
||||||
|
|
|
@ -11,12 +11,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
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.ILanguageSettingsProvidersKeeper;
|
||||||
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.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
@ -124,9 +119,9 @@ public class STDWizardHandler extends MBSWizardHandler {
|
||||||
if (isTryingNewSD) {
|
if (isTryingNewSD) {
|
||||||
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(cfg, cfgDes);
|
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(cfg, cfgDes);
|
||||||
} else {
|
} else {
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
providers.add(LanguageSettingsManager.getWorkspaceProvider(ScannerDiscoveryLegacySupport.MBS_LANGUAGE_SETTINGS_PROVIDER_ID));
|
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||||
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(providers);
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, false);
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, false);
|
||||||
|
|
|
@ -120,6 +120,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
public void testListenerRegisterer_OneOwnedByCfg() throws Exception {
|
public void testListenerRegisterer_OneOwnedByCfg() throws Exception {
|
||||||
// create project
|
// create project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
|
|
||||||
{
|
{
|
||||||
// get project descriptions
|
// get project descriptions
|
||||||
|
@ -169,6 +170,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
"org.eclipse.cdt.core.tests.configuration.id.1",
|
"org.eclipse.cdt.core.tests.configuration.id.1",
|
||||||
"org.eclipse.cdt.core.tests.configuration.id.2",
|
"org.eclipse.cdt.core.tests.configuration.id.2",
|
||||||
});
|
});
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
|
|
||||||
{
|
{
|
||||||
// get project descriptions
|
// get project descriptions
|
||||||
|
@ -228,6 +230,8 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
public void testListenerRegisterer_OneGlobal() throws Exception {
|
public void testListenerRegisterer_OneGlobal() throws Exception {
|
||||||
// create project
|
// create project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
|
|
||||||
{
|
{
|
||||||
// get project descriptions
|
// get project descriptions
|
||||||
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance().getProjectDescription(project, true);
|
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance().getProjectDescription(project, true);
|
||||||
|
@ -276,6 +280,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
"org.eclipse.cdt.core.tests.configuration.id.1",
|
"org.eclipse.cdt.core.tests.configuration.id.1",
|
||||||
"org.eclipse.cdt.core.tests.configuration.id.2",
|
"org.eclipse.cdt.core.tests.configuration.id.2",
|
||||||
});
|
});
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
|
|
||||||
{
|
{
|
||||||
// retrieve global provider
|
// retrieve global provider
|
||||||
|
@ -336,6 +341,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
"org.eclipse.cdt.core.tests.configuration.id.1",
|
"org.eclipse.cdt.core.tests.configuration.id.1",
|
||||||
"org.eclipse.cdt.core.tests.configuration.id.2",
|
"org.eclipse.cdt.core.tests.configuration.id.2",
|
||||||
});
|
});
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
|
|
||||||
{
|
{
|
||||||
// retrieve workspace provider
|
// retrieve workspace provider
|
||||||
|
@ -407,6 +413,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
public void testListenerRegisterer_GlobalProviderTwoProjects() throws Exception {
|
public void testListenerRegisterer_GlobalProviderTwoProjects() throws Exception {
|
||||||
// create project 1
|
// create project 1
|
||||||
IProject project_1 = ResourceHelper.createCDTProjectWithConfig(this.getName() + ".1");
|
IProject project_1 = ResourceHelper.createCDTProjectWithConfig(this.getName() + ".1");
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project_1, true);
|
||||||
{
|
{
|
||||||
// get project descriptions
|
// get project descriptions
|
||||||
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance().getProjectDescription(project_1, true);
|
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance().getProjectDescription(project_1, true);
|
||||||
|
@ -431,6 +438,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
|
|
||||||
// create project 2
|
// create project 2
|
||||||
IProject project_2 = ResourceHelper.createCDTProjectWithConfig(this.getName() + ".2");
|
IProject project_2 = ResourceHelper.createCDTProjectWithConfig(this.getName() + ".2");
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project_2, true);
|
||||||
{
|
{
|
||||||
// get project descriptions
|
// get project descriptions
|
||||||
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance().getProjectDescription(project_2, true);
|
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance().getProjectDescription(project_2, true);
|
||||||
|
@ -510,6 +518,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
// prepare project
|
// prepare project
|
||||||
List<ILanguageSettingsProvider> workspaceProvidersOriginal = LanguageSettingsManager.getWorkspaceProviders();
|
List<ILanguageSettingsProvider> workspaceProvidersOriginal = LanguageSettingsManager.getWorkspaceProviders();
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
{
|
{
|
||||||
// get project descriptions
|
// get project descriptions
|
||||||
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance().getProjectDescription(project, true);
|
ICProjectDescription prjDescriptionWritable = CProjectDescriptionManager.getInstance().getProjectDescription(project, true);
|
||||||
|
@ -560,6 +569,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
public void testNotification_cfgProvider_AddEmptyProvider() throws Exception {
|
public void testNotification_cfgProvider_AddEmptyProvider() throws Exception {
|
||||||
// create project
|
// create project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
// First clear default providers
|
// First clear default providers
|
||||||
{
|
{
|
||||||
// get project descriptions
|
// get project descriptions
|
||||||
|
@ -618,6 +628,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
public void testNotification_cfgProvider_AddNonEmptyProvider() throws Exception {
|
public void testNotification_cfgProvider_AddNonEmptyProvider() throws Exception {
|
||||||
// create project
|
// create project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
// First clear default providers
|
// First clear default providers
|
||||||
{
|
{
|
||||||
// get project descriptions
|
// get project descriptions
|
||||||
|
@ -685,6 +696,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
public void testNotification_cfgProvider_SerializeEntries() throws Exception {
|
public void testNotification_cfgProvider_SerializeEntries() throws Exception {
|
||||||
// create project
|
// create project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
|
|
||||||
// add the mock provider
|
// add the mock provider
|
||||||
{
|
{
|
||||||
|
@ -754,6 +766,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
public void testNotification_cfgProvider_SerializeEntriesConcurrent() throws Exception {
|
public void testNotification_cfgProvider_SerializeEntriesConcurrent() throws Exception {
|
||||||
// create project
|
// create project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
|
|
||||||
// add the mock provider
|
// add the mock provider
|
||||||
{
|
{
|
||||||
|
@ -857,6 +870,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
public void testNotification_globalProvider_AddEmptyProvider() throws Exception {
|
public void testNotification_globalProvider_AddEmptyProvider() throws Exception {
|
||||||
// create project
|
// create project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
// First clear default providers
|
// First clear default providers
|
||||||
{
|
{
|
||||||
// get project descriptions
|
// get project descriptions
|
||||||
|
@ -922,6 +936,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
public void testNotification_globalProvider_AddNonEmptyProvider() throws Exception {
|
public void testNotification_globalProvider_AddNonEmptyProvider() throws Exception {
|
||||||
// create project
|
// create project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
// First clear default providers
|
// First clear default providers
|
||||||
{
|
{
|
||||||
// get project descriptions
|
// get project descriptions
|
||||||
|
@ -997,6 +1012,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||||
public void testNotification_globalProvider_SerializeEntries() throws Exception {
|
public void testNotification_globalProvider_SerializeEntries() throws Exception {
|
||||||
// create project
|
// create project
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
|
|
||||||
// register mock listener to inspect the notifications
|
// register mock listener to inspect the notifications
|
||||||
LanguageSettingsManager.registerLanguageSettingsChangeListener(mockLseListener);
|
LanguageSettingsManager.registerLanguageSettingsChangeListener(mockLseListener);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
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;
|
||||||
|
@ -18,6 +19,8 @@ import java.util.Map;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
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.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
import org.osgi.service.prefs.BackingStoreException;
|
import org.osgi.service.prefs.BackingStoreException;
|
||||||
|
@ -86,10 +89,9 @@ public class ScannerDiscoveryLegacySupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @noreference This is internal helper method to support compatibility with previous versions
|
* Check if legacy Scanner Discovery in MBS should be active.
|
||||||
* which is not intended to be referenced by clients.
|
|
||||||
*/
|
*/
|
||||||
public static boolean isMbsLanguageSettingsProviderOn(ICConfigurationDescription cfgDescription) {
|
private static boolean isMbsLanguageSettingsProviderOn(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) {
|
||||||
|
@ -101,6 +103,28 @@ public class ScannerDiscoveryLegacySupport {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @noreference This is internal helper method to support compatibility with previous versions
|
||||||
|
* which is not intended to be referenced by clients.
|
||||||
|
*/
|
||||||
|
public static boolean isLegacyScannerDiscoveryOn(ICConfigurationDescription cfgDescription) {
|
||||||
|
IProject project = cfgDescription != null ? cfgDescription.getProjectDescription().getProject() : null;
|
||||||
|
return isLanguageSettingsProvidersFunctionalityEnabled(project) || isMbsLanguageSettingsProviderOn(cfgDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list containing MBS and User provider. Used to initialize for unaware tool-chains (backward compatibility).
|
||||||
|
*/
|
||||||
|
public static List<ILanguageSettingsProvider> getDefaultProvidersLegacy() {
|
||||||
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>(2);
|
||||||
|
ILanguageSettingsProvider provider = LanguageSettingsExtensionManager.getExtensionProviderCopy((ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID), false);
|
||||||
|
if (provider != null) {
|
||||||
|
providers.add(provider);
|
||||||
|
}
|
||||||
|
providers.add(LanguageSettingsProvidersSerializer.getWorkspaceProvider(ScannerDiscoveryLegacySupport.MBS_LANGUAGE_SETTINGS_PROVIDER_ID));
|
||||||
|
return providers;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the values of scanner discovery profiles (scannerConfigDiscoveryProfileId) which were deprecated
|
* Returns the values of scanner discovery profiles (scannerConfigDiscoveryProfileId) which were deprecated
|
||||||
* and replaced with language settings providers in plugin.xml.
|
* and replaced with language settings providers in plugin.xml.
|
||||||
|
|
|
@ -261,9 +261,15 @@ public class LanguageSettingsProvidersSerializer {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
if (specSettings != null) {
|
if (specSettings != null) {
|
||||||
|
String cfgId = cfgDescription.getId();
|
||||||
|
if (ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(prjDescription.getProject())) {
|
||||||
LanguageSettingsDelta delta = specSettings.dropDelta();
|
LanguageSettingsDelta delta = specSettings.dropDelta();
|
||||||
if (delta != null)
|
if (delta != null) {
|
||||||
deltaMap.put(cfgDescription.getId(), delta);
|
deltaMap.put(cfgId, delta);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deltaMap.remove(cfgId);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
IStatus ss = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "Internal error: Missing specSettings for " //$NON-NLS-1$
|
IStatus ss = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "Internal error: Missing specSettings for " //$NON-NLS-1$
|
||||||
+ cfgDescription.getClass().getSimpleName());
|
+ cfgDescription.getClass().getSimpleName());
|
||||||
|
@ -1059,10 +1065,7 @@ public class LanguageSettingsProvidersSerializer {
|
||||||
ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations();
|
ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations();
|
||||||
for (ICConfigurationDescription cfgDescription : cfgDescriptions) {
|
for (ICConfigurationDescription cfgDescription : cfgDescriptions) {
|
||||||
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>(2);
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||||
providers.add(LanguageSettingsExtensionManager.getExtensionProviderCopy((ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID), true));
|
|
||||||
providers.add(getWorkspaceProvider(ScannerDiscoveryLegacySupport.MBS_LANGUAGE_SETTINGS_PROVIDER_ID));
|
|
||||||
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ import javax.xml.transform.dom.DOMSource;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
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.LanguageSettingsManager;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingsStorage;
|
import org.eclipse.cdt.core.settings.model.ICSettingsStorage;
|
||||||
|
@ -172,7 +171,7 @@ public class XmlProjectDescriptionStorage extends AbstractCProjectDescriptionSto
|
||||||
}, null, IWorkspace.AVOID_UPDATE, null);
|
}, null, IWorkspace.AVOID_UPDATE, null);
|
||||||
// end Bug 249951 & Bug 310007
|
// end Bug 249951 & Bug 310007
|
||||||
serializingLock.acquire();
|
serializingLock.acquire();
|
||||||
LanguageSettingsManager.serializeLanguageSettings(fDes);
|
LanguageSettingsProvidersSerializer.serializeLanguageSettings(fDes);
|
||||||
projectModificaitonStamp = serialize(fDes.getProject(), ICProjectDescriptionStorageType.STORAGE_FILE_NAME, fElement);
|
projectModificaitonStamp = serialize(fDes.getProject(), ICProjectDescriptionStorageType.STORAGE_FILE_NAME, fElement);
|
||||||
((ContributedEnvironment) CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment()).serialize(fDes);
|
((ContributedEnvironment) CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment()).serialize(fDes);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -441,6 +441,15 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
||||||
boolean enabled = enableProvidersCheckBox.getSelection();
|
boolean enabled = enableProvidersCheckBox.getSelection();
|
||||||
if (masterPropertyPage!=null)
|
if (masterPropertyPage!=null)
|
||||||
masterPropertyPage.setLanguageSettingsProvidersEnabled(enabled);
|
masterPropertyPage.setLanguageSettingsProvidersEnabled(enabled);
|
||||||
|
|
||||||
|
if (!enabled) {
|
||||||
|
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||||
|
updateData(getResDesc());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enableControls(enabled);
|
enableControls(enabled);
|
||||||
updateStatusLine();
|
updateStatusLine();
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab {
|
||||||
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
||||||
String[] defaultIds = ((ILanguageSettingsProvidersKeeper) cfgDescription).getDefaultLanguageSettingsProvidersIds();
|
String[] defaultIds = ((ILanguageSettingsProvidersKeeper) cfgDescription).getDefaultLanguageSettingsProvidersIds();
|
||||||
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
if (Arrays.asList(defaultIds).contains(id) != providers.contains(provider)) {
|
if (defaultIds != null && Arrays.asList(defaultIds).contains(id) != providers.contains(provider)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,6 +339,16 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab {
|
||||||
boolean enabled = enableProvidersCheckBox.getSelection();
|
boolean enabled = enableProvidersCheckBox.getSelection();
|
||||||
if (masterPropertyPage!=null)
|
if (masterPropertyPage!=null)
|
||||||
masterPropertyPage.setLanguageSettingsProvidersEnabled(enabled);
|
masterPropertyPage.setLanguageSettingsProvidersEnabled(enabled);
|
||||||
|
|
||||||
|
// AG TODO - if not enabled reset providers to MBS provider only
|
||||||
|
if (!enabled) {
|
||||||
|
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||||
|
updateData(getResDesc());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
enableControls(enabled);
|
enableControls(enabled);
|
||||||
updateStatusLine();
|
updateStatusLine();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue