1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Made the CDescriptorTests pass

This commit is contained in:
Mikhail Sennikovsky 2007-03-27 15:56:26 +00:00
parent fd22d96b63
commit 0c819191c7
2 changed files with 47 additions and 27 deletions

View file

@ -657,43 +657,24 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
}
public void remove(ICConfigExtensionReference ext) throws CoreException {
// boolean fireEvent = false;
// synchronized (this) {
CConfigExtensionReference extensions[] = (CConfigExtensionReference[])getExtMap().get(ext.getExtensionPoint());
for (int i = 0; i < extensions.length; i++) {
if (extensions[i] == ext) {
// System.arraycopy(extensions, i, extensions, i + 1, extensions.length - 1 - i);
System.arraycopy(extensions, i + 1, extensions, i, extensions.length - 1 - i);
if (extensions.length > 1) {
CConfigExtensionReference[] newExtensions = new CConfigExtensionReference[extensions.length - 1];
System.arraycopy(extensions, 0, newExtensions, 0, newExtensions.length);
getExtMap().put(ext.getExtensionPoint(), newExtensions);
} else {
getExtMap().remove(ext.getExtensionPoint());
}
// updateOnDisk();
// if (!isInitializing) {
// fireEvent = true;
// }
}
}
// }
// if (fireEvent) {
// fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED, CDescriptorEvent.EXTENSION_CHANGED));
// }
doRemove(ext);
fIsModified = true;
}
private void doRemove(String extensionPoint) throws CoreException {
private boolean doRemove(String extensionPoint) throws CoreException {
// boolean fireEvent = false;
// synchronized (this) {
CConfigExtensionReference extensions[] = (CConfigExtensionReference[])getExtMap().get(extensionPoint);
if (extensions != null) {
getExtMap().remove(extensionPoint);
return true;
// updateOnDisk();
// if (!isInitializing) {
// fireEvent = true;
// }
}
return false;
// }
// if (fireEvent) {
// fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED, CDescriptorEvent.EXTENSION_CHANGED));
@ -702,9 +683,12 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
public void remove(String extensionPoint) throws CoreException {
doRemove(extensionPoint);
boolean changed = doRemove(extensionPoint);
checkReconsile(extensionPoint, false);
if(changed)
fIsModified = true;
}
CExtensionInfo getInfo(CConfigExtensionReference cProjectExtension) {
@ -891,4 +875,29 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
}
return refsMap;
}
boolean extRefSettingsEqual(CConfigurationSpecSettings other){
if(fExtMap == null || fExtMap.size() == 0)
return other.fExtMap == null || other.fExtMap.size() == 0;
if(other.fExtMap == null || other.fExtMap.size() == 0)
return false;
if(fExtMap.size() != other.fExtMap.size())
return false;
for(Iterator iter = fExtMap.entrySet().iterator(); iter.hasNext();){
Map.Entry entry = (Map.Entry)iter.next();
ICConfigExtensionReference[] thisRefs = (ICConfigExtensionReference[])entry.getValue();
ICConfigExtensionReference[] otherRefs = (ICConfigExtensionReference[])other.fExtMap.get(entry.getKey());
if(thisRefs.length != otherRefs.length)
return false;
Map map = createRefMap(thisRefs);
map.entrySet().removeAll(createRefMap(otherRefs).entrySet());
if(map.size() != 0)
return false;
}
return true;
}
}

View file

@ -1962,7 +1962,8 @@ public class CProjectDescriptionManager {
public CProjectDescriptionDelta createDelta(ICConfigurationDescription newCfg, ICConfigurationDescription oldCfg){
CProjectDescriptionDelta delta = new CProjectDescriptionDelta(newCfg, oldCfg);
IInternalCCfgInfo newInfo = (IInternalCCfgInfo)newCfg;
IInternalCCfgInfo oldInfo = (IInternalCCfgInfo)oldCfg;
if(delta.getDeltaKind() == ICDescriptionDelta.CHANGED){
ICFolderDescription[] foDess = newCfg.getFolderDescriptions();
for(int i = 0; i < foDess.length; i++){
@ -2057,6 +2058,16 @@ public class CProjectDescriptionManager {
}
}
try {
CConfigurationSpecSettings newSettings = newInfo.getSpecSettings();
CConfigurationSpecSettings oldSettings = oldInfo.getSpecSettings();
if(!newSettings.extRefSettingsEqual(oldSettings))
delta.addChangeFlags(ICDescriptionDelta.EXT_REF);
} catch (CoreException e){
CCorePlugin.log(e);
}
ExternalSettingsManager.getInstance().calculateCfgExtSettingsDelta(delta);
int drFlags = calculateDescriptorFlags(newCfg, oldCfg);