mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
1. Tool-chain modification functionality fixes
2. setProjectDescription enhancements 2. other bug-fixes
This commit is contained in:
parent
52750d5170
commit
202d1bb38b
10 changed files with 123 additions and 38 deletions
|
@ -3556,7 +3556,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
private static final boolean TEST_CONSISTANCE = false;
|
private static final boolean TEST_CONSISTANCE = true;
|
||||||
|
|
||||||
public static IConfiguration getConfigurationForDescription(ICConfigurationDescription cfgDes){
|
public static IConfiguration getConfigurationForDescription(ICConfigurationDescription cfgDes){
|
||||||
return getConfigurationForDescription(cfgDes, TEST_CONSISTANCE);
|
return getConfigurationForDescription(cfgDes, TEST_CONSISTANCE);
|
||||||
|
@ -3660,8 +3660,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
private static ICConfigurationDescription getDescriptionForConfiguration(IConfiguration cfg, boolean checkConsistance){
|
private static ICConfigurationDescription getDescriptionForConfiguration(IConfiguration cfg, boolean checkConsistance){
|
||||||
ICConfigurationDescription des = ((Configuration)cfg).getConfigurationDescription();
|
ICConfigurationDescription des = ((Configuration)cfg).getConfigurationDescription();
|
||||||
if(des == null){
|
if(des == null){
|
||||||
if(checkConsistance)
|
// if(checkConsistance)
|
||||||
throw new IllegalStateException();
|
// throw new IllegalStateException();
|
||||||
if(((Configuration)cfg).isPreference()){
|
if(((Configuration)cfg).isPreference()){
|
||||||
try {
|
try {
|
||||||
des = CCorePlugin.getDefault().getPreferenceConfiguration(CFG_DATA_PROVIDER_ID);
|
des = CCorePlugin.getDefault().getPreferenceConfiguration(CFG_DATA_PROVIDER_ID);
|
||||||
|
|
|
@ -2707,12 +2707,20 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
||||||
if(newBuilder.getParent() == tc){
|
if(newBuilder.getParent() == tc){
|
||||||
newCfgBuilder = (Builder)newBuilder;
|
newCfgBuilder = (Builder)newBuilder;
|
||||||
} else {
|
} else {
|
||||||
IBuilder extBuilder = newBuilder;
|
IBuilder curReal = ManagedBuildManager.getRealBuilder(cur);
|
||||||
for(;extBuilder != null && !extBuilder.isExtensionElement(); extBuilder = extBuilder.getSuperClass());
|
IBuilder newReal = ManagedBuildManager.getRealBuilder(newBuilder);
|
||||||
if(extBuilder == null)
|
if(newReal != curReal){
|
||||||
extBuilder = newBuilder;
|
IBuilder extBuilder = newBuilder;
|
||||||
newCfgBuilder = new Builder(tc, extBuilder, id, name, false);
|
for(;extBuilder != null && !extBuilder.isExtensionElement(); extBuilder = extBuilder.getSuperClass());
|
||||||
newCfgBuilder.copySettings(cur, allBuildSettings);
|
if(extBuilder == null)
|
||||||
|
extBuilder = newBuilder;
|
||||||
|
|
||||||
|
newCfgBuilder = new Builder(tc, extBuilder, id, name, false);
|
||||||
|
newCfgBuilder.copySettings(cur, allBuildSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(newCfgBuilder != null){
|
||||||
tc.setBuilder(newCfgBuilder);
|
tc.setBuilder(newCfgBuilder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
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{
|
public IToolChain changeToolChain(IToolChain newSuperClass, String Id, String name) throws BuildException{
|
||||||
IConfigurationElement el = getToolChainConverterElement(newSuperClass);
|
IToolChain curReal = ManagedBuildManager.getRealToolChain(toolChain);
|
||||||
ToolChain oldToolChain = toolChain;
|
IToolChain newReal = ManagedBuildManager.getRealToolChain(newSuperClass);
|
||||||
ITool oldTools[] = oldToolChain.getTools();
|
|
||||||
|
|
||||||
if(el != null){
|
if(newReal != curReal){
|
||||||
updateToolChainWithConverter(el, newSuperClass, Id, name);
|
ToolChain oldToolChain = toolChain;
|
||||||
} else {
|
IConfigurationElement el = getToolChainConverterElement(newSuperClass);
|
||||||
updateToolChainWithProperties(newSuperClass, Id, name);
|
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;
|
return toolChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,7 +801,37 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
|
||||||
return null;
|
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){
|
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 remainingRemoved = new ArrayList();
|
||||||
List remainingAdded = new ArrayList();
|
List remainingAdded = new ArrayList();
|
||||||
Map converterMap = calculateConverterTools(removed, added, remainingRemoved, remainingAdded);
|
Map converterMap = calculateConverterTools(removed, added, remainingRemoved, remainingAdded);
|
||||||
|
|
|
@ -449,7 +449,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
CConfigurationData data,
|
CConfigurationData data,
|
||||||
IProgressMonitor monitor) {
|
IProgressMonitor monitor) {
|
||||||
BuildConfigurationData cfgData = (BuildConfigurationData)data;
|
BuildConfigurationData cfgData = (BuildConfigurationData)data;
|
||||||
((Configuration)cfgData.getConfiguration()).setConfigurationDescription(null);
|
((Configuration)cfgData.getConfiguration()).setConfigurationDescription(cfgDes);
|
||||||
cfgData.clearCachedData();
|
cfgData.clearCachedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,13 +37,13 @@ import org.eclipse.cdt.managedbuilder.internal.dataprovider.SettingsSet.SettingL
|
||||||
|
|
||||||
public class EntryStorage {
|
public class EntryStorage {
|
||||||
private int fKind;
|
private int fKind;
|
||||||
private SettingsSet fSettings;
|
// private SettingsSet fSettings;
|
||||||
// private EntryListMap fDiscoveredEntries = new EntryListMap();
|
// private EntryListMap fDiscoveredEntries = new EntryListMap();
|
||||||
// private EntryListMap fUserEntries = new EntryListMap();
|
// private EntryListMap fUserEntries = new EntryListMap();
|
||||||
// private ICLanguageSettingEntry fEntries[];
|
// private ICLanguageSettingEntry fEntries[];
|
||||||
private BuildLanguageData fLangData;
|
private BuildLanguageData fLangData;
|
||||||
private boolean fCacheInited;
|
// private boolean fCacheInited;
|
||||||
private boolean fUserValuesInited;
|
// private boolean fUserValuesInited;
|
||||||
|
|
||||||
private static final String EMPTY_STRING = new String();
|
private static final String EMPTY_STRING = new String();
|
||||||
|
|
||||||
|
@ -57,15 +57,15 @@ public class EntryStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
void optionsChanged(){
|
void optionsChanged(){
|
||||||
fUserValuesInited = false;
|
// fUserValuesInited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getEntries(List list){
|
public List getEntries(List list){
|
||||||
initCache();
|
SettingsSet settings = initCache();
|
||||||
if(list == null)
|
if(list == null)
|
||||||
list = new ArrayList();
|
list = new ArrayList();
|
||||||
|
|
||||||
ICLanguageSettingEntry entries[] = fSettings.getEntries();
|
ICLanguageSettingEntry entries[] = settings.getEntries();
|
||||||
list.addAll(Arrays.asList(entries));
|
list.addAll(Arrays.asList(entries));
|
||||||
// for(Iterator iter = fUserEntries.getIterator(); iter.hasNext();){
|
// for(Iterator iter = fUserEntries.getIterator(); iter.hasNext();){
|
||||||
// EntryInfo info = (EntryInfo)iter.next();
|
// EntryInfo info = (EntryInfo)iter.next();
|
||||||
|
@ -102,7 +102,7 @@ public class EntryStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetCache(){
|
private void resetCache(){
|
||||||
fCacheInited = false;
|
// fCacheInited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEntries(ICLanguageSettingEntry entries[]){
|
public void setEntries(ICLanguageSettingEntry entries[]){
|
||||||
|
@ -110,9 +110,9 @@ public class EntryStorage {
|
||||||
resetDefaults();
|
resetDefaults();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
initCache();
|
SettingsSet settings = initCache();
|
||||||
|
|
||||||
fSettings.applyEntries(entries);
|
settings.applyEntries(entries);
|
||||||
// ArrayList userList = new ArrayList();
|
// ArrayList userList = new ArrayList();
|
||||||
// Map discoveredMap = fDiscoveredEntries.getEntryInfoMap();
|
// Map discoveredMap = fDiscoveredEntries.getEntryInfoMap();
|
||||||
// boolean discoveredReadOnly = isDiscoveredEntriesReadOnly();
|
// boolean discoveredReadOnly = isDiscoveredEntriesReadOnly();
|
||||||
|
@ -134,7 +134,7 @@ public class EntryStorage {
|
||||||
// info.makeOverridden(false);
|
// info.makeOverridden(false);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
SettingLevel level = fSettings.getLevels()[0];
|
SettingLevel level = settings.getLevels()[0];
|
||||||
IOption options[] = fLangData.getOptionsForKind(fKind);
|
IOption options[] = fLangData.getOptionsForKind(fKind);
|
||||||
if(options.length != 0){
|
if(options.length != 0){
|
||||||
ICLanguageSettingEntry usrEntries[] = level.getEntries();
|
ICLanguageSettingEntry usrEntries[] = level.getEntries();
|
||||||
|
@ -174,7 +174,7 @@ public class EntryStorage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCache(){
|
private SettingsSet initCache(){
|
||||||
// if(fCacheInited){
|
// if(fCacheInited){
|
||||||
// if(!fUserValuesInited){
|
// if(!fUserValuesInited){
|
||||||
// for(Iterator iter = fDiscoveredEntries.getIterator(); iter.hasNext();){
|
// for(Iterator iter = fDiscoveredEntries.getIterator(); iter.hasNext();){
|
||||||
|
@ -186,9 +186,9 @@ public class EntryStorage {
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// } else {
|
// } else {
|
||||||
fSettings = createEmptySettings();
|
SettingsSet settings = createEmptySettings();
|
||||||
SettingLevel levels[] = fSettings.getLevels();
|
SettingLevel levels[] = settings.getLevels();
|
||||||
fCacheInited = true;
|
// fCacheInited = true;
|
||||||
DiscoveredEntry[] dEntries = fLangData.getDiscoveredEntryValues(fKind);
|
DiscoveredEntry[] dEntries = fLangData.getDiscoveredEntryValues(fKind);
|
||||||
addEntries(levels[2], dEntries);
|
addEntries(levels[2], dEntries);
|
||||||
|
|
||||||
|
@ -199,7 +199,9 @@ public class EntryStorage {
|
||||||
addEntries(levels[0], dEntries);
|
addEntries(levels[0], dEntries);
|
||||||
levels[0].fOverrideSet = getUserUndefinedStringSet();
|
levels[0].fOverrideSet = getUserUndefinedStringSet();
|
||||||
|
|
||||||
fSettings.adjustOverrideState();
|
settings.adjustOverrideState();
|
||||||
|
|
||||||
|
return settings;
|
||||||
//// fDiscoveredEntries.clear();
|
//// fDiscoveredEntries.clear();
|
||||||
// boolean readOnly = isDiscoveredEntriesReadOnly();
|
// boolean readOnly = isDiscoveredEntriesReadOnly();
|
||||||
// if(dEntries.length != 0){
|
// if(dEntries.length != 0){
|
||||||
|
|
|
@ -94,10 +94,13 @@ public abstract class CDataProxyContainer extends CDataProxy implements ICDataPr
|
||||||
if(provider == null)
|
if(provider == null)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
|
||||||
|
provider.invalidateCache();
|
||||||
|
|
||||||
CDataProxy proxies[] = provider.getCachedProxies();
|
CDataProxy proxies[] = provider.getCachedProxies();
|
||||||
for(int i = 0; i < proxies.length; i++){
|
for(int i = 0; i < proxies.length; i++){
|
||||||
proxies[i].setRescan(true);
|
proxies[i].setRescan(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICSettingObject getChildSettingById(String id) {
|
public ICSettingObject getChildSettingById(String id) {
|
||||||
|
|
|
@ -15,8 +15,12 @@ import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
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.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.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingContainer;
|
import org.eclipse.cdt.core.settings.model.ICSettingContainer;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingObject;
|
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.cdt.core.settings.model.util.CSettingEntryFactory;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
|
|
||||||
public class CProjectDescription implements ICProjectDescription, ICDataProxyContainer {
|
public class CProjectDescription implements ICProjectDescription, ICDataProxyContainer {
|
||||||
|
@ -435,4 +440,22 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
public void removeStorage(String id) throws CoreException {
|
public void removeStorage(String id) throws CoreException {
|
||||||
getStorageBase().removeStorage(id);
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@ public interface IProxyProvider {
|
||||||
CDataProxy[] getCachedProxies();
|
CDataProxy[] getCachedProxies();
|
||||||
|
|
||||||
void cacheValues();
|
void cacheValues();
|
||||||
|
|
||||||
|
void invalidateCache();
|
||||||
/*
|
/*
|
||||||
CDataProxy[] getProxies(Class arrayElClass);
|
CDataProxy[] getProxies(Class arrayElClass);
|
||||||
|
|
||||||
|
|
|
@ -125,4 +125,10 @@ public class ProxyProvider implements IProxyProvider {
|
||||||
fProxiesCached = true;
|
fProxiesCached = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void invalidateCache() {
|
||||||
|
fProxiesCached = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,12 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
|
||||||
}
|
}
|
||||||
|
|
||||||
CProjectDescription fNewDescriptionCache = new CProjectDescription(fSetDescription, true, el);
|
CProjectDescription fNewDescriptionCache = new CProjectDescription(fSetDescription, true, el);
|
||||||
mngr.setDescriptionApplying(project, fNewDescriptionCache);
|
try {
|
||||||
fNewDescriptionCache.applyDatas();
|
mngr.setDescriptionApplying(project, fNewDescriptionCache);
|
||||||
mngr.clearDescriptionApplying(project);
|
fNewDescriptionCache.applyDatas();
|
||||||
|
} finally {
|
||||||
|
mngr.clearDescriptionApplying(project);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ICDescriptionDelta delta = mngr.createDelta(fNewDescriptionCache, fOldDescriptionCache);
|
ICDescriptionDelta delta = mngr.createDelta(fNewDescriptionCache, fOldDescriptionCache);
|
||||||
|
@ -71,6 +74,9 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
|
||||||
}
|
}
|
||||||
|
|
||||||
mngr.setLoaddedDescription(project, fNewDescriptionCache, true);
|
mngr.setLoaddedDescription(project, fNewDescriptionCache, true);
|
||||||
|
|
||||||
|
fSetDescription.switchToCachedAppliedData(fNewDescriptionCache);
|
||||||
|
|
||||||
CompositeWorkspaceRunnable runnable = new CompositeWorkspaceRunnable(SettingsModelMessages.getString("SetCProjectDescriptionOperation.0")); //$NON-NLS-1$
|
CompositeWorkspaceRunnable runnable = new CompositeWorkspaceRunnable(SettingsModelMessages.getString("SetCProjectDescriptionOperation.0")); //$NON-NLS-1$
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue