mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 08:45:44 +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){
|
private IRcSettingInfo[] mapFileDiscoveredInfo(IProject project, CConfigurationData data, RcSetSettings rcSet, PathFilePathInfo[] pfpis){
|
||||||
IResource rc;
|
// IResource rc;
|
||||||
PathInfo pInfo;
|
PathInfo pInfo;
|
||||||
Map.Entry entry;
|
|
||||||
IPath projRelPath;
|
IPath projRelPath;
|
||||||
CResourceData rcData;
|
CResourceData rcData;
|
||||||
// RcSetSettings dataSetting;
|
// RcSetSettings dataSetting;
|
||||||
List list = new ArrayList(map.size());
|
List list = new ArrayList(pfpis.length);
|
||||||
RcSettingInfo rcInfo;
|
RcSettingInfo rcInfo;
|
||||||
LangSettingInfo lInfo;
|
LangSettingInfo lInfo;
|
||||||
CLanguageData lData;
|
CLanguageData lData;
|
||||||
ArrayList tmpList;
|
ArrayList tmpList;
|
||||||
|
PathFilePathInfo pfpi;
|
||||||
|
|
||||||
for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){
|
for(int i = 0; i < pfpis.length; i++){
|
||||||
entry = (Map.Entry)iter.next();
|
pfpi = pfpis[i];
|
||||||
rc = (IResource)entry.getKey();
|
projRelPath = pfpi.fPath;
|
||||||
pInfo = (PathInfo)entry.getValue();
|
pInfo = pfpi.fInfo;
|
||||||
if(pInfo.isEmpty())
|
if(pInfo.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch(rc.getType()){
|
if(projRelPath.segmentCount() == 0)
|
||||||
case IResource.FILE:
|
continue;
|
||||||
projRelPath = rc.getProjectRelativePath();
|
// switch(rc.getType()){
|
||||||
|
// case IResource.FILE:
|
||||||
|
// projRelPath = rc.getProjectRelativePath();
|
||||||
// dataSetting = rcSet.getChild(projRelPath, false);
|
// dataSetting = rcSet.getChild(projRelPath, false);
|
||||||
// rcData = dataSetting.fRcData;
|
// rcData = dataSetting.fRcData;
|
||||||
rcData = rcSet.getChild(projRelPath, false).fRcData;
|
rcData = rcSet.getChild(projRelPath, false).fRcData;
|
||||||
|
@ -723,8 +725,8 @@ public class PerFileSettingsCalculator {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
return (RcSettingInfo[])list.toArray(new RcSettingInfo[list.size()]);
|
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){
|
public IRcSettingInfo[] getSettingInfos(IProject project, CConfigurationData data, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo, boolean fileDataMode){
|
||||||
if(fileDataMode){
|
if(fileDataMode){
|
||||||
RcSetSettings rcSettings = createRcSetInfo(data);
|
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);
|
RcSetSettings settings = createRcSetSettings(data, discoveredInfo);
|
||||||
return createInfos(data, settings);
|
return createInfos(data, settings);
|
||||||
|
@ -981,13 +984,13 @@ public class PerFileSettingsCalculator {
|
||||||
for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){
|
for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){
|
||||||
entry = (Map.Entry)iter.next();
|
entry = (Map.Entry)iter.next();
|
||||||
rc = (IResource)entry.getKey();
|
rc = (IResource)entry.getKey();
|
||||||
path = rc.getFullPath();
|
path = rc.getProjectRelativePath();
|
||||||
int segCount = path.segmentCount();
|
int segCount = path.segmentCount();
|
||||||
if(segCount < 1)
|
// if(segCount < 1)
|
||||||
continue;
|
// continue;
|
||||||
|
|
||||||
path = path.removeFirstSegments(1);
|
// path = path.removeFirstSegments(1);
|
||||||
segCount--;
|
// segCount--;
|
||||||
|
|
||||||
info = (PathInfo)entry.getValue();
|
info = (PathInfo)entry.getValue();
|
||||||
storedInfo = (PathInfo)infoMap.get(info);
|
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 final QualifiedName CONTAINER_INFO_PROPERTY = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "ScannerConfigBuilderInfo2Container"); //$NON-NLS-1$
|
||||||
|
|
||||||
private static class ContainerInfo{
|
private static class ContainerInfo{
|
||||||
ICProjectDescription fDes;
|
int fCode;
|
||||||
IScannerConfigBuilderInfo2Set fContainer;
|
IScannerConfigBuilderInfo2Set fContainer;
|
||||||
|
|
||||||
ContainerInfo(ICProjectDescription des, IScannerConfigBuilderInfo2Set container){
|
ContainerInfo(ICProjectDescription des, IScannerConfigBuilderInfo2Set container){
|
||||||
this.fDes = des;
|
this.fCode = des.hashCode();
|
||||||
this.fContainer = container;
|
this.fContainer = container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean matches(ICProjectDescription des){
|
||||||
|
return des.hashCode() == fCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private static class CfgInfo implements ICfgScannerConfigBuilderInfo2Set {
|
private static class CfgInfo implements ICfgScannerConfigBuilderInfo2Set {
|
||||||
private Configuration cfg;
|
private Configuration cfg;
|
||||||
|
@ -101,7 +105,7 @@ public class CfgScannerConfigInfoFactory2 {
|
||||||
ICProjectDescription projDes = cfgDes.getProjectDescription();
|
ICProjectDescription projDes = cfgDes.getProjectDescription();
|
||||||
if(projDes != null){
|
if(projDes != null){
|
||||||
ContainerInfo cInfo = (ContainerInfo)projDes.getSessionProperty(CONTAINER_INFO_PROPERTY);
|
ContainerInfo cInfo = (ContainerInfo)projDes.getSessionProperty(CONTAINER_INFO_PROPERTY);
|
||||||
if(cInfo != null && cInfo.fDes == projDes){
|
if(cInfo != null && cInfo.matches(projDes)){
|
||||||
fContainer = cInfo.fContainer;
|
fContainer = cInfo.fContainer;
|
||||||
} else {
|
} else {
|
||||||
fContainer = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(cfg.getOwner().getProject());
|
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{
|
public static void save(BuildConfigurationData data, ICProjectDescription des, ICProjectDescription baseDescription, boolean force) throws CoreException{
|
||||||
ContainerInfo info = (ContainerInfo)des.getSessionProperty(CONTAINER_INFO_PROPERTY);
|
ContainerInfo info = (ContainerInfo)des.getSessionProperty(CONTAINER_INFO_PROPERTY);
|
||||||
if(info != null){
|
if(info != null){
|
||||||
if(info.fDes == baseDescription){
|
if(info.matches(baseDescription)){
|
||||||
IScannerConfigBuilderInfo2Set baseContainer = info.fContainer;
|
IScannerConfigBuilderInfo2Set baseContainer = info.fContainer;
|
||||||
baseContainer.save();
|
baseContainer.save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2789,6 +2789,10 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
||||||
cfgScannerInfo = info;
|
cfgScannerInfo = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearCachedData(){
|
||||||
|
cfgScannerInfo = null;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isPreference(){
|
public boolean isPreference(){
|
||||||
return isPreferenceConfig;
|
return isPreferenceConfig;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1231,6 +1231,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
|
||||||
// rebuildNeeded = true;
|
// rebuildNeeded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasCustomSettings(){
|
||||||
|
return toolChain.hasCustomSettings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -743,4 +743,20 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
||||||
}
|
}
|
||||||
return requires;
|
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;
|
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);
|
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);
|
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 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 boolean rebuildState;
|
||||||
private BooleanExpressionApplicabilityCalculator booleanExpressionCalculator;
|
private BooleanExpressionApplicabilityCalculator booleanExpressionCalculator;
|
||||||
|
|
||||||
private HashMap typeToDataMap = new HashMap();
|
private HashMap typeToDataMap = new HashMap(2);
|
||||||
private boolean fDataMapInited;
|
private boolean fDataMapInited;
|
||||||
private List identicalList;
|
private List identicalList;
|
||||||
private HashMap discoveredInfoMap = new HashMap();
|
private HashMap discoveredInfoMap = new HashMap(2);
|
||||||
private String scannerConfigDiscoveryProfileId;
|
private String scannerConfigDiscoveryProfileId;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -443,9 +443,11 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
super.copyChildren(tool);
|
super.copyChildren(tool);
|
||||||
// Clone the children
|
// Clone the children
|
||||||
if (tool.inputTypeList != null) {
|
if (tool.inputTypeList != null) {
|
||||||
|
discoveredInfoMap = (HashMap)tool.discoveredInfoMap.clone();
|
||||||
Iterator iter = tool.getInputTypeList().listIterator();
|
Iterator iter = tool.getInputTypeList().listIterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
InputType inputType = (InputType) iter.next();
|
InputType inputType = (InputType) iter.next();
|
||||||
|
PathInfoCache cache = (PathInfoCache)discoveredInfoMap.remove(getTypeKey(inputType));
|
||||||
int nnn = ManagedBuildManager.getRandomNumber();
|
int nnn = ManagedBuildManager.getRandomNumber();
|
||||||
String subId;
|
String subId;
|
||||||
String subName;
|
String subName;
|
||||||
|
@ -458,6 +460,9 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
}
|
}
|
||||||
InputType newInputType = new InputType(this, subId, subName, inputType);
|
InputType newInputType = new InputType(this, subId, subName, inputType);
|
||||||
addInputType(newInputType);
|
addInputType(newInputType);
|
||||||
|
if(cache != null){
|
||||||
|
discoveredInfoMap.put(getTypeKey(newInputType), cache);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tool.outputTypeList != null) {
|
if (tool.outputTypeList != null) {
|
||||||
|
@ -3937,4 +3942,86 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
}
|
}
|
||||||
return id;
|
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;
|
nonInternalBuilderId = toolChain.nonInternalBuilderId;
|
||||||
|
|
||||||
|
discoveredInfo = toolChain.discoveredInfo;
|
||||||
|
|
||||||
// Clone the children in superclass
|
// Clone the children in superclass
|
||||||
boolean copyIds = toolChain.getId().equals(id);
|
boolean copyIds = toolChain.getId().equals(id);
|
||||||
super.copyChildren(toolChain);
|
super.copyChildren(toolChain);
|
||||||
|
@ -2621,4 +2623,22 @@ public class ToolChain extends HoldsOptions implements IToolChain, IBuildPropert
|
||||||
IToolChain tch = ManagedBuildManager.getRealToolChain(this);
|
IToolChain tch = ManagedBuildManager.getRealToolChain(this);
|
||||||
return tch != null && tch.getId().equals(ConfigurationDataProvider.PREF_TC_ID);
|
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;
|
package org.eclipse.cdt.managedbuilder.internal.dataprovider;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
|
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.CBuildData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
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.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.IResourceInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
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.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
public class BuildConfigurationData extends CConfigurationData {
|
public class BuildConfigurationData extends CConfigurationData {
|
||||||
private IConfiguration fCfg;
|
private Configuration fCfg;
|
||||||
private BuildVariablesContributor fCdtVars;
|
private BuildVariablesContributor fCdtVars;
|
||||||
public BuildConfigurationData(IConfiguration cfg){
|
public BuildConfigurationData(IConfiguration cfg){
|
||||||
fCfg = cfg;
|
fCfg = (Configuration)cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfiguration getConfiguration(){
|
public IConfiguration getConfiguration(){
|
||||||
|
@ -129,4 +131,22 @@ public class BuildConfigurationData extends CConfigurationData {
|
||||||
fCdtVars = new BuildVariablesContributor(this);
|
fCdtVars = new BuildVariablesContributor(this);
|
||||||
return fCdtVars;
|
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.CFileData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
|
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.core.ResourceConfiguration;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
public class BuildFileData extends CFileData {
|
public class BuildFileData extends CFileData {
|
||||||
private IFileInfo fFileInfo;
|
private ResourceConfiguration fFileInfo;
|
||||||
public BuildFileData(IFileInfo fileInfo){
|
public BuildFileData(IFileInfo fileInfo){
|
||||||
fFileInfo = fileInfo;
|
fFileInfo = (ResourceConfiguration)fileInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFileInfo getFileInfo(){
|
public IFileInfo getFileInfo(){
|
||||||
|
@ -64,4 +65,14 @@ public class BuildFileData extends CFileData {
|
||||||
return null;
|
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.CFolderData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
public class BuildFolderData extends CFolderData {
|
public class BuildFolderData extends CFolderData {
|
||||||
private IFolderInfo fFolderInfo;
|
private FolderInfo fFolderInfo;
|
||||||
public BuildFolderData(IFolderInfo folderInfo){
|
public BuildFolderData(IFolderInfo folderInfo){
|
||||||
fFolderInfo = folderInfo;
|
fFolderInfo = (FolderInfo)folderInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFolderInfo getFolderInfo(){
|
public IFolderInfo getFolderInfo(){
|
||||||
|
@ -72,4 +73,15 @@ public class BuildFolderData extends CFolderData {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
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
|
// 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.IBuilder;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
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.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
|
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.macros.DefaultMacroContextInfo;
|
import org.eclipse.cdt.managedbuilder.internal.macros.DefaultMacroContextInfo;
|
||||||
|
@ -129,19 +130,16 @@ public class BuildVariablesContributor implements ICdtVariablesContributor {
|
||||||
IConfiguration cfg = fCfgData.getConfiguration();
|
IConfiguration cfg = fCfgData.getConfiguration();
|
||||||
if(((Configuration)cfg).isPreference())
|
if(((Configuration)cfg).isPreference())
|
||||||
return null;
|
return null;
|
||||||
IProject project = cfg.getOwner().getProject();
|
ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
||||||
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(project);
|
if(cfgDes != null){
|
||||||
if(des != null){
|
return new ContributorMacroContextInfo(mngr,
|
||||||
ICConfigurationDescription cfgDes = des.getConfigurationById(cfg.getId());
|
cfgDes,
|
||||||
if(cfgDes != null){
|
BuildMacroProvider.CONTEXT_CONFIGURATION,
|
||||||
return new ContributorMacroContextInfo(mngr,
|
cfg);
|
||||||
cfgDes,
|
|
||||||
BuildMacroProvider.CONTEXT_CONFIGURATION,
|
|
||||||
cfg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICdtVariable[] getVariables(ICdtVariableManager provider) {
|
public ICdtVariable[] getVariables(ICdtVariableManager provider) {
|
||||||
ContributorMacroContextInfo info = createContextInfo(provider);
|
ContributorMacroContextInfo info = createContextInfo(provider);
|
||||||
if(info != null)
|
if(info != null)
|
||||||
|
|
|
@ -438,4 +438,12 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
mProj.removeConfiguration(cfg.getId());
|
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,
|
ICConfigurationDescription baseDescription,
|
||||||
CConfigurationData baseData,
|
CConfigurationData baseData,
|
||||||
IProgressMonitor monitor) throws CoreException;
|
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 setPath(IPath path) ;
|
||||||
|
|
||||||
public abstract void setExcluded(boolean excluded);
|
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);
|
fRootFolderData = copyFolderData(baseRootFolderData.getPath(), baseRootFolderData, clone);
|
||||||
addRcData(fRootFolderData);
|
addRcData(fRootFolderData);
|
||||||
|
|
||||||
CResourceData[] rcDatas = base.getResourceDatas();
|
CResourceData[] rcDatas = filterRcDatasToCopy(base);
|
||||||
|
|
||||||
for(int i = 0; i < rcDatas.length; i++){
|
for(int i = 0; i < rcDatas.length; i++){
|
||||||
CResourceData rcData = rcDatas[i];
|
CResourceData rcData = rcDatas[i];
|
||||||
|
@ -119,6 +119,10 @@ public class CDefaultConfigurationData extends CConfigurationData {
|
||||||
addRcData(copyFileData(rcData.getPath(), (CFileData)rcData, clone));
|
addRcData(copyFileData(rcData.getPath(), (CFileData)rcData, clone));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected CResourceData[] filterRcDatasToCopy(CConfigurationData base){
|
||||||
|
return base.getResourceDatas();
|
||||||
|
}
|
||||||
|
|
||||||
protected CFolderData copyFolderData(IPath path, CFolderData base, boolean clone){
|
protected CFolderData copyFolderData(IPath path, CFolderData base, boolean clone){
|
||||||
return fFactory.createFolderData(this, base, clone, path);
|
return fFactory.createFolderData(this, base, clone, path);
|
||||||
|
|
|
@ -123,4 +123,8 @@ public class CDefaultFileData extends CFileData {
|
||||||
fFactory.setModified(fLanguageData, false);
|
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.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
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.CFolderData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
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.cdt.core.settings.model.extension.impl.CDefaultLanguageData;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.ProjectScope;
|
import org.eclipse.core.resources.ProjectScope;
|
||||||
|
@ -319,6 +322,19 @@ public class CDataUtil {
|
||||||
}
|
}
|
||||||
return null;
|
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 Set fFiltersSet;
|
||||||
private boolean fIsExported;
|
private boolean fIsExported;
|
||||||
private IProject fProject;
|
private IProject fProject;
|
||||||
private ICConfigurationDescription fCfg;
|
// private ICConfigurationDescription fCfg;
|
||||||
|
|
||||||
PathEntryComposer(String projName, IProject project, ICConfigurationDescription cfg){
|
PathEntryComposer(String projName, IProject project/*, ICConfigurationDescription cfg*/){
|
||||||
this(new Path(projName).makeAbsolute(), project, 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);
|
fPath = toProjectPath(path);
|
||||||
fProject = project;
|
fProject = project;
|
||||||
fCfg = cfg;
|
// fCfg = cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IPath toProjectPath(IPath path){
|
private static IPath toProjectPath(IPath path){
|
||||||
|
@ -768,11 +768,11 @@ public class PathEntryTranslator {
|
||||||
return path.makeAbsolute();
|
return path.makeAbsolute();
|
||||||
}
|
}
|
||||||
|
|
||||||
PathEntryComposer(ICExclusionPatternPathEntry entry, IProject project, ICConfigurationDescription cfg){
|
PathEntryComposer(ICExclusionPatternPathEntry entry, IProject project/*, ICConfigurationDescription cfg*/){
|
||||||
fPath = new Path(entry.getValue());
|
fPath = new Path(entry.getValue());
|
||||||
fLangEntry = entry;
|
fLangEntry = entry;
|
||||||
fProject = project;
|
fProject = project;
|
||||||
fCfg = cfg;
|
// fCfg = cfg;
|
||||||
IPath[] exclusions = entry.getExclusionPatterns();
|
IPath[] exclusions = entry.getExclusionPatterns();
|
||||||
if(exclusions.length != 0){
|
if(exclusions.length != 0){
|
||||||
fFiltersSet = new HashSet(exclusions.length);
|
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;
|
fPath = path;
|
||||||
fLangEntry = entry;
|
fLangEntry = entry;
|
||||||
fIsExported = exported;
|
fIsExported = exported;
|
||||||
fProject = project;
|
fProject = project;
|
||||||
fCfg = cfg;
|
// fCfg = cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFilter(IPath path){
|
public void addFilter(IPath path){
|
||||||
|
@ -856,28 +856,28 @@ public class PathEntryTranslator {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPathEntry toPathEntry(){
|
public IPathEntry toPathEntry(ICConfigurationDescription cfg){
|
||||||
if(fLangEntry != null){
|
if(fLangEntry != null){
|
||||||
switch(fLangEntry.getKind()){
|
switch(fLangEntry.getKind()){
|
||||||
case ICLanguageSettingEntry.INCLUDE_FILE:{
|
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);
|
return CoreModel.newIncludeFileEntry(fPath, null, paths[0], paths[1], getExclusionPatterns(), fIsExported);
|
||||||
}
|
}
|
||||||
case ICLanguageSettingEntry.INCLUDE_PATH:{
|
case ICLanguageSettingEntry.INCLUDE_PATH:{
|
||||||
IPath paths[] = getEntryPath(fLangEntry, fCfg);
|
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
||||||
ICIncludePathEntry ipe = (ICIncludePathEntry)fLangEntry;
|
ICIncludePathEntry ipe = (ICIncludePathEntry)fLangEntry;
|
||||||
return CoreModel.newIncludeEntry(fPath, paths[0], paths[1], !ipe.isLocal(), getExclusionPatterns(), fIsExported);
|
return CoreModel.newIncludeEntry(fPath, paths[0], paths[1], !ipe.isLocal(), getExclusionPatterns(), fIsExported);
|
||||||
}
|
}
|
||||||
case ICLanguageSettingEntry.MACRO:
|
case ICLanguageSettingEntry.MACRO:
|
||||||
return CoreModel.newMacroEntry(fPath, fLangEntry.getName(), fLangEntry.getValue(), getExclusionPatterns(), fIsExported);
|
return CoreModel.newMacroEntry(fPath, fLangEntry.getName(), fLangEntry.getValue(), getExclusionPatterns(), fIsExported);
|
||||||
case ICLanguageSettingEntry.MACRO_FILE:{
|
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);
|
return CoreModel.newMacroFileEntry(fPath, paths[0], null, paths[1], getExclusionPatterns(), fIsExported);
|
||||||
}
|
}
|
||||||
case ICLanguageSettingEntry.LIBRARY_PATH:
|
case ICLanguageSettingEntry.LIBRARY_PATH:
|
||||||
return null;
|
return null;
|
||||||
case ICLanguageSettingEntry.LIBRARY_FILE:{
|
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);
|
return CoreModel.newLibraryEntry(fPath, paths[0], paths[1], null, null, null, fIsExported);
|
||||||
}
|
}
|
||||||
case ICLanguageSettingEntry.OUTPUT_PATH:
|
case ICLanguageSettingEntry.OUTPUT_PATH:
|
||||||
|
@ -919,27 +919,27 @@ public class PathEntryTranslator {
|
||||||
private KindBasedStore fStore;
|
private KindBasedStore fStore;
|
||||||
private LinkedHashMap fRefProjMap;
|
private LinkedHashMap fRefProjMap;
|
||||||
private IProject fProject;
|
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 = PathSettingsContainer.createRootContainer();
|
||||||
fStorage.setValue(this);
|
fStorage.setValue(this);
|
||||||
fStore = new KindBasedStore(false);
|
fStore = new KindBasedStore(false);
|
||||||
fCfg = cfg;
|
// fCfg = cfg;
|
||||||
fProject = project;
|
fProject = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PathEntryCollector(PathSettingsContainer container, KindBasedStore store, IProject project, ICConfigurationDescription cfg){
|
private PathEntryCollector(PathSettingsContainer container, KindBasedStore store, IProject project/*, ICConfigurationDescription cfg*/){
|
||||||
fStorage = container;
|
fStorage = container;
|
||||||
fStore = store;
|
fStore = store;
|
||||||
fCfg = cfg;
|
// fCfg = cfg;
|
||||||
fProject = project;
|
fProject = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSourceOutputEntries(int kind, ICExclusionPatternPathEntry entries[]){
|
public void setSourceOutputEntries(int kind, ICExclusionPatternPathEntry entries[]){
|
||||||
Map map = getEntriesMap(kind, true);
|
Map map = getEntriesMap(kind, true);
|
||||||
for(int i = 0; i < entries.length; i++){
|
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 {
|
else {
|
||||||
fRefProjMap = new LinkedHashMap();
|
fRefProjMap = new LinkedHashMap();
|
||||||
for(int i = 0; i < paths.length; i++){
|
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();
|
IPath path = cs.getPath();
|
||||||
fRefProjMap.put(path, cs);
|
fRefProjMap.put(path, cs);
|
||||||
}
|
}
|
||||||
|
@ -976,7 +976,7 @@ public class PathEntryTranslator {
|
||||||
info[i].setInfo((LinkedHashMap)map.clone());
|
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);
|
newContainer.setValue(newCr);
|
||||||
return newCr;
|
return newCr;
|
||||||
}
|
}
|
||||||
|
@ -1014,7 +1014,7 @@ public class PathEntryTranslator {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ICLanguageSettingEntry entry = entries[i];
|
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){
|
if(list == null){
|
||||||
list = new ArrayList();
|
list = new ArrayList();
|
||||||
}
|
}
|
||||||
|
@ -1103,7 +1103,7 @@ public class PathEntryTranslator {
|
||||||
PathEntryComposer cs = (PathEntryComposer)iter.next();
|
PathEntryComposer cs = (PathEntryComposer)iter.next();
|
||||||
ICSettingEntry entry = cs.getSettingEntry();
|
ICSettingEntry entry = cs.getSettingEntry();
|
||||||
if(checkFilter(cs, entry, flags)){
|
if(checkFilter(cs, entry, flags)){
|
||||||
IPathEntry pe = cs.toPathEntry();
|
IPathEntry pe = cs.toPathEntry(cfg);
|
||||||
if(pe != null)
|
if(pe != null)
|
||||||
list.add(pe);
|
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)
|
if(list == null)
|
||||||
list = new ArrayList();
|
list = new ArrayList();
|
||||||
int peKinds[] = PathEntryKyndStore.getSupportedKinds();
|
int peKinds[] = PathEntryKyndStore.getSupportedKinds();
|
||||||
for(int i = 0; i < peKinds.length; i++){
|
for(int i = 0; i < peKinds.length; i++){
|
||||||
getEntries(peKinds[i], list, flags);
|
getEntries(peKinds[i], list, flags, cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPathEntry[] getEntries(int flags){
|
public IPathEntry[] getEntries(int flags, ICConfigurationDescription cfg){
|
||||||
List list = getEntries(null, flags);
|
List list = getEntries(null, flags,cfg);
|
||||||
IPathEntry[] entries = (IPathEntry[])list.toArray(new IPathEntry[list.size()]);
|
IPathEntry[] entries = (IPathEntry[])list.toArray(new IPathEntry[list.size()]);
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
@ -1217,18 +1217,7 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PathSettingsContainer createRcDataHolder(CConfigurationData data){
|
private static PathSettingsContainer createRcDataHolder(CConfigurationData data){
|
||||||
PathSettingsContainer h = PathSettingsContainer.createRootContainer();
|
return CDataUtil.createRcDataHolder(data);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceSettingsInfo applyPathEntries(PathEntryResolveInfo info, int op){
|
public ReferenceSettingsInfo applyPathEntries(PathEntryResolveInfo info, int op){
|
||||||
|
@ -2237,7 +2226,7 @@ public class PathEntryTranslator {
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// public static PathEntryCollector collectEntries(IProject project, CConfigurationData data, ReferenceSettingsInfo refInfo){
|
// 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);
|
PathSettingsContainer rcDatas = createRcDataHolder(data);
|
||||||
IPath srcPaths[] = data.getSourcePaths();
|
IPath srcPaths[] = data.getSourcePaths();
|
||||||
ICSourceEntry sEntries[] = calculateSourceEntriesFromPaths(project, rcDatas, srcPaths);
|
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, CConfigurationData data, ReferenceSettingsInfo refInfo, int flags){
|
||||||
public static IPathEntry[] getPathEntries(IProject project, ICConfigurationDescription cfg, int flags){
|
public static IPathEntry[] getPathEntries(IProject project, ICConfigurationDescription cfg, int flags){
|
||||||
PathEntryCollector cr = collectEntries(project, cfg);
|
PathEntryCollector cr = collectEntries(project, cfg);
|
||||||
return cr.getEntries(flags);
|
return cr.getEntries(flags, cfg);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// private
|
// private
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class CContainerInfo extends OpenableInfo {
|
||||||
|
|
||||||
// IPathEntry[] entries = cproject.getResolvedPathEntries();
|
// IPathEntry[] entries = cproject.getResolvedPathEntries();
|
||||||
ICSourceEntry[] entries = null;
|
ICSourceEntry[] entries = null;
|
||||||
CProjectDescription des = (CProjectDescription)CProjectDescriptionManager.getInstance().getProjectDescription(cproject.getProject());
|
CProjectDescription des = (CProjectDescription)CProjectDescriptionManager.getInstance().getProjectDescription(cproject.getProject(), false);
|
||||||
if(des != null){
|
if(des != null){
|
||||||
ICConfigurationDescription cfg = des.getIndexConfiguration();
|
ICConfigurationDescription cfg = des.getIndexConfiguration();
|
||||||
if(cfg != null){
|
if(cfg != null){
|
||||||
|
|
|
@ -88,7 +88,7 @@ class CProjectInfo extends OpenableInfo {
|
||||||
char[][] exclusionPatterns = null;
|
char[][] exclusionPatterns = null;
|
||||||
// try {
|
// try {
|
||||||
// entries = cproject.getResolvedPathEntries();
|
// entries = cproject.getResolvedPathEntries();
|
||||||
CProjectDescription des = (CProjectDescription)CProjectDescriptionManager.getInstance().getProjectDescription(project);
|
CProjectDescription des = (CProjectDescription)CProjectDescriptionManager.getInstance().getProjectDescription(project, false);
|
||||||
if(des != null){
|
if(des != null){
|
||||||
ICConfigurationDescription cfg = des.getIndexConfiguration();
|
ICConfigurationDescription cfg = des.getIndexConfiguration();
|
||||||
if(cfg != null){
|
if(cfg != null){
|
||||||
|
|
|
@ -338,8 +338,10 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
||||||
if(fCfgCache != null){
|
if(fCfgCache != null){
|
||||||
if(fCfgCache.isInitializing())
|
if(fCfgCache.isInitializing())
|
||||||
fCfgSpecSettings = fCfgCache.getSpecSettings();
|
fCfgSpecSettings = fCfgCache.getSpecSettings();
|
||||||
else
|
else {
|
||||||
fCfgSpecSettings = new CConfigurationSpecSettings(this, fCfgCache.getSpecSettings());
|
fCfgSpecSettings = new CConfigurationSpecSettings(this, fCfgCache.getSpecSettings());
|
||||||
|
fCfgCache = null;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fCfgSpecSettings = new CConfigurationSpecSettings(this, (ICStorageElement)null);
|
fCfgSpecSettings = new CConfigurationSpecSettings(this, (ICStorageElement)null);
|
||||||
}
|
}
|
||||||
|
@ -348,6 +350,7 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
||||||
} else if( fCfgSpecSettings.getConfigurarion() != this){
|
} else if( fCfgSpecSettings.getConfigurarion() != this){
|
||||||
if(!fCfgCache.isInitializing()){
|
if(!fCfgCache.isInitializing()){
|
||||||
fCfgSpecSettings = new CConfigurationSpecSettings(this, fCfgCache.getSpecSettings());
|
fCfgSpecSettings = new CConfigurationSpecSettings(this, fCfgCache.getSpecSettings());
|
||||||
|
fCfgCache = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fCfgSpecSettings;
|
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.cdt.internal.core.cdtvariables.StorableCdtVariables;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
|
|
||||||
public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
||||||
|
@ -437,10 +438,18 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
||||||
}
|
}
|
||||||
|
|
||||||
void doneInitialization(){
|
void doneInitialization(){
|
||||||
|
CProjectDescriptionManager.getInstance().notifyCached(this, fData, null);
|
||||||
fInitializing = false;
|
fInitializing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICLanguageSetting getLanguageSettingForFile(IPath path) {
|
public ICLanguageSetting getLanguageSettingForFile(IPath path) {
|
||||||
return CProjectDescriptionManager.getLanguageSettingForFile(this, 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() {
|
public IPath getPath() {
|
||||||
return ResourceDescriptionHolder.normalizePath(super.getPath());
|
return ResourceDescriptionHolder.normalizePath(super.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasCustomSettings() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,4 +134,10 @@ public class CFolderDescriptionCache extends CDefaultFolderData implements
|
||||||
public IPath getPath() {
|
public IPath getPath() {
|
||||||
return ResourceDescriptionHolder.normalizePath(super.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.ICTargetPlatformSetting;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
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.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.CFolderData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
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.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.extension.impl.CDefaultConfigurationData;
|
||||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
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.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.KindBasedStore;
|
||||||
import org.eclipse.cdt.core.settings.model.util.ListComparator;
|
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.CConfigBasedDescriptorManager;
|
||||||
import org.eclipse.cdt.internal.core.envvar.ContributedEnvironment;
|
import org.eclipse.cdt.internal.core.envvar.ContributedEnvironment;
|
||||||
import org.eclipse.cdt.internal.core.model.CElementDelta;
|
import org.eclipse.cdt.internal.core.model.CElementDelta;
|
||||||
|
@ -1488,7 +1492,19 @@ public class CProjectDescriptionManager {
|
||||||
CConfigurationDataProvider provider = getProvider(des);
|
CConfigurationDataProvider provider = getProvider(des);
|
||||||
return provider.applyConfiguration(des, baseDescription, base, monitor);
|
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{
|
void removeData(ICConfigurationDescription des, CConfigurationData data, IProgressMonitor monitor) throws CoreException{
|
||||||
if(monitor == null)
|
if(monitor == null)
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
|
@ -3134,4 +3150,141 @@ public class CProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
return ((ICFileDescription)rcDes).getLanguageSetting();
|
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 {
|
public IPathEntry[] getRawPathEntries() throws CoreException {
|
||||||
PathEntryCollector cr = getCollector(fProject);
|
ICConfigurationDescription cfg = getIndexCfg(fProject);
|
||||||
|
PathEntryCollector cr = getCollector(fProject, cfg);
|
||||||
if(cr != null){
|
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));
|
list.add(CoreModel.newContainerEntry(ConfigBasedPathEntryContainer.CONTAINER_PATH));
|
||||||
return (IPathEntry[])list.toArray(new IPathEntry[list.size()]);
|
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 {
|
public void setRawPathEntries(IPathEntry[] entries) throws CoreException {
|
||||||
PathEntryCollector cr = getCollector(fProject);
|
ICConfigurationDescription cfg = getIndexCfg(fProject);
|
||||||
|
PathEntryCollector cr = getCollector(fProject, cfg);
|
||||||
if(cr != null){
|
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);
|
List usrList = new ArrayList(entries.length);
|
||||||
for(int i = 0; i < entries.length; i++){
|
for(int i = 0; i < entries.length; i++){
|
||||||
if(entries[i].getEntryKind() != IPathEntry.CDT_CONTAINER)
|
if(entries[i].getEntryKind() != IPathEntry.CDT_CONTAINER)
|
||||||
|
@ -155,7 +157,7 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
||||||
ICConfigurationDescription oldIndexCfg = oldDes.getIndexConfiguration();
|
ICConfigurationDescription oldIndexCfg = oldDes.getIndexConfiguration();
|
||||||
PathEntryCollector oldCr = getCachedCollector(oldIndexCfg);
|
PathEntryCollector oldCr = getCachedCollector(oldIndexCfg);
|
||||||
if(oldCr != null)
|
if(oldCr != null)
|
||||||
oldCrEntries = oldCr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS);
|
oldCrEntries = oldCr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS, oldIndexCfg);
|
||||||
}
|
}
|
||||||
if(des != null){
|
if(des != null){
|
||||||
//TODO: smart delta handling
|
//TODO: smart delta handling
|
||||||
|
@ -165,8 +167,9 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oldCrEntries != null){
|
if(oldCrEntries != null){
|
||||||
PathEntryCollector newCr = getCollector(des);
|
ICConfigurationDescription newIndexCfg = des.getIndexConfiguration();
|
||||||
IPathEntry[] newCrEntries = newCr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS);
|
PathEntryCollector newCr = getCollector(fProject, newIndexCfg);
|
||||||
|
IPathEntry[] newCrEntries = newCr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS, newIndexCfg);
|
||||||
if(!Arrays.equals(oldCrEntries, newCrEntries)){
|
if(!Arrays.equals(oldCrEntries, newCrEntries)){
|
||||||
CModelManager manager = CModelManager.getDefault();
|
CModelManager manager = CModelManager.getDefault();
|
||||||
ICProject cproject = manager.create(project);
|
ICProject cproject = manager.create(project);
|
||||||
|
@ -187,19 +190,31 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PathEntryCollector getCollector(ICProjectDescription des){
|
// private static PathEntryCollector getCollector(ICProjectDescription des){
|
||||||
ICConfigurationDescription cfgDes = ((CProjectDescription)des).getIndexConfiguration();
|
// 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){
|
if(cfgDes != null){
|
||||||
PathEntryCollector cr = getCachedCollector(cfgDes);
|
PathEntryCollector cr = getCachedCollector(cfgDes);
|
||||||
if(cr == null){
|
if(cr == null){
|
||||||
cr = PathEntryTranslator.collectEntries(des.getProject(), cfgDes);
|
cr = PathEntryTranslator.collectEntries(project, cfgDes);
|
||||||
setCachedCollector(cfgDes, cr);
|
setCachedCollector(cfgDes, cr);
|
||||||
}
|
}
|
||||||
return cr;
|
return cr;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PathEntryCollector getCachedCollector(ICConfigurationDescription cfgDes){
|
private static PathEntryCollector getCachedCollector(ICConfigurationDescription cfgDes){
|
||||||
return (PathEntryCollector)cfgDes.getSessionProperty(PATH_ENTRY_COLLECTOR_PROPERTY_NAME);
|
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);
|
cfgDes.setSessionProperty(PATH_ENTRY_COLLECTOR_PROPERTY_NAME, cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PathEntryCollector getCollector(IProject project){
|
// public static PathEntryCollector getCollector(IProject project){
|
||||||
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project, false);
|
// ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project, false);
|
||||||
if(des != null)
|
// if(des != null)
|
||||||
return getCollector(des);
|
// return getCollector(des);
|
||||||
return null;
|
// 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){
|
public static IPathEntry[] getContainerEntries(IProject project){
|
||||||
|
@ -223,9 +243,10 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IPathEntry[] getContainerEntries(ICProjectDescription des){
|
public static IPathEntry[] getContainerEntries(ICProjectDescription des){
|
||||||
PathEntryCollector cr = getCollector(des);
|
ICConfigurationDescription cfg = ((CProjectDescription)des).getIndexConfiguration();
|
||||||
|
PathEntryCollector cr = getCollector(des.getProject(), cfg);
|
||||||
if(cr != null)
|
if(cr != null)
|
||||||
return cr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS);
|
return cr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS, cfg);
|
||||||
return new IPathEntry[0];
|
return new IPathEntry[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue