mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Fix for [Bug 181021] [Project Model]Source location and "exlude from build" settings are inconsistent
This commit is contained in:
parent
7f5644f01c
commit
ead2da2599
45 changed files with 1401 additions and 670 deletions
|
@ -18,7 +18,7 @@ import org.eclipse.cdt.core.settings.model.util.CDataSerializer;
|
|||
import org.eclipse.cdt.core.settings.model.util.UserAndDiscoveredEntryDataSerializer;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.CDataDiscoveredInfoCalculator;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.CDataDiscoveredInfoProcessor;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.CDataDiscoveredInfoCalculator.IRcSettingInfo;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.CDataDiscoveredInfoCalculator.DiscoveredSettingInfo;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -65,9 +65,9 @@ public class MakeConfigurationDataProvider extends CDefaultConfigurationDataProv
|
|||
CDataDiscoveredInfoCalculator calculator,
|
||||
CDataDiscoveredInfoProcessor processor){
|
||||
|
||||
IRcSettingInfo rcInfos[] = calculator.getSettingInfos(project, cfgData);
|
||||
DiscoveredSettingInfo dsInfo = calculator.getSettingInfos(project, cfgData);
|
||||
|
||||
processor.applyDiscoveredInfo(cfgData, rcInfos);
|
||||
processor.applyDiscoveredInfo(cfgData, dsInfo);
|
||||
}
|
||||
|
||||
protected CDataDiscoveredInfoProcessor getInfoProcessor(){
|
||||
|
|
|
@ -44,6 +44,24 @@ public class CDataDiscoveredInfoCalculator {
|
|||
|
||||
private static CDataDiscoveredInfoCalculator fInstance;
|
||||
|
||||
public static class DiscoveredSettingInfo{
|
||||
private boolean fIsPerFileDiscovery;
|
||||
private IRcSettingInfo[] fInfos;
|
||||
|
||||
public DiscoveredSettingInfo(boolean isPerFileDiscovery, IRcSettingInfo[] infos){
|
||||
fIsPerFileDiscovery = isPerFileDiscovery;
|
||||
fInfos = infos;
|
||||
}
|
||||
|
||||
public boolean isPerFileDiscovery(){
|
||||
return fIsPerFileDiscovery;
|
||||
}
|
||||
|
||||
public IRcSettingInfo[] getRcSettingInfos(){
|
||||
return fInfos;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IRcSettingInfo {
|
||||
CResourceData getResourceData();
|
||||
|
||||
|
@ -1099,14 +1117,15 @@ public class CDataDiscoveredInfoCalculator {
|
|||
return fInstance;
|
||||
}
|
||||
|
||||
public IRcSettingInfo[] getSettingInfos(IProject project,
|
||||
public DiscoveredSettingInfo getSettingInfos(IProject project,
|
||||
CConfigurationData cfgData){
|
||||
InfoContext context = createContext(project, cfgData);
|
||||
try {
|
||||
IDiscoveredPathManager.IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project, context);
|
||||
if(info instanceof IDiscoveredPathManager.IPerFileDiscoveredPathInfo2){
|
||||
IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 perFileInfo = (IDiscoveredPathManager.IPerFileDiscoveredPathInfo2)info;
|
||||
return getSettingInfos(project, cfgData, perFileInfo, true);
|
||||
DiscoveredSettingInfo dsInfo = new DiscoveredSettingInfo(true, getSettingInfos(project, cfgData, perFileInfo, true));
|
||||
return dsInfo;
|
||||
}
|
||||
IPath[] includes = info.getIncludePaths();
|
||||
Map symbols = info.getSymbols();
|
||||
|
@ -1114,11 +1133,11 @@ public class CDataDiscoveredInfoCalculator {
|
|||
PathInfo pathInfo = new PathInfo(includes, null, symbols, null, null);
|
||||
CFolderData rootData = cfgData.getRootFolderData();
|
||||
IRcSettingInfo rcInfo = createRcSettingInfo(rootData, pathInfo);
|
||||
return new IRcSettingInfo[]{rcInfo};
|
||||
return new DiscoveredSettingInfo(false, new IRcSettingInfo[]{rcInfo});
|
||||
} catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
}
|
||||
return new IRcSettingInfo[0];
|
||||
return new DiscoveredSettingInfo(false, new IRcSettingInfo[0]);
|
||||
}
|
||||
|
||||
protected InfoContext createContext(IProject project, CConfigurationData data){
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.core.settings.model.extension.CResourceData;
|
|||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.PathInfo;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.CDataDiscoveredInfoCalculator.DiscoveredSettingInfo;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.CDataDiscoveredInfoCalculator.ILangSettingInfo;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.CDataDiscoveredInfoCalculator.IRcSettingInfo;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
@ -30,12 +31,14 @@ import org.eclipse.core.runtime.Path;
|
|||
|
||||
public abstract class CDataDiscoveredInfoProcessor {
|
||||
|
||||
public void applyDiscoveredInfo(CConfigurationData cfgData, IRcSettingInfo[] infos){
|
||||
public void applyDiscoveredInfo(CConfigurationData cfgData, DiscoveredSettingInfo dsIinfo){
|
||||
Map map = CDataUtil.createPathRcDataMap(cfgData);
|
||||
IRcSettingInfo info;
|
||||
|
||||
PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
|
||||
|
||||
IRcSettingInfo[] infos = dsIinfo.getRcSettingInfos();
|
||||
|
||||
for(int i = 0; i < infos.length; i++){
|
||||
info = infos[i];
|
||||
applyInfo(cfgData, info, cr);
|
||||
|
|
|
@ -189,7 +189,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
return getCachedPathInfo(cInfo);
|
||||
}
|
||||
|
||||
cInfo.fLoadContext.getConfiguration().getRootFolderInfo().setExclude(false);
|
||||
((FolderInfo)cInfo.fLoadContext.getConfiguration().getRootFolderInfo()).setContainsDiscoveredScannerInfo(true);
|
||||
Map map = baseInfo.getSymbols();
|
||||
IPath paths[] = baseInfo.getIncludePaths();
|
||||
|
||||
|
@ -232,7 +232,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
}
|
||||
|
||||
if(rootSettingFound && fileSettingFound)
|
||||
data.getRootFolderData().setExcluded(true);
|
||||
((BuildFolderData)data.getRootFolderData()).setContainsDiscoveredScannerInfo(false);
|
||||
|
||||
if(!rcDataMap.isEmpty()){
|
||||
CResourceData tmpRcData;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.core;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CBuildData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
|
||||
|
@ -50,7 +51,7 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont
|
|||
public static final String BUILD_ARTEFACT_TYPE = "buildArtefactType"; //$NON-NLS-1$
|
||||
public static final String IS_SYSTEM = "isSystem"; //$NON-NLS-1$
|
||||
|
||||
|
||||
public static final String SOURCE_ENTRIES = "sourceEntries"; //$NON-NLS-1$
|
||||
|
||||
|
||||
|
||||
|
@ -586,9 +587,9 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont
|
|||
|
||||
CConfigurationData getConfigurationData();
|
||||
|
||||
IPath[] getSourcePaths();
|
||||
ICSourceEntry[] getSourceEntries();
|
||||
|
||||
void setSourcePaths(IPath[] paths);
|
||||
void setSourceEntries(ICSourceEntry[] entries);
|
||||
|
||||
CBuildData getBuildData();
|
||||
|
||||
|
|
|
@ -22,6 +22,10 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.CSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
||||
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
|
||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
|
||||
|
@ -59,7 +63,6 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
|
|||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
|
||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType;
|
||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
|
||||
import org.eclipse.cdt.managedbuilder.makegen.gnu.ManagedBuildGnuToolInfo;
|
||||
import org.eclipse.cdt.managedbuilder.pdomdepgen.PDOMDependencyGenerator;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -109,7 +112,7 @@ public class BuildDescription implements IBuildDescription {
|
|||
private Set fToolInProcesSet = new HashSet();
|
||||
private ITool fOrderedTools[];
|
||||
|
||||
private IPath[] fSourcePaths;
|
||||
private ICSourceEntry[] fSourceEntries;
|
||||
|
||||
// private Map fExtToToolAndTypeListMap = new HashMap();
|
||||
|
||||
|
@ -519,12 +522,14 @@ public class BuildDescription implements IBuildDescription {
|
|||
}
|
||||
|
||||
protected boolean isSource(IPath path){
|
||||
path = path.makeRelative();
|
||||
for(int i = 0; i < fSourcePaths.length; i++){
|
||||
if(fSourcePaths[i].isPrefixOf(path))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !CDataUtil.isExcluded(path, fSourceEntries);
|
||||
//
|
||||
// path = path.makeRelative();
|
||||
// for(int i = 0; i < fSourcePaths.length; i++){
|
||||
// if(fSourcePaths[i].isPrefixOf(path))
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -705,10 +710,10 @@ public class BuildDescription implements IBuildDescription {
|
|||
fInfo = ManagedBuildManager.getBuildInfo(fProject);
|
||||
fFlags = flags;
|
||||
|
||||
fSourcePaths = fCfg.getSourcePaths();
|
||||
if(fSourcePaths.length == 0){
|
||||
fSourcePaths = new IPath[]{Path.EMPTY};
|
||||
}
|
||||
fSourceEntries = fCfg.getSourceEntries();
|
||||
if(fSourceEntries.length == 0){
|
||||
fSourceEntries = new ICSourceEntry[]{new CSourceEntry(Path.EMPTY, null, ICSettingEntry.RESOLVED | ICSettingEntry.VALUE_WORKSPACE_PATH)};
|
||||
}
|
||||
fInputStep = createStep(null,null);
|
||||
fOutputStep = createStep(null,null);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.eclipse.cdt.core.settings.model.COutputEntry;
|
|||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICOutputEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CBuildData;
|
||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||
|
@ -560,7 +561,7 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
|||
IManagedConfigElement child = children[i];
|
||||
String name = child.getName();
|
||||
if(OUTPUT_ENTRIES.equals(name)){
|
||||
ICLanguageSettingEntry entries[] = LanguageSettingEntriesSerializer.loadEntries(new ManagedConfigStorageElement(child));
|
||||
ICSettingEntry entries[] = LanguageSettingEntriesSerializer.loadEntries(new ManagedConfigStorageElement(child));
|
||||
if(entries.length == 0){
|
||||
outputEntries = new ICOutputEntry[0];
|
||||
} else {
|
||||
|
@ -702,7 +703,7 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
|
|||
ICStorageElement child = children[i];
|
||||
String name = child.getName();
|
||||
if(OUTPUT_ENTRIES.equals(name)){
|
||||
ICLanguageSettingEntry entries[] = LanguageSettingEntriesSerializer.loadEntries(child);
|
||||
ICSettingEntry entries[] = LanguageSettingEntriesSerializer.loadEntries(child);
|
||||
if(entries.length == 0){
|
||||
outputEntries = new ICOutputEntry[0];
|
||||
} else {
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -24,14 +25,19 @@ import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set
|
|||
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache;
|
||||
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
||||
import org.eclipse.cdt.core.settings.model.CLibraryPathEntry;
|
||||
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.ICLibraryPathEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICOutputEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||
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.util.CDataUtil;
|
||||
import org.eclipse.cdt.core.settings.model.util.LanguageSettingEntriesSerializer;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
|
||||
|
@ -104,7 +110,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
private String preannouncebuildStep;
|
||||
private String postannouncebuildStep;
|
||||
private String description;
|
||||
private IPath[] sourcePaths;
|
||||
private ICSourceEntry[] sourceEntries;
|
||||
private BuildObjectProperties buildProperties;
|
||||
private boolean isTest;
|
||||
private SupportedProperties supportedProperties;
|
||||
|
@ -128,6 +134,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
// private Boolean isPerResourceDiscovery;
|
||||
private ICfgScannerConfigBuilderInfo2Set cfgScannerInfo;
|
||||
private boolean isPreferenceConfig;
|
||||
private List excludeList;
|
||||
|
||||
//property name for holding the rebuild state
|
||||
private static final String REBUILD_STATE = "rebuildState"; //$NON-NLS-1$
|
||||
|
@ -217,6 +224,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
// Load the children
|
||||
IManagedConfigElement[] configElements = element.getChildren();
|
||||
List srcPathList = new ArrayList();
|
||||
excludeList = new ArrayList();
|
||||
for (int l = 0; l < configElements.length; ++l) {
|
||||
IManagedConfigElement configElement = configElements[l];
|
||||
if (configElement.getName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) {
|
||||
|
@ -235,11 +243,15 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
srcPathList.add(p.getPath());
|
||||
} else if (configElement.getName().equals(SupportedProperties.SUPPORTED_PROPERTIES)){
|
||||
loadProperties(configElement);
|
||||
} else if (SOURCE_ENTRIES.equals(configElement.getName())){
|
||||
List seList = LanguageSettingEntriesSerializer.loadEntriesList(new ManagedConfigStorageElement(configElement), ICSettingEntry.SOURCE_PATH);
|
||||
sourceEntries = (ICSourceEntry[])seList.toArray(new ICSourceEntry[seList.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
if(srcPathList.size() > 0)
|
||||
sourcePaths = (IPath[])srcPathList.toArray(new IPath[srcPathList.size()]);
|
||||
sourceEntries = createSourceEntries(sourceEntries, srcPathList, excludeList);
|
||||
|
||||
excludeList = null;
|
||||
|
||||
if(rootFolderInfo == null)
|
||||
createRootFolderInfo();
|
||||
|
@ -277,6 +289,37 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
|
||||
setDirty(false);
|
||||
}
|
||||
|
||||
private static ICSourceEntry[] createSourceEntries(ICSourceEntry[] curEntries, List pathList, List excludeList){
|
||||
for(int i = 0; i < excludeList.size(); i++){
|
||||
IPath path = (IPath)excludeList.get(i);
|
||||
if(path.segmentCount() == 0)
|
||||
excludeList.remove(i);
|
||||
}
|
||||
if(pathList.size() == 0)
|
||||
pathList.add(Path.EMPTY);
|
||||
|
||||
if(pathList.size() == 1
|
||||
&& pathList.get(0).equals(Path.EMPTY)
|
||||
&& excludeList.size() == 0)
|
||||
return curEntries;
|
||||
|
||||
int pathSize = pathList.size();
|
||||
Map map = new LinkedHashMap();
|
||||
|
||||
for(int i = 0; i < pathSize; i++){
|
||||
IPath path = (IPath)pathList.get(i);
|
||||
ICSourceEntry entry = (ICSourceEntry)map.get(path);
|
||||
if(entry == null)
|
||||
entry = new CSourceEntry(path, null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
||||
|
||||
entry = CDataUtil.addExcludePaths(entry, excludeList, true);
|
||||
if(entry != null)
|
||||
map.put(path, entry);
|
||||
}
|
||||
|
||||
return (ICSourceEntry[])map.values().toArray(new ICSourceEntry[map.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new extension configuration based on one already defined.
|
||||
|
@ -363,6 +406,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
|
||||
ICStorageElement configElements[] = element.getChildren();
|
||||
List srcPathList = new ArrayList();
|
||||
excludeList = new ArrayList();
|
||||
for (int i = 0; i < configElements.length; ++i) {
|
||||
ICStorageElement configElement = configElements[i];
|
||||
if (configElement.getName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) {
|
||||
|
@ -379,14 +423,17 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
SourcePath p = new SourcePath(configElement);
|
||||
if(p.getPath() != null)
|
||||
srcPathList.add(p.getPath());
|
||||
} else if (SOURCE_ENTRIES.equals(configElement.getName())){
|
||||
List seList = LanguageSettingEntriesSerializer.loadEntriesList(configElement, ICSettingEntry.SOURCE_PATH);
|
||||
sourceEntries = (ICSourceEntry[])seList.toArray(new ICSourceEntry[seList.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
resolveProjectReferences(true);
|
||||
|
||||
if(srcPathList.size() > 0)
|
||||
sourcePaths = (IPath[])srcPathList.toArray(new IPath[srcPathList.size()]);
|
||||
sourceEntries = createSourceEntries(sourceEntries, srcPathList, excludeList);
|
||||
|
||||
excludeList = null;
|
||||
|
||||
PropertyManager mngr = PropertyManager.getInstance();
|
||||
String rebuild = mngr.getProperty(this, REBUILD_STATE);
|
||||
|
@ -462,8 +509,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
|
||||
postannouncebuildStep = baseCfg.postannouncebuildStep;
|
||||
|
||||
if(baseCfg.sourcePaths != null)
|
||||
sourcePaths = (IPath[])baseCfg.sourcePaths.clone();
|
||||
if(baseCfg.sourceEntries != null)
|
||||
sourceEntries = (ICSourceEntry[])baseCfg.sourceEntries.clone();
|
||||
|
||||
// enableInternalBuilder(baseCfg.isInternalBuilderEnabled());
|
||||
// setInternalBuilderIgnoreErr(baseCfg.getInternalBuilderIgnoreErr());
|
||||
|
@ -618,8 +665,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
if (cloneConfig.postannouncebuildStep != null) {
|
||||
postannouncebuildStep = new String(cloneConfig.postannouncebuildStep);
|
||||
}
|
||||
if(cloneConfig.sourcePaths != null)
|
||||
sourcePaths = (IPath[])cloneConfig.sourcePaths.clone();
|
||||
if(cloneConfig.sourceEntries != null)
|
||||
sourceEntries = (ICSourceEntry[])cloneConfig.sourceEntries.clone();
|
||||
|
||||
// enableInternalBuilder(cloneConfig.isInternalBuilderEnabled());
|
||||
// setInternalBuilderIgnoreErr(cloneConfig.getInternalBuilderIgnoreErr());
|
||||
|
@ -906,12 +953,9 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
|
||||
PropertyManager.getInstance().serialize(this);
|
||||
|
||||
if(sourcePaths != null && sourcePaths.length > 0){
|
||||
for(int i = 0; i < sourcePaths.length; i++){
|
||||
SourcePath p = new SourcePath(sourcePaths[i]);
|
||||
ICStorageElement el = element.createChild(SourcePath.ELEMENT_NAME);
|
||||
p.serialize(el);
|
||||
}
|
||||
if(sourceEntries != null && sourceEntries.length > 0){
|
||||
ICStorageElement el = element.createChild(SOURCE_ENTRIES);
|
||||
LanguageSettingEntriesSerializer.serializeEntries(sourceEntries, el);
|
||||
}
|
||||
// I am clean now
|
||||
isDirty = false;
|
||||
|
@ -2259,26 +2303,32 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
return folderInfo;
|
||||
}
|
||||
|
||||
public IPath[] getSourcePaths() {
|
||||
if(sourcePaths == null){
|
||||
public ICSourceEntry[] getSourceEntries() {
|
||||
if(sourceEntries == null){
|
||||
if(parent != null)
|
||||
return parent.getSourcePaths();
|
||||
return new IPath[]{new Path("")}; //$NON-NLS-1$
|
||||
return parent.getSourceEntries();
|
||||
return new ICSourceEntry[]{new CSourceEntry(Path.EMPTY, null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED)}; //$NON-NLS-1$
|
||||
|
||||
}
|
||||
return (IPath[])sourcePaths.clone();
|
||||
return (ICSourceEntry[])sourceEntries.clone();
|
||||
}
|
||||
|
||||
public void setSourcePaths(IPath[] paths) {
|
||||
if(Arrays.equals(sourcePaths, paths))
|
||||
public void setSourceEntries(ICSourceEntry[] entries) {
|
||||
setSourceEntries(entries, true);
|
||||
}
|
||||
|
||||
public void setSourceEntries(ICSourceEntry[] entries, boolean setRebuildState) {
|
||||
if(Arrays.equals(getSourceEntries(), entries))
|
||||
return;
|
||||
sourcePaths = (IPath[])paths.clone();
|
||||
sourceEntries = entries != null ? (ICSourceEntry[])entries.clone() : null;
|
||||
// for(int i = 0; i < sourcePaths.length; i++){
|
||||
// sourcePaths[i] = sourcePaths[i].makeRelative();
|
||||
// }
|
||||
exportArtifactInfo();
|
||||
setDirty(true);
|
||||
setRebuildState(true);
|
||||
if(setRebuildState){
|
||||
setDirty(true);
|
||||
setRebuildState(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setErrorParserAttribute(String[] ids) {
|
||||
|
@ -2893,4 +2943,26 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
throw new BuildException(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
boolean isExcluded(IPath path){
|
||||
// if(path.segmentCount() == 0)
|
||||
// return false;
|
||||
ICSourceEntry[] entries = getSourceEntries();
|
||||
return CDataUtil.isExcluded(path, entries);
|
||||
}
|
||||
|
||||
void setExcluded(IPath path, boolean excluded){
|
||||
// if(path.segmentCount() == 0)
|
||||
// return;
|
||||
if(excludeList == null) {
|
||||
ICSourceEntry[] entries = getSourceEntries();
|
||||
ICSourceEntry[] newEntries = CDataUtil.setExcluded(path, excluded, entries);
|
||||
setSourceEntries(newEntries, false);
|
||||
} else{
|
||||
if(excluded)
|
||||
excludeList.add(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ import org.eclipse.core.runtime.Path;
|
|||
public class FolderInfo extends ResourceInfo implements IFolderInfo {
|
||||
private ToolChain toolChain;
|
||||
private boolean isExtensionElement;
|
||||
private boolean containsDiscoveredScannerInfo = true;
|
||||
|
||||
public FolderInfo(FolderInfo folderInfo, String id, String resourceName, IPath path){
|
||||
super(folderInfo, path, id, resourceName);
|
||||
|
@ -245,6 +246,9 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
|
|||
((ToolChain)newChain).setTargetPlatform(tp);
|
||||
}
|
||||
|
||||
if(isRoot())
|
||||
containsDiscoveredScannerInfo = cloneInfo.containsDiscoveredScannerInfo;
|
||||
|
||||
if(copyIds){
|
||||
isDirty = cloneInfo.isDirty;
|
||||
needsRebuild = cloneInfo.needsRebuild;
|
||||
|
@ -1354,4 +1358,15 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
|
|||
public boolean hasCustomSettings(){
|
||||
return toolChain.hasCustomSettings();
|
||||
}
|
||||
|
||||
public boolean containsDiscoveredScannerInfo(){
|
||||
if(!isRoot())
|
||||
return true;
|
||||
|
||||
return containsDiscoveredScannerInfo;
|
||||
}
|
||||
|
||||
public void setContainsDiscoveredScannerInfo(boolean contains){
|
||||
containsDiscoveredScannerInfo = contains;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -798,8 +798,7 @@ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
|
|||
tool.removeOption(opts[j]);
|
||||
}
|
||||
}
|
||||
|
||||
setExclude(false);
|
||||
// setExclude(false);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -32,10 +32,10 @@ import org.eclipse.core.runtime.Path;
|
|||
public abstract class ResourceInfo extends BuildObject implements IResourceInfo {
|
||||
// private IFolderInfo parentFolderInfo;
|
||||
// private String parentFolderInfoId;
|
||||
private IConfiguration config;
|
||||
private Configuration config;
|
||||
private IPath path;
|
||||
boolean isDirty;
|
||||
private boolean isExcluded;
|
||||
// private boolean isExcluded;
|
||||
boolean needsRebuild;
|
||||
private ResourceInfoContainer rcInfo;
|
||||
private CResourceData resourceData;
|
||||
|
@ -44,15 +44,15 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
// private String baseToolChainId;
|
||||
|
||||
ResourceInfo(IConfiguration cfg, IManagedConfigElement element, boolean hasBody){
|
||||
config = cfg;
|
||||
config = (Configuration)cfg;
|
||||
if(hasBody)
|
||||
loadFromManifest(element);
|
||||
}
|
||||
|
||||
ResourceInfo(IConfiguration cfg, ResourceInfo base, String id) {
|
||||
config = cfg;
|
||||
config = (Configuration)cfg;
|
||||
path = normalizePath(base.path);
|
||||
internalSetExclude(base.isExcluded);
|
||||
// internalSetExclude(base.isExcluded);
|
||||
|
||||
setId(id);
|
||||
setName(base.getName());
|
||||
|
@ -88,7 +88,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
}
|
||||
|
||||
ResourceInfo(IConfiguration cfg, IPath path, String id, String name) {
|
||||
config = cfg;
|
||||
config = (Configuration)cfg;
|
||||
path = normalizePath(path);
|
||||
this.path = path;
|
||||
|
||||
|
@ -98,7 +98,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
}
|
||||
|
||||
ResourceInfo(IFileInfo base, IPath path, String id, String name) {
|
||||
config = base.getParent();
|
||||
config = (Configuration)base.getParent();
|
||||
|
||||
setId(id);
|
||||
setName(name);
|
||||
|
@ -106,7 +106,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
path = normalizePath(path);
|
||||
|
||||
this.path = path;
|
||||
internalSetExclude(base.isExcluded());
|
||||
// internalSetExclude(base.isExcluded());
|
||||
// parentFolderInfoId = base.getId();
|
||||
// parentFolderInfo = base;
|
||||
// inheritParentInfo = false;
|
||||
|
@ -115,7 +115,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
}
|
||||
|
||||
ResourceInfo(FolderInfo base, IPath path, String id, String name) {
|
||||
config = base.getParent();
|
||||
config = (Configuration)base.getParent();
|
||||
|
||||
setId(id);
|
||||
setName(name);
|
||||
|
@ -123,7 +123,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
path = normalizePath(path);
|
||||
|
||||
this.path = path;
|
||||
internalSetExclude(base.isExcluded());
|
||||
// internalSetExclude(base.isExcluded());
|
||||
// parentFolderInfoId = base.getId();
|
||||
// parentFolderInfo = base;
|
||||
// inheritParentInfo = base.getPath().isPrefixOf(path);
|
||||
|
@ -132,7 +132,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
}
|
||||
|
||||
ResourceInfo(IConfiguration cfg, ICStorageElement element, boolean hasBody){
|
||||
config = cfg;
|
||||
config = (Configuration)cfg;
|
||||
if(hasBody)
|
||||
loadFromProject(element);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
// exclude
|
||||
String excludeStr = element.getAttribute(EXCLUDE);
|
||||
if (excludeStr != null){
|
||||
internalSetExclude("true".equals(excludeStr)); //$NON-NLS-1$
|
||||
config.setExcluded(getPath(), ("true".equals(excludeStr))); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
if (element.getAttribute(EXCLUDE) != null) {
|
||||
String excludeStr = element.getAttribute(EXCLUDE);
|
||||
if (excludeStr != null){
|
||||
internalSetExclude("true".equals(excludeStr)); //$NON-NLS-1$
|
||||
config.setExcluded(getPath(), ("true".equals(excludeStr))); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
}
|
||||
|
||||
public boolean isExcluded() {
|
||||
return isExcluded;
|
||||
return config.isExcluded(getPath());
|
||||
}
|
||||
|
||||
public boolean needsRebuild() {
|
||||
|
@ -244,17 +244,20 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
}
|
||||
|
||||
public void setExclude(boolean excluded) {
|
||||
if (isExcluded != internalSetExclude(excluded)) {
|
||||
setDirty(true);
|
||||
setRebuildState(true);
|
||||
}
|
||||
if(isExcluded() == excluded)
|
||||
return;
|
||||
|
||||
config.setExcluded(getPath(), excluded);
|
||||
|
||||
setDirty(true);
|
||||
setRebuildState(true);
|
||||
}
|
||||
|
||||
private boolean internalSetExclude(boolean excluded){
|
||||
// if(excluded/* && isRoot()*/)
|
||||
// return isExcluded;
|
||||
return isExcluded = excluded;
|
||||
}
|
||||
// private boolean internalSetExclude(boolean excluded){
|
||||
//// if(excluded/* && isRoot()*/)
|
||||
//// return isExcluded;
|
||||
// return isExcluded = excluded;
|
||||
// }
|
||||
|
||||
public void setPath(IPath p) {
|
||||
p = normalizePath(p);
|
||||
|
@ -287,9 +290,9 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
element.setAttribute(IBuildObject.NAME, name);
|
||||
}
|
||||
|
||||
if (isExcluded) {
|
||||
element.setAttribute(IResourceInfo.EXCLUDE, "true"); //$NON-NLS-1$
|
||||
}
|
||||
// if (isExcluded) {
|
||||
// element.setAttribute(IResourceInfo.EXCLUDE, "true"); //$NON-NLS-1$
|
||||
// }
|
||||
|
||||
if (path != null) {
|
||||
element.setAttribute(IResourceInfo.RESOURCE_PATH, path.toString());
|
||||
|
|
|
@ -994,8 +994,9 @@ public class ToolChain extends HoldsOptions implements IToolChain, IBuildPropert
|
|||
for (j = 0; j < tools.length; j++) {
|
||||
ITool superTool = tool.getSuperClass();
|
||||
if(superTool != null){
|
||||
if(!superTool.isExtensionElement())
|
||||
superTool = superTool.getSuperClass();
|
||||
superTool = ManagedBuildManager.getExtensionTool(superTool);
|
||||
// if(!superTool.isExtensionElement())
|
||||
// superTool = superTool.getSuperClass();
|
||||
|
||||
if(superTool != null && superTool.getId().equals(tools[j].getId())){
|
||||
tools[j] = tool;
|
||||
|
|
|
@ -12,6 +12,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.ICSourceEntry;
|
||||
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;
|
||||
|
@ -114,12 +115,12 @@ public class BuildConfigurationData extends CConfigurationData {
|
|||
return fCfg.getToolChain().getTargetPlatformData();
|
||||
}
|
||||
|
||||
public IPath[] getSourcePaths() {
|
||||
return fCfg.getSourcePaths();
|
||||
public ICSourceEntry[] getSourceEntries() {
|
||||
return fCfg.getSourceEntries();
|
||||
}
|
||||
|
||||
public void setSourcePaths(IPath[] paths) {
|
||||
fCfg.setSourcePaths(paths);
|
||||
public void setSourceEntries(ICSourceEntry[] entries) {
|
||||
fCfg.setSourceEntries(entries);
|
||||
}
|
||||
|
||||
public CBuildData getBuildData() {
|
||||
|
|
|
@ -30,13 +30,13 @@ public class BuildFileData extends CFileData {
|
|||
return fFileInfo.getPath();
|
||||
}
|
||||
|
||||
public boolean isExcluded() {
|
||||
return fFileInfo.isExcluded();
|
||||
}
|
||||
|
||||
public void setExcluded(boolean excluded) {
|
||||
fFileInfo.setExclude(excluded);
|
||||
}
|
||||
// public boolean isExcluded() {
|
||||
// return fFileInfo.isExcluded();
|
||||
// }
|
||||
//
|
||||
// public void setExcluded(boolean excluded) {
|
||||
// fFileInfo.setExclude(excluded);
|
||||
// }
|
||||
|
||||
public void setPath(IPath path) {
|
||||
fFileInfo.setPath(path);
|
||||
|
|
|
@ -34,13 +34,13 @@ public class BuildFolderData extends CFolderData {
|
|||
return fFolderInfo.getPath();
|
||||
}
|
||||
|
||||
public boolean isExcluded() {
|
||||
return fFolderInfo.isExcluded();
|
||||
}
|
||||
|
||||
public void setExcluded(boolean excluded) {
|
||||
fFolderInfo.setExclude(excluded);
|
||||
}
|
||||
// public boolean isExcluded() {
|
||||
// return fFolderInfo.isExcluded();
|
||||
// }
|
||||
//
|
||||
// public void setExcluded(boolean excluded) {
|
||||
// fFolderInfo.setExclude(excluded);
|
||||
// }
|
||||
|
||||
public void setPath(IPath path) {
|
||||
fFolderInfo.setPath(path);
|
||||
|
@ -84,4 +84,13 @@ public class BuildFolderData extends CFolderData {
|
|||
((BuildLanguageData)lDatas[i]).clearCachedData();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean containsScannerInfo() {
|
||||
return fFolderInfo.containsDiscoveredScannerInfo();
|
||||
}
|
||||
|
||||
public void setContainsDiscoveredScannerInfo(boolean contains) {
|
||||
fFolderInfo.setContainsDiscoveredScannerInfo(contains);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,9 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||
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.util.CDataUtil;
|
||||
import org.eclipse.cdt.core.settings.model.util.IKindBasedInfo;
|
||||
import org.eclipse.cdt.core.settings.model.util.KindBasedStore;
|
||||
|
@ -28,6 +30,7 @@ import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
|||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.InputType;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.ResourceConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ProfileInfoProvider.DiscoveredEntry;
|
||||
|
@ -523,4 +526,12 @@ public class BuildLanguageData extends CLanguageData {
|
|||
void clearCachedData(){
|
||||
fKindToEntryStore.clear();
|
||||
}
|
||||
|
||||
public boolean containsDiscoveredScannerInfo() {
|
||||
IResourceInfo rcInfo = fTool.getParentResourceInfo();
|
||||
if(rcInfo instanceof FolderInfo){
|
||||
return ((FolderInfo)rcInfo).containsDiscoveredScannerInfo();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@ import java.util.Set;
|
|||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.settings.model.CSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||
import org.eclipse.cdt.core.settings.model.util.IPathSettingsContainerVisitor;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
||||
import org.eclipse.cdt.internal.core.model.Util;
|
||||
|
@ -141,7 +145,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
|
|||
fo = (IFolderInfo)rcInfo;
|
||||
}
|
||||
// What kind of resource change has occurred
|
||||
if(!rcInfo.isExcluded() && isSource){
|
||||
if(/*!rcInfo.isExcluded() && */isSource){
|
||||
if (resource.getType() == IResource.FILE) {
|
||||
String ext = resource.getFileExtension();
|
||||
switch (delta.getKind()) {
|
||||
|
@ -242,7 +246,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
|
|||
// if it has a file extension that one of the tools builds, add the sudirectory to the list
|
||||
// boolean willBuild = false;
|
||||
IResourceInfo rcInfo = config.getResourceInfo(resource.getProjectRelativePath(), false);
|
||||
if (isSource && !rcInfo.isExcluded()) {
|
||||
if (isSource/* && !rcInfo.isExcluded()*/) {
|
||||
boolean willBuild = false;
|
||||
if(rcInfo instanceof IFolderInfo){
|
||||
String ext = resource.getFileExtension();
|
||||
|
@ -364,7 +368,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
|
|||
// Dependency file variables
|
||||
// private Vector dependencyMakefiles; // IPath's - relative to the top build directory or absolute
|
||||
|
||||
private IPath srcPaths[];
|
||||
private ICSourceEntry srcEntries[];
|
||||
|
||||
|
||||
public GnuMakefileGenerator() {
|
||||
|
@ -513,12 +517,13 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
|
|||
}
|
||||
|
||||
protected boolean isSource(IPath path){
|
||||
path = path.makeRelative();
|
||||
for(int i = 0; i < srcPaths.length; i++){
|
||||
if(srcPaths[i].isPrefixOf(path))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !CDataUtil.isExcluded(path, srcEntries);
|
||||
// path = path.makeRelative();
|
||||
// for(int i = 0; i < srcPaths.length; i++){
|
||||
// if(srcPaths[i].isPrefixOf(path))
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
}
|
||||
|
||||
private class DepInfo {
|
||||
|
@ -1982,9 +1987,12 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
|
|||
IResource resource = resources[i];
|
||||
if (resource.getType() == IResource.FILE) {
|
||||
// Check whether this resource is excluded from build
|
||||
rcInfo = config.getResourceInfo(resource.getProjectRelativePath(), false);
|
||||
if( (rcInfo.isExcluded()) )
|
||||
IPath rcProjRelPath = resource.getProjectRelativePath();
|
||||
if(!isSource(rcProjRelPath))
|
||||
continue;
|
||||
rcInfo = config.getResourceInfo(rcProjRelPath, false);
|
||||
// if( (rcInfo.isExcluded()) )
|
||||
// continue;
|
||||
addFragmentMakefileEntriesForSource(buildVarToRuleStringMap, ruleBuffer,
|
||||
folder, relativePath, resource, resource.getLocation(), rcInfo, null, false);
|
||||
}
|
||||
|
@ -4658,9 +4666,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
|
|||
//set the top build dir path
|
||||
topBuildDir = project.getFolder(cfg.getName()).getFullPath();
|
||||
|
||||
srcPaths = config.getSourcePaths();
|
||||
if(srcPaths.length == 0){
|
||||
srcPaths = new IPath[]{new Path("")}; //$NON-NLS-1$
|
||||
srcEntries = config.getSourceEntries();
|
||||
if(srcEntries.length == 0){
|
||||
srcEntries = new ICSourceEntry[]{new CSourceEntry(Path.EMPTY, null, ICSettingEntry.RESOLVED | ICSettingEntry.VALUE_WORKSPACE_PATH)};
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.eclipse.cdt.managedbuilder.ui.tests.util;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CBuildData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
|
||||
|
@ -538,5 +539,15 @@ public class TestConfiguration implements IConfiguration {
|
|||
|
||||
}
|
||||
|
||||
public ICSourceEntry[] getSourceEntries() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setSourceEntries(ICSourceEntry[] entries) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.eclipse.cdt.internal.core.model.OutputEntry;
|
|||
import org.eclipse.cdt.internal.core.model.PathEntryManager;
|
||||
import org.eclipse.cdt.internal.core.model.ProjectEntry;
|
||||
import org.eclipse.cdt.internal.core.model.SourceEntry;
|
||||
import org.eclipse.cdt.internal.core.settings.model.CLanguageSettingCache;
|
||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescription;
|
||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
@ -1238,6 +1239,10 @@ public class CoreModel {
|
|||
return oldIsScannerInformationEmpty(resource);
|
||||
}
|
||||
ICLanguageSetting lSetting = indexCfg.getLanguageSettingForFile(resource.getProjectRelativePath(), false);
|
||||
if(lSetting != null && lSetting instanceof CLanguageSettingCache){
|
||||
if(!((CLanguageSettingCache)lSetting).containsDiscoveredScannerInfo())
|
||||
lSetting = null;
|
||||
}
|
||||
if(lSetting != null){
|
||||
ICLanguageSettingEntry[] entries = lSetting.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH);
|
||||
if(entries.length != 0)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package org.eclipse.cdt.core.settings.model.extension;
|
||||
|
||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
|
||||
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
|
@ -48,9 +49,9 @@ public abstract class CConfigurationData extends CDataObject {
|
|||
|
||||
public abstract CTargetPlatformData getTargetPlatformData();
|
||||
|
||||
public abstract IPath[] getSourcePaths();
|
||||
public abstract ICSourceEntry[] getSourceEntries();
|
||||
|
||||
public abstract void setSourcePaths(IPath[] paths);
|
||||
public abstract void setSourceEntries(ICSourceEntry[] entries);
|
||||
|
||||
public abstract CBuildData getBuildData();
|
||||
|
||||
|
|
|
@ -22,14 +22,6 @@ public abstract class CFolderData extends CResourceData {
|
|||
return ICSettingBase.SETTING_FOLDER;
|
||||
}
|
||||
|
||||
// public abstract CResourceData[] getNestedResourceDatas(int kind);
|
||||
|
||||
// public abstract CResourceData getNestedResourceData(IPath path);
|
||||
|
||||
// public abstract CDataObject[] getChildrenOfKind(int kind);
|
||||
|
||||
// public abstract CDataObject getChildById(String id);
|
||||
|
||||
public abstract CLanguageData[] getLanguageDatas();
|
||||
|
||||
public abstract CLanguageData createLanguageDataForContentTypes(String languageId, String cTypesIds[]);
|
||||
|
|
|
@ -50,4 +50,8 @@ public abstract class CLanguageData extends CDataObject {
|
|||
public abstract void setSourceContentTypeIds(String ids[]);
|
||||
|
||||
public abstract void setSourceExtensions(String exts[]);
|
||||
|
||||
public boolean containsDiscoveredScannerInfo(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,11 +19,11 @@ public abstract class CResourceData extends CDataObject {
|
|||
|
||||
public abstract IPath getPath();
|
||||
|
||||
public abstract boolean isExcluded();
|
||||
// public abstract boolean isExcluded();
|
||||
|
||||
public abstract void setPath(IPath path) ;
|
||||
|
||||
public abstract void setExcluded(boolean excluded);
|
||||
// public abstract void setExcluded(boolean excluded);
|
||||
|
||||
public abstract boolean hasCustomSettings();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.HashMap;
|
|||
|
||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
||||
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;
|
||||
|
@ -35,7 +36,7 @@ public class CDefaultConfigurationData extends CConfigurationData {
|
|||
protected String fId;
|
||||
protected CTargetPlatformData fTargetPlatformData;
|
||||
protected CBuildData fBuildData;
|
||||
protected IPath[] fSourcePaths;
|
||||
protected ICSourceEntry[] fSourceEntries;
|
||||
private CDataFacroty fFactory;
|
||||
protected boolean fIsModified;
|
||||
|
||||
|
@ -99,7 +100,7 @@ public class CDefaultConfigurationData extends CConfigurationData {
|
|||
fDescription = base.getDescription();
|
||||
|
||||
fTargetPlatformData = copyTargetPlatformData(base.getTargetPlatformData(), clone);
|
||||
fSourcePaths = base.getSourcePaths();
|
||||
fSourceEntries = base.getSourceEntries();
|
||||
fBuildData = copyBuildData(base.getBuildData(), clone);
|
||||
|
||||
CFolderData baseRootFolderData = base.getRootFolderData();
|
||||
|
@ -237,15 +238,15 @@ public class CDefaultConfigurationData extends CConfigurationData {
|
|||
return fTargetPlatformData;
|
||||
}
|
||||
|
||||
public IPath[] getSourcePaths() {
|
||||
return fSourcePaths != null ? (IPath[])fSourcePaths.clone() : null;
|
||||
public ICSourceEntry[] getSourceEntries() {
|
||||
return fSourceEntries != null ? (ICSourceEntry[])fSourceEntries.clone() : null;
|
||||
}
|
||||
|
||||
public void setSourcePaths(IPath[] paths) {
|
||||
if(Arrays.equals(paths, fSourcePaths))
|
||||
public void setSourceEntries(ICSourceEntry[] entries) {
|
||||
if(Arrays.equals(entries, fSourceEntries))
|
||||
return;
|
||||
|
||||
fSourcePaths = paths != null ? (IPath[])paths.clone() : null;
|
||||
fSourceEntries = entries != null ? (ICSourceEntry[])entries.clone() : null;
|
||||
setModified(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.core.runtime.IPath;
|
|||
|
||||
public class CDefaultFileData extends CFileData {
|
||||
protected IPath fPath;
|
||||
protected boolean fIsExcluded;
|
||||
// protected boolean fIsExcluded;
|
||||
protected String fName;
|
||||
protected String fId;
|
||||
protected CLanguageData fLanguageData;
|
||||
|
@ -57,11 +57,11 @@ public class CDefaultFileData extends CFileData {
|
|||
if(baseLanguageData != null)
|
||||
fLanguageData = copyLanguageData(baseLanguageData, clone);
|
||||
|
||||
fIsExcluded = base.isExcluded();
|
||||
// fIsExcluded = base.isExcluded();
|
||||
}
|
||||
|
||||
protected void copyDataFrom(CFolderData base, CLanguageData baseLanguageData){
|
||||
fIsExcluded = base != null ? base.isExcluded() : false;
|
||||
// fIsExcluded = base != null ? base.isExcluded() : false;
|
||||
if(baseLanguageData != null)
|
||||
fLanguageData = copyLanguageData(baseLanguageData, false);
|
||||
}
|
||||
|
@ -75,16 +75,16 @@ public class CDefaultFileData extends CFileData {
|
|||
return fPath;
|
||||
}
|
||||
|
||||
public boolean isExcluded() {
|
||||
return fIsExcluded;
|
||||
}
|
||||
// public boolean isExcluded() {
|
||||
// return fIsExcluded;
|
||||
// }
|
||||
|
||||
public void setExcluded(boolean excluded) {
|
||||
if(excluded == fIsExcluded)
|
||||
return;
|
||||
|
||||
fIsExcluded = excluded;
|
||||
}
|
||||
// public void setExcluded(boolean excluded) {
|
||||
// if(excluded == fIsExcluded)
|
||||
// return;
|
||||
//
|
||||
// fIsExcluded = excluded;
|
||||
// }
|
||||
|
||||
public void setPath(IPath path) {
|
||||
fPath = path;
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.eclipse.core.runtime.IPath;
|
|||
|
||||
public class CDefaultFolderData extends CFolderData {
|
||||
protected IPath fPath;
|
||||
protected boolean fIsExcluded;
|
||||
// protected boolean fIsExcluded;
|
||||
protected List fLanguageDatas = new ArrayList();
|
||||
protected String fName;
|
||||
protected String fId;
|
||||
|
@ -56,7 +56,7 @@ public class CDefaultFolderData extends CFolderData {
|
|||
fLanguageDatas.add(copyLanguageData(lDatas[i], clone));
|
||||
}
|
||||
|
||||
fIsExcluded = base.isExcluded();
|
||||
// fIsExcluded = base.isExcluded();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,17 +72,17 @@ public class CDefaultFolderData extends CFolderData {
|
|||
return fPath;
|
||||
}
|
||||
|
||||
public boolean isExcluded() {
|
||||
return fIsExcluded;
|
||||
}
|
||||
|
||||
public void setExcluded(boolean excluded) {
|
||||
if(excluded == fIsExcluded)
|
||||
return;
|
||||
|
||||
fIsExcluded = excluded;
|
||||
setModified(true);
|
||||
}
|
||||
// public boolean isExcluded() {
|
||||
// return fIsExcluded;
|
||||
// }
|
||||
//
|
||||
// public void setExcluded(boolean excluded) {
|
||||
// if(excluded == fIsExcluded)
|
||||
// return;
|
||||
//
|
||||
// fIsExcluded = excluded;
|
||||
// setModified(true);
|
||||
// }
|
||||
|
||||
public void setPath(IPath path) {
|
||||
if(CDataUtil.objectsEqual(path, fPath))
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
|||
import org.eclipse.cdt.core.settings.model.ICOutputEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CBuildData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
|
@ -37,7 +38,7 @@ public class CDataSerializer {
|
|||
protected static final String NAME = "name";
|
||||
protected static final String ID = "id";
|
||||
protected static final String DESCRIPTION = "description";
|
||||
protected static final String SOURCE_PATHS = "sourcePaths";
|
||||
protected static final String SOURCE_ENTRIES = "sourceEntries";
|
||||
protected static final String PATH = "path";
|
||||
protected static final String LANGUAGE_ID = "languageId";
|
||||
protected static final String CONTENT_TYPE_IDS = "contentTypeIds";
|
||||
|
@ -48,7 +49,7 @@ public class CDataSerializer {
|
|||
protected static final String BUILD_DATA = "buildData";
|
||||
protected static final String TARGET_PLATFORM_DATA = "targetPlatformData";
|
||||
protected static final String LANGUAGE_DATA = "languageData";
|
||||
protected static final String EXCLUDED = "excluded";
|
||||
// protected static final String EXCLUDED = "excluded";
|
||||
protected static final String OUTPUT_ENTRIES = "outputEntries";
|
||||
protected static final String ERROR_PARSERS = "errorParsers";
|
||||
protected static final String BINARY_PARSERS = "binaryParsers";
|
||||
|
@ -78,15 +79,15 @@ public class CDataSerializer {
|
|||
if(tmp != null)
|
||||
data.setDescription(tmp);
|
||||
|
||||
tmp = el.getAttribute(SOURCE_PATHS);
|
||||
if(tmp != null){
|
||||
String[] strPaths = CDataUtil.stringToArray(tmp, DELIMITER);
|
||||
IPath[] paths = new IPath[strPaths.length];
|
||||
for(int i = 0; i < paths.length; i++){
|
||||
paths[i] = new Path(strPaths[i]);
|
||||
}
|
||||
data.setSourcePaths(paths);
|
||||
}
|
||||
// tmp = el.getAttribute(SOURCE_PATHS);
|
||||
// if(tmp != null){
|
||||
// String[] strPaths = CDataUtil.stringToArray(tmp, DELIMITER);
|
||||
// IPath[] paths = new IPath[strPaths.length];
|
||||
// for(int i = 0; i < paths.length; i++){
|
||||
// paths[i] = new Path(strPaths[i]);
|
||||
// }
|
||||
// data.setSourcePaths(paths);
|
||||
// }
|
||||
|
||||
ICStorageElement[] children = el.getChildren();
|
||||
ICStorageElement child;
|
||||
|
@ -110,6 +111,10 @@ public class CDataSerializer {
|
|||
CTargetPlatformData tpData = loadTargetPlatformData(data, factory, child);
|
||||
if(tpData != null)
|
||||
factory.link(data, tpData);
|
||||
} else if (SOURCE_ENTRIES.equals(childName)){
|
||||
List list = LanguageSettingEntriesSerializer.loadEntriesList(child, ICSettingEntry.SOURCE_PATH);
|
||||
ICSourceEntry[] entries = (ICSourceEntry[])list.toArray(new ICSourceEntry[list.size()]);
|
||||
data.setSourceEntries(entries);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
|
@ -133,11 +138,11 @@ public class CDataSerializer {
|
|||
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "failed to create folder data"));
|
||||
}
|
||||
|
||||
tmp = el.getAttribute(EXCLUDED);
|
||||
if(tmp != null){
|
||||
boolean b = Boolean.valueOf(tmp).booleanValue();
|
||||
foData.setExcluded(b);
|
||||
}
|
||||
// tmp = el.getAttribute(EXCLUDED);
|
||||
// if(tmp != null){
|
||||
// boolean b = Boolean.valueOf(tmp).booleanValue();
|
||||
// foData.setExcluded(b);
|
||||
// }
|
||||
|
||||
ICStorageElement[] children = el.getChildren();
|
||||
ICStorageElement child;
|
||||
|
@ -171,11 +176,11 @@ public class CDataSerializer {
|
|||
if(fiData == null)
|
||||
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "failed to create file data"));
|
||||
|
||||
tmp = el.getAttribute(EXCLUDED);
|
||||
if(tmp != null){
|
||||
boolean b = Boolean.valueOf(tmp).booleanValue();
|
||||
fiData.setExcluded(b);
|
||||
}
|
||||
// tmp = el.getAttribute(EXCLUDED);
|
||||
// if(tmp != null){
|
||||
// boolean b = Boolean.valueOf(tmp).booleanValue();
|
||||
// fiData.setExcluded(b);
|
||||
// }
|
||||
|
||||
ICStorageElement[] children = el.getChildren();
|
||||
ICStorageElement child;
|
||||
|
@ -327,14 +332,16 @@ public class CDataSerializer {
|
|||
setAttribute(el, NAME, data.getName());
|
||||
setAttribute(el, DESCRIPTION, data.getDescription());
|
||||
|
||||
IPath[] paths = data.getSourcePaths();
|
||||
if(paths != null && paths.length != 0){
|
||||
setAttribute(el, SOURCE_PATHS, CDataUtil.arrayToString(paths, DELIMITER));
|
||||
}
|
||||
ICSourceEntry[] entries = data.getSourceEntries();
|
||||
ICStorageElement child = el.createChild(SOURCE_ENTRIES);
|
||||
LanguageSettingEntriesSerializer.serializeEntries(entries, child);
|
||||
// if(paths != null && paths.length != 0){
|
||||
// setAttribute(el, SOURCE_PATHS, CDataUtil.arrayToString(paths, DELIMITER));
|
||||
// }
|
||||
|
||||
CResourceData[] rcDatas = data.getResourceDatas();
|
||||
CResourceData rcData;
|
||||
ICStorageElement child;
|
||||
// ICStorageElement child;
|
||||
for(int i = 0; i < rcDatas.length; i++){
|
||||
rcData = rcDatas[i];
|
||||
if(rcData.getType() == ICSettingBase.SETTING_FILE){
|
||||
|
@ -368,7 +375,7 @@ public class CDataSerializer {
|
|||
setAttribute(el, PATH, path.toString());
|
||||
}
|
||||
|
||||
setAttribute(el, EXCLUDED, Boolean.valueOf(data.isExcluded()).toString());
|
||||
// setAttribute(el, EXCLUDED, Boolean.valueOf(data.isExcluded()).toString());
|
||||
|
||||
CLanguageData lDatas[] = data.getLanguageDatas();
|
||||
ICStorageElement child;
|
||||
|
@ -387,7 +394,7 @@ public class CDataSerializer {
|
|||
setAttribute(el, PATH, path.toString());
|
||||
}
|
||||
|
||||
setAttribute(el, EXCLUDED, Boolean.valueOf(data.isExcluded()).toString());
|
||||
// setAttribute(el, EXCLUDED, Boolean.valueOf(data.isExcluded()).toString());
|
||||
|
||||
CLanguageData lData = data.getLanguageData();
|
||||
if(lData != null){
|
||||
|
|
|
@ -12,8 +12,12 @@ package org.eclipse.cdt.core.settings.model.util;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
@ -23,6 +27,7 @@ import java.util.StringTokenizer;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
|
||||
import org.eclipse.cdt.core.model.CoreModelUtil;
|
||||
import org.eclipse.cdt.core.model.ILanguageDescriptor;
|
||||
import org.eclipse.cdt.core.model.LanguageManager;
|
||||
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
|
||||
|
@ -37,6 +42,7 @@ import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
||||
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.CFolderData;
|
||||
|
@ -487,5 +493,211 @@ public class CDataUtil {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isExcluded(IPath path, ICSourceEntry[] entries){
|
||||
for(int i = 0; i < entries.length; i++){
|
||||
if(!isExcluded(path, entries[i]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isExcluded(IPath path, ICSourceEntry entry){
|
||||
IPath entryPath = new Path(entry.getName());
|
||||
if(!entryPath.isPrefixOf(path))
|
||||
return true;
|
||||
|
||||
if(path.segmentCount() == 0)
|
||||
return false;
|
||||
char[][] exclusions = entry.fullExclusionPatternChars();
|
||||
return CoreModelUtil.isExcluded(path, exclusions);
|
||||
}
|
||||
|
||||
public static ICSourceEntry[] setExcluded(IPath path, boolean excluded, ICSourceEntry[] entries){
|
||||
if(isExcluded(path, entries) == excluded)
|
||||
return entries;
|
||||
|
||||
ICSourceEntry[] newEntries;
|
||||
if(excluded){
|
||||
List includeList = new ArrayList(entries.length);
|
||||
List excludeList = new ArrayList(entries.length);
|
||||
|
||||
sortEntries(path, entries, includeList, excludeList);
|
||||
|
||||
for(int i = 0; i < includeList.size(); i++){
|
||||
ICSourceEntry oldEntry = (ICSourceEntry)includeList.get(i);
|
||||
List tmp = new ArrayList(1);
|
||||
tmp.add(path);
|
||||
ICSourceEntry newEntry = addExcludePaths(oldEntry, tmp, true);
|
||||
if(newEntry != null)
|
||||
excludeList.add(newEntry);
|
||||
}
|
||||
|
||||
newEntries = (ICSourceEntry[])excludeList.toArray(new ICSourceEntry[excludeList.size()]);
|
||||
} else {
|
||||
newEntries = new ICSourceEntry[entries.length + 1];
|
||||
System.arraycopy(entries, 0, newEntries, 0, entries.length);
|
||||
newEntries[entries.length] = new CSourceEntry(path, null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
||||
}
|
||||
|
||||
return newEntries;
|
||||
}
|
||||
|
||||
public static ICSourceEntry[] adjustEntries(ICSourceEntry entries[]){
|
||||
return adjustEntries(entries, false, null);
|
||||
}
|
||||
|
||||
private static ICSourceEntry[] getDefaultEntries(boolean absolute, IProject project){
|
||||
ICSourceEntry entry;
|
||||
if(absolute){
|
||||
if(project != null)
|
||||
entry = new CSourceEntry(project.getFullPath(), null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSourceEntry.RESOLVED);
|
||||
else
|
||||
entry = new CSourceEntry(Path.EMPTY, null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSourceEntry.RESOLVED);
|
||||
} else {
|
||||
entry = new CSourceEntry(Path.EMPTY, null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSourceEntry.RESOLVED);
|
||||
}
|
||||
return new ICSourceEntry[]{entry};
|
||||
}
|
||||
|
||||
public static ICSourceEntry[] adjustEntries(ICSourceEntry entries[], boolean makeAbsolute, IProject project){
|
||||
if(entries == null)
|
||||
return getDefaultEntries(makeAbsolute, project);
|
||||
|
||||
ICSourceEntry ei, ej;
|
||||
LinkedHashMap map = new LinkedHashMap();
|
||||
for(int i = 0; i < entries.length; i++){
|
||||
ei = entries[i];
|
||||
List list = null;
|
||||
for(int j = 0; j < entries.length; j++){
|
||||
ej = entries[j];
|
||||
if(ei == ej)
|
||||
continue;
|
||||
|
||||
IPath ejPath = new Path(ej.getName());
|
||||
if(!isExcluded(ejPath, ei)){
|
||||
if(list == null)
|
||||
list = new ArrayList();
|
||||
list.add(ejPath);
|
||||
}
|
||||
}
|
||||
|
||||
map.put(ei, list);
|
||||
}
|
||||
List resultList = new ArrayList(entries.length);
|
||||
for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
List list = (List)entry.getValue();
|
||||
if(list == null)
|
||||
resultList.add(entry.getKey());
|
||||
else {
|
||||
ICSourceEntry se = (ICSourceEntry)entry.getKey();
|
||||
se = addExcludePaths(se, list, true);
|
||||
if(se != null)
|
||||
resultList.add(se);
|
||||
}
|
||||
}
|
||||
|
||||
if(makeAbsolute){
|
||||
if(project != null)
|
||||
resultList = makeAbsolute(project, resultList);
|
||||
} else {
|
||||
resultList = makeRelative(project, resultList);
|
||||
}
|
||||
return (ICSourceEntry[])resultList.toArray(new ICSourceEntry[resultList.size()]);
|
||||
}
|
||||
|
||||
private static List makeRelative(IProject project, List list){
|
||||
int size = list.size();
|
||||
|
||||
for(int i = 0; i < size; i++){
|
||||
list.set(i, makeRelative(project, (ICSourceEntry)list.get(i)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List makeAbsolute(IProject project, List list){
|
||||
int size = list.size();
|
||||
|
||||
for(int i = 0; i < size; i++){
|
||||
list.set(i, makeAbsolute(project, (ICSourceEntry)list.get(i)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static ICSourceEntry makeAbsolute(IProject project, ICSourceEntry entry){
|
||||
if(project == null)
|
||||
return entry;
|
||||
|
||||
IPath path = new Path(entry.getName());
|
||||
if(path.isAbsolute())
|
||||
return entry;
|
||||
|
||||
path = project.getFullPath().append(path);
|
||||
|
||||
return new CSourceEntry(path, entry.getExclusionPatterns(), entry.getFlags());
|
||||
}
|
||||
|
||||
public static ICSourceEntry makeRelative(IProject project, ICSourceEntry entry){
|
||||
IPath path = new Path(entry.getName());
|
||||
if(!path.isAbsolute())
|
||||
return entry;
|
||||
|
||||
// if(project != null){
|
||||
//
|
||||
// IPath projPath = project.getFullPath();
|
||||
//
|
||||
// }
|
||||
// if(pro)
|
||||
|
||||
return new CSourceEntry(path.removeFirstSegments(1).makeRelative(), entry.getExclusionPatterns(), entry.getFlags());
|
||||
}
|
||||
|
||||
private static Collection removePrefix(IPath prefix, Collection paths, Collection result){
|
||||
if(result == null)
|
||||
result = new ArrayList(paths.size());
|
||||
for(Iterator iter = paths.iterator(); iter.hasNext(); ){
|
||||
IPath path = (IPath)iter.next();
|
||||
if(prefix.isPrefixOf(path))
|
||||
result.add(path.removeFirstSegments(prefix.segmentCount()));
|
||||
// else
|
||||
// result.add(path);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ICSourceEntry addExcludePaths(ICSourceEntry entry, Collection paths, boolean removePrefix){
|
||||
IPath entryPath = new Path(entry.getName());
|
||||
IPath[] oldExclusions = entry.getExclusionPatterns();
|
||||
// List newExList = new ArrayList(oldExclusions.length + paths.size());
|
||||
LinkedHashSet newSet = new LinkedHashSet();
|
||||
if(removePrefix){
|
||||
removePrefix(entryPath, paths, newSet);
|
||||
} else {
|
||||
newSet.addAll(paths);
|
||||
}
|
||||
|
||||
for(Iterator iter = newSet.iterator(); iter.hasNext();){
|
||||
IPath path = (IPath)iter.next();
|
||||
if(path.segmentCount() == 0)
|
||||
return null;
|
||||
}
|
||||
|
||||
newSet.addAll(Arrays.asList(oldExclusions));
|
||||
|
||||
IPath[] newExclusions = (IPath[])newSet.toArray(new IPath[newSet.size()]);
|
||||
return new CSourceEntry(entry.getName(), newExclusions, entry.getFlags());
|
||||
}
|
||||
|
||||
private static void sortEntries(IPath path, ICSourceEntry[] entries, List included, List excluded){
|
||||
for(int i = 0; i < entries.length; i++){
|
||||
if(isExcluded(path, entries[i])){
|
||||
if(excluded != null)
|
||||
excluded.add(entries[i]);
|
||||
} else {
|
||||
if(included != null)
|
||||
included.add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,15 @@ public class KindBasedStore implements Cloneable {
|
|||
private static final int INDEX_OUPUT_PATH = 7;
|
||||
private static final int ALL_STORAGE_SIZE = 8;
|
||||
|
||||
public static final int ORED_LANG_ENTRY_KINDS =
|
||||
ICLanguageSettingEntry.INCLUDE_PATH
|
||||
| ICLanguageSettingEntry.INCLUDE_FILE
|
||||
| ICLanguageSettingEntry.MACRO
|
||||
| ICLanguageSettingEntry.MACRO_FILE
|
||||
| ICLanguageSettingEntry.LIBRARY_PATH
|
||||
| ICLanguageSettingEntry.LIBRARY_FILE;
|
||||
|
||||
|
||||
private static final int LANG_ENTRY_KINDS[] = new int[]{
|
||||
ICLanguageSettingEntry.INCLUDE_PATH,
|
||||
ICLanguageSettingEntry.INCLUDE_FILE,
|
||||
|
@ -75,7 +84,7 @@ public class KindBasedStore implements Cloneable {
|
|||
}
|
||||
throw new IllegalArgumentException(UtilMessages.getString("KindBasedStore.0")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
public static int[] getLanguageEntryKinds(){
|
||||
return (int[])LANG_ENTRY_KINDS.clone();
|
||||
}
|
||||
|
|
|
@ -58,28 +58,38 @@ public class LanguageSettingEntriesSerializer {
|
|||
|
||||
public static final String FLAGS_SEPARATOR = "|"; //$NON-NLS-1$
|
||||
|
||||
public static ICLanguageSettingEntry[] loadEntries(ICStorageElement el){
|
||||
List list = loadEntriesList(el);
|
||||
return (ICLanguageSettingEntry[])list.toArray(new ICLanguageSettingEntry[list.size()]);
|
||||
public static ICSettingEntry[] loadEntries(ICStorageElement el){
|
||||
return loadEntries(el, 0);
|
||||
}
|
||||
|
||||
public static ICSettingEntry[] loadEntries(ICStorageElement el, int kindFilter){
|
||||
List list = loadEntriesList(el, kindFilter);
|
||||
return (ICSettingEntry[])list.toArray(new ICSettingEntry[list.size()]);
|
||||
}
|
||||
|
||||
public static List loadEntriesList(ICStorageElement el){
|
||||
return loadEntriesList(el, 0);
|
||||
}
|
||||
|
||||
public static List loadEntriesList(ICStorageElement el, int kindFilter){
|
||||
ICStorageElement children[] = el.getChildren();
|
||||
ICStorageElement child;
|
||||
List list = new ArrayList();
|
||||
ICLanguageSettingEntry entry;
|
||||
ICSettingEntry entry;
|
||||
for(int i = 0; i < children.length; i++){
|
||||
child = children[i];
|
||||
if(ELEMENT_ENTRY.equals(child.getName())){
|
||||
entry = loadEntry(child);
|
||||
if(entry != null)
|
||||
if(entry != null
|
||||
&& (kindFilter == 0
|
||||
|| (kindFilter & entry.getKind()) != 0))
|
||||
list.add(entry);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static ICLanguageSettingEntry loadEntry(ICStorageElement el){
|
||||
public static ICSettingEntry loadEntry(ICStorageElement el){
|
||||
int kind = stringToKind(el.getAttribute(ATTRIBUTE_KIND));
|
||||
if(kind == 0)
|
||||
return null;
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -34,6 +35,7 @@ import org.eclipse.cdt.core.model.ILibraryEntry;
|
|||
import org.eclipse.cdt.core.model.IMacroEntry;
|
||||
import org.eclipse.cdt.core.model.IMacroFileEntry;
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
import org.eclipse.cdt.core.model.ISourceEntry;
|
||||
import org.eclipse.cdt.core.resources.IPathEntryVariableManager;
|
||||
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
|
||||
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
||||
|
@ -336,7 +338,7 @@ public class PathEntryTranslator {
|
|||
ResourceInfo fRcInfo;
|
||||
List fResolvedEntries;
|
||||
KindBasedStore fLangEntries;
|
||||
boolean fIsExcluded;
|
||||
// boolean fIsExcluded;
|
||||
|
||||
private RcDesInfo(ResourceInfo rcInfo){
|
||||
this.fRcInfo = rcInfo;
|
||||
|
@ -344,13 +346,13 @@ public class PathEntryTranslator {
|
|||
fLangEntries = new KindBasedStore();
|
||||
}
|
||||
|
||||
public boolean isExcluded(){
|
||||
return fIsExcluded;
|
||||
}
|
||||
|
||||
public void setExcluded(boolean excluded){
|
||||
fIsExcluded = excluded;
|
||||
}
|
||||
// public boolean isExcluded(){
|
||||
// return fIsExcluded;
|
||||
// }
|
||||
//
|
||||
// public void setExcluded(boolean excluded){
|
||||
// fIsExcluded = excluded;
|
||||
// }
|
||||
|
||||
public ResolvedEntry[] getResolvedEntries(){
|
||||
return (ResolvedEntry[])fResolvedEntries.toArray(new ResolvedEntry[fResolvedEntries.size()]);
|
||||
|
@ -1271,184 +1273,184 @@ public class PathEntryTranslator {
|
|||
return addPathEntries(rEntries, op);
|
||||
}
|
||||
|
||||
public static ICSourceEntry[] calculateSourceEntriesFromPaths(IProject project, PathSettingsContainer rcDatas, IPath paths[]){
|
||||
if(paths == null || paths.length == 0)
|
||||
paths = new IPath[]{new Path("")}; //$NON-NLS-1$
|
||||
|
||||
// Set set = new HashSet(paths.length);
|
||||
PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
|
||||
IPath pi, pj;
|
||||
List entriesList = new ArrayList(paths.length);
|
||||
IPath projPath = project != null ? project.getFullPath() : null;
|
||||
|
||||
for(int i = 0; i < paths.length; i++){
|
||||
pi = paths[i];
|
||||
// set.clear();
|
||||
cr.removeChildren();
|
||||
cr.setValue(null);
|
||||
for(int j = 0; j < paths.length; j++){
|
||||
pj = paths[j];
|
||||
if(pi != pj && pi.isPrefixOf(pj)){
|
||||
// set.add(pj);
|
||||
cr.getChildContainer(pj, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
PathSettingsContainer children[] = rcDatas.getDirectChildrenForPath(pi);
|
||||
for(int k = 0; k < children.length; k++){
|
||||
PathSettingsContainer child = children[k];
|
||||
IPath childPath = child.getPath();
|
||||
PathSettingsContainer parentExclusion = cr.getChildContainer(childPath, false, false);
|
||||
IPath parentExclusionPath = parentExclusion.getPath();
|
||||
if(parentExclusionPath.segmentCount() > 0 && !parentExclusionPath.equals(childPath) && parentExclusionPath.isPrefixOf(childPath))
|
||||
continue;
|
||||
|
||||
CResourceData rcData = (CResourceData)child.getValue();
|
||||
if(rcData.isExcluded()){
|
||||
// set.add(rcDes.getPath());
|
||||
cr.getChildContainer(childPath, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
PathSettingsContainer exclusions[] = cr.getChildren(false);
|
||||
// IPath exlusionPaths[] = new IPath[set.size()];
|
||||
IPath exlusionPaths[] = new IPath[exclusions.length];
|
||||
// int k = 0;
|
||||
int segCount = pi.segmentCount();
|
||||
// for(Iterator iter = set.iterator(); iter.hasNext(); k++) {
|
||||
// IPath path = (IPath)iter.next();
|
||||
// exlusionPaths[k] = path.removeFirstSegments(segCount).makeRelative();
|
||||
// public static ICSourceEntry[] calculateSourceEntriesFromPaths(IProject project, PathSettingsContainer rcDatas, IPath paths[]){
|
||||
// if(paths == null || paths.length == 0)
|
||||
// paths = new IPath[]{new Path("")}; //$NON-NLS-1$
|
||||
//
|
||||
//// Set set = new HashSet(paths.length);
|
||||
// PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
|
||||
// IPath pi, pj;
|
||||
// List entriesList = new ArrayList(paths.length);
|
||||
// IPath projPath = project != null ? project.getFullPath() : null;
|
||||
//
|
||||
// for(int i = 0; i < paths.length; i++){
|
||||
// pi = paths[i];
|
||||
//// set.clear();
|
||||
// cr.removeChildren();
|
||||
// cr.setValue(null);
|
||||
// for(int j = 0; j < paths.length; j++){
|
||||
// pj = paths[j];
|
||||
// if(pi != pj && pi.isPrefixOf(pj)){
|
||||
//// set.add(pj);
|
||||
// cr.getChildContainer(pj, true, true);
|
||||
// }
|
||||
// }
|
||||
for(int k = 0; k < exlusionPaths.length; k++) {
|
||||
exlusionPaths[k] = exclusions[k].getPath().removeFirstSegments(segCount).makeRelative();
|
||||
}
|
||||
if(projPath != null)
|
||||
pi = projPath.append(pi);
|
||||
entriesList.add(new CSourceEntry(pi, exlusionPaths, 0));
|
||||
}
|
||||
|
||||
return (ICSourceEntry[])entriesList.toArray(new ICSourceEntry[entriesList.size()]);
|
||||
}
|
||||
|
||||
private IPath[] setSourceEntries(PathSettingsContainer crontainer, List res) {
|
||||
// ICSourceEntry entry;
|
||||
IPath entryPath;
|
||||
// IPath paths[];
|
||||
Set srcPathSet = new HashSet();
|
||||
IPath projPath = fProject != null ? fProject.getFullPath() : null;
|
||||
PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
|
||||
cr.setValue(Boolean.TRUE);
|
||||
|
||||
// Map exclusionMap = new HashMap();
|
||||
|
||||
// HashSet pathSet = new HashSet();
|
||||
for(Iterator iter = res.iterator(); iter.hasNext();){
|
||||
ResolvedEntry re = (ResolvedEntry)iter.next();
|
||||
ResourceInfo rcInfo = re.getResourceInfo();
|
||||
entryPath = rcInfo.fRc.getFullPath();
|
||||
if(projPath != null){
|
||||
if(projPath.isPrefixOf(entryPath)){
|
||||
entryPath = entryPath.removeFirstSegments(projPath.segmentCount());
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// if(entryPath.segmentCount() > 0)
|
||||
// entryPath = entryPath.removeFirstSegments(1);
|
||||
// else
|
||||
//
|
||||
// PathSettingsContainer children[] = rcDatas.getDirectChildrenForPath(pi);
|
||||
// for(int k = 0; k < children.length; k++){
|
||||
// PathSettingsContainer child = children[k];
|
||||
// IPath childPath = child.getPath();
|
||||
// PathSettingsContainer parentExclusion = cr.getChildContainer(childPath, false, false);
|
||||
// IPath parentExclusionPath = parentExclusion.getPath();
|
||||
// if(parentExclusionPath.segmentCount() > 0 && !parentExclusionPath.equals(childPath) && parentExclusionPath.isPrefixOf(childPath))
|
||||
// continue;
|
||||
//
|
||||
// CResourceData rcData = (CResourceData)child.getValue();
|
||||
// if(rcData.isExcluded()){
|
||||
//// set.add(rcDes.getPath());
|
||||
// cr.getChildContainer(childPath, true, true);
|
||||
// }
|
||||
// }
|
||||
if(srcPathSet.add(entryPath)){
|
||||
// exclusionMap.put(entryPath, Boolean.TRUE);
|
||||
PathSettingsContainer entryCr = cr.getChildContainer(entryPath, true, true);
|
||||
entryCr.setValue(Boolean.TRUE);
|
||||
//
|
||||
// PathSettingsContainer exclusions[] = cr.getChildren(false);
|
||||
//// IPath exlusionPaths[] = new IPath[set.size()];
|
||||
// IPath exlusionPaths[] = new IPath[exclusions.length];
|
||||
//// int k = 0;
|
||||
// int segCount = pi.segmentCount();
|
||||
//// for(Iterator iter = set.iterator(); iter.hasNext(); k++) {
|
||||
//// IPath path = (IPath)iter.next();
|
||||
//// exlusionPaths[k] = path.removeFirstSegments(segCount).makeRelative();
|
||||
//// }
|
||||
// for(int k = 0; k < exlusionPaths.length; k++) {
|
||||
// exlusionPaths[k] = exclusions[k].getPath().removeFirstSegments(segCount).makeRelative();
|
||||
// }
|
||||
// if(projPath != null)
|
||||
// pi = projPath.append(pi);
|
||||
// entriesList.add(new CSourceEntry(pi, exlusionPaths, 0));
|
||||
// }
|
||||
//
|
||||
// return (ICSourceEntry[])entriesList.toArray(new ICSourceEntry[entriesList.size()]);
|
||||
// }
|
||||
|
||||
ResourceInfo[] filters = re.getFilterInfos();
|
||||
|
||||
// paths = entry.getExclusionPatterns();
|
||||
|
||||
for(int j = 0; j < filters.length; j++){
|
||||
IPath path = filters[j].fRc.getFullPath();
|
||||
path = path.removeFirstSegments(entryPath.segmentCount());
|
||||
PathSettingsContainer exclusion = entryCr.getChildContainer(path, true, true);
|
||||
if(exclusion.getValue() == null)
|
||||
exclusion.setValue(Boolean.FALSE);
|
||||
// if(null == exclusionMap.get(path))
|
||||
// exclusionMap.put(path, Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CConfigurationData data = getConfigurationData(true);
|
||||
// data.setSourcePaths((IPath[])srcPathSet.toArray(new IPath[srcPathSet.size()]));
|
||||
// ICResourceDescription rcDess[] = getResourceDescriptions();
|
||||
// ICResourceDescription rcDes;
|
||||
Set pathSet = new HashSet();
|
||||
PathSettingsContainer children[] = crontainer.getChildren(true);
|
||||
|
||||
for(int i = 0; i < children.length; i++){
|
||||
PathSettingsContainer child = children[i];
|
||||
RcDesInfo rcDesInfo = (RcDesInfo)child.getValue();
|
||||
// rcDes = rcDess[i];
|
||||
IPath path = child.getPath();
|
||||
pathSet.add(path);
|
||||
// Boolean b = (Boolean)exclusionMap.remove(path);
|
||||
Boolean b = (Boolean)cr.getChildContainer(path, false, false).getValue();
|
||||
assert (b != null);
|
||||
if(Boolean.TRUE == b) {
|
||||
if(rcDesInfo.isExcluded())
|
||||
rcDesInfo.setExcluded(false);
|
||||
} else {
|
||||
if(path.segmentCount() != 0)
|
||||
rcDesInfo.setExcluded(true);
|
||||
}
|
||||
}
|
||||
|
||||
PathSettingsContainer crs[] = cr.getChildren(true);
|
||||
for(int i= 0; i < crs.length; i++){
|
||||
PathSettingsContainer c = crs[i];
|
||||
IPath path = c.getPath();
|
||||
if(!pathSet.remove(path)){
|
||||
Boolean b = (Boolean)c.getValue();
|
||||
assert (b != null);
|
||||
PathSettingsContainer baseCr = crontainer.getChildContainer(path, false, false);
|
||||
RcDesInfo baseInfo = (RcDesInfo)baseCr.getValue();
|
||||
if(b == Boolean.TRUE){
|
||||
if(baseInfo.isExcluded()){
|
||||
RcDesInfo newInfo = new RcDesInfo(findResourceInfo(fProject, path, true));
|
||||
PathSettingsContainer newCr = crontainer.getChildContainer(path, true, true);
|
||||
newCr.setValue(newInfo);
|
||||
// if(newInfo == null){
|
||||
// ICResourceDescription fo = getResourceDescription(path, false);
|
||||
// if(fo.getType() == ICSettingBase.SETTING_FILE){
|
||||
// fo = getResourceDescription(path.removeLastSegments(1), false);
|
||||
// }
|
||||
// newDes = createFolderDescription(path, (ICFolderDescription)fo);
|
||||
// }
|
||||
newInfo.setExcluded(false);
|
||||
}
|
||||
} else {
|
||||
if(!baseInfo.isExcluded()){
|
||||
// ICResourceDescription newDes = createResourceDescription(path, base);
|
||||
RcDesInfo newInfo = new RcDesInfo(findResourceInfo(fProject, path, true));
|
||||
PathSettingsContainer newCr = crontainer.getChildContainer(path, true, true);
|
||||
newCr.setValue(newInfo);
|
||||
|
||||
// if(newDes == null){
|
||||
// ICResourceDescription fo = getResourceDescription(path, false);
|
||||
// if(fo.getType() == ICSettingBase.SETTING_FILE){
|
||||
// fo = getResourceDescription(path.removeLastSegments(1), false);
|
||||
// }
|
||||
// newDes = createFolderDescription(path, (ICFolderDescription)fo);
|
||||
// }
|
||||
newInfo.setExcluded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (IPath[])pathSet.toArray(new IPath[pathSet.size()]);
|
||||
}
|
||||
// private IPath[] setSourceEntries(PathSettingsContainer crontainer, List res) {
|
||||
//// ICSourceEntry entry;
|
||||
// IPath entryPath;
|
||||
//// IPath paths[];
|
||||
// Set srcPathSet = new HashSet();
|
||||
// IPath projPath = fProject != null ? fProject.getFullPath() : null;
|
||||
// PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
|
||||
// cr.setValue(Boolean.TRUE);
|
||||
//
|
||||
//// Map exclusionMap = new HashMap();
|
||||
//
|
||||
//// HashSet pathSet = new HashSet();
|
||||
// for(Iterator iter = res.iterator(); iter.hasNext();){
|
||||
// ResolvedEntry re = (ResolvedEntry)iter.next();
|
||||
// ResourceInfo rcInfo = re.getResourceInfo();
|
||||
// entryPath = rcInfo.fRc.getFullPath();
|
||||
// if(projPath != null){
|
||||
// if(projPath.isPrefixOf(entryPath)){
|
||||
// entryPath = entryPath.removeFirstSegments(projPath.segmentCount());
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//// else {
|
||||
//// if(entryPath.segmentCount() > 0)
|
||||
//// entryPath = entryPath.removeFirstSegments(1);
|
||||
//// else
|
||||
//// continue;
|
||||
//// }
|
||||
// if(srcPathSet.add(entryPath)){
|
||||
// // exclusionMap.put(entryPath, Boolean.TRUE);
|
||||
// PathSettingsContainer entryCr = cr.getChildContainer(entryPath, true, true);
|
||||
// entryCr.setValue(Boolean.TRUE);
|
||||
//
|
||||
// ResourceInfo[] filters = re.getFilterInfos();
|
||||
//
|
||||
//// paths = entry.getExclusionPatterns();
|
||||
//
|
||||
// for(int j = 0; j < filters.length; j++){
|
||||
// IPath path = filters[j].fRc.getFullPath();
|
||||
// path = path.removeFirstSegments(entryPath.segmentCount());
|
||||
// PathSettingsContainer exclusion = entryCr.getChildContainer(path, true, true);
|
||||
// if(exclusion.getValue() == null)
|
||||
// exclusion.setValue(Boolean.FALSE);
|
||||
// // if(null == exclusionMap.get(path))
|
||||
// // exclusionMap.put(path, Boolean.FALSE);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//// CConfigurationData data = getConfigurationData(true);
|
||||
//// data.setSourcePaths((IPath[])srcPathSet.toArray(new IPath[srcPathSet.size()]));
|
||||
//// ICResourceDescription rcDess[] = getResourceDescriptions();
|
||||
//// ICResourceDescription rcDes;
|
||||
// Set pathSet = new HashSet();
|
||||
// PathSettingsContainer children[] = crontainer.getChildren(true);
|
||||
//
|
||||
// for(int i = 0; i < children.length; i++){
|
||||
// PathSettingsContainer child = children[i];
|
||||
// RcDesInfo rcDesInfo = (RcDesInfo)child.getValue();
|
||||
//// rcDes = rcDess[i];
|
||||
// IPath path = child.getPath();
|
||||
// pathSet.add(path);
|
||||
//// Boolean b = (Boolean)exclusionMap.remove(path);
|
||||
// Boolean b = (Boolean)cr.getChildContainer(path, false, false).getValue();
|
||||
// assert (b != null);
|
||||
// if(Boolean.TRUE == b) {
|
||||
// if(rcDesInfo.isExcluded())
|
||||
// rcDesInfo.setExcluded(false);
|
||||
// } else {
|
||||
// if(path.segmentCount() != 0)
|
||||
// rcDesInfo.setExcluded(true);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// PathSettingsContainer crs[] = cr.getChildren(true);
|
||||
// for(int i= 0; i < crs.length; i++){
|
||||
// PathSettingsContainer c = crs[i];
|
||||
// IPath path = c.getPath();
|
||||
// if(!pathSet.remove(path)){
|
||||
// Boolean b = (Boolean)c.getValue();
|
||||
// assert (b != null);
|
||||
// PathSettingsContainer baseCr = crontainer.getChildContainer(path, false, false);
|
||||
// RcDesInfo baseInfo = (RcDesInfo)baseCr.getValue();
|
||||
// if(b == Boolean.TRUE){
|
||||
// if(baseInfo.isExcluded()){
|
||||
// RcDesInfo newInfo = new RcDesInfo(findResourceInfo(fProject, path, true));
|
||||
// PathSettingsContainer newCr = crontainer.getChildContainer(path, true, true);
|
||||
// newCr.setValue(newInfo);
|
||||
//// if(newInfo == null){
|
||||
//// ICResourceDescription fo = getResourceDescription(path, false);
|
||||
//// if(fo.getType() == ICSettingBase.SETTING_FILE){
|
||||
//// fo = getResourceDescription(path.removeLastSegments(1), false);
|
||||
//// }
|
||||
//// newDes = createFolderDescription(path, (ICFolderDescription)fo);
|
||||
//// }
|
||||
// newInfo.setExcluded(false);
|
||||
// }
|
||||
// } else {
|
||||
// if(!baseInfo.isExcluded()){
|
||||
//// ICResourceDescription newDes = createResourceDescription(path, base);
|
||||
// RcDesInfo newInfo = new RcDesInfo(findResourceInfo(fProject, path, true));
|
||||
// PathSettingsContainer newCr = crontainer.getChildContainer(path, true, true);
|
||||
// newCr.setValue(newInfo);
|
||||
//
|
||||
//// if(newDes == null){
|
||||
//// ICResourceDescription fo = getResourceDescription(path, false);
|
||||
//// if(fo.getType() == ICSettingBase.SETTING_FILE){
|
||||
//// fo = getResourceDescription(path.removeLastSegments(1), false);
|
||||
//// }
|
||||
//// newDes = createFolderDescription(path, (ICFolderDescription)fo);
|
||||
//// }
|
||||
// newInfo.setExcluded(true);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return (IPath[])pathSet.toArray(new IPath[pathSet.size()]);
|
||||
// }
|
||||
|
||||
private ReferenceSettingsInfo addPathEntries(ResolvedEntry[] rEntries, int op){
|
||||
PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
|
||||
|
@ -1457,7 +1459,7 @@ public class PathEntryTranslator {
|
|||
List outList = new ArrayList();
|
||||
List projList = new ArrayList();
|
||||
List exportSettingsList = new ArrayList();
|
||||
IPath srcPaths[] = null;
|
||||
ICSourceEntry srcEntries[] = null;
|
||||
PathSettingsContainer child;
|
||||
ResolvedEntry rEntry;
|
||||
IPath projPath;
|
||||
|
@ -1468,7 +1470,7 @@ public class PathEntryTranslator {
|
|||
if(toLanguageEntryKind(rEntry.fEntry.getEntryKind()) == 0){
|
||||
switch(rEntry.fEntry.getEntryKind()){
|
||||
case IPathEntry.CDT_SOURCE:
|
||||
srcList.add(rEntry);
|
||||
srcList.add(rEntry.fEntry);
|
||||
break;
|
||||
case IPathEntry.CDT_OUTPUT:
|
||||
outList.add(rEntry);
|
||||
|
@ -1497,7 +1499,7 @@ public class PathEntryTranslator {
|
|||
}
|
||||
|
||||
if(srcList.size() != 0){
|
||||
srcPaths = setSourceEntries(cr, srcList);
|
||||
srcEntries = toCSourceEntries(srcList);
|
||||
} else {
|
||||
// srcPaths = new IPath[]{new Path("")}; //$NON-NLS-1$
|
||||
}
|
||||
|
@ -1522,7 +1524,8 @@ public class PathEntryTranslator {
|
|||
|
||||
//applying settings
|
||||
|
||||
applySourcePaths(srcPaths, op);
|
||||
//applySourcePaths(srcPaths, op);
|
||||
applySourceEntries(srcEntries, op);
|
||||
applyLangSettings(cr, op);
|
||||
|
||||
IPath refProjPaths[] = new IPath[projList.size()];
|
||||
|
@ -1550,32 +1553,50 @@ public class PathEntryTranslator {
|
|||
return new ReferenceSettingsInfo(refProjPaths, extSettings);
|
||||
}
|
||||
|
||||
private void applySourcePaths(IPath srcPaths[], int op){
|
||||
private static ICSourceEntry[] toCSourceEntries(List list){
|
||||
ICSourceEntry[] entries = new ICSourceEntry[list.size()];
|
||||
for(int i = 0; i < entries.length; i++){
|
||||
entries[i] = toCSourceEntry((ISourceEntry)list.get(i), true);
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
private static ICSourceEntry toCSourceEntry(ISourceEntry entry, boolean makeProjRelative){
|
||||
IPath path = entry.getPath();
|
||||
if(makeProjRelative && path.isAbsolute())
|
||||
path = path.removeFirstSegments(1);
|
||||
return new CSourceEntry(path,
|
||||
entry.getExclusionPatterns(),
|
||||
ICSettingEntry.VALUE_WORKSPACE_PATH
|
||||
| ICSourceEntry.RESOLVED);
|
||||
}
|
||||
|
||||
private void applySourceEntries(ICSourceEntry entries[], int op){
|
||||
switch (op) {
|
||||
case OP_ADD:
|
||||
if(srcPaths != null){
|
||||
IPath curPaths[] = fCfgData.getSourcePaths();
|
||||
Set set = new HashSet();
|
||||
set.addAll(Arrays.asList(curPaths));
|
||||
set.addAll(Arrays.asList(srcPaths));
|
||||
fCfgData.setSourcePaths((IPath[])set.toArray(new IPath[set.size()]));
|
||||
if(entries != null && entries.length != 0){
|
||||
ICSourceEntry curEntries[] = fCfgData.getSourceEntries();
|
||||
Set set = new LinkedHashSet();
|
||||
set.addAll(Arrays.asList(curEntries));
|
||||
set.addAll(Arrays.asList(entries));
|
||||
fCfgData.setSourceEntries((ICSourceEntry[])set.toArray(new ICSourceEntry[set.size()]));
|
||||
}
|
||||
break;
|
||||
case OP_REMOVE:
|
||||
if(srcPaths != null){
|
||||
IPath curPaths[] = fCfgData.getSourcePaths();
|
||||
if(entries != null && entries.length != 0){
|
||||
ICSourceEntry curEntries[] = fCfgData.getSourceEntries();
|
||||
Set set = new HashSet();
|
||||
set.addAll(Arrays.asList(curPaths));
|
||||
set.removeAll(Arrays.asList(srcPaths));
|
||||
fCfgData.setSourcePaths((IPath[])set.toArray(new IPath[set.size()]));
|
||||
set.addAll(Arrays.asList(curEntries));
|
||||
set.removeAll(Arrays.asList(entries));
|
||||
fCfgData.setSourceEntries((ICSourceEntry[])set.toArray(new ICSourceEntry[set.size()]));
|
||||
}
|
||||
break;
|
||||
case OP_REPLACE:
|
||||
default:
|
||||
if(srcPaths != null){
|
||||
fCfgData.setSourcePaths(srcPaths);
|
||||
if(entries != null){
|
||||
fCfgData.setSourceEntries(entries);
|
||||
} else {
|
||||
fCfgData.setSourcePaths(new IPath[0]);
|
||||
fCfgData.setSourceEntries(new ICSourceEntry[0]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1603,7 +1624,7 @@ public class PathEntryTranslator {
|
|||
}
|
||||
|
||||
RcDesInfo desInfo = (RcDesInfo)c.getValue();
|
||||
rcData.setExcluded(desInfo.isExcluded());
|
||||
// rcData.setExcluded(desInfo.isExcluded());
|
||||
|
||||
applyEntries(rcData, desInfo, op);
|
||||
}
|
||||
|
@ -2274,8 +2295,8 @@ public class PathEntryTranslator {
|
|||
// public static PathEntryCollector collectEntries(IProject project, CConfigurationData data, ReferenceSettingsInfo refInfo){
|
||||
final PathEntryCollector cr = new PathEntryCollector(project/*, des*/);
|
||||
PathSettingsContainer rcDatas = createRcDataHolder(data);
|
||||
IPath srcPaths[] = data.getSourcePaths();
|
||||
ICSourceEntry sEntries[] = calculateSourceEntriesFromPaths(project, rcDatas, srcPaths);
|
||||
ICSourceEntry sEntries[] = data.getSourceEntries();
|
||||
// ICSourceEntry sEntries[] = calculateSourceEntriesFromPaths(project, rcDatas, srcPaths);
|
||||
if(sEntries != null && sEntries.length != 0){
|
||||
cr.setSourceOutputEntries(ICSettingEntry.SOURCE_PATH, sEntries);
|
||||
}
|
||||
|
|
|
@ -14,12 +14,15 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
public class PathSettingsContainer {
|
||||
private static final Object INEXISTENT_VALUE = new Object();
|
||||
private static final String ROOY_PATH_NAME = Path.ROOT.toString();
|
||||
// private static final boolean DEBUG = true;
|
||||
// private static final int INIT_CHILDREN_MAP_CAPACITY = 2;
|
||||
|
||||
// private Map fChildrenMap;
|
||||
|
@ -39,6 +42,10 @@ public class PathSettingsContainer {
|
|||
private static final int VALUE_CHANGED = 3;
|
||||
private static final int PATH_CHANGED = 4;
|
||||
|
||||
private static class PatternSearchInfo {
|
||||
Set fStoreSet;
|
||||
int fNumDoubleStarEls;
|
||||
}
|
||||
|
||||
public static PathSettingsContainer createRootContainer(){
|
||||
return createRootContainer(false);
|
||||
|
@ -49,7 +56,7 @@ public class PathSettingsContainer {
|
|||
}
|
||||
|
||||
private PathSettingsContainer(boolean pattternMode){
|
||||
this(null, null, "", pattternMode); //$NON-NLS-1$
|
||||
this(null, null, ROOY_PATH_NAME, pattternMode);
|
||||
}
|
||||
|
||||
private PathSettingsContainer(PathSettingsContainer root, PathSettingsContainer parent, String name, boolean patternMode){
|
||||
|
@ -83,7 +90,19 @@ public class PathSettingsContainer {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private boolean isDoubleStarName(){
|
||||
return PatternNameMap.DOUBLE_STAR_PATTERN.equals(getName());
|
||||
}
|
||||
|
||||
private PathSettingsContainer getDoubleStarChild(){
|
||||
PatternNameMap pMap = getPatternChildrenMap(false);
|
||||
if(pMap != null){
|
||||
return pMap.containsDoubleStar() ? (PathSettingsContainer)pMap.get(PatternNameMap.DOUBLE_STAR_PATTERN) : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List getChildren(String name){
|
||||
PatternNameMap pMap = getPatternChildrenMap(false);
|
||||
if(pMap != null){
|
||||
|
@ -129,9 +148,13 @@ public class PathSettingsContainer {
|
|||
PatternNameMap pMap = getPatternChildrenMap(false);
|
||||
return pMap != null && pMap.size() != 0;
|
||||
}
|
||||
|
||||
|
||||
public PathSettingsContainer getChildContainer(IPath path, boolean create, boolean exactPath){
|
||||
PathSettingsContainer container = findContainer(path, create, exactPath);
|
||||
return getChildContainer(path, create, exactPath, fIsPatternMode);
|
||||
}
|
||||
|
||||
public PathSettingsContainer getChildContainer(IPath path, boolean create, boolean exactPath, boolean patternSearch){
|
||||
PathSettingsContainer container = findContainer(path, create, exactPath, patternSearch, -1, null);
|
||||
if(container != null && container.internalGetValue() == INEXISTENT_VALUE){
|
||||
if(create){
|
||||
container.internalSetValue(null);
|
||||
|
@ -147,6 +170,10 @@ public class PathSettingsContainer {
|
|||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
static IPath toNormalizedContainerPath(IPath path){
|
||||
return Path.ROOT.append(path);
|
||||
}
|
||||
|
||||
public PathSettingsContainer[] getChildren(final boolean includeThis){
|
||||
final List list = new ArrayList();
|
||||
|
@ -163,19 +190,45 @@ public class PathSettingsContainer {
|
|||
}
|
||||
|
||||
public PathSettingsContainer[] getChildrenForPath(IPath path, boolean includePath){
|
||||
PathSettingsContainer cr = findContainer(path, false, true);
|
||||
PathSettingsContainer cr = findContainer(path, false, true, fIsPatternMode, -1, null);
|
||||
if(cr != null)
|
||||
return cr.getChildren(includePath);
|
||||
return new PathSettingsContainer[0];
|
||||
}
|
||||
|
||||
public PathSettingsContainer[] getDirectChildrenForPath(IPath path){
|
||||
PathSettingsContainer cr = findContainer(path, false, true);
|
||||
PathSettingsContainer cr = findContainer(path, false, true, fIsPatternMode, -1, null);
|
||||
if(cr != null)
|
||||
return cr.getDirectChildren();
|
||||
return new PathSettingsContainer[0];
|
||||
}
|
||||
|
||||
|
||||
/* public PathSettingsContainer[] getDirectChildrenForPath(IPath path, boolean searchPatterns){
|
||||
if(!searchPatterns)
|
||||
return getDirectChildrenForPath(path);
|
||||
|
||||
if(!isRoot() && !PatternNameMap.isPatternName(fName)){
|
||||
return getDirectParentContainer().getDirectChildrenForPath(
|
||||
new Path(fName).append(path), true);
|
||||
}
|
||||
return searchPatternsDirectChildrenForPath(path);
|
||||
}
|
||||
|
||||
private PathSettingsContainer[] searchPatternsDirectChildrenForPath(IPath path){
|
||||
Set set = new HashSet();
|
||||
findContainer(path, false, false, path.segmentCount(), set);
|
||||
|
||||
if(DEBUG){
|
||||
for(Iterator iter = set.iterator(); iter.hasNext();){
|
||||
PathSettingsContainer child = (PathSettingsContainer)iter.next();
|
||||
if(child.fValue == INEXISTENT_VALUE)
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
return (PathSettingsContainer[])set.toArray(new PathSettingsContainer[set.size()]);
|
||||
}
|
||||
*/
|
||||
public PathSettingsContainer[] getDirectChildren(){
|
||||
List list = doGetDirectChildren(null);
|
||||
if(list == null || list.size() == 0)
|
||||
|
@ -292,39 +345,167 @@ public class PathSettingsContainer {
|
|||
return fName;
|
||||
}
|
||||
|
||||
private PathSettingsContainer findContainer(IPath path, boolean create, boolean exactPath){
|
||||
private PathSettingsContainer findContainer(IPath path, boolean create, boolean exactPath, boolean patternSearch, int matchDepth, PatternSearchInfo psi){
|
||||
PathSettingsContainer container = null;
|
||||
if(path.segmentCount() == 0)
|
||||
container = this;
|
||||
else if (create || exactPath || !fIsPatternMode) {
|
||||
else if (create || exactPath || !patternSearch || !fIsPatternMode) {
|
||||
PathSettingsContainer child = getExacChild(path.segment(0), create);
|
||||
if(child != null)
|
||||
container = child.findContainer(path.removeFirstSegments(1), create, exactPath);
|
||||
container = child.findContainer(path.removeFirstSegments(1), create, exactPath, patternSearch, stepDepth(matchDepth), psi);
|
||||
else if(!exactPath)
|
||||
container = this;
|
||||
} else {
|
||||
//looking for container using patterns in read mode (i.e. not creating new container)
|
||||
List list = getChildren(path.segment(0));
|
||||
if(list != null){
|
||||
int size = list.size();
|
||||
PathSettingsContainer child, childFound;
|
||||
|
||||
for(int i = 0; i < size; i++){
|
||||
child = (PathSettingsContainer)list.get(i);
|
||||
childFound = child.findContainer(path.removeFirstSegments(1), false, false);
|
||||
if(container == null)
|
||||
container = childFound;
|
||||
else if(container.getPath().segmentCount() < childFound.getPath().segmentCount()){
|
||||
container = childFound;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(container == null)
|
||||
container = this;
|
||||
if(psi == null)
|
||||
psi = new PatternSearchInfo();
|
||||
container = processPatterns(path, matchDepth, 0, psi);
|
||||
// do {
|
||||
// List list = getChildren(path.segment(0));
|
||||
// if(list != null){
|
||||
// int size = list.size();
|
||||
// PathSettingsContainer child, childFound;
|
||||
//
|
||||
// for(int i = 0; i < size; i++){
|
||||
// child = (PathSettingsContainer)list.get(i);
|
||||
// if(directChildren && child.fValue != INEXISTENT_VALUE){
|
||||
// childFound = child;
|
||||
// } else {
|
||||
// childFound = child.findContainer(path.removeFirstSegments(1), false, false, directChildren, storeSet);
|
||||
// }
|
||||
//
|
||||
// if(childFound.fValue != INEXISTENT_VALUE){
|
||||
// if(container == null
|
||||
// || container.getValue() == INEXISTENT_VALUE
|
||||
// || container.getPath().segmentCount() < childFound.getPath().segmentCount()){
|
||||
// container = childFound;
|
||||
// }
|
||||
// if(storeSet != null)
|
||||
// storeSet.add(container);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(container == null || storeSet != null){
|
||||
// PathSettingsContainer dsChild = getDoubleStarChild();
|
||||
// if(dsChild != null && !storeSet.contains(dsChild)){
|
||||
// container = dsChild.findContainer(path, false, false, directChildren, storeSet);
|
||||
// }
|
||||
//
|
||||
// if(container == null){
|
||||
// if(isDoubleStarName()){
|
||||
// if(path.segmentCount() != 0){
|
||||
// path = path.removeFirstSegments(1);
|
||||
// continue;
|
||||
// }
|
||||
// } else {
|
||||
// container = this;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// } while(true);
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
static boolean pathsEqual(IPath p1, IPath p2) {
|
||||
if (p1 == p2)
|
||||
return true;
|
||||
|
||||
int i = p1.segmentCount();
|
||||
if(i != p2.segmentCount())
|
||||
return false;
|
||||
|
||||
while (--i >= 0)
|
||||
if (!p1.segment(i).equals(p2.segment(i)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private PathSettingsContainer processPatterns(IPath path, int matchDepth, int depth, PatternSearchInfo psi){
|
||||
Set storeSet = psi.fStoreSet;
|
||||
PathSettingsContainer container = null;
|
||||
String name = path.segment(0);
|
||||
List list = getChildren(name);
|
||||
PathSettingsContainer child, childFound;
|
||||
boolean exactPathFound = false;
|
||||
if(list != null){
|
||||
int size = list.size();
|
||||
|
||||
for(int i = 0; i < size; i++){
|
||||
child = (PathSettingsContainer)list.get(i);
|
||||
if(matchDepth == 0 && child.fValue != INEXISTENT_VALUE){
|
||||
childFound = child;
|
||||
} else {
|
||||
childFound = child.findContainer(path.removeFirstSegments(1), false, false, true, stepDepth(matchDepth), psi);
|
||||
}
|
||||
|
||||
if(childFound != null && childFound.fValue != INEXISTENT_VALUE){
|
||||
if(!exactPathFound
|
||||
&& path.segmentCount() == 1
|
||||
&& child != childFound
|
||||
&& name.equals(childFound.fName)){
|
||||
container = childFound;
|
||||
exactPathFound = true;
|
||||
} else if(container == null
|
||||
|| container.getValue() == INEXISTENT_VALUE
|
||||
|| container.getPath().segmentCount() < childFound.getPath().segmentCount()){
|
||||
container = childFound;
|
||||
}
|
||||
if(storeSet != null)
|
||||
storeSet.add(container);
|
||||
else if(exactPathFound)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!exactPathFound || storeSet != null){
|
||||
child = getDoubleStarChild();
|
||||
if(child != null/* && !storeSet.contains(child)*/){
|
||||
if(matchDepth == 0 && child.fValue != INEXISTENT_VALUE){
|
||||
childFound = child;
|
||||
} else {
|
||||
childFound = child.findContainer(path, false, false, true, matchDepth, psi);
|
||||
}
|
||||
|
||||
if(childFound != null && childFound.fValue != INEXISTENT_VALUE){
|
||||
psi.fNumDoubleStarEls++;
|
||||
if(container == null
|
||||
|| container.getValue() == INEXISTENT_VALUE
|
||||
|| container.getPath().segmentCount() < childFound.getPath().segmentCount() + depth - psi.fNumDoubleStarEls){
|
||||
container = childFound;
|
||||
}
|
||||
if(storeSet != null)
|
||||
storeSet.add(container);
|
||||
}
|
||||
}
|
||||
|
||||
if(container == null){
|
||||
if(isDoubleStarName()){
|
||||
if(path.segmentCount() > 1){
|
||||
childFound = processPatterns(path.removeFirstSegments(1), stepDepth(matchDepth), depth + 1, psi);
|
||||
if(childFound != null && childFound.fValue != INEXISTENT_VALUE){
|
||||
container = childFound;
|
||||
if(storeSet != null)
|
||||
storeSet.add(container);
|
||||
}
|
||||
}
|
||||
} else if (matchDepth < 0 && fValue != INEXISTENT_VALUE){
|
||||
container = this;
|
||||
if(storeSet != null)
|
||||
storeSet.add(container);
|
||||
}
|
||||
}
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
private int stepDepth(int depth){
|
||||
return depth == 0 ? depth : depth-1;
|
||||
}
|
||||
|
||||
public void accept(IPathSettingsContainerVisitor visitor){
|
||||
doAccept(visitor);
|
||||
}
|
||||
|
@ -377,7 +558,7 @@ public class PathSettingsContainer {
|
|||
|
||||
}
|
||||
|
||||
PathSettingsContainer newParent = fRootContainer.findContainer(path.removeLastSegments(1), true, true);
|
||||
PathSettingsContainer newParent = fRootContainer.findContainer(path.removeLastSegments(1), true, true, false, -1, null);
|
||||
PathSettingsContainer oldParent = fDirectParentContainer;
|
||||
fName = path.segment(path.segmentCount()-1);
|
||||
fPath = path;
|
||||
|
@ -442,4 +623,33 @@ public class PathSettingsContainer {
|
|||
private void setParent(PathSettingsContainer parent){
|
||||
fDirectParentContainer = parent;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return contributeToString(new StringBuffer(), 0).toString();
|
||||
}
|
||||
|
||||
private StringBuffer contributeToString(StringBuffer buf, int depth){
|
||||
for (int i= 0; i < depth; i++) {
|
||||
buf.append('\t');
|
||||
}
|
||||
buf.append('[').append(getPath()).append(']').append('\n');
|
||||
|
||||
PathSettingsContainer[] directChildren = getDirectChildren();
|
||||
if(directChildren.length != 0){
|
||||
int nextDepth = depth + 1;
|
||||
for(int i = 0; i < directChildren.length; i++){
|
||||
directChildren[i].contributeToString(buf, nextDepth);
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
static boolean hasSpecChars(IPath path){
|
||||
int count = path.segmentCount();
|
||||
for(int i = 0; i < count; i++){
|
||||
if(PatternNameMap.isPatternName(path.segment(i)))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,10 +23,12 @@ import org.eclipse.cdt.core.model.CoreModelUtil;
|
|||
|
||||
public class PatternNameMap {
|
||||
private static final char[] SPEC_CHARS = new char[]{'*', '?'};
|
||||
static final String DOUBLE_STAR_PATTERN = "**";
|
||||
|
||||
private Map fChildrenMap;
|
||||
private Map fPatternMap;
|
||||
private Collection fValues;
|
||||
private boolean fContainsDoubleStar;
|
||||
|
||||
private static class StringCharArray {
|
||||
private String fString;
|
||||
|
@ -98,9 +100,13 @@ public class PatternNameMap {
|
|||
|
||||
public void remove() {
|
||||
fEntrySetIter.remove();
|
||||
removePattern((String)fCur.getKey());
|
||||
String name = (String)fCur.getKey();
|
||||
if(DOUBLE_STAR_PATTERN.equals(name)){
|
||||
fContainsDoubleStar = false;
|
||||
} else {
|
||||
removePattern(name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Iterator iterator() {
|
||||
|
@ -128,16 +134,24 @@ public class PatternNameMap {
|
|||
return fChildrenMap != null ? fChildrenMap.size() : 0;
|
||||
}
|
||||
|
||||
public boolean hasPatterns(){
|
||||
return fPatternMap != null && fPatternMap.size() != 0;
|
||||
public boolean isEmpty(){
|
||||
return fChildrenMap == null || fChildrenMap.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasPatterns(){
|
||||
return fContainsDoubleStar || hasPatternsMap();
|
||||
}
|
||||
|
||||
public boolean hasPatternsMap(){
|
||||
return (fPatternMap != null && fPatternMap.size() != 0);
|
||||
}
|
||||
|
||||
public List getValues(String name){
|
||||
if(fChildrenMap == null)
|
||||
return null;
|
||||
|
||||
Object val = fChildrenMap.get(name);
|
||||
if(hasPatterns()){
|
||||
if(hasPatternsMap()){
|
||||
List list;
|
||||
if(val != null){
|
||||
list = new ArrayList(3);
|
||||
|
@ -167,6 +181,10 @@ public class PatternNameMap {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean containsDoubleStar(){
|
||||
return fContainsDoubleStar;
|
||||
}
|
||||
|
||||
public Object put(String name, Object value){
|
||||
if(value == null)
|
||||
return remove(name);
|
||||
|
@ -181,7 +199,9 @@ public class PatternNameMap {
|
|||
|
||||
fChildrenMap.put(name, value);
|
||||
|
||||
if(isPatternName(name)){
|
||||
if(DOUBLE_STAR_PATTERN.equals(name)){
|
||||
fContainsDoubleStar = true;
|
||||
} else if(isPatternName(name)){
|
||||
StringCharArray strCA = new StringCharArray(name);
|
||||
if(fPatternMap == null)
|
||||
fPatternMap = new HashMap();
|
||||
|
@ -198,6 +218,9 @@ public class PatternNameMap {
|
|||
if(fChildrenMap.size() == 0){
|
||||
fChildrenMap = null;
|
||||
fPatternMap = null;
|
||||
fContainsDoubleStar = false;
|
||||
} else if(DOUBLE_STAR_PATTERN.equals(name)){
|
||||
fContainsDoubleStar = false;
|
||||
} else {
|
||||
removePattern(name);
|
||||
}
|
||||
|
@ -230,6 +253,7 @@ public class PatternNameMap {
|
|||
public void clear(){
|
||||
fChildrenMap = null;
|
||||
fPatternMap = null;
|
||||
fContainsDoubleStar = false;
|
||||
}
|
||||
|
||||
public Collection values(){
|
||||
|
|
|
@ -12,14 +12,11 @@ package org.eclipse.cdt.internal.core.settings.model;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
|
||||
import org.eclipse.cdt.core.settings.model.CSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICBuildSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
|
@ -43,12 +40,11 @@ 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.CTargetPlatformData;
|
||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
|
||||
public class CConfigurationDescription extends CDataProxyContainer implements ICConfigurationDescription, IProxyFactory, IInternalCCfgInfo {
|
||||
|
@ -471,151 +467,159 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
|||
|
||||
public ICSourceEntry[] getSourceEntries() {
|
||||
CConfigurationData data = getConfigurationData(false);
|
||||
IPath[] srcPaths = data.getSourcePaths();
|
||||
ICSourceEntry[] srcEntries = data.getSourceEntries();
|
||||
IProject proj = fIsPreference ? null : getProjectDescription().getProject();
|
||||
return getRcHolder().calculateSourceEntriesFromPaths(proj, srcPaths);
|
||||
return CDataUtil.adjustEntries(srcEntries, true, proj);
|
||||
// return getRcHolder().calculateSourceEntriesFromPaths(proj, srcPaths);
|
||||
}
|
||||
|
||||
public void setSourceEntries(ICSourceEntry[] entries) throws CoreException {
|
||||
ICSourceEntry entry;
|
||||
IPath entryPath;
|
||||
IPath paths[];
|
||||
PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
|
||||
cr.setValue(Boolean.valueOf(getRootFolderDescription().isExcluded()));
|
||||
Set srcPathSet = new HashSet();
|
||||
IProject project = fIsPreference ? null : getProjectDescription().getProject();
|
||||
IPath projPath = project != null ? project.getFullPath() : null;
|
||||
// Map exclusionMap = new HashMap();
|
||||
|
||||
// HashSet pathSet = new HashSet();
|
||||
|
||||
if(entries == null){
|
||||
IPath pasePath = projPath != null ? projPath : Path.EMPTY;
|
||||
entries = new ICSourceEntry[]{new CSourceEntry(pasePath, null, ICLanguageSettingEntry.RESOLVED | ICLanguageSettingEntry.VALUE_WORKSPACE_PATH)};
|
||||
}
|
||||
|
||||
for(int i = 0 ; i < entries.length; i++){
|
||||
entry = entries[i];
|
||||
entryPath = entry.getFullPath();
|
||||
if(projPath != null){
|
||||
if(projPath.isPrefixOf(entryPath)){
|
||||
entryPath = entryPath.removeFirstSegments(projPath.segmentCount());
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// if(entryPath.segmentCount() > 0)
|
||||
// entryPath = entryPath.removeFirstSegments(1);
|
||||
// else
|
||||
// continue;
|
||||
// }
|
||||
if(srcPathSet.add(entryPath)){
|
||||
// exclusionMap.put(entryPath, Boolean.TRUE);
|
||||
PathSettingsContainer entryCr = cr.getChildContainer(entryPath, true, true);
|
||||
entryCr.setValue(Boolean.TRUE);
|
||||
|
||||
|
||||
paths = entry.getExclusionPatterns();
|
||||
|
||||
|
||||
for(int j = 0; j < paths.length; j++){
|
||||
IPath path = paths[j];
|
||||
PathSettingsContainer exclusion = entryCr.getChildContainer(path, true, true);
|
||||
if(exclusion.getValue() == null)
|
||||
exclusion.setValue(Boolean.FALSE);
|
||||
// if(null == exclusionMap.get(path))
|
||||
// exclusionMap.put(path, Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CConfigurationData data = getConfigurationData(true);
|
||||
data.setSourcePaths((IPath[])srcPathSet.toArray(new IPath[srcPathSet.size()]));
|
||||
ICResourceDescription rcDess[] = getResourceDescriptions();
|
||||
ICResourceDescription rcDes;
|
||||
Set pathSet = new HashSet();
|
||||
|
||||
for(int i = 0; i < rcDess.length; i++){
|
||||
rcDes = rcDess[i];
|
||||
IPath path = rcDes.getPath();
|
||||
pathSet.add(path);
|
||||
// Boolean b = (Boolean)exclusionMap.remove(path);
|
||||
Boolean b = (Boolean)cr.getChildContainer(path, false, false).getValue();
|
||||
assert (b != null);
|
||||
if(Boolean.TRUE == b) {
|
||||
if(rcDes.isExcluded())
|
||||
rcDes.setExcluded(false);
|
||||
} else {
|
||||
if(/*(rcDes.getType() == ICSettingBase.SETTING_FILE
|
||||
|| !((ICFolderDescription)rcDes).isRoot())
|
||||
&&*/ !rcDes.isExcluded())
|
||||
rcDes.setExcluded(true);
|
||||
}
|
||||
}
|
||||
|
||||
PathSettingsContainer crs[] = cr.getChildren(true);
|
||||
for(int i= 0; i < crs.length; i++){
|
||||
PathSettingsContainer c = crs[i];
|
||||
IPath path = c.getPath();
|
||||
if(!pathSet.remove(path)){
|
||||
Boolean b = (Boolean)c.getValue();
|
||||
assert (b != null);
|
||||
ICResourceDescription base = getResourceDescription(path, false);
|
||||
if(b == Boolean.TRUE){
|
||||
if(base.isExcluded()){
|
||||
ICResourceDescription newDes = createResourceDescription(path, base);
|
||||
if(newDes == null){
|
||||
ICResourceDescription fo = getResourceDescription(path, false);
|
||||
if(fo.getType() == ICSettingBase.SETTING_FILE){
|
||||
fo = getResourceDescription(path.removeLastSegments(1), false);
|
||||
}
|
||||
newDes = createFolderDescription(path, (ICFolderDescription)fo);
|
||||
}
|
||||
newDes.setExcluded(false);
|
||||
}
|
||||
} else {
|
||||
if(!base.isExcluded()){
|
||||
ICResourceDescription newDes = createResourceDescription(path, base);
|
||||
if(newDes == null){
|
||||
ICResourceDescription fo = getResourceDescription(path, false);
|
||||
if(fo.getType() == ICSettingBase.SETTING_FILE){
|
||||
fo = getResourceDescription(path.removeLastSegments(1), false);
|
||||
}
|
||||
newDes = createFolderDescription(path, (ICFolderDescription)fo);
|
||||
}
|
||||
newDes.setExcluded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
IProject project = fIsPreference ? null : getProjectDescription().getProject();
|
||||
if(entries != null && entries.length == 0)
|
||||
entries = null;
|
||||
entries = CDataUtil.adjustEntries(entries, false, project);
|
||||
data.setSourceEntries(entries);
|
||||
|
||||
// ICSourceEntry entry;
|
||||
// IPath entryPath;
|
||||
// IPath paths[];
|
||||
// PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
|
||||
// cr.setValue(Boolean.valueOf(getRootFolderDescription().isExcluded()));
|
||||
// Set srcPathSet = new HashSet();
|
||||
// IProject project = fIsPreference ? null : getProjectDescription().getProject();
|
||||
// IPath projPath = project != null ? project.getFullPath() : null;
|
||||
//// Map exclusionMap = new HashMap();
|
||||
//
|
||||
//// HashSet pathSet = new HashSet();
|
||||
//
|
||||
// if(entries == null){
|
||||
// IPath pasePath = projPath != null ? projPath : Path.EMPTY;
|
||||
// entries = new ICSourceEntry[]{new CSourceEntry(pasePath, null, ICLanguageSettingEntry.RESOLVED | ICLanguageSettingEntry.VALUE_WORKSPACE_PATH)};
|
||||
// }
|
||||
//
|
||||
// for(int i = 0 ; i < entries.length; i++){
|
||||
// entry = entries[i];
|
||||
// entryPath = entry.getFullPath();
|
||||
// if(projPath != null){
|
||||
// if(projPath.isPrefixOf(entryPath)){
|
||||
// entryPath = entryPath.removeFirstSegments(projPath.segmentCount());
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//// else {
|
||||
//// if(entryPath.segmentCount() > 0)
|
||||
//// entryPath = entryPath.removeFirstSegments(1);
|
||||
//// else
|
||||
//// continue;
|
||||
//// }
|
||||
// if(srcPathSet.add(entryPath)){
|
||||
// // exclusionMap.put(entryPath, Boolean.TRUE);
|
||||
// PathSettingsContainer entryCr = cr.getChildContainer(entryPath, true, true);
|
||||
// entryCr.setValue(Boolean.TRUE);
|
||||
//
|
||||
//
|
||||
// paths = entry.getExclusionPatterns();
|
||||
//
|
||||
//
|
||||
// for(int j = 0; j < paths.length; j++){
|
||||
// IPath path = paths[j];
|
||||
// PathSettingsContainer exclusion = entryCr.getChildContainer(path, true, true);
|
||||
// if(exclusion.getValue() == null)
|
||||
// exclusion.setValue(Boolean.FALSE);
|
||||
// // if(null == exclusionMap.get(path))
|
||||
// // exclusionMap.put(path, Boolean.FALSE);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// CConfigurationData data = getConfigurationData(true);
|
||||
// data.setSourcePaths((IPath[])srcPathSet.toArray(new IPath[srcPathSet.size()]));
|
||||
// ICResourceDescription rcDess[] = getResourceDescriptions();
|
||||
// ICResourceDescription rcDes;
|
||||
// Set pathSet = new HashSet();
|
||||
//
|
||||
// for(int i = 0; i < rcDess.length; i++){
|
||||
// rcDes = rcDess[i];
|
||||
// IPath path = rcDes.getPath();
|
||||
// pathSet.add(path);
|
||||
//// Boolean b = (Boolean)exclusionMap.remove(path);
|
||||
// Boolean b = (Boolean)cr.getChildContainer(path, false, false).getValue();
|
||||
// assert (b != null);
|
||||
// if(Boolean.TRUE == b) {
|
||||
// if(rcDes.isExcluded())
|
||||
// rcDes.setExcluded(false);
|
||||
// } else {
|
||||
// if(/*(rcDes.getType() == ICSettingBase.SETTING_FILE
|
||||
// || !((ICFolderDescription)rcDes).isRoot())
|
||||
// &&*/ !rcDes.isExcluded())
|
||||
// rcDes.setExcluded(true);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// PathSettingsContainer crs[] = cr.getChildren(true);
|
||||
// for(int i= 0; i < crs.length; i++){
|
||||
// PathSettingsContainer c = crs[i];
|
||||
// IPath path = c.getPath();
|
||||
// if(!pathSet.remove(path)){
|
||||
// Boolean b = (Boolean)c.getValue();
|
||||
// assert (b != null);
|
||||
// ICResourceDescription base = getResourceDescription(path, false);
|
||||
// if(b == Boolean.TRUE){
|
||||
// if(base.isExcluded()){
|
||||
// ICResourceDescription newDes = createResourceDescription(path, base);
|
||||
// if(newDes == null){
|
||||
// ICResourceDescription fo = getResourceDescription(path, false);
|
||||
// if(fo.getType() == ICSettingBase.SETTING_FILE){
|
||||
// fo = getResourceDescription(path.removeLastSegments(1), false);
|
||||
// }
|
||||
// newDes = createFolderDescription(path, (ICFolderDescription)fo);
|
||||
// }
|
||||
// newDes.setExcluded(false);
|
||||
// }
|
||||
// } else {
|
||||
// if(!base.isExcluded()){
|
||||
// ICResourceDescription newDes = createResourceDescription(path, base);
|
||||
// if(newDes == null){
|
||||
// ICResourceDescription fo = getResourceDescription(path, false);
|
||||
// if(fo.getType() == ICSettingBase.SETTING_FILE){
|
||||
// fo = getResourceDescription(path.removeLastSegments(1), false);
|
||||
// }
|
||||
// newDes = createFolderDescription(path, (ICFolderDescription)fo);
|
||||
// }
|
||||
// newDes.setExcluded(true);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
}
|
||||
|
||||
private ICResourceDescription createResourceDescription(IPath path, ICResourceDescription base){
|
||||
if(fIsPreference)
|
||||
return null;
|
||||
IProject project = getProjectDescription().getProject();
|
||||
IResource rc = project.findMember(path);
|
||||
ICResourceDescription des = null;
|
||||
if(rc != null){
|
||||
if(rc.getType() == IResource.FILE) {
|
||||
try {
|
||||
des = createFileDescription(path, base);
|
||||
} catch (WriteAccessException e) {
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
} else if (rc.getType() == IResource.FOLDER) {
|
||||
try {
|
||||
des = createFolderDescription(path, (ICFolderDescription)base);
|
||||
} catch (WriteAccessException e) {
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return des;
|
||||
}
|
||||
// private ICResourceDescription createResourceDescription(IPath path, ICResourceDescription base){
|
||||
// if(fIsPreference)
|
||||
// return null;
|
||||
// IProject project = getProjectDescription().getProject();
|
||||
// IResource rc = project.findMember(path);
|
||||
// ICResourceDescription des = null;
|
||||
// if(rc != null){
|
||||
// if(rc.getType() == IResource.FILE) {
|
||||
// try {
|
||||
// des = createFileDescription(path, base);
|
||||
// } catch (WriteAccessException e) {
|
||||
// } catch (CoreException e) {
|
||||
// }
|
||||
// } else if (rc.getType() == IResource.FOLDER) {
|
||||
// try {
|
||||
// des = createFolderDescription(path, (ICFolderDescription)base);
|
||||
// } catch (WriteAccessException e) {
|
||||
// } catch (CoreException e) {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return des;
|
||||
// }
|
||||
|
||||
public Map getReferenceInfo() {
|
||||
try {
|
||||
|
@ -737,4 +741,52 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
|||
public ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExcludeStatus) {
|
||||
return CProjectDescriptionManager.getLanguageSettingForFile(this, path, ignoreExcludeStatus);
|
||||
}
|
||||
|
||||
boolean isExcluded(IPath path){
|
||||
// if(path.segmentCount() == 0)
|
||||
// return false;
|
||||
IProject project = fIsPreference ? null : getProjectDescription().getProject();
|
||||
ICSourceEntry[] entries = getSourceEntries();
|
||||
if(project != null)
|
||||
path = project.getFullPath().append(path);
|
||||
return CDataUtil.isExcluded(path, entries);
|
||||
}
|
||||
|
||||
void setExcluded(IPath path, boolean exclude){
|
||||
// if(path.segmentCount() == 0)
|
||||
// return;
|
||||
if(isExcluded(path) == exclude)
|
||||
return;
|
||||
|
||||
IProject project = fIsPreference ? null : getProjectDescription().getProject();
|
||||
if(project != null)
|
||||
path = project.getFullPath().append(path);
|
||||
|
||||
CConfigurationData data = getConfigurationData(false);
|
||||
ICSourceEntry[] newEntries = null;
|
||||
if(project != null){
|
||||
if(!(data instanceof CConfigurationDescriptionCache)){
|
||||
ICProjectDescription roDes = CProjectDescriptionManager.getInstance().getProjectDescription(project, false);
|
||||
if(roDes != null){
|
||||
ICConfigurationDescription roCfg = roDes.getConfigurationById(getId());
|
||||
if(roCfg != null){
|
||||
newEntries = roCfg.getSourceEntries();
|
||||
if(CDataUtil.isExcluded(path, newEntries) != exclude)
|
||||
newEntries = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(newEntries == null){
|
||||
newEntries = CDataUtil.setExcluded(path, exclude, getSourceEntries());
|
||||
}
|
||||
|
||||
try {
|
||||
setSourceEntries(newEntries);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,10 +41,12 @@ 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.CTargetPlatformData;
|
||||
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.PathSettingsContainer;
|
||||
import org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager;
|
||||
import org.eclipse.cdt.internal.core.cdtvariables.StorableCdtVariables;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
|
@ -57,7 +59,7 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
|||
private List fChildList = new ArrayList();
|
||||
private CConfigurationSpecSettings fSpecSettings;
|
||||
private CConfigurationData fData;
|
||||
private ICSourceEntry fSourceEntries[];
|
||||
private ICSourceEntry fProjSourceEntries[];
|
||||
private StorableCdtVariables fMacros;
|
||||
private boolean fDataLoadded;
|
||||
private boolean fInitializing;
|
||||
|
@ -346,11 +348,19 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
|||
}
|
||||
|
||||
public ICSourceEntry[] getSourceEntries() {
|
||||
if(fSourceEntries == null){
|
||||
IPath[] paths = getSourcePaths();
|
||||
fSourceEntries = fRcHolder.calculateSourceEntriesFromPaths(getProjectDescription().getProject(), paths);
|
||||
initSourceEntries();
|
||||
return (ICSourceEntry[])fProjSourceEntries.clone();
|
||||
}
|
||||
|
||||
private void initSourceEntries(){
|
||||
if(fProjSourceEntries == null){
|
||||
IProject project = getProject();
|
||||
fProjSourceEntries = CDataUtil.adjustEntries(fSourceEntries, true, project);
|
||||
}
|
||||
return fSourceEntries;
|
||||
}
|
||||
|
||||
private IProject getProject(){
|
||||
return isPreferenceConfiguration() ? null : getProjectDescription().getProject();
|
||||
}
|
||||
|
||||
public void setSourceEntries(ICSourceEntry[] entries) {
|
||||
|
@ -451,4 +461,15 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
|||
return super.filterRcDatasToCopy(base);
|
||||
}
|
||||
|
||||
boolean isExcluded(IPath path){
|
||||
// if(path.segmentCount() == 0)
|
||||
// return false;
|
||||
|
||||
initSourceEntries();
|
||||
IProject project = getProject();
|
||||
if(project != null)
|
||||
path = project.getFullPath().append(path);
|
||||
|
||||
return CDataUtil.isExcluded(path, fProjSourceEntries);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ public class CExternalSetting implements ICExternalSetting {
|
|||
if(tmp != null)
|
||||
fExtensions = tmp.split(ATTRIBUTE_EXTENSIONS);
|
||||
|
||||
ICLanguageSettingEntry entries[] = LanguageSettingEntriesSerializer.loadEntries(element);
|
||||
|
||||
List entriesList = LanguageSettingEntriesSerializer.loadEntriesList(element, KindBasedStore.ORED_LANG_ENTRY_KINDS);
|
||||
ICLanguageSettingEntry[] entries = (ICLanguageSettingEntry[])entriesList.toArray(new ICLanguageSettingEntry[entriesList.size()]);
|
||||
initEntryStore(entries);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,16 +37,13 @@ public class CFileDescription extends CDataProxyContainer implements
|
|||
}
|
||||
|
||||
public boolean isExcluded() {
|
||||
CResourceData data = (CResourceData)getData(false);
|
||||
return data.isExcluded();
|
||||
CConfigurationDescription cfg = (CConfigurationDescription)getConfiguration();
|
||||
return cfg.isExcluded(getPath());
|
||||
}
|
||||
|
||||
public void setExcluded(boolean excluded) {
|
||||
if(isExcluded() == excluded)
|
||||
return;
|
||||
|
||||
CResourceData data = (CResourceData)getData(true);
|
||||
data.setExcluded(excluded);
|
||||
CConfigurationDescription cfg = (CConfigurationDescription)getConfiguration();
|
||||
cfg.setExcluded(getPath(), excluded);
|
||||
}
|
||||
|
||||
public void setPath(IPath path) {
|
||||
|
|
|
@ -90,4 +90,8 @@ public class CFileDescriptionCache extends CDefaultFileData implements
|
|||
public boolean hasCustomSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isExcluded() {
|
||||
return fCfg.isExcluded(getPath());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,16 +39,13 @@ public class CFolderDescription extends CDataProxyContainer implements
|
|||
}
|
||||
|
||||
public boolean isExcluded() {
|
||||
CResourceData data = (CResourceData)getData(false);
|
||||
return data.isExcluded();
|
||||
CConfigurationDescription cfg = (CConfigurationDescription)getConfiguration();
|
||||
return cfg.isExcluded(getPath());
|
||||
}
|
||||
|
||||
public void setExcluded(boolean excluded){
|
||||
if(isExcluded() == excluded)
|
||||
return;
|
||||
|
||||
CResourceData data = (CResourceData)getData(true);
|
||||
data.setExcluded(excluded);
|
||||
public void setExcluded(boolean excluded) {
|
||||
CConfigurationDescription cfg = (CConfigurationDescription)getConfiguration();
|
||||
cfg.setExcluded(getPath(), excluded);
|
||||
}
|
||||
|
||||
public void setPath(IPath path) {
|
||||
|
|
|
@ -18,10 +18,8 @@ import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
|||
import org.eclipse.cdt.core.settings.model.ICSettingContainer;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingObject;
|
||||
import org.eclipse.cdt.core.settings.model.WriteAccessException;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
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.impl.CDataFacroty;
|
||||
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultFolderData;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
@ -31,7 +29,7 @@ public class CFolderDescriptionCache extends CDefaultFolderData implements
|
|||
ICFolderDescription, ICachedData {
|
||||
private CConfigurationDescriptionCache fCfg;
|
||||
private ResourceDescriptionHolder fRcDesHolder;
|
||||
|
||||
|
||||
public CFolderDescriptionCache(CFolderData base, CConfigurationDescriptionCache cfg) {
|
||||
super(base.getId(), base.getPath(), cfg, null);
|
||||
fCfg = cfg;
|
||||
|
@ -138,6 +136,8 @@ public class CFolderDescriptionCache extends CDefaultFolderData implements
|
|||
public boolean hasCustomSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean isExcluded() {
|
||||
return fCfg.isExcluded(getPath());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public class CLanguageSettingCache extends CDefaultLanguageData implements
|
|||
private ICResourceDescription fParent;
|
||||
protected EntryStore fResolvedEntriesStore;
|
||||
private String fCachedExtensions[];
|
||||
private boolean fContainsDiscoveredScannerInfo = true;
|
||||
|
||||
public CLanguageSettingCache(CLanguageData base, CFolderDescriptionCache folderCache) {
|
||||
fId = base.getId();
|
||||
|
@ -42,7 +43,12 @@ public class CLanguageSettingCache extends CDefaultLanguageData implements
|
|||
copySettingsFrom(base);
|
||||
}
|
||||
|
||||
/* public ICLanguageSettingEntry[] getResolvedSettingEntries() {
|
||||
protected void copySettingsFrom(CLanguageData data) {
|
||||
super.copySettingsFrom(data);
|
||||
fContainsDiscoveredScannerInfo = data.containsDiscoveredScannerInfo();
|
||||
}
|
||||
|
||||
/* public ICLanguageSettingEntry[] getResolvedSettingEntries() {
|
||||
// TODO Auto-generated method stub
|
||||
return getSettingEntries();
|
||||
}
|
||||
|
@ -171,4 +177,7 @@ public class CLanguageSettingCache extends CDefaultLanguageData implements
|
|||
return entries;
|
||||
}
|
||||
|
||||
public boolean containsDiscoveredScannerInfo() {
|
||||
return fContainsDiscoveredScannerInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3211,8 +3211,8 @@ public class CProjectDescriptionManager {
|
|||
}
|
||||
|
||||
private static boolean baseSettingsCustomized(CResourceData parent, CResourceData child){
|
||||
if(parent.isExcluded() != child.isExcluded())
|
||||
return true;
|
||||
// if(parent.isExcluded() != child.isExcluded())
|
||||
// return true;
|
||||
|
||||
if(child.hasCustomSettings())
|
||||
return true;
|
||||
|
|
|
@ -54,9 +54,9 @@ public class ProviderBasedRcDesHolder extends ResourceDescriptionHolder {
|
|||
return super.getDirectChildren();
|
||||
}
|
||||
|
||||
public ICSourceEntry[] calculateSourceEntriesFromPaths(IProject project, IPath[] paths) {
|
||||
fProvider.cacheValues();
|
||||
return super.calculateSourceEntriesFromPaths(project, paths);
|
||||
}
|
||||
// public ICSourceEntry[] calculateSourceEntriesFromPaths(IProject project, IPath[] paths) {
|
||||
// fProvider.cacheValues();
|
||||
// return super.calculateSourceEntriesFromPaths(project, paths);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -13,17 +13,13 @@ package org.eclipse.cdt.internal.core.settings.model;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.CSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICFileDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.util.IPathSettingsContainerVisitor;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
public class ResourceDescriptionHolder {
|
||||
private PathSettingsContainer fPathSettingContainer;
|
||||
|
@ -111,64 +107,64 @@ public class ResourceDescriptionHolder {
|
|||
return rcDess;
|
||||
}
|
||||
|
||||
public ICSourceEntry[] calculateSourceEntriesFromPaths(IProject project, IPath paths[]){
|
||||
if(paths == null || paths.length == 0)
|
||||
paths = new IPath[]{new Path("")}; //$NON-NLS-1$
|
||||
|
||||
// Set set = new HashSet(paths.length);
|
||||
PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
|
||||
IPath pi, pj;
|
||||
List entriesList = new ArrayList(paths.length);
|
||||
IPath projPath = project != null ? project.getFullPath() : null;
|
||||
|
||||
for(int i = 0; i < paths.length; i++){
|
||||
pi = paths[i];
|
||||
// set.clear();
|
||||
cr.removeChildren();
|
||||
cr.setValue(null);
|
||||
for(int j = 0; j < paths.length; j++){
|
||||
pj = paths[j];
|
||||
if(pi != pj && pi.isPrefixOf(pj)){
|
||||
// set.add(pj);
|
||||
cr.getChildContainer(pj, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
PathSettingsContainer children[] = fPathSettingContainer.getDirectChildrenForPath(pi);
|
||||
for(int k = 0; k < children.length; k++){
|
||||
PathSettingsContainer child = children[k];
|
||||
IPath childPath = child.getPath();
|
||||
PathSettingsContainer parentExclusion = cr.getChildContainer(childPath, false, false);
|
||||
IPath parentExclusionPath = parentExclusion.getPath();
|
||||
if(parentExclusionPath.segmentCount() > 0 && !parentExclusionPath.equals(childPath) && parentExclusionPath.isPrefixOf(childPath))
|
||||
continue;
|
||||
|
||||
ICResourceDescription rcDes = (ICResourceDescription)child.getValue();
|
||||
if(rcDes.isExcluded()){
|
||||
// set.add(rcDes.getPath());
|
||||
cr.getChildContainer(childPath, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
PathSettingsContainer exclusions[] = cr.getChildren(false);
|
||||
// IPath exlusionPaths[] = new IPath[set.size()];
|
||||
IPath exlusionPaths[] = new IPath[exclusions.length];
|
||||
// int k = 0;
|
||||
int segCount = pi.segmentCount();
|
||||
// for(Iterator iter = set.iterator(); iter.hasNext(); k++) {
|
||||
// IPath path = (IPath)iter.next();
|
||||
// exlusionPaths[k] = path.removeFirstSegments(segCount).makeRelative();
|
||||
// public ICSourceEntry[] calculateSourceEntriesFromPaths(IProject project, IPath paths[]){
|
||||
// if(paths == null || paths.length == 0)
|
||||
// paths = new IPath[]{new Path("")}; //$NON-NLS-1$
|
||||
//
|
||||
//// Set set = new HashSet(paths.length);
|
||||
// PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
|
||||
// IPath pi, pj;
|
||||
// List entriesList = new ArrayList(paths.length);
|
||||
// IPath projPath = project != null ? project.getFullPath() : null;
|
||||
//
|
||||
// for(int i = 0; i < paths.length; i++){
|
||||
// pi = paths[i];
|
||||
//// set.clear();
|
||||
// cr.removeChildren();
|
||||
// cr.setValue(null);
|
||||
// for(int j = 0; j < paths.length; j++){
|
||||
// pj = paths[j];
|
||||
// if(pi != pj && pi.isPrefixOf(pj)){
|
||||
//// set.add(pj);
|
||||
// cr.getChildContainer(pj, true, true);
|
||||
// }
|
||||
// }
|
||||
for(int k = 0; k < exlusionPaths.length; k++) {
|
||||
exlusionPaths[k] = exclusions[k].getPath().removeFirstSegments(segCount).makeRelative();
|
||||
}
|
||||
if(projPath != null)
|
||||
pi = projPath.append(pi);
|
||||
entriesList.add(new CSourceEntry(pi, exlusionPaths, 0));
|
||||
}
|
||||
|
||||
return (ICSourceEntry[])entriesList.toArray(new ICSourceEntry[entriesList.size()]);
|
||||
}
|
||||
//
|
||||
// PathSettingsContainer children[] = fPathSettingContainer.getDirectChildrenForPath(pi);
|
||||
// for(int k = 0; k < children.length; k++){
|
||||
// PathSettingsContainer child = children[k];
|
||||
// IPath childPath = child.getPath();
|
||||
// PathSettingsContainer parentExclusion = cr.getChildContainer(childPath, false, false);
|
||||
// IPath parentExclusionPath = parentExclusion.getPath();
|
||||
// if(parentExclusionPath.segmentCount() > 0 && !parentExclusionPath.equals(childPath) && parentExclusionPath.isPrefixOf(childPath))
|
||||
// continue;
|
||||
//
|
||||
// ICResourceDescription rcDes = (ICResourceDescription)child.getValue();
|
||||
// if(rcDes.isExcluded()){
|
||||
//// set.add(rcDes.getPath());
|
||||
// cr.getChildContainer(childPath, true, true);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// PathSettingsContainer exclusions[] = cr.getChildren(false);
|
||||
//// IPath exlusionPaths[] = new IPath[set.size()];
|
||||
// IPath exlusionPaths[] = new IPath[exclusions.length];
|
||||
//// int k = 0;
|
||||
// int segCount = pi.segmentCount();
|
||||
//// for(Iterator iter = set.iterator(); iter.hasNext(); k++) {
|
||||
//// IPath path = (IPath)iter.next();
|
||||
//// exlusionPaths[k] = path.removeFirstSegments(segCount).makeRelative();
|
||||
//// }
|
||||
// for(int k = 0; k < exlusionPaths.length; k++) {
|
||||
// exlusionPaths[k] = exclusions[k].getPath().removeFirstSegments(segCount).makeRelative();
|
||||
// }
|
||||
// if(projPath != null)
|
||||
// pi = projPath.append(pi);
|
||||
// entriesList.add(new CSourceEntry(pi, exlusionPaths, 0));
|
||||
// }
|
||||
//
|
||||
// return (ICSourceEntry[])entriesList.toArray(new ICSourceEntry[entriesList.size()]);
|
||||
// }
|
||||
|
||||
public ICFolderDescription getParentFolderDescription(){
|
||||
PathSettingsContainer parent = fPathSettingContainer.getParentContainer();
|
||||
|
|
|
@ -352,7 +352,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
create(ti, "getName()", cd.getName()); //$NON-NLS-1$
|
||||
expand(ti, "getResourceDatas()", cd.getResourceDatas()); //$NON-NLS-1$
|
||||
update(ti, "getRootFolderData()", cd.getRootFolderData()); //$NON-NLS-1$
|
||||
expand(ti, "getSourcePaths()", cd.getSourcePaths()); //$NON-NLS-1$
|
||||
// expand(ti, "getSourcePaths()", cd.getSourcePaths()); //$NON-NLS-1$
|
||||
update(ti, "getTargetPlatformData()", cd.getTargetPlatformData()); //$NON-NLS-1$
|
||||
create(ti,"getType()",cd.getType()); //$NON-NLS-1$
|
||||
create(ti,"isValid()",cd.isValid()); //$NON-NLS-1$
|
||||
|
@ -388,7 +388,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
create(ti, "getName()", bd.getName()); //$NON-NLS-1$
|
||||
update(ti,"getPath()",bd.getPath()); //$NON-NLS-1$
|
||||
create(ti,"getType()",bd.getType()); //$NON-NLS-1$
|
||||
create(ti,"isExcluded()",bd.isExcluded()); //$NON-NLS-1$
|
||||
// create(ti,"isExcluded()",bd.isExcluded()); //$NON-NLS-1$
|
||||
create(ti,"isValid()",bd.isValid()); //$NON-NLS-1$
|
||||
return ti;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue