1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-09 19:43:27 +02:00

Bug 312575 Reconciling external settings should ensure config referenced settings are in the correct order.

This commit is contained in:
James Blackburn 2010-05-18 17:21:37 +00:00
parent 034cba9fe6
commit 501ba90f28

View file

@ -12,6 +12,7 @@
package org.eclipse.cdt.internal.core.settings.model; package org.eclipse.cdt.internal.core.settings.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
@ -367,6 +368,7 @@ public class CExternalSettingsManager implements ICExternalSettingsListener, ICP
// Modifying the project description in an asynchronous runnable is likely bad... // Modifying the project description in an asynchronous runnable is likely bad...
// Unfortunately there's nothing else we can do as it's not safe to modify the referencing configurations in place // Unfortunately there's nothing else we can do as it's not safe to modify the referencing configurations in place
IWorkspaceRunnable r = new IWorkspaceRunnable() { IWorkspaceRunnable r = new IWorkspaceRunnable() {
@SuppressWarnings("unchecked")
public void run(IProgressMonitor monitor) throws CoreException { public void run(IProgressMonitor monitor) throws CoreException {
ProjDesCfgList[] lists = null; ProjDesCfgList[] lists = null;
for (CExternalSettingsContainerChangeInfo info : event.getChangeInfos()) { for (CExternalSettingsContainerChangeInfo info : event.getChangeInfos()) {
@ -380,7 +382,14 @@ public class CExternalSettingsManager implements ICExternalSettingsListener, ICP
for (ProjDesCfgList list : lists) { for (ProjDesCfgList list : lists) {
for(int i = 0; i < list.size(); i++){ for(int i = 0; i < list.size(); i++){
CfgListCfgContainer cr = new CfgListCfgContainer(list, i); CfgListCfgContainer cr = new CfgListCfgContainer(list, i);
processContainerChange(OP_CHANGED, cr, new CfgContainerRefInfoContainer(cr), info.getContainerInfo()); if (processContainerChange(OP_CHANGED, cr, new CfgContainerRefInfoContainer(cr), info.getContainerInfo())) {
// Ensure the newly discovered settings are in the right order...
// we do this by removing and re-adding the references list
ICConfigurationDescription desc = cr.getConfguration(true);
Map<String, String> references = desc.getReferenceInfo();
desc.setReferenceInfo(Collections.EMPTY_MAP);
cr.getConfguration(true).setReferenceInfo(references);
}
} }
} }
} }
@ -546,6 +555,7 @@ public class CExternalSettingsManager implements ICExternalSettingsListener, ICP
// us to reconcile / update the cached configuration during load // us to reconcile / update the cached configuration during load
final IProject project = event.getProject(); final IProject project = event.getProject();
IWorkspaceRunnable r = new IWorkspaceRunnable(){ IWorkspaceRunnable r = new IWorkspaceRunnable(){
@SuppressWarnings("unchecked")
public void run(IProgressMonitor monitor) throws CoreException { public void run(IProgressMonitor monitor) throws CoreException {
if (!project.isAccessible()) if (!project.isAccessible())
return; return;
@ -556,8 +566,15 @@ public class CExternalSettingsManager implements ICExternalSettingsListener, ICP
CfgContainerRefInfoContainer ric = new CfgContainerRefInfoContainer(cfgCr); CfgContainerRefInfoContainer ric = new CfgContainerRefInfoContainer(cfgCr);
CContainerRef[] refs = ric.getRefInfo(false).getReferences(); CContainerRef[] refs = ric.getRefInfo(false).getReferences();
for(int k = 0; k < refs.length; k++) { for(int k = 0; k < refs.length; k++) {
if(processContainerChange(OP_CHANGED, cfgCr, new CfgContainerRefInfoContainer(cfgCr), refs[k])) if(processContainerChange(OP_CHANGED, cfgCr, new CfgContainerRefInfoContainer(cfgCr), refs[k])) {
// Ensure the newly discovered settings are in the right order...
// we do this by removing and re-adding the references list
ICConfigurationDescription desc = cfgCr.getConfguration(true);
Map<String, String> references = desc.getReferenceInfo();
desc.setReferenceInfo(Collections.EMPTY_MAP);
cfgCr.getConfguration(true).setReferenceInfo(references);
changed = true; changed = true;
}
} }
} }
if (changed) if (changed)