1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

1. Tool-chain modification functionality fixes

2. setProjectDescription enhancements
2. other bug-fixes
This commit is contained in:
Mikhail Sennikovsky 2007-03-26 13:13:41 +00:00
parent 52750d5170
commit 202d1bb38b
10 changed files with 123 additions and 38 deletions

View file

@ -3556,7 +3556,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
return null;
}
*/
private static final boolean TEST_CONSISTANCE = false;
private static final boolean TEST_CONSISTANCE = true;
public static IConfiguration getConfigurationForDescription(ICConfigurationDescription cfgDes){
return getConfigurationForDescription(cfgDes, TEST_CONSISTANCE);
@ -3660,8 +3660,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
private static ICConfigurationDescription getDescriptionForConfiguration(IConfiguration cfg, boolean checkConsistance){
ICConfigurationDescription des = ((Configuration)cfg).getConfigurationDescription();
if(des == null){
if(checkConsistance)
throw new IllegalStateException();
// if(checkConsistance)
// throw new IllegalStateException();
if(((Configuration)cfg).isPreference()){
try {
des = CCorePlugin.getDefault().getPreferenceConfiguration(CFG_DATA_PROVIDER_ID);

View file

@ -2707,12 +2707,20 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
if(newBuilder.getParent() == tc){
newCfgBuilder = (Builder)newBuilder;
} else {
IBuilder extBuilder = newBuilder;
for(;extBuilder != null && !extBuilder.isExtensionElement(); extBuilder = extBuilder.getSuperClass());
if(extBuilder == null)
extBuilder = newBuilder;
newCfgBuilder = new Builder(tc, extBuilder, id, name, false);
newCfgBuilder.copySettings(cur, allBuildSettings);
IBuilder curReal = ManagedBuildManager.getRealBuilder(cur);
IBuilder newReal = ManagedBuildManager.getRealBuilder(newBuilder);
if(newReal != curReal){
IBuilder extBuilder = newBuilder;
for(;extBuilder != null && !extBuilder.isExtensionElement(); extBuilder = extBuilder.getSuperClass());
if(extBuilder == null)
extBuilder = newBuilder;
newCfgBuilder = new Builder(tc, extBuilder, id, name, false);
newCfgBuilder.copySettings(cur, allBuildSettings);
}
}
if(newCfgBuilder != null){
tc.setBuilder(newCfgBuilder);
}
}

View file

@ -15,6 +15,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -738,18 +739,22 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
}
public IToolChain changeToolChain(IToolChain newSuperClass, String Id, String name) throws BuildException{
IConfigurationElement el = getToolChainConverterElement(newSuperClass);
ToolChain oldToolChain = toolChain;
ITool oldTools[] = oldToolChain.getTools();
IToolChain curReal = ManagedBuildManager.getRealToolChain(toolChain);
IToolChain newReal = ManagedBuildManager.getRealToolChain(newSuperClass);
if(el != null){
updateToolChainWithConverter(el, newSuperClass, Id, name);
} else {
updateToolChainWithProperties(newSuperClass, Id, name);
if(newReal != curReal){
ToolChain oldToolChain = toolChain;
IConfigurationElement el = getToolChainConverterElement(newSuperClass);
ITool oldTools[] = oldToolChain.getTools();
if(el != null){
updateToolChainWithConverter(el, newSuperClass, Id, name);
} else {
updateToolChainWithProperties(newSuperClass, Id, name);
}
BuildSettingsUtil.disconnectDepentents(getParent(), oldTools);
}
BuildSettingsUtil.disconnectDepentents(getParent(), oldTools);
return toolChain;
}
@ -796,7 +801,37 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
return null;
}
private ITool[][] checkDups(ITool[] removed, ITool[] added){
LinkedHashMap removedMap = createRealMap(removed);
LinkedHashMap addedMap = createRealMap(added);
LinkedHashMap rmCopy = (LinkedHashMap)removedMap.clone();
removedMap.keySet().removeAll(addedMap.keySet());
addedMap.keySet().removeAll(rmCopy.keySet());
ITool[][] result = new Tool[2][];
result[0] = (Tool[])removedMap.values().toArray(new Tool[removedMap.size()]);
result[1] = (Tool[])addedMap.values().toArray(new Tool[addedMap.size()]);
return result;
}
private LinkedHashMap createRealMap(ITool[] tools){
LinkedHashMap map = new LinkedHashMap();
for(int i = 0; i < tools.length; i++){
Tool realTool = (Tool)ManagedBuildManager.getRealTool(tools[i]);
Object key = realTool.getMatchKey();
map.put(key, tools[i]);
}
return map;
}
public void modifyToolChain(ITool[] removed, ITool[] added){
ITool[][] checked = checkDups(removed, added);
removed = checked[0];
added = checked[1];
if(added.length == 0 && removed.length == 0)
return;
List remainingRemoved = new ArrayList();
List remainingAdded = new ArrayList();
Map converterMap = calculateConverterTools(removed, added, remainingRemoved, remainingAdded);

View file

@ -449,7 +449,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
CConfigurationData data,
IProgressMonitor monitor) {
BuildConfigurationData cfgData = (BuildConfigurationData)data;
((Configuration)cfgData.getConfiguration()).setConfigurationDescription(null);
((Configuration)cfgData.getConfiguration()).setConfigurationDescription(cfgDes);
cfgData.clearCachedData();
}

View file

@ -37,13 +37,13 @@ import org.eclipse.cdt.managedbuilder.internal.dataprovider.SettingsSet.SettingL
public class EntryStorage {
private int fKind;
private SettingsSet fSettings;
// private SettingsSet fSettings;
// private EntryListMap fDiscoveredEntries = new EntryListMap();
// private EntryListMap fUserEntries = new EntryListMap();
// private ICLanguageSettingEntry fEntries[];
private BuildLanguageData fLangData;
private boolean fCacheInited;
private boolean fUserValuesInited;
// private boolean fCacheInited;
// private boolean fUserValuesInited;
private static final String EMPTY_STRING = new String();
@ -57,15 +57,15 @@ public class EntryStorage {
}
void optionsChanged(){
fUserValuesInited = false;
// fUserValuesInited = false;
}
public List getEntries(List list){
initCache();
SettingsSet settings = initCache();
if(list == null)
list = new ArrayList();
ICLanguageSettingEntry entries[] = fSettings.getEntries();
ICLanguageSettingEntry entries[] = settings.getEntries();
list.addAll(Arrays.asList(entries));
// for(Iterator iter = fUserEntries.getIterator(); iter.hasNext();){
// EntryInfo info = (EntryInfo)iter.next();
@ -102,7 +102,7 @@ public class EntryStorage {
}
private void resetCache(){
fCacheInited = false;
// fCacheInited = false;
}
public void setEntries(ICLanguageSettingEntry entries[]){
@ -110,9 +110,9 @@ public class EntryStorage {
resetDefaults();
return;
}
initCache();
SettingsSet settings = initCache();
fSettings.applyEntries(entries);
settings.applyEntries(entries);
// ArrayList userList = new ArrayList();
// Map discoveredMap = fDiscoveredEntries.getEntryInfoMap();
// boolean discoveredReadOnly = isDiscoveredEntriesReadOnly();
@ -134,7 +134,7 @@ public class EntryStorage {
// info.makeOverridden(false);
// }
SettingLevel level = fSettings.getLevels()[0];
SettingLevel level = settings.getLevels()[0];
IOption options[] = fLangData.getOptionsForKind(fKind);
if(options.length != 0){
ICLanguageSettingEntry usrEntries[] = level.getEntries();
@ -174,7 +174,7 @@ public class EntryStorage {
}
}
private void initCache(){
private SettingsSet initCache(){
// if(fCacheInited){
// if(!fUserValuesInited){
// for(Iterator iter = fDiscoveredEntries.getIterator(); iter.hasNext();){
@ -186,9 +186,9 @@ public class EntryStorage {
// }
//
// } else {
fSettings = createEmptySettings();
SettingLevel levels[] = fSettings.getLevels();
fCacheInited = true;
SettingsSet settings = createEmptySettings();
SettingLevel levels[] = settings.getLevels();
// fCacheInited = true;
DiscoveredEntry[] dEntries = fLangData.getDiscoveredEntryValues(fKind);
addEntries(levels[2], dEntries);
@ -199,7 +199,9 @@ public class EntryStorage {
addEntries(levels[0], dEntries);
levels[0].fOverrideSet = getUserUndefinedStringSet();
fSettings.adjustOverrideState();
settings.adjustOverrideState();
return settings;
//// fDiscoveredEntries.clear();
// boolean readOnly = isDiscoveredEntriesReadOnly();
// if(dEntries.length != 0){

View file

@ -94,10 +94,13 @@ public abstract class CDataProxyContainer extends CDataProxy implements ICDataPr
if(provider == null)
throw new IllegalStateException();
provider.invalidateCache();
CDataProxy proxies[] = provider.getCachedProxies();
for(int i = 0; i < proxies.length; i++){
proxies[i].setRescan(true);
}
}
public ICSettingObject getChildSettingById(String id) {

View file

@ -15,8 +15,12 @@ import java.util.Iterator;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.settings.model.ICBuildSetting;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.core.settings.model.ICSettingBase;
import org.eclipse.cdt.core.settings.model.ICSettingContainer;
import org.eclipse.cdt.core.settings.model.ICSettingObject;
@ -27,6 +31,7 @@ import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.core.settings.model.util.CSettingEntryFactory;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
public class CProjectDescription implements ICProjectDescription, ICDataProxyContainer {
@ -435,4 +440,22 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
public void removeStorage(String id) throws CoreException {
getStorageBase().removeStorage(id);
}
void switchToCachedAppliedData(CProjectDescription appliedCache){
if(fIsReadOnly)
return;
ICConfigurationDescription[] cfgs = appliedCache.getConfigurations();
for(int i = 0; i < cfgs.length; i++){
CConfigurationDescriptionCache cfgCache = (CConfigurationDescriptionCache)cfgs[i];
CConfigurationDescription des = (CConfigurationDescription)getChildSettingById(cfgCache.getId());
if(des != null){
des.setData(cfgCache);
// ICResourceDescription rcDes = des.getResourceDescription(new Path("dd"), false);
// rcDes = des.getResourceDescription(new Path("dd"), false);
// ICBuildSetting bs = des.getBuildSetting();
// ICLanguageSetting lss[] = ((ICFolderDescription)rcDes).getLanguageSettings();
}
}
}
}

View file

@ -29,6 +29,8 @@ public interface IProxyProvider {
CDataProxy[] getCachedProxies();
void cacheValues();
void invalidateCache();
/*
CDataProxy[] getProxies(Class arrayElClass);

View file

@ -125,4 +125,10 @@ public class ProxyProvider implements IProxyProvider {
fProxiesCached = true;
}
}
public void invalidateCache() {
fProxiesCached = false;
}
}

View file

@ -53,9 +53,12 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
}
CProjectDescription fNewDescriptionCache = new CProjectDescription(fSetDescription, true, el);
mngr.setDescriptionApplying(project, fNewDescriptionCache);
fNewDescriptionCache.applyDatas();
mngr.clearDescriptionApplying(project);
try {
mngr.setDescriptionApplying(project, fNewDescriptionCache);
fNewDescriptionCache.applyDatas();
} finally {
mngr.clearDescriptionApplying(project);
}
ICDescriptionDelta delta = mngr.createDelta(fNewDescriptionCache, fOldDescriptionCache);
@ -71,6 +74,9 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
}
mngr.setLoaddedDescription(project, fNewDescriptionCache, true);
fSetDescription.switchToCachedAppliedData(fNewDescriptionCache);
CompositeWorkspaceRunnable runnable = new CompositeWorkspaceRunnable(SettingsModelMessages.getString("SetCProjectDescriptionOperation.0")); //$NON-NLS-1$
try {