mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-07 16:26:11 +02:00
1. Additional fixes for [Bug 174936] [Scanner Discovery] Per file scanner discovery is broken with the New Project Model functionality
2. Bug-fixes
This commit is contained in:
parent
34cf7052a6
commit
fda3d97512
33 changed files with 557 additions and 113 deletions
|
@ -654,29 +654,31 @@ public class PerFileSettingsCalculator {
|
|||
}
|
||||
}
|
||||
|
||||
private IRcSettingInfo[] mapFileDiscoveredInfo(IProject project, CConfigurationData data, RcSetSettings rcSet, Map map){
|
||||
IResource rc;
|
||||
private IRcSettingInfo[] mapFileDiscoveredInfo(IProject project, CConfigurationData data, RcSetSettings rcSet, PathFilePathInfo[] pfpis){
|
||||
// IResource rc;
|
||||
PathInfo pInfo;
|
||||
Map.Entry entry;
|
||||
IPath projRelPath;
|
||||
CResourceData rcData;
|
||||
// RcSetSettings dataSetting;
|
||||
List list = new ArrayList(map.size());
|
||||
List list = new ArrayList(pfpis.length);
|
||||
RcSettingInfo rcInfo;
|
||||
LangSettingInfo lInfo;
|
||||
CLanguageData lData;
|
||||
ArrayList tmpList;
|
||||
PathFilePathInfo pfpi;
|
||||
|
||||
for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){
|
||||
entry = (Map.Entry)iter.next();
|
||||
rc = (IResource)entry.getKey();
|
||||
pInfo = (PathInfo)entry.getValue();
|
||||
for(int i = 0; i < pfpis.length; i++){
|
||||
pfpi = pfpis[i];
|
||||
projRelPath = pfpi.fPath;
|
||||
pInfo = pfpi.fInfo;
|
||||
if(pInfo.isEmpty())
|
||||
continue;
|
||||
|
||||
switch(rc.getType()){
|
||||
case IResource.FILE:
|
||||
projRelPath = rc.getProjectRelativePath();
|
||||
if(projRelPath.segmentCount() == 0)
|
||||
continue;
|
||||
// switch(rc.getType()){
|
||||
// case IResource.FILE:
|
||||
// projRelPath = rc.getProjectRelativePath();
|
||||
// dataSetting = rcSet.getChild(projRelPath, false);
|
||||
// rcData = dataSetting.fRcData;
|
||||
rcData = rcSet.getChild(projRelPath, false).fRcData;
|
||||
|
@ -723,8 +725,8 @@ public class PerFileSettingsCalculator {
|
|||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
return (RcSettingInfo[])list.toArray(new RcSettingInfo[list.size()]);
|
||||
}
|
||||
|
@ -732,7 +734,8 @@ public class PerFileSettingsCalculator {
|
|||
public IRcSettingInfo[] getSettingInfos(IProject project, CConfigurationData data, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo, boolean fileDataMode){
|
||||
if(fileDataMode){
|
||||
RcSetSettings rcSettings = createRcSetInfo(data);
|
||||
return mapFileDiscoveredInfo(project, data, rcSettings, discoveredInfo.getPathInfoMap());
|
||||
PathFilePathInfo pInfos[] = createOrderedInfo(discoveredInfo.getPathInfoMap());
|
||||
return mapFileDiscoveredInfo(project, data, rcSettings, pInfos);
|
||||
}
|
||||
RcSetSettings settings = createRcSetSettings(data, discoveredInfo);
|
||||
return createInfos(data, settings);
|
||||
|
@ -981,13 +984,13 @@ public class PerFileSettingsCalculator {
|
|||
for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){
|
||||
entry = (Map.Entry)iter.next();
|
||||
rc = (IResource)entry.getKey();
|
||||
path = rc.getFullPath();
|
||||
path = rc.getProjectRelativePath();
|
||||
int segCount = path.segmentCount();
|
||||
if(segCount < 1)
|
||||
continue;
|
||||
// if(segCount < 1)
|
||||
// continue;
|
||||
|
||||
path = path.removeFirstSegments(1);
|
||||
segCount--;
|
||||
// path = path.removeFirstSegments(1);
|
||||
// segCount--;
|
||||
|
||||
info = (PathInfo)entry.getValue();
|
||||
storedInfo = (PathInfo)infoMap.get(info);
|
||||
|
|
|
@ -48,13 +48,17 @@ public class CfgScannerConfigInfoFactory2 {
|
|||
private static final QualifiedName CONTAINER_INFO_PROPERTY = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "ScannerConfigBuilderInfo2Container"); //$NON-NLS-1$
|
||||
|
||||
private static class ContainerInfo{
|
||||
ICProjectDescription fDes;
|
||||
int fCode;
|
||||
IScannerConfigBuilderInfo2Set fContainer;
|
||||
|
||||
ContainerInfo(ICProjectDescription des, IScannerConfigBuilderInfo2Set container){
|
||||
this.fDes = des;
|
||||
this.fCode = des.hashCode();
|
||||
this.fContainer = container;
|
||||
}
|
||||
|
||||
public boolean matches(ICProjectDescription des){
|
||||
return des.hashCode() == fCode;
|
||||
}
|
||||
}
|
||||
private static class CfgInfo implements ICfgScannerConfigBuilderInfo2Set {
|
||||
private Configuration cfg;
|
||||
|
@ -101,7 +105,7 @@ public class CfgScannerConfigInfoFactory2 {
|
|||
ICProjectDescription projDes = cfgDes.getProjectDescription();
|
||||
if(projDes != null){
|
||||
ContainerInfo cInfo = (ContainerInfo)projDes.getSessionProperty(CONTAINER_INFO_PROPERTY);
|
||||
if(cInfo != null && cInfo.fDes == projDes){
|
||||
if(cInfo != null && cInfo.matches(projDes)){
|
||||
fContainer = cInfo.fContainer;
|
||||
} else {
|
||||
fContainer = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(cfg.getOwner().getProject());
|
||||
|
@ -295,7 +299,7 @@ public class CfgScannerConfigInfoFactory2 {
|
|||
public static void save(BuildConfigurationData data, ICProjectDescription des, ICProjectDescription baseDescription, boolean force) throws CoreException{
|
||||
ContainerInfo info = (ContainerInfo)des.getSessionProperty(CONTAINER_INFO_PROPERTY);
|
||||
if(info != null){
|
||||
if(info.fDes == baseDescription){
|
||||
if(info.matches(baseDescription)){
|
||||
IScannerConfigBuilderInfo2Set baseContainer = info.fContainer;
|
||||
baseContainer.save();
|
||||
}
|
||||
|
|
|
@ -2789,6 +2789,10 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
cfgScannerInfo = info;
|
||||
}
|
||||
|
||||
public void clearCachedData(){
|
||||
cfgScannerInfo = null;
|
||||
}
|
||||
|
||||
public boolean isPreference(){
|
||||
return isPreferenceConfig;
|
||||
}
|
||||
|
|
|
@ -1231,6 +1231,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
|
|||
// rebuildNeeded = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean hasCustomSettings(){
|
||||
return toolChain.hasCustomSettings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -743,4 +743,20 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
}
|
||||
return requires;
|
||||
}
|
||||
|
||||
boolean hasCustomSettings(){
|
||||
if(superClass == null)
|
||||
return true;
|
||||
|
||||
if(optionList != null && optionList.size() != 0){
|
||||
Option option;
|
||||
for(Iterator iter = optionList.iterator(); iter.hasNext();){
|
||||
option = (Option)iter.next();
|
||||
if(option.hasCustomSettings())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1852,4 +1852,8 @@ public class InputType extends BuildObject implements IInputType {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean hasCustomSettings(){
|
||||
//TODO:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2054,4 +2054,14 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
|
|||
}
|
||||
}
|
||||
|
||||
public boolean hasCustomSettings(){
|
||||
if(superClass == null)
|
||||
return true;
|
||||
|
||||
if(value != null && !value.equals(superClass.getValue())){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -919,5 +919,8 @@ public class OutputType extends BuildObject implements IOutputType {
|
|||
return calc.isOutputTypeEnabled(tool, this);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasCustomSettings(){
|
||||
//TODO:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -971,4 +971,18 @@ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
|
|||
tool.resolveProjectReferences(onLoad);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasCustomSettings() {
|
||||
if(toolList != null && toolList.size() != 0){
|
||||
Tool tool;
|
||||
for(Iterator iter = toolList.iterator(); iter.hasNext();){
|
||||
tool = (Tool)iter.next();
|
||||
if(tool.hasCustomSettings())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -462,4 +462,5 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
|
||||
abstract void resolveProjectReferences(boolean onLoad);
|
||||
|
||||
abstract public boolean hasCustomSettings();
|
||||
}
|
||||
|
|
|
@ -150,10 +150,10 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
private boolean rebuildState;
|
||||
private BooleanExpressionApplicabilityCalculator booleanExpressionCalculator;
|
||||
|
||||
private HashMap typeToDataMap = new HashMap();
|
||||
private HashMap typeToDataMap = new HashMap(2);
|
||||
private boolean fDataMapInited;
|
||||
private List identicalList;
|
||||
private HashMap discoveredInfoMap = new HashMap();
|
||||
private HashMap discoveredInfoMap = new HashMap(2);
|
||||
private String scannerConfigDiscoveryProfileId;
|
||||
|
||||
/*
|
||||
|
@ -443,9 +443,11 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
super.copyChildren(tool);
|
||||
// Clone the children
|
||||
if (tool.inputTypeList != null) {
|
||||
discoveredInfoMap = (HashMap)tool.discoveredInfoMap.clone();
|
||||
Iterator iter = tool.getInputTypeList().listIterator();
|
||||
while (iter.hasNext()) {
|
||||
InputType inputType = (InputType) iter.next();
|
||||
PathInfoCache cache = (PathInfoCache)discoveredInfoMap.remove(getTypeKey(inputType));
|
||||
int nnn = ManagedBuildManager.getRandomNumber();
|
||||
String subId;
|
||||
String subName;
|
||||
|
@ -458,6 +460,9 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
}
|
||||
InputType newInputType = new InputType(this, subId, subName, inputType);
|
||||
addInputType(newInputType);
|
||||
if(cache != null){
|
||||
discoveredInfoMap.put(getTypeKey(newInputType), cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tool.outputTypeList != null) {
|
||||
|
@ -3937,4 +3942,86 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean hasCustomSettings(){
|
||||
if(superClass == null)
|
||||
return true;
|
||||
|
||||
if(super.hasCustomSettings())
|
||||
return true;
|
||||
|
||||
if(inputTypeList != null && inputTypeList.size() != 0){
|
||||
InputType inType;
|
||||
for(Iterator iter = inputTypeList.iterator(); iter.hasNext();){
|
||||
inType = (InputType)iter.next();
|
||||
if(inType.hasCustomSettings())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(outputTypeList != null && outputTypeList.size() != 0){
|
||||
OutputType outType;
|
||||
for(Iterator iter = outputTypeList.iterator(); iter.hasNext();){
|
||||
outType = (OutputType)iter.next();
|
||||
if(outType.hasCustomSettings())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//envVarBuildPathList;
|
||||
// Managed Build model attributes
|
||||
// unusedChildren;
|
||||
// isAbstract;
|
||||
Tool superTool = (Tool)superClass;
|
||||
|
||||
if(command != null && !command.equals(superTool.getToolCommand()))
|
||||
return true;
|
||||
|
||||
//inputExtensions;
|
||||
//interfaceExtensions; //(header extensions)
|
||||
//natureFilter;
|
||||
//outputExtensions;
|
||||
//outputFlag;
|
||||
//outputPrefix;
|
||||
if(errorParserIds != null && !errorParserIds.equals(superTool.getErrorParserIds()))
|
||||
return true;
|
||||
|
||||
|
||||
if(commandLinePattern != null && !commandLinePattern.equals(superTool.getCommandLinePattern()))
|
||||
return true;
|
||||
|
||||
//versionsSupported;
|
||||
//convertToId;
|
||||
//advancedInputCategory;
|
||||
if(customBuildStep != null && customBuildStep.booleanValue() != superTool.getCustomBuildStep())
|
||||
return true;
|
||||
|
||||
if(announcement != null && !announcement.equals(superTool.getAnnouncement()))
|
||||
return true;
|
||||
//commandLineGeneratorElement
|
||||
//commandLineGenerator
|
||||
//dependencyGeneratorElement
|
||||
//dependencyGenerator
|
||||
//iconPathURL;
|
||||
//pathconverterElement
|
||||
//optionPathConverter
|
||||
//supportedProperties
|
||||
//supportsManagedBuild
|
||||
//isTest;
|
||||
// Miscellaneous
|
||||
//isExtensionTool
|
||||
//isDirty
|
||||
//resolved
|
||||
//previousMbsVersionConversionElement
|
||||
//currentMbsVersionConversionElement
|
||||
//rebuildState
|
||||
//booleanExpressionCalculator
|
||||
|
||||
//typeToDataMap
|
||||
//fDataMapInited;
|
||||
//identicalList;
|
||||
if(discoveredInfoMap != null && discoveredInfoMap.size() != 0)
|
||||
return true;
|
||||
//scannerConfigDiscoveryProfileId
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -357,6 +357,8 @@ public class ToolChain extends HoldsOptions implements IToolChain, IBuildPropert
|
|||
|
||||
nonInternalBuilderId = toolChain.nonInternalBuilderId;
|
||||
|
||||
discoveredInfo = toolChain.discoveredInfo;
|
||||
|
||||
// Clone the children in superclass
|
||||
boolean copyIds = toolChain.getId().equals(id);
|
||||
super.copyChildren(toolChain);
|
||||
|
@ -2621,4 +2623,22 @@ public class ToolChain extends HoldsOptions implements IToolChain, IBuildPropert
|
|||
IToolChain tch = ManagedBuildManager.getRealToolChain(this);
|
||||
return tch != null && tch.getId().equals(ConfigurationDataProvider.PREF_TC_ID);
|
||||
}
|
||||
|
||||
public boolean hasCustomSettings(){
|
||||
if(superClass == null)
|
||||
return true;
|
||||
|
||||
if(super.hasCustomSettings())
|
||||
return true;
|
||||
|
||||
if(toolList != null && toolList.size() != 0){
|
||||
Tool tool;
|
||||
for(Iterator iter = toolList.iterator(); iter.hasNext();){
|
||||
tool = (Tool)iter.next();
|
||||
if(tool.hasCustomSettings())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package org.eclipse.cdt.managedbuilder.internal.dataprovider;
|
||||
|
||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CBuildData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CFileData;
|
||||
|
@ -24,14 +25,15 @@ import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
|||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
public class BuildConfigurationData extends CConfigurationData {
|
||||
private IConfiguration fCfg;
|
||||
private Configuration fCfg;
|
||||
private BuildVariablesContributor fCdtVars;
|
||||
public BuildConfigurationData(IConfiguration cfg){
|
||||
fCfg = cfg;
|
||||
fCfg = (Configuration)cfg;
|
||||
}
|
||||
|
||||
public IConfiguration getConfiguration(){
|
||||
|
@ -129,4 +131,22 @@ public class BuildConfigurationData extends CConfigurationData {
|
|||
fCdtVars = new BuildVariablesContributor(this);
|
||||
return fCdtVars;
|
||||
}
|
||||
|
||||
void clearCachedData(){
|
||||
fCfg.clearCachedData();
|
||||
CResourceData[] datas = getResourceDatas();
|
||||
CResourceData data;
|
||||
BuildLanguageData lData;
|
||||
BuildLanguageData[] lDatas;
|
||||
|
||||
|
||||
for(int i = 0; i < datas.length; i++){
|
||||
data = datas[i];
|
||||
if(data.getType() == ICSettingBase.SETTING_FOLDER){
|
||||
((BuildFolderData)data).clearCachedData();
|
||||
} else {
|
||||
((BuildFileData)data).clearCachedData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,12 +13,13 @@ package org.eclipse.cdt.managedbuilder.internal.dataprovider;
|
|||
import org.eclipse.cdt.core.settings.model.extension.CFileData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
||||
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.ResourceConfiguration;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
public class BuildFileData extends CFileData {
|
||||
private IFileInfo fFileInfo;
|
||||
private ResourceConfiguration fFileInfo;
|
||||
public BuildFileData(IFileInfo fileInfo){
|
||||
fFileInfo = fileInfo;
|
||||
fFileInfo = (ResourceConfiguration)fileInfo;
|
||||
}
|
||||
|
||||
public IFileInfo getFileInfo(){
|
||||
|
@ -64,4 +65,14 @@ public class BuildFileData extends CFileData {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean hasCustomSettings() {
|
||||
return fFileInfo.hasCustomSettings();
|
||||
}
|
||||
|
||||
void clearCachedData(){
|
||||
BuildLanguageData lData = (BuildLanguageData)getLanguageData();
|
||||
if(lData != null)
|
||||
lData.clearCachedData();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,12 +13,13 @@ package org.eclipse.cdt.managedbuilder.internal.dataprovider;
|
|||
import org.eclipse.cdt.core.settings.model.extension.CFolderData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
||||
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
public class BuildFolderData extends CFolderData {
|
||||
private IFolderInfo fFolderInfo;
|
||||
private FolderInfo fFolderInfo;
|
||||
public BuildFolderData(IFolderInfo folderInfo){
|
||||
fFolderInfo = folderInfo;
|
||||
fFolderInfo = (FolderInfo)folderInfo;
|
||||
}
|
||||
|
||||
public IFolderInfo getFolderInfo(){
|
||||
|
@ -72,4 +73,15 @@ public class BuildFolderData extends CFolderData {
|
|||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasCustomSettings() {
|
||||
return fFolderInfo.hasCustomSettings();
|
||||
}
|
||||
|
||||
void clearCachedData(){
|
||||
CLanguageData[] lDatas = getLanguageDatas();
|
||||
for(int i = 0; i < lDatas.length; i++){
|
||||
((BuildLanguageData)lDatas[i]).clearCachedData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -472,4 +472,8 @@ public class BuildLanguageData extends CLanguageData {
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
void clearCachedData(){
|
||||
fKindToEntryStore.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
|||
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
|
||||
import org.eclipse.cdt.managedbuilder.internal.macros.DefaultMacroContextInfo;
|
||||
|
@ -129,19 +130,16 @@ public class BuildVariablesContributor implements ICdtVariablesContributor {
|
|||
IConfiguration cfg = fCfgData.getConfiguration();
|
||||
if(((Configuration)cfg).isPreference())
|
||||
return null;
|
||||
IProject project = cfg.getOwner().getProject();
|
||||
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(project);
|
||||
if(des != null){
|
||||
ICConfigurationDescription cfgDes = des.getConfigurationById(cfg.getId());
|
||||
if(cfgDes != null){
|
||||
return new ContributorMacroContextInfo(mngr,
|
||||
cfgDes,
|
||||
BuildMacroProvider.CONTEXT_CONFIGURATION,
|
||||
cfg);
|
||||
}
|
||||
ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
||||
if(cfgDes != null){
|
||||
return new ContributorMacroContextInfo(mngr,
|
||||
cfgDes,
|
||||
BuildMacroProvider.CONTEXT_CONFIGURATION,
|
||||
cfg);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ICdtVariable[] getVariables(ICdtVariableManager provider) {
|
||||
ContributorMacroContextInfo info = createContextInfo(provider);
|
||||
if(info != null)
|
||||
|
|
|
@ -438,4 +438,12 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
|||
mProj.removeConfiguration(cfg.getId());
|
||||
}
|
||||
|
||||
public void dataCached(ICConfigurationDescription cfgDes,
|
||||
CConfigurationData data,
|
||||
IProgressMonitor monitor) {
|
||||
BuildConfigurationData cfgData = (BuildConfigurationData)data;
|
||||
((Configuration)cfgData.getConfiguration()).setConfigurationDescription(null);
|
||||
cfgData.clearCachedData();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,4 +68,15 @@ public abstract class CConfigurationDataProvider {
|
|||
ICConfigurationDescription baseDescription,
|
||||
CConfigurationData baseData,
|
||||
IProgressMonitor monitor) throws CoreException;
|
||||
|
||||
/**
|
||||
* called to notify that the configuration data was cached
|
||||
* implementors can do any necessary cleaning, etc.
|
||||
* Default implementation is empty
|
||||
*
|
||||
* @param cfgDes
|
||||
* @param data
|
||||
*/
|
||||
public void dataCached(ICConfigurationDescription cfgDes, CConfigurationData data, IProgressMonitor monitor){
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,4 +24,6 @@ public abstract class CResourceData extends CDataObject {
|
|||
public abstract void setPath(IPath path) ;
|
||||
|
||||
public abstract void setExcluded(boolean excluded);
|
||||
|
||||
public abstract boolean hasCustomSettings();
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public class CDefaultConfigurationData extends CConfigurationData {
|
|||
fRootFolderData = copyFolderData(baseRootFolderData.getPath(), baseRootFolderData, clone);
|
||||
addRcData(fRootFolderData);
|
||||
|
||||
CResourceData[] rcDatas = base.getResourceDatas();
|
||||
CResourceData[] rcDatas = filterRcDatasToCopy(base);
|
||||
|
||||
for(int i = 0; i < rcDatas.length; i++){
|
||||
CResourceData rcData = rcDatas[i];
|
||||
|
@ -119,6 +119,10 @@ public class CDefaultConfigurationData extends CConfigurationData {
|
|||
addRcData(copyFileData(rcData.getPath(), (CFileData)rcData, clone));
|
||||
}
|
||||
}
|
||||
|
||||
protected CResourceData[] filterRcDatasToCopy(CConfigurationData base){
|
||||
return base.getResourceDatas();
|
||||
}
|
||||
|
||||
protected CFolderData copyFolderData(IPath path, CFolderData base, boolean clone){
|
||||
return fFactory.createFolderData(this, base, clone, path);
|
||||
|
|
|
@ -123,4 +123,8 @@ public class CDefaultFileData extends CFileData {
|
|||
fFactory.setModified(fLanguageData, false);
|
||||
}
|
||||
|
||||
public boolean hasCustomSettings() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -159,5 +159,7 @@ public class CDefaultFolderData extends CFolderData {
|
|||
|
||||
}
|
||||
|
||||
|
||||
public boolean hasCustomSettings() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,11 @@ import org.eclipse.cdt.core.settings.model.CSourceEntry;
|
|||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CFileData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CFolderData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CResourceData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultLanguageData;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ProjectScope;
|
||||
|
@ -319,6 +322,19 @@ public class CDataUtil {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static PathSettingsContainer createRcDataHolder(CConfigurationData data){
|
||||
PathSettingsContainer h = PathSettingsContainer.createRootContainer();
|
||||
|
||||
h.setValue(data.getRootFolderData());
|
||||
CResourceData[] rcDatas = data.getResourceDatas();
|
||||
CResourceData rcData;
|
||||
PathSettingsContainer child;
|
||||
for(int i = 0; i < rcDatas.length; i++){
|
||||
rcData = rcDatas[i];
|
||||
child = h.getChildContainer(rcData.getPath(), true, true);
|
||||
child.setValue(rcData);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -749,16 +749,16 @@ public class PathEntryTranslator {
|
|||
private Set fFiltersSet;
|
||||
private boolean fIsExported;
|
||||
private IProject fProject;
|
||||
private ICConfigurationDescription fCfg;
|
||||
// private ICConfigurationDescription fCfg;
|
||||
|
||||
PathEntryComposer(String projName, IProject project, ICConfigurationDescription cfg){
|
||||
this(new Path(projName).makeAbsolute(), project, cfg);
|
||||
PathEntryComposer(String projName, IProject project/*, ICConfigurationDescription cfg*/){
|
||||
this(new Path(projName).makeAbsolute(), project/*, cfg*/);
|
||||
}
|
||||
|
||||
PathEntryComposer(IPath path, IProject project, ICConfigurationDescription cfg){
|
||||
PathEntryComposer(IPath path, IProject project/*, ICConfigurationDescription cfg*/){
|
||||
fPath = toProjectPath(path);
|
||||
fProject = project;
|
||||
fCfg = cfg;
|
||||
// fCfg = cfg;
|
||||
}
|
||||
|
||||
private static IPath toProjectPath(IPath path){
|
||||
|
@ -768,11 +768,11 @@ public class PathEntryTranslator {
|
|||
return path.makeAbsolute();
|
||||
}
|
||||
|
||||
PathEntryComposer(ICExclusionPatternPathEntry entry, IProject project, ICConfigurationDescription cfg){
|
||||
PathEntryComposer(ICExclusionPatternPathEntry entry, IProject project/*, ICConfigurationDescription cfg*/){
|
||||
fPath = new Path(entry.getValue());
|
||||
fLangEntry = entry;
|
||||
fProject = project;
|
||||
fCfg = cfg;
|
||||
// fCfg = cfg;
|
||||
IPath[] exclusions = entry.getExclusionPatterns();
|
||||
if(exclusions.length != 0){
|
||||
fFiltersSet = new HashSet(exclusions.length);
|
||||
|
@ -780,12 +780,12 @@ public class PathEntryTranslator {
|
|||
}
|
||||
}
|
||||
|
||||
PathEntryComposer(IPath path, ICLanguageSettingEntry entry, boolean exported, IProject project, ICConfigurationDescription cfg){
|
||||
PathEntryComposer(IPath path, ICLanguageSettingEntry entry, boolean exported, IProject project/*, ICConfigurationDescription cfg*/){
|
||||
fPath = path;
|
||||
fLangEntry = entry;
|
||||
fIsExported = exported;
|
||||
fProject = project;
|
||||
fCfg = cfg;
|
||||
// fCfg = cfg;
|
||||
}
|
||||
|
||||
public void addFilter(IPath path){
|
||||
|
@ -856,28 +856,28 @@ public class PathEntryTranslator {
|
|||
return result;
|
||||
}
|
||||
|
||||
public IPathEntry toPathEntry(){
|
||||
public IPathEntry toPathEntry(ICConfigurationDescription cfg){
|
||||
if(fLangEntry != null){
|
||||
switch(fLangEntry.getKind()){
|
||||
case ICLanguageSettingEntry.INCLUDE_FILE:{
|
||||
IPath paths[] = getEntryPath(fLangEntry, fCfg);
|
||||
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
||||
return CoreModel.newIncludeFileEntry(fPath, null, paths[0], paths[1], getExclusionPatterns(), fIsExported);
|
||||
}
|
||||
case ICLanguageSettingEntry.INCLUDE_PATH:{
|
||||
IPath paths[] = getEntryPath(fLangEntry, fCfg);
|
||||
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
||||
ICIncludePathEntry ipe = (ICIncludePathEntry)fLangEntry;
|
||||
return CoreModel.newIncludeEntry(fPath, paths[0], paths[1], !ipe.isLocal(), getExclusionPatterns(), fIsExported);
|
||||
}
|
||||
case ICLanguageSettingEntry.MACRO:
|
||||
return CoreModel.newMacroEntry(fPath, fLangEntry.getName(), fLangEntry.getValue(), getExclusionPatterns(), fIsExported);
|
||||
case ICLanguageSettingEntry.MACRO_FILE:{
|
||||
IPath paths[] = getEntryPath(fLangEntry, fCfg);
|
||||
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
||||
return CoreModel.newMacroFileEntry(fPath, paths[0], null, paths[1], getExclusionPatterns(), fIsExported);
|
||||
}
|
||||
case ICLanguageSettingEntry.LIBRARY_PATH:
|
||||
return null;
|
||||
case ICLanguageSettingEntry.LIBRARY_FILE:{
|
||||
IPath paths[] = getEntryPath(fLangEntry, fCfg);
|
||||
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
||||
return CoreModel.newLibraryEntry(fPath, paths[0], paths[1], null, null, null, fIsExported);
|
||||
}
|
||||
case ICLanguageSettingEntry.OUTPUT_PATH:
|
||||
|
@ -919,27 +919,27 @@ public class PathEntryTranslator {
|
|||
private KindBasedStore fStore;
|
||||
private LinkedHashMap fRefProjMap;
|
||||
private IProject fProject;
|
||||
private ICConfigurationDescription fCfg;
|
||||
// private ICConfigurationDescription fCfg;
|
||||
|
||||
private PathEntryCollector(IProject project, ICConfigurationDescription cfg){
|
||||
private PathEntryCollector(IProject project/*, ICConfigurationDescription cfg*/){
|
||||
fStorage = PathSettingsContainer.createRootContainer();
|
||||
fStorage.setValue(this);
|
||||
fStore = new KindBasedStore(false);
|
||||
fCfg = cfg;
|
||||
// fCfg = cfg;
|
||||
fProject = project;
|
||||
}
|
||||
|
||||
private PathEntryCollector(PathSettingsContainer container, KindBasedStore store, IProject project, ICConfigurationDescription cfg){
|
||||
private PathEntryCollector(PathSettingsContainer container, KindBasedStore store, IProject project/*, ICConfigurationDescription cfg*/){
|
||||
fStorage = container;
|
||||
fStore = store;
|
||||
fCfg = cfg;
|
||||
// fCfg = cfg;
|
||||
fProject = project;
|
||||
}
|
||||
|
||||
public void setSourceOutputEntries(int kind, ICExclusionPatternPathEntry entries[]){
|
||||
Map map = getEntriesMap(kind, true);
|
||||
for(int i = 0; i < entries.length; i++){
|
||||
map.put(entries[i], new PathEntryComposer(entries[i], fProject, fCfg));
|
||||
map.put(entries[i], new PathEntryComposer(entries[i], fProject/*, fCfg*/));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -949,7 +949,7 @@ public class PathEntryTranslator {
|
|||
else {
|
||||
fRefProjMap = new LinkedHashMap();
|
||||
for(int i = 0; i < paths.length; i++){
|
||||
PathEntryComposer cs = new PathEntryComposer(paths[i], fProject, fCfg);
|
||||
PathEntryComposer cs = new PathEntryComposer(paths[i], fProject/*, fCfg*/);
|
||||
IPath path = cs.getPath();
|
||||
fRefProjMap.put(path, cs);
|
||||
}
|
||||
|
@ -976,7 +976,7 @@ public class PathEntryTranslator {
|
|||
info[i].setInfo((LinkedHashMap)map.clone());
|
||||
}
|
||||
}
|
||||
PathEntryCollector newCr = new PathEntryCollector(newContainer, cloneStore, fProject, fCfg);
|
||||
PathEntryCollector newCr = new PathEntryCollector(newContainer, cloneStore, fProject/*, fCfg*/);
|
||||
newContainer.setValue(newCr);
|
||||
return newCr;
|
||||
}
|
||||
|
@ -1014,7 +1014,7 @@ public class PathEntryTranslator {
|
|||
continue;
|
||||
|
||||
ICLanguageSettingEntry entry = entries[i];
|
||||
map.put(entry, new PathEntryComposer(fullPath, entry, exportedEntries.contains(entry), fProject, fCfg));
|
||||
map.put(entry, new PathEntryComposer(fullPath, entry, exportedEntries.contains(entry), fProject/*, fCfg*/));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1084,7 +1084,7 @@ public class PathEntryTranslator {
|
|||
}
|
||||
}
|
||||
|
||||
public List getEntries(int peKind, List list, int flags){
|
||||
public List getEntries(int peKind, List list, int flags, ICConfigurationDescription cfg){
|
||||
if(list == null){
|
||||
list = new ArrayList();
|
||||
}
|
||||
|
@ -1103,7 +1103,7 @@ public class PathEntryTranslator {
|
|||
PathEntryComposer cs = (PathEntryComposer)iter.next();
|
||||
ICSettingEntry entry = cs.getSettingEntry();
|
||||
if(checkFilter(cs, entry, flags)){
|
||||
IPathEntry pe = cs.toPathEntry();
|
||||
IPathEntry pe = cs.toPathEntry(cfg);
|
||||
if(pe != null)
|
||||
list.add(pe);
|
||||
}
|
||||
|
@ -1127,19 +1127,19 @@ public class PathEntryTranslator {
|
|||
}
|
||||
|
||||
|
||||
public List getEntries(List list, int flags){
|
||||
public List getEntries(List list, int flags, ICConfigurationDescription cfg){
|
||||
if(list == null)
|
||||
list = new ArrayList();
|
||||
int peKinds[] = PathEntryKyndStore.getSupportedKinds();
|
||||
for(int i = 0; i < peKinds.length; i++){
|
||||
getEntries(peKinds[i], list, flags);
|
||||
getEntries(peKinds[i], list, flags, cfg);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public IPathEntry[] getEntries(int flags){
|
||||
List list = getEntries(null, flags);
|
||||
public IPathEntry[] getEntries(int flags, ICConfigurationDescription cfg){
|
||||
List list = getEntries(null, flags,cfg);
|
||||
IPathEntry[] entries = (IPathEntry[])list.toArray(new IPathEntry[list.size()]);
|
||||
return entries;
|
||||
}
|
||||
|
@ -1217,18 +1217,7 @@ public class PathEntryTranslator {
|
|||
}
|
||||
|
||||
private static PathSettingsContainer createRcDataHolder(CConfigurationData data){
|
||||
PathSettingsContainer h = PathSettingsContainer.createRootContainer();
|
||||
|
||||
h.setValue(data.getRootFolderData());
|
||||
CResourceData[] rcDatas = data.getResourceDatas();
|
||||
CResourceData rcData;
|
||||
PathSettingsContainer child;
|
||||
for(int i = 0; i < rcDatas.length; i++){
|
||||
rcData = rcDatas[i];
|
||||
child = h.getChildContainer(rcData.getPath(), true, true);
|
||||
child.setValue(rcData);
|
||||
}
|
||||
return h;
|
||||
return CDataUtil.createRcDataHolder(data);
|
||||
}
|
||||
|
||||
public ReferenceSettingsInfo applyPathEntries(PathEntryResolveInfo info, int op){
|
||||
|
@ -2237,7 +2226,7 @@ public class PathEntryTranslator {
|
|||
// }
|
||||
//
|
||||
// public static PathEntryCollector collectEntries(IProject project, CConfigurationData data, ReferenceSettingsInfo refInfo){
|
||||
final PathEntryCollector cr = new PathEntryCollector(project, des);
|
||||
final PathEntryCollector cr = new PathEntryCollector(project/*, des*/);
|
||||
PathSettingsContainer rcDatas = createRcDataHolder(data);
|
||||
IPath srcPaths[] = data.getSourcePaths();
|
||||
ICSourceEntry sEntries[] = calculateSourceEntriesFromPaths(project, rcDatas, srcPaths);
|
||||
|
@ -2327,7 +2316,7 @@ public class PathEntryTranslator {
|
|||
// public static IPathEntry[] getPathEntries(IProject project, CConfigurationData data, ReferenceSettingsInfo refInfo, int flags){
|
||||
public static IPathEntry[] getPathEntries(IProject project, ICConfigurationDescription cfg, int flags){
|
||||
PathEntryCollector cr = collectEntries(project, cfg);
|
||||
return cr.getEntries(flags);
|
||||
return cr.getEntries(flags, cfg);
|
||||
}
|
||||
//
|
||||
// private
|
||||
|
|
|
@ -70,7 +70,7 @@ public class CContainerInfo extends OpenableInfo {
|
|||
|
||||
// IPathEntry[] entries = cproject.getResolvedPathEntries();
|
||||
ICSourceEntry[] entries = null;
|
||||
CProjectDescription des = (CProjectDescription)CProjectDescriptionManager.getInstance().getProjectDescription(cproject.getProject());
|
||||
CProjectDescription des = (CProjectDescription)CProjectDescriptionManager.getInstance().getProjectDescription(cproject.getProject(), false);
|
||||
if(des != null){
|
||||
ICConfigurationDescription cfg = des.getIndexConfiguration();
|
||||
if(cfg != null){
|
||||
|
|
|
@ -88,7 +88,7 @@ class CProjectInfo extends OpenableInfo {
|
|||
char[][] exclusionPatterns = null;
|
||||
// try {
|
||||
// entries = cproject.getResolvedPathEntries();
|
||||
CProjectDescription des = (CProjectDescription)CProjectDescriptionManager.getInstance().getProjectDescription(project);
|
||||
CProjectDescription des = (CProjectDescription)CProjectDescriptionManager.getInstance().getProjectDescription(project, false);
|
||||
if(des != null){
|
||||
ICConfigurationDescription cfg = des.getIndexConfiguration();
|
||||
if(cfg != null){
|
||||
|
|
|
@ -338,8 +338,10 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
|||
if(fCfgCache != null){
|
||||
if(fCfgCache.isInitializing())
|
||||
fCfgSpecSettings = fCfgCache.getSpecSettings();
|
||||
else
|
||||
else {
|
||||
fCfgSpecSettings = new CConfigurationSpecSettings(this, fCfgCache.getSpecSettings());
|
||||
fCfgCache = null;
|
||||
}
|
||||
} else {
|
||||
fCfgSpecSettings = new CConfigurationSpecSettings(this, (ICStorageElement)null);
|
||||
}
|
||||
|
@ -348,6 +350,7 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
|||
} else if( fCfgSpecSettings.getConfigurarion() != this){
|
||||
if(!fCfgCache.isInitializing()){
|
||||
fCfgSpecSettings = new CConfigurationSpecSettings(this, fCfgCache.getSpecSettings());
|
||||
fCfgCache = null;
|
||||
}
|
||||
}
|
||||
return fCfgSpecSettings;
|
||||
|
|
|
@ -47,6 +47,7 @@ import org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager;
|
|||
import org.eclipse.cdt.internal.core.cdtvariables.StorableCdtVariables;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
|
||||
public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
||||
|
@ -437,10 +438,18 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
|||
}
|
||||
|
||||
void doneInitialization(){
|
||||
CProjectDescriptionManager.getInstance().notifyCached(this, fData, null);
|
||||
fInitializing = false;
|
||||
}
|
||||
|
||||
public ICLanguageSetting getLanguageSettingForFile(IPath path) {
|
||||
return CProjectDescriptionManager.getLanguageSettingForFile(this, path);
|
||||
}
|
||||
|
||||
protected CResourceData[] filterRcDatasToCopy(CConfigurationData base) {
|
||||
if(!isPreferenceConfiguration())
|
||||
CProjectDescriptionManager.removeNonCustomSettings(getProjectDescription().getProject(), base);
|
||||
return super.filterRcDatasToCopy(base);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,4 +86,8 @@ public class CFileDescriptionCache extends CDefaultFileData implements
|
|||
public IPath getPath() {
|
||||
return ResourceDescriptionHolder.normalizePath(super.getPath());
|
||||
}
|
||||
|
||||
public boolean hasCustomSettings() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,4 +134,10 @@ public class CFolderDescriptionCache extends CDefaultFolderData implements
|
|||
public IPath getPath() {
|
||||
return ResourceDescriptionHolder.normalizePath(super.getPath());
|
||||
}
|
||||
|
||||
public boolean hasCustomSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
|||
import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CFileData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CFolderData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CResourceData;
|
||||
|
@ -70,8 +71,11 @@ import org.eclipse.cdt.core.settings.model.extension.impl.CDataFacroty;
|
|||
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationData;
|
||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||
import org.eclipse.cdt.core.settings.model.util.CSettingEntryFactory;
|
||||
import org.eclipse.cdt.core.settings.model.util.IPathSettingsContainerVisitor;
|
||||
import org.eclipse.cdt.core.settings.model.util.KindBasedStore;
|
||||
import org.eclipse.cdt.core.settings.model.util.ListComparator;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
||||
import org.eclipse.cdt.core.settings.model.util.PatternNameMap;
|
||||
import org.eclipse.cdt.internal.core.CConfigBasedDescriptorManager;
|
||||
import org.eclipse.cdt.internal.core.envvar.ContributedEnvironment;
|
||||
import org.eclipse.cdt.internal.core.model.CElementDelta;
|
||||
|
@ -1488,7 +1492,19 @@ public class CProjectDescriptionManager {
|
|||
CConfigurationDataProvider provider = getProvider(des);
|
||||
return provider.applyConfiguration(des, baseDescription, base, monitor);
|
||||
}
|
||||
|
||||
|
||||
void notifyCached(ICConfigurationDescription des, CConfigurationData data, IProgressMonitor monitor) {
|
||||
if(monitor == null)
|
||||
monitor = new NullProgressMonitor();
|
||||
|
||||
try {
|
||||
CConfigurationDataProvider provider = getProvider(des);
|
||||
provider.dataCached(des, data, monitor);
|
||||
} catch (CoreException e){
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
void removeData(ICConfigurationDescription des, CConfigurationData data, IProgressMonitor monitor) throws CoreException{
|
||||
if(monitor == null)
|
||||
monitor = new NullProgressMonitor();
|
||||
|
@ -3134,4 +3150,141 @@ public class CProjectDescriptionManager {
|
|||
}
|
||||
return ((ICFileDescription)rcDes).getLanguageSetting();
|
||||
}
|
||||
|
||||
static private HashMap createExtSetToLDataMap(IProject project, CLanguageData[] lDatas){
|
||||
HashMap map = new HashMap();
|
||||
|
||||
for(int i = 0; i < lDatas.length; i++){
|
||||
CLanguageData lData = lDatas[i];
|
||||
String[] exts = CDataUtil.getSourceExtensions(project, lData);
|
||||
HashSet set = new HashSet(Arrays.asList(exts));
|
||||
map.put(set, lData);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
static boolean removeNonCustomSettings(IProject project, CConfigurationData data){
|
||||
if(true)
|
||||
return false;
|
||||
PathSettingsContainer cr = CDataUtil.createRcDataHolder(data);
|
||||
PathSettingsContainer[] crs = cr.getChildren(false);
|
||||
PathSettingsContainer child, parent;
|
||||
CResourceData childRcData;
|
||||
boolean modified = false;
|
||||
for(int i = 0; i < crs.length; i++){
|
||||
child = crs[i];
|
||||
childRcData = (CResourceData)child.getValue();
|
||||
if(childRcData.getType() == ICSettingBase.SETTING_FOLDER){
|
||||
CResourceData parentRcData = null;
|
||||
for(parent = child.getParentContainer();
|
||||
(parentRcData = (CResourceData)parent.getValue()).getType() != ICSettingBase.SETTING_FOLDER;
|
||||
parent = parent.getParentContainer());
|
||||
if(!settingsCustomized(project, (CFolderData)parentRcData, (CFolderData)childRcData)){
|
||||
try {
|
||||
data.removeResourceData(childRcData);
|
||||
modified = true;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
parent = child.getParentContainer();
|
||||
if(!settingsCustomized(project, (CResourceData)parent.getValue(), (CFileData)childRcData)){
|
||||
try {
|
||||
data.removeResourceData(childRcData);
|
||||
modified = true;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
static boolean settingsCustomized(IProject project, CFolderData parent, CFolderData child){
|
||||
if(baseSettingsCustomized(parent, child))
|
||||
return true;
|
||||
|
||||
CLanguageData[] childLDatas = child.getLanguageDatas();
|
||||
CLanguageData[] parentLDatas = parent.getLanguageDatas();
|
||||
|
||||
if(childLDatas.length != parentLDatas.length)
|
||||
return true;
|
||||
|
||||
if(childLDatas.length != 0){
|
||||
HashMap parentMap = createExtSetToLDataMap(project, parentLDatas);
|
||||
HashMap childMap = createExtSetToLDataMap(project, childLDatas);
|
||||
CLanguageData parentLData, childLData;
|
||||
for(Iterator iter = parentMap.entrySet().iterator(); iter.hasNext();){
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
childLData = (CLanguageData)childMap.get(entry.getKey());
|
||||
if(childLData == null)
|
||||
return true;
|
||||
|
||||
parentLData = (CLanguageData)entry.getValue();
|
||||
if(!langDatasEqual(parentLData, childLData))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean settingsCustomized(IProject project, CResourceData parent, CFileData child){
|
||||
if(baseSettingsCustomized(parent, child))
|
||||
return true;
|
||||
|
||||
CLanguageData lData = child.getLanguageData();
|
||||
|
||||
if(parent.getType() == ICSettingBase.SETTING_FOLDER){
|
||||
CFolderData foParent = (CFolderData)parent;
|
||||
|
||||
IPath childPath = child.getPath();
|
||||
String fileName = childPath.lastSegment();
|
||||
if(PatternNameMap.isPatternName(fileName))
|
||||
return true;
|
||||
|
||||
CLanguageData parentLangData = CDataUtil.findLanguagDataForFile(fileName, project, foParent);
|
||||
|
||||
return !langDatasEqual(lData, parentLangData);
|
||||
}
|
||||
|
||||
CFileData fiParent = (CFileData)parent;
|
||||
CLanguageData parentLangData = fiParent.getLanguageData();
|
||||
return !langDatasEqual(lData, parentLangData);
|
||||
}
|
||||
|
||||
static boolean langDatasEqual(CLanguageData lData1, CLanguageData lData2){
|
||||
if(lData1 == null)
|
||||
return lData2 == null;
|
||||
|
||||
if(lData2 == null)
|
||||
return false;
|
||||
|
||||
int kinds[] = KindBasedStore.getLanguageEntryKinds();
|
||||
int kind;
|
||||
for(int i = 0; i < kinds.length; i++){
|
||||
kind = kinds[i];
|
||||
ICLanguageSettingEntry entries1[] = lData1.getEntries(kind);
|
||||
ICLanguageSettingEntry entries2[] = lData2.getEntries(kind);
|
||||
if(!Arrays.equals(entries1, entries2))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean baseSettingsCustomized(CResourceData parent, CResourceData child){
|
||||
if(parent.isExcluded() != child.isExcluded())
|
||||
return true;
|
||||
|
||||
if(child.hasCustomSettings())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -99,9 +99,10 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
|||
}
|
||||
|
||||
public IPathEntry[] getRawPathEntries() throws CoreException {
|
||||
PathEntryCollector cr = getCollector(fProject);
|
||||
ICConfigurationDescription cfg = getIndexCfg(fProject);
|
||||
PathEntryCollector cr = getCollector(fProject, cfg);
|
||||
if(cr != null){
|
||||
List list = cr.getEntries(null, PathEntryTranslator.INCLUDE_USER);
|
||||
List list = cr.getEntries(null, PathEntryTranslator.INCLUDE_USER, cfg);
|
||||
list.add(CoreModel.newContainerEntry(ConfigBasedPathEntryContainer.CONTAINER_PATH));
|
||||
return (IPathEntry[])list.toArray(new IPathEntry[list.size()]);
|
||||
}
|
||||
|
@ -109,9 +110,10 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
|||
}
|
||||
|
||||
public void setRawPathEntries(IPathEntry[] entries) throws CoreException {
|
||||
PathEntryCollector cr = getCollector(fProject);
|
||||
ICConfigurationDescription cfg = getIndexCfg(fProject);
|
||||
PathEntryCollector cr = getCollector(fProject, cfg);
|
||||
if(cr != null){
|
||||
List sysList = cr.getEntries(null, PathEntryTranslator.INCLUDE_BUILT_INS);
|
||||
List sysList = cr.getEntries(null, PathEntryTranslator.INCLUDE_BUILT_INS, cfg);
|
||||
List usrList = new ArrayList(entries.length);
|
||||
for(int i = 0; i < entries.length; i++){
|
||||
if(entries[i].getEntryKind() != IPathEntry.CDT_CONTAINER)
|
||||
|
@ -155,7 +157,7 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
|||
ICConfigurationDescription oldIndexCfg = oldDes.getIndexConfiguration();
|
||||
PathEntryCollector oldCr = getCachedCollector(oldIndexCfg);
|
||||
if(oldCr != null)
|
||||
oldCrEntries = oldCr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS);
|
||||
oldCrEntries = oldCr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS, oldIndexCfg);
|
||||
}
|
||||
if(des != null){
|
||||
//TODO: smart delta handling
|
||||
|
@ -165,8 +167,9 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
|||
}
|
||||
|
||||
if(oldCrEntries != null){
|
||||
PathEntryCollector newCr = getCollector(des);
|
||||
IPathEntry[] newCrEntries = newCr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS);
|
||||
ICConfigurationDescription newIndexCfg = des.getIndexConfiguration();
|
||||
PathEntryCollector newCr = getCollector(fProject, newIndexCfg);
|
||||
IPathEntry[] newCrEntries = newCr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS, newIndexCfg);
|
||||
if(!Arrays.equals(oldCrEntries, newCrEntries)){
|
||||
CModelManager manager = CModelManager.getDefault();
|
||||
ICProject cproject = manager.create(project);
|
||||
|
@ -187,19 +190,31 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
|||
}
|
||||
}
|
||||
|
||||
private static PathEntryCollector getCollector(ICProjectDescription des){
|
||||
ICConfigurationDescription cfgDes = ((CProjectDescription)des).getIndexConfiguration();
|
||||
// private static PathEntryCollector getCollector(ICProjectDescription des){
|
||||
// ICConfigurationDescription cfgDes = ((CProjectDescription)des).getIndexConfiguration();
|
||||
// if(cfgDes != null){
|
||||
// PathEntryCollector cr = getCachedCollector(cfgDes);
|
||||
// if(cr == null){
|
||||
// cr = PathEntryTranslator.collectEntries(des.getProject(), cfgDes);
|
||||
// setCachedCollector(cfgDes, cr);
|
||||
// }
|
||||
// return cr;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
private static PathEntryCollector getCollector(IProject project, ICConfigurationDescription cfgDes){
|
||||
if(cfgDes != null){
|
||||
PathEntryCollector cr = getCachedCollector(cfgDes);
|
||||
if(cr == null){
|
||||
cr = PathEntryTranslator.collectEntries(des.getProject(), cfgDes);
|
||||
cr = PathEntryTranslator.collectEntries(project, cfgDes);
|
||||
setCachedCollector(cfgDes, cr);
|
||||
}
|
||||
return cr;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private static PathEntryCollector getCachedCollector(ICConfigurationDescription cfgDes){
|
||||
return (PathEntryCollector)cfgDes.getSessionProperty(PATH_ENTRY_COLLECTOR_PROPERTY_NAME);
|
||||
}
|
||||
|
@ -208,11 +223,16 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
|||
cfgDes.setSessionProperty(PATH_ENTRY_COLLECTOR_PROPERTY_NAME, cr);
|
||||
}
|
||||
|
||||
public static PathEntryCollector getCollector(IProject project){
|
||||
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project, false);
|
||||
if(des != null)
|
||||
return getCollector(des);
|
||||
return null;
|
||||
// public static PathEntryCollector getCollector(IProject project){
|
||||
// ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project, false);
|
||||
// if(des != null)
|
||||
// return getCollector(des);
|
||||
// return null;
|
||||
// }
|
||||
|
||||
private static ICConfigurationDescription getIndexCfg(IProject project){
|
||||
CProjectDescription des = (CProjectDescription)CCorePlugin.getDefault().getProjectDescription(project, false);
|
||||
return des.getIndexConfiguration();
|
||||
}
|
||||
|
||||
public static IPathEntry[] getContainerEntries(IProject project){
|
||||
|
@ -223,9 +243,10 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
|||
}
|
||||
|
||||
public static IPathEntry[] getContainerEntries(ICProjectDescription des){
|
||||
PathEntryCollector cr = getCollector(des);
|
||||
ICConfigurationDescription cfg = ((CProjectDescription)des).getIndexConfiguration();
|
||||
PathEntryCollector cr = getCollector(des.getProject(), cfg);
|
||||
if(cr != null)
|
||||
return cr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS);
|
||||
return cr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS, cfg);
|
||||
return new IPathEntry[0];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue