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
|
@ -32,12 +32,12 @@ import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
/**
|
/**
|
||||||
* Runs after standard make builder.
|
* Runs after standard make builder.
|
||||||
* Consolidates discovered scanner configuration and updates project's scanner configuration.
|
* Consolidates discovered scanner configuration and updates project's scanner configuration.
|
||||||
*
|
*
|
||||||
* @deprecated as of CDT 4.0. Used by legacy CDT 3.X projects.
|
* @deprecated as of CDT 4.0. Used by legacy CDT 3.X projects.
|
||||||
* Replaced by ScannerConfigBuilder in org.eclipse.cdt.managedbuilder.core.
|
* Replaced by ScannerConfigBuilder in org.eclipse.cdt.managedbuilder.core.
|
||||||
*
|
*
|
||||||
* @see IncrementalProjectBuilder
|
* @see IncrementalProjectBuilder
|
||||||
*
|
*
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
*/
|
*/
|
||||||
|
@ -67,34 +67,34 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
try {
|
try {
|
||||||
// IScannerConfigBuilderInfo buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(getProject(), BUILDER_ID);
|
// IScannerConfigBuilderInfo buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(getProject(), BUILDER_ID);
|
||||||
// autodiscoveryEnabled = buildInfo.isAutoDiscoveryEnabled();
|
// autodiscoveryEnabled = buildInfo.isAutoDiscoveryEnabled();
|
||||||
//
|
//
|
||||||
// if (autodiscoveryEnabled) {
|
// if (autodiscoveryEnabled) {
|
||||||
// monitor.beginTask("ScannerConfigBuilder.Invoking_Builder", 100); //$NON-NLS-1$
|
// monitor.beginTask("ScannerConfigBuilder.Invoking_Builder", 100); //$NON-NLS-1$
|
||||||
// monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
|
// monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
|
||||||
// getProject().getName());
|
// getProject().getName());
|
||||||
// ScannerInfoCollector.getInstance().updateScannerConfiguration(getProject(), new SubProgressMonitor(monitor, 100));
|
// ScannerInfoCollector.getInstance().updateScannerConfiguration(getProject(), new SubProgressMonitor(monitor, 100));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
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) {
|
||||||
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
|
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
|
||||||
monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
|
monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
|
||||||
getProject().getName());
|
getProject().getName());
|
||||||
|
|
||||||
// get scanner info from all external providers
|
// get scanner info from all external providers
|
||||||
SCJobsUtil.getProviderScannerInfo(getProject(), buildInfo2, new SubProgressMonitor(monitor, 70));
|
SCJobsUtil.getProviderScannerInfo(getProject(), buildInfo2, new SubProgressMonitor(monitor, 70));
|
||||||
|
|
||||||
// update and persist scanner configuration
|
// update and persist scanner configuration
|
||||||
SCJobsUtil.updateScannerConfiguration(getProject(), buildInfo2, new SubProgressMonitor(monitor, 30));
|
SCJobsUtil.updateScannerConfiguration(getProject(), buildInfo2, new SubProgressMonitor(monitor, 30));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (CoreException e) {
|
catch (CoreException e) {
|
||||||
// builder not installed or disabled
|
// builder not installed or disabled
|
||||||
// autodiscoveryEnabled = false;
|
// autodiscoveryEnabled = false;
|
||||||
|
@ -103,12 +103,12 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
}
|
}
|
||||||
return getProject().getReferencedProjects();
|
return getProject().getReferencedProjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean buildNewStyle(IProject project, IProgressMonitor monitor) throws CoreException{
|
protected boolean buildNewStyle(IProject project, IProgressMonitor monitor) throws CoreException{
|
||||||
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project, false);
|
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project, false);
|
||||||
if(!CCorePlugin.getDefault().isNewStyleProject(des))
|
if(!CCorePlugin.getDefault().isNewStyleProject(des))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ICConfigurationDescription[] cfgs = des.getConfigurations();
|
ICConfigurationDescription[] cfgs = des.getConfigurations();
|
||||||
IScannerConfigBuilderInfo2Set container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(project);
|
IScannerConfigBuilderInfo2Set container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(project);
|
||||||
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.0"), cfgs.length + 1); //$NON-NLS-1$
|
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.0"), cfgs.length + 1); //$NON-NLS-1$
|
||||||
|
@ -126,27 +126,27 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
if(build(project, context, info, new SubProgressMonitor(monitor, 1)))
|
if(build(project, context, info, new SubProgressMonitor(monitor, 1)))
|
||||||
wasbuilt = true;
|
wasbuilt = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(wasbuilt)
|
if(wasbuilt)
|
||||||
CCorePlugin.getDefault().updateProjectDescriptions(new IProject[]{project}, new SubProgressMonitor(monitor, 1));
|
CCorePlugin.getDefault().updateProjectDescriptions(new IProject[]{project}, new SubProgressMonitor(monitor, 1));
|
||||||
|
|
||||||
monitor.done();
|
monitor.done();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
|
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
|
||||||
monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
|
monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
|
||||||
getProject().getName());
|
getProject().getName());
|
||||||
|
|
||||||
// get scanner info from all external providers
|
// get scanner info from all external providers
|
||||||
SCJobsUtil.getProviderScannerInfo(getProject(), context, buildInfo2, new SubProgressMonitor(monitor, 70));
|
SCJobsUtil.getProviderScannerInfo(getProject(), context, buildInfo2, new SubProgressMonitor(monitor, 70));
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -42,9 +42,9 @@ import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
/**
|
/**
|
||||||
* Runs after standard make builder.
|
* Runs after standard make builder.
|
||||||
* Consolidates discovered scanner configuration and updates project's scanner configuration.
|
* Consolidates discovered scanner configuration and updates project's scanner configuration.
|
||||||
*
|
*
|
||||||
* @see IncrementalProjectBuilder
|
* @see IncrementalProjectBuilder
|
||||||
*
|
*
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
*/
|
*/
|
||||||
|
@ -56,7 +56,7 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
* tells the discovery mechanism to perform core settings update
|
* tells the discovery mechanism to perform core settings update
|
||||||
*/
|
*/
|
||||||
public static final int PERFORM_CORE_UPDATE = 1;
|
public static final int PERFORM_CORE_UPDATE = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* force the discovery, i.e. run the discovery even if it is disabled
|
* force the discovery, i.e. run the discovery even if it is disabled
|
||||||
*/
|
*/
|
||||||
|
@ -68,7 +68,7 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
public static final int SKIP_SI_DISCOVERY = 1 << 2;
|
public static final int SKIP_SI_DISCOVERY = 1 << 2;
|
||||||
|
|
||||||
public final static String BUILDER_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".ScannerConfigBuilder"; //$NON-NLS-1$
|
public final static String BUILDER_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".ScannerConfigBuilder"; //$NON-NLS-1$
|
||||||
|
|
||||||
public ScannerConfigBuilder() {
|
public ScannerConfigBuilder() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -121,22 +121,22 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CfgDiscoveredPathManager.getInstance().updateCoreSettings(getProject(), cfgs);
|
CfgDiscoveredPathManager.getInstance().updateCoreSettings(getProject(), cfgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return getProject().getReferencedProjects();
|
return getProject().getReferencedProjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void build(IConfiguration cfg, int flags, IProgressMonitor monitor){
|
public static void build(IConfiguration cfg, int flags, IProgressMonitor monitor){
|
||||||
if(cfg != null){
|
if(cfg != null){
|
||||||
// IScannerConfigBuilderInfo buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(getProject(), BUILDER_ID);
|
// IScannerConfigBuilderInfo buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(getProject(), BUILDER_ID);
|
||||||
// autodiscoveryEnabled = buildInfo.isAutoDiscoveryEnabled();
|
// autodiscoveryEnabled = buildInfo.isAutoDiscoveryEnabled();
|
||||||
//
|
//
|
||||||
// if (autodiscoveryEnabled) {
|
// if (autodiscoveryEnabled) {
|
||||||
// monitor.beginTask("ScannerConfigBuilder.Invoking_Builder", 100); //$NON-NLS-1$
|
// monitor.beginTask("ScannerConfigBuilder.Invoking_Builder", 100); //$NON-NLS-1$
|
||||||
// monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
|
// monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
|
||||||
// getProject().getName());
|
// getProject().getName());
|
||||||
// ScannerInfoCollector.getInstance().updateScannerConfiguration(getProject(), new SubProgressMonitor(monitor, 100));
|
// ScannerInfoCollector.getInstance().updateScannerConfiguration(getProject(), new SubProgressMonitor(monitor, 100));
|
||||||
// }
|
// }
|
||||||
|
@ -165,7 +165,7 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Properties calcEnvironment(IConfiguration cfg){
|
private static Properties calcEnvironment(IConfiguration cfg){
|
||||||
Properties envProps = new Properties();
|
Properties envProps = new Properties();
|
||||||
ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
||||||
|
@ -174,27 +174,24 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
for(int i = 0; i < vars.length; i++){
|
for(int i = 0; i < vars.length; i++){
|
||||||
envProps.setProperty(vars[i].getName(), vars[i].getValue());
|
envProps.setProperty(vars[i].getName(), vars[i].getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
return envProps;
|
return envProps;
|
||||||
}
|
}
|
||||||
|
|
||||||
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$
|
||||||
monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
|
monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
|
||||||
project.getName());
|
project.getName());
|
||||||
|
|
||||||
if(env == null)
|
if(env == null)
|
||||||
env = calcEnvironment(cfg);
|
env = calcEnvironment(cfg);
|
||||||
|
|
||||||
// get scanner info from all external providers
|
// get scanner info from all external providers
|
||||||
SCProfileInstance instance = ScannerConfigProfileManager.getInstance().
|
SCProfileInstance instance = ScannerConfigProfileManager.getInstance().
|
||||||
getSCProfileInstance(project, context.toInfoContext(), buildInfo2.getSelectedProfileId());
|
getSCProfileInstance(project, context.toInfoContext(), buildInfo2.getSelectedProfileId());
|
||||||
|
@ -206,17 +203,17 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
|
|
||||||
// update and persist scanner configuration
|
// update and persist scanner configuration
|
||||||
CfgSCJobsUtil.updateScannerConfiguration(project, context, instance, buildInfo2, new SubProgressMonitor(monitor, 30));
|
CfgSCJobsUtil.updateScannerConfiguration(project, context, instance, buildInfo2, new SubProgressMonitor(monitor, 30));
|
||||||
|
|
||||||
// Remove the previous discovered path info to ensure it get's regenerated.
|
// Remove the previous discovered path info to ensure it get's regenerated.
|
||||||
// TODO we should really only do this if the information has changed
|
// TODO we should really only do this if the information has changed
|
||||||
CfgDiscoveredPathManager.getInstance().removeDiscoveredInfo(project, context, false);
|
CfgDiscoveredPathManager.getInstance().removeDiscoveredInfo(project, context, false);
|
||||||
|
|
||||||
if((flags & PERFORM_CORE_UPDATE) != 0)
|
if((flags & PERFORM_CORE_UPDATE) != 0)
|
||||||
CfgDiscoveredPathManager.getInstance().updateCoreSettings(project, new IConfiguration[]{cfg});
|
CfgDiscoveredPathManager.getInstance().updateCoreSettings(project, new IConfiguration[]{cfg});
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
LanguageSettingsDelta delta = specSettings.dropDelta();
|
String cfgId = cfgDescription.getId();
|
||||||
if (delta != null)
|
if (ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(prjDescription.getProject())) {
|
||||||
deltaMap.put(cfgDescription.getId(), delta);
|
LanguageSettingsDelta delta = specSettings.dropDelta();
|
||||||
|
if (delta != null) {
|
||||||
|
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