mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 06:45:43 +02:00
Made the CDescriptorTests pass
This commit is contained in:
parent
fd22d96b63
commit
0c819191c7
2 changed files with 47 additions and 27 deletions
|
@ -657,43 +657,24 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(ICConfigExtensionReference ext) throws CoreException {
|
public void remove(ICConfigExtensionReference ext) throws CoreException {
|
||||||
// boolean fireEvent = false;
|
doRemove(ext);
|
||||||
// synchronized (this) {
|
|
||||||
CConfigExtensionReference extensions[] = (CConfigExtensionReference[])getExtMap().get(ext.getExtensionPoint());
|
fIsModified = true;
|
||||||
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));
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doRemove(String extensionPoint) throws CoreException {
|
private boolean doRemove(String extensionPoint) throws CoreException {
|
||||||
// boolean fireEvent = false;
|
// boolean fireEvent = false;
|
||||||
// synchronized (this) {
|
// synchronized (this) {
|
||||||
CConfigExtensionReference extensions[] = (CConfigExtensionReference[])getExtMap().get(extensionPoint);
|
CConfigExtensionReference extensions[] = (CConfigExtensionReference[])getExtMap().get(extensionPoint);
|
||||||
if (extensions != null) {
|
if (extensions != null) {
|
||||||
getExtMap().remove(extensionPoint);
|
getExtMap().remove(extensionPoint);
|
||||||
|
return true;
|
||||||
// updateOnDisk();
|
// updateOnDisk();
|
||||||
// if (!isInitializing) {
|
// if (!isInitializing) {
|
||||||
// fireEvent = true;
|
// fireEvent = true;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
// }
|
// }
|
||||||
// if (fireEvent) {
|
// if (fireEvent) {
|
||||||
// fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED, CDescriptorEvent.EXTENSION_CHANGED));
|
// 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 {
|
public void remove(String extensionPoint) throws CoreException {
|
||||||
|
|
||||||
doRemove(extensionPoint);
|
boolean changed = doRemove(extensionPoint);
|
||||||
|
|
||||||
checkReconsile(extensionPoint, false);
|
checkReconsile(extensionPoint, false);
|
||||||
|
|
||||||
|
if(changed)
|
||||||
|
fIsModified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CExtensionInfo getInfo(CConfigExtensionReference cProjectExtension) {
|
CExtensionInfo getInfo(CConfigExtensionReference cProjectExtension) {
|
||||||
|
@ -891,4 +875,29 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
|
||||||
}
|
}
|
||||||
return refsMap;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1962,7 +1962,8 @@ public class CProjectDescriptionManager {
|
||||||
|
|
||||||
public CProjectDescriptionDelta createDelta(ICConfigurationDescription newCfg, ICConfigurationDescription oldCfg){
|
public CProjectDescriptionDelta createDelta(ICConfigurationDescription newCfg, ICConfigurationDescription oldCfg){
|
||||||
CProjectDescriptionDelta delta = new CProjectDescriptionDelta(newCfg, oldCfg);
|
CProjectDescriptionDelta delta = new CProjectDescriptionDelta(newCfg, oldCfg);
|
||||||
|
IInternalCCfgInfo newInfo = (IInternalCCfgInfo)newCfg;
|
||||||
|
IInternalCCfgInfo oldInfo = (IInternalCCfgInfo)oldCfg;
|
||||||
if(delta.getDeltaKind() == ICDescriptionDelta.CHANGED){
|
if(delta.getDeltaKind() == ICDescriptionDelta.CHANGED){
|
||||||
ICFolderDescription[] foDess = newCfg.getFolderDescriptions();
|
ICFolderDescription[] foDess = newCfg.getFolderDescriptions();
|
||||||
for(int i = 0; i < foDess.length; i++){
|
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);
|
ExternalSettingsManager.getInstance().calculateCfgExtSettingsDelta(delta);
|
||||||
|
|
||||||
int drFlags = calculateDescriptorFlags(newCfg, oldCfg);
|
int drFlags = calculateDescriptorFlags(newCfg, oldCfg);
|
||||||
|
|
Loading…
Add table
Reference in a new issue