mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Additional fixes to the scanner discovery and Path Entry calculation mechanisms
This commit is contained in:
parent
51b4189f67
commit
100e69cd8b
14 changed files with 144 additions and 68 deletions
|
@ -206,7 +206,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
||||||
IRcSettingInfo[] rcInfos = calculator.getSettingInfos(cInfo.fLoadContext.getConfiguration().getOwner().getProject(), data, info, true);
|
IRcSettingInfo[] rcInfos = calculator.getSettingInfos(cInfo.fLoadContext.getConfiguration().getOwner().getProject(), data, info, true);
|
||||||
|
|
||||||
CResourceData rcDatas[] = data.getResourceDatas();
|
CResourceData rcDatas[] = data.getResourceDatas();
|
||||||
Map rcDataMap = new HashMap(rcDatas.length);
|
Map rcDataMap = new HashMap();
|
||||||
CResourceData rcData;
|
CResourceData rcData;
|
||||||
for(int i = 0; i < rcDatas.length; i++){
|
for(int i = 0; i < rcDatas.length; i++){
|
||||||
rcData = rcDatas[i];
|
rcData = rcDatas[i];
|
||||||
|
@ -214,15 +214,25 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
IRcSettingInfo rcInfo;
|
IRcSettingInfo rcInfo;
|
||||||
|
IPath path;
|
||||||
|
boolean rootSettingFound = false;
|
||||||
|
boolean fileSettingFound = false;
|
||||||
for(int i = 0; i < rcInfos.length; i++){
|
for(int i = 0; i < rcInfos.length; i++){
|
||||||
rcInfo = rcInfos[i];
|
rcInfo = rcInfos[i];
|
||||||
rcData = rcInfo.getResourceData();
|
rcData = rcInfo.getResourceData();
|
||||||
|
path = rcData.getPath();
|
||||||
|
if(path.segmentCount() != 0)
|
||||||
|
fileSettingFound = true;
|
||||||
|
else
|
||||||
|
rootSettingFound = true;
|
||||||
|
|
||||||
rcDataMap.remove(rcData.getPath());
|
rcDataMap.remove(path);
|
||||||
cache(cInfo, rcInfo);
|
cache(cInfo, rcInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(rootSettingFound && fileSettingFound)
|
||||||
|
data.getRootFolderData().setExcluded(true);
|
||||||
|
|
||||||
if(!rcDataMap.isEmpty()){
|
if(!rcDataMap.isEmpty()){
|
||||||
CResourceData tmpRcData;
|
CResourceData tmpRcData;
|
||||||
for(Iterator iter = rcDataMap.values().iterator(); iter.hasNext();){
|
for(Iterator iter = rcDataMap.values().iterator(); iter.hasNext();){
|
||||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CFileData;
|
import org.eclipse.cdt.core.settings.model.extension.CFileData;
|
||||||
|
@ -675,8 +676,46 @@ public class PerFileSettingsCalculator {
|
||||||
if(pInfo.isEmpty())
|
if(pInfo.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(projRelPath.segmentCount() == 0)
|
if(projRelPath.segmentCount() == 0){
|
||||||
|
CFolderData rootData = (CFolderData)rcSet.fRcData;
|
||||||
|
CLanguageData lDatas[] = rootData.getLanguageDatas();
|
||||||
|
IPath[] incPaths = pInfo.getIncludePaths();
|
||||||
|
IPath[] quotedIncPaths = pInfo.getQuoteIncludePaths();
|
||||||
|
IPath[] incFiles = pInfo.getIncludeFiles();
|
||||||
|
IPath[] macroFiles = pInfo.getMacroFiles();
|
||||||
|
Map symbolMap = pInfo.getSymbols();
|
||||||
|
int kinds = 0;
|
||||||
|
|
||||||
|
if(incPaths.length != 0 || quotedIncPaths.length != 0)
|
||||||
|
kinds |= ICLanguageSettingEntry.INCLUDE_PATH;
|
||||||
|
if(incFiles.length != 0)
|
||||||
|
kinds |= ICLanguageSettingEntry.INCLUDE_FILE;
|
||||||
|
if(macroFiles.length != 0)
|
||||||
|
kinds |= ICLanguageSettingEntry.MACRO_FILE;
|
||||||
|
if(symbolMap.size() != 0)
|
||||||
|
kinds |= ICLanguageSettingEntry.MACRO;
|
||||||
|
|
||||||
|
rcInfo = null;
|
||||||
|
for(int k = 0; k < lDatas.length; k++){
|
||||||
|
lData = lDatas[k];
|
||||||
|
if((lData.getSupportedEntryKinds() & kinds) == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(rcInfo == null){
|
||||||
|
rcInfo = new RcSettingInfo(rootData);
|
||||||
|
tmpList = new ArrayList(lDatas.length - k);
|
||||||
|
rcInfo.fLangInfoList = tmpList;
|
||||||
|
}
|
||||||
|
|
||||||
|
lInfo = new LangSettingInfo(lData, pInfo);
|
||||||
|
rcInfo.add(lInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rcInfo != null)
|
||||||
|
list.add(rcInfo);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
// switch(rc.getType()){
|
// switch(rc.getType()){
|
||||||
// case IResource.FILE:
|
// case IResource.FILE:
|
||||||
// projRelPath = rc.getProjectRelativePath();
|
// projRelPath = rc.getProjectRelativePath();
|
||||||
|
|
|
@ -251,9 +251,8 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean internalSetExclude(boolean excluded){
|
private boolean internalSetExclude(boolean excluded){
|
||||||
if(excluded && isRoot())
|
// if(excluded/* && isRoot()*/)
|
||||||
return isExcluded;
|
// return isExcluded;
|
||||||
|
|
||||||
return isExcluded = excluded;
|
return isExcluded = excluded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -446,7 +446,7 @@ class MockConfig implements ICConfigurationDescription {
|
||||||
public void removeStorage(String id) throws CoreException {
|
public void removeStorage(String id) throws CoreException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICLanguageSetting getLanguageSettingForFile(IPath path) {
|
public ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExludeStatus) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1239,7 +1239,7 @@ public class CoreModel {
|
||||||
if(!mngr.isNewStyleCfg(indexCfg)){
|
if(!mngr.isNewStyleCfg(indexCfg)){
|
||||||
return oldIsScannerInformationEmpty(resource);
|
return oldIsScannerInformationEmpty(resource);
|
||||||
}
|
}
|
||||||
ICLanguageSetting lSetting = indexCfg.getLanguageSettingForFile(resource.getProjectRelativePath());
|
ICLanguageSetting lSetting = indexCfg.getLanguageSettingForFile(resource.getProjectRelativePath(), false);
|
||||||
if(lSetting != null){
|
if(lSetting != null){
|
||||||
ICLanguageSettingEntry[] entries = lSetting.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH);
|
ICLanguageSettingEntry[] entries = lSetting.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH);
|
||||||
if(entries.length != 0)
|
if(entries.length != 0)
|
||||||
|
|
|
@ -360,5 +360,5 @@ public interface ICConfigurationDescription extends ICSettingContainer, ICSettin
|
||||||
* @param path - file project relative path
|
* @param path - file project relative path
|
||||||
* @return ICLanguageSetting or null if not found
|
* @return ICLanguageSetting or null if not found
|
||||||
*/
|
*/
|
||||||
ICLanguageSetting getLanguageSettingForFile(IPath path);
|
ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExludeStatus);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,10 +53,11 @@ public class CDefaultFileData extends CFileData {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void copyDataFrom(CFileData base, boolean clone){
|
protected void copyDataFrom(CFileData base, boolean clone){
|
||||||
fIsExcluded = base.isExcluded();
|
|
||||||
CLanguageData baseLanguageData = base.getLanguageData();
|
CLanguageData baseLanguageData = base.getLanguageData();
|
||||||
if(baseLanguageData != null)
|
if(baseLanguageData != null)
|
||||||
fLanguageData = copyLanguageData(baseLanguageData, clone);
|
fLanguageData = copyLanguageData(baseLanguageData, clone);
|
||||||
|
|
||||||
|
fIsExcluded = base.isExcluded();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void copyDataFrom(CFolderData base, CLanguageData baseLanguageData){
|
protected void copyDataFrom(CFolderData base, CLanguageData baseLanguageData){
|
||||||
|
|
|
@ -51,12 +51,12 @@ public class CDefaultFolderData extends CFolderData {
|
||||||
|
|
||||||
protected void copyDataFrom(CFolderData base, boolean clone){
|
protected void copyDataFrom(CFolderData base, boolean clone){
|
||||||
if(base != null){
|
if(base != null){
|
||||||
fIsExcluded = base.isExcluded();
|
|
||||||
|
|
||||||
CLanguageData lDatas[] = base.getLanguageDatas();
|
CLanguageData lDatas[] = base.getLanguageDatas();
|
||||||
for(int i = 0; i < lDatas.length; i++){
|
for(int i = 0; i < lDatas.length; i++){
|
||||||
fLanguageDatas.add(copyLanguageData(lDatas[i], clone));
|
fLanguageDatas.add(copyLanguageData(lDatas[i], clone));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fIsExcluded = base.isExcluded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -476,7 +476,7 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
||||||
IPath entryPath;
|
IPath entryPath;
|
||||||
IPath paths[];
|
IPath paths[];
|
||||||
PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
|
PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
|
||||||
cr.setValue(Boolean.TRUE);
|
cr.setValue(Boolean.valueOf(getRootFolderDescription().isExcluded()));
|
||||||
Set srcPathSet = new HashSet();
|
Set srcPathSet = new HashSet();
|
||||||
IProject project = fIsPreference ? null : getProjectDescription().getProject();
|
IProject project = fIsPreference ? null : getProjectDescription().getProject();
|
||||||
IPath projPath = project != null ? project.getFullPath() : null;
|
IPath projPath = project != null ? project.getFullPath() : null;
|
||||||
|
@ -542,9 +542,9 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
||||||
if(rcDes.isExcluded())
|
if(rcDes.isExcluded())
|
||||||
rcDes.setExcluded(false);
|
rcDes.setExcluded(false);
|
||||||
} else {
|
} else {
|
||||||
if((rcDes.getType() == ICSettingBase.SETTING_FILE
|
if(/*(rcDes.getType() == ICSettingBase.SETTING_FILE
|
||||||
|| !((ICFolderDescription)rcDes).isRoot())
|
|| !((ICFolderDescription)rcDes).isRoot())
|
||||||
&& !rcDes.isExcluded())
|
&&*/ !rcDes.isExcluded())
|
||||||
rcDes.setExcluded(true);
|
rcDes.setExcluded(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,7 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
||||||
return data.isInitializing();
|
return data.isInitializing();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICLanguageSetting getLanguageSettingForFile(IPath path) {
|
public ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExcludeStatus) {
|
||||||
return CProjectDescriptionManager.getLanguageSettingForFile(this, path);
|
return CProjectDescriptionManager.getLanguageSettingForFile(this, path, ignoreExcludeStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,6 @@ import org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager;
|
||||||
import org.eclipse.cdt.internal.core.cdtvariables.StorableCdtVariables;
|
import org.eclipse.cdt.internal.core.cdtvariables.StorableCdtVariables;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
|
|
||||||
public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
||||||
|
@ -442,8 +441,8 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
||||||
fInitializing = false;
|
fInitializing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICLanguageSetting getLanguageSettingForFile(IPath path) {
|
public ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExcludeStatus) {
|
||||||
return CProjectDescriptionManager.getLanguageSettingForFile(this, path);
|
return CProjectDescriptionManager.getLanguageSettingForFile(this, path, ignoreExcludeStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CResourceData[] filterRcDatasToCopy(CConfigurationData base) {
|
protected CResourceData[] filterRcDatasToCopy(CConfigurationData base) {
|
||||||
|
|
|
@ -71,7 +71,6 @@ import org.eclipse.cdt.core.settings.model.extension.impl.CDataFacroty;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationData;
|
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationData;
|
||||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
import org.eclipse.cdt.core.settings.model.util.CSettingEntryFactory;
|
import org.eclipse.cdt.core.settings.model.util.CSettingEntryFactory;
|
||||||
import org.eclipse.cdt.core.settings.model.util.IPathSettingsContainerVisitor;
|
|
||||||
import org.eclipse.cdt.core.settings.model.util.KindBasedStore;
|
import org.eclipse.cdt.core.settings.model.util.KindBasedStore;
|
||||||
import org.eclipse.cdt.core.settings.model.util.ListComparator;
|
import org.eclipse.cdt.core.settings.model.util.ListComparator;
|
||||||
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
||||||
|
@ -3150,12 +3149,15 @@ public class CProjectDescriptionManager {
|
||||||
map.remove(project);
|
map.remove(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ICLanguageSetting getLanguageSettingForFile(ICConfigurationDescription cfgDes, IPath path){
|
static ICLanguageSetting getLanguageSettingForFile(ICConfigurationDescription cfgDes, IPath path, boolean ignoreExcludeStatus){
|
||||||
int segCount = path.segmentCount();
|
int segCount = path.segmentCount();
|
||||||
if(segCount == 0)
|
if(segCount == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ICResourceDescription rcDes = cfgDes.getResourceDescription(path, false);
|
ICResourceDescription rcDes = cfgDes.getResourceDescription(path, false);
|
||||||
|
if(!ignoreExcludeStatus && rcDes.isExcluded())
|
||||||
|
return null;
|
||||||
|
|
||||||
if(rcDes.getType() == ICSettingBase.SETTING_FOLDER){
|
if(rcDes.getType() == ICSettingBase.SETTING_FOLDER){
|
||||||
return ((ICFolderDescription)rcDes).getLanguageSettingForFile(path.lastSegment());
|
return ((ICFolderDescription)rcDes).getLanguageSettingForFile(path.lastSegment());
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.settings.model;
|
package org.eclipse.cdt.internal.core.settings.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
import org.eclipse.cdt.core.model.IPathEntryContainer;
|
import org.eclipse.cdt.core.model.IPathEntryContainer;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
@ -19,6 +21,10 @@ public class ConfigBasedPathEntryContainer implements IPathEntryContainer {
|
||||||
public static final IPath CONTAINER_PATH = new Path("org.eclipse.cdt.core.CFG_BASED_CONTAINER"); //$NON-NLS-1$
|
public static final IPath CONTAINER_PATH = new Path("org.eclipse.cdt.core.CFG_BASED_CONTAINER"); //$NON-NLS-1$
|
||||||
private IPathEntry[] fEntries;
|
private IPathEntry[] fEntries;
|
||||||
|
|
||||||
|
public ConfigBasedPathEntryContainer(List list){
|
||||||
|
this.fEntries = (IPathEntry[])list.toArray(new IPathEntry[list.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
public ConfigBasedPathEntryContainer(IPathEntry entries[]){
|
public ConfigBasedPathEntryContainer(IPathEntry entries[]){
|
||||||
this.fEntries = (IPathEntry[])entries.clone();
|
this.fEntries = (IPathEntry[])entries.clone();
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,9 +100,10 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
||||||
|
|
||||||
public IPathEntry[] getRawPathEntries() throws CoreException {
|
public IPathEntry[] getRawPathEntries() throws CoreException {
|
||||||
ICConfigurationDescription cfg = getIndexCfg(fProject);
|
ICConfigurationDescription cfg = getIndexCfg(fProject);
|
||||||
PathEntryCollector cr = getCollector(fProject, cfg);
|
List[] es = getEntries(fProject, cfg);
|
||||||
if(cr != null){
|
if(es != null){
|
||||||
List list = cr.getEntries(null, PathEntryTranslator.INCLUDE_USER, cfg);
|
List list = new ArrayList(es[0].size() + 1);
|
||||||
|
list.addAll(es[0]);
|
||||||
list.add(CoreModel.newContainerEntry(ConfigBasedPathEntryContainer.CONTAINER_PATH));
|
list.add(CoreModel.newContainerEntry(ConfigBasedPathEntryContainer.CONTAINER_PATH));
|
||||||
return (IPathEntry[])list.toArray(new IPathEntry[list.size()]);
|
return (IPathEntry[])list.toArray(new IPathEntry[list.size()]);
|
||||||
}
|
}
|
||||||
|
@ -111,14 +112,14 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
||||||
|
|
||||||
public void setRawPathEntries(IPathEntry[] entries) throws CoreException {
|
public void setRawPathEntries(IPathEntry[] entries) throws CoreException {
|
||||||
ICConfigurationDescription cfg = getIndexCfg(fProject);
|
ICConfigurationDescription cfg = getIndexCfg(fProject);
|
||||||
PathEntryCollector cr = getCollector(fProject, cfg);
|
List es[] = getEntries(fProject, cfg);
|
||||||
if(cr != null){
|
if(es != null){
|
||||||
List sysList = cr.getEntries(null, PathEntryTranslator.INCLUDE_BUILT_INS, cfg);
|
List sysList = es[1];
|
||||||
List usrList = new ArrayList(entries.length);
|
List usrList = es[0];
|
||||||
for(int i = 0; i < entries.length; i++){
|
// for(int i = 0; i < entries.length; i++){
|
||||||
if(entries[i].getEntryKind() != IPathEntry.CDT_CONTAINER)
|
// if(entries[i].getEntryKind() != IPathEntry.CDT_CONTAINER)
|
||||||
usrList.add(entries[i]);
|
// usrList.add(entries[i]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
CProjectDescription des = (CProjectDescription)CoreModel.getDefault().getProjectDescription(fProject, true);
|
CProjectDescription des = (CProjectDescription)CoreModel.getDefault().getProjectDescription(fProject, true);
|
||||||
ICConfigurationDescription cfgDes = des.getIndexConfiguration();
|
ICConfigurationDescription cfgDes = des.getIndexConfiguration();
|
||||||
|
@ -143,6 +144,13 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void clearCachedEntries(ICProjectDescription des){
|
||||||
|
ICConfigurationDescription[] cfgDess = des.getConfigurations();
|
||||||
|
for(int i = 0; i < cfgDess.length; i++){
|
||||||
|
setCachedEntries(cfgDess[i], null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void handleEvent(CProjectDescriptionEvent event) {
|
public void handleEvent(CProjectDescriptionEvent event) {
|
||||||
IProject project = event.getProject();
|
IProject project = event.getProject();
|
||||||
if(!fProject.equals(project))
|
if(!fProject.equals(project))
|
||||||
|
@ -152,25 +160,24 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
||||||
case CProjectDescriptionEvent.APPLIED:{
|
case CProjectDescriptionEvent.APPLIED:{
|
||||||
CProjectDescription des = (CProjectDescription)event.getNewCProjectDescription();
|
CProjectDescription des = (CProjectDescription)event.getNewCProjectDescription();
|
||||||
CProjectDescription oldDes = (CProjectDescription)event.getOldCProjectDescription();
|
CProjectDescription oldDes = (CProjectDescription)event.getOldCProjectDescription();
|
||||||
IPathEntry oldCrEntries[] = null;
|
List oldCrEntries = null;
|
||||||
if(oldDes != null){
|
if(oldDes != null){
|
||||||
ICConfigurationDescription oldIndexCfg = oldDes.getIndexConfiguration();
|
ICConfigurationDescription oldIndexCfg = oldDes.getIndexConfiguration();
|
||||||
PathEntryCollector oldCr = getCachedCollector(oldIndexCfg);
|
List[] oldEs = getCachedEntries(oldIndexCfg);
|
||||||
if(oldCr != null)
|
if(oldEs != null)
|
||||||
oldCrEntries = oldCr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS, oldIndexCfg);
|
oldCrEntries = oldEs[1];
|
||||||
|
|
||||||
|
clearCachedEntries(oldDes);
|
||||||
}
|
}
|
||||||
if(des != null){
|
if(des != null){
|
||||||
//TODO: smart delta handling
|
//TODO: smart delta handling
|
||||||
ICConfigurationDescription[] cfgDess = des.getConfigurations();
|
clearCachedEntries(des);
|
||||||
for(int i = 0; i < cfgDess.length; i++){
|
|
||||||
setCachedCollector(cfgDess[i], null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(oldCrEntries != null){
|
if(oldCrEntries != null){
|
||||||
ICConfigurationDescription newIndexCfg = des.getIndexConfiguration();
|
ICConfigurationDescription newIndexCfg = des.getIndexConfiguration();
|
||||||
PathEntryCollector newCr = getCollector(fProject, newIndexCfg);
|
List[] newEs = getEntries(fProject, newIndexCfg);
|
||||||
IPathEntry[] newCrEntries = newCr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS, newIndexCfg);
|
List newCrEntries = newEs[1];
|
||||||
if(!Arrays.equals(oldCrEntries, newCrEntries)){
|
if(!Arrays.equals(oldCrEntries.toArray(), newCrEntries.toArray())){
|
||||||
CModelManager manager = CModelManager.getDefault();
|
CModelManager manager = CModelManager.getDefault();
|
||||||
ICProject cproject = manager.create(project);
|
ICProject cproject = manager.create(project);
|
||||||
|
|
||||||
|
@ -203,24 +210,37 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private static PathEntryCollector getCollector(IProject project, ICConfigurationDescription cfgDes){
|
private static List[] getEntries(IProject project, ICConfigurationDescription cfgDes){
|
||||||
if(cfgDes != null){
|
if(cfgDes != null){
|
||||||
PathEntryCollector cr = getCachedCollector(cfgDes);
|
List[] es = getCachedEntries(cfgDes);
|
||||||
if(cr == null){
|
if(es == null){
|
||||||
cr = PathEntryTranslator.collectEntries(project, cfgDes);
|
PathEntryCollector cr = PathEntryTranslator.collectEntries(project, cfgDes);
|
||||||
setCachedCollector(cfgDes, cr);
|
es = createEntriesList(cfgDes, cr);
|
||||||
|
setCachedEntries(cfgDes, es);
|
||||||
}
|
}
|
||||||
return cr;
|
return es;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PathEntryCollector getCachedCollector(ICConfigurationDescription cfgDes){
|
private static List[] createEntriesList(ICConfigurationDescription cfgDes, PathEntryCollector cr){
|
||||||
return (PathEntryCollector)cfgDes.getSessionProperty(PATH_ENTRY_COLLECTOR_PROPERTY_NAME);
|
ArrayList[] es = new ArrayList[2];
|
||||||
|
es[0] = new ArrayList();
|
||||||
|
cr.getEntries(es[0], PathEntryTranslator.INCLUDE_USER, cfgDes);
|
||||||
|
es[0].trimToSize();
|
||||||
|
es[1] = new ArrayList();
|
||||||
|
cr.getEntries(es[1], PathEntryTranslator.INCLUDE_BUILT_INS, cfgDes);
|
||||||
|
es[1].trimToSize();
|
||||||
|
|
||||||
|
return es;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setCachedCollector(ICConfigurationDescription cfgDes, PathEntryCollector cr){
|
private static List[] getCachedEntries(ICConfigurationDescription cfgDes){
|
||||||
cfgDes.setSessionProperty(PATH_ENTRY_COLLECTOR_PROPERTY_NAME, cr);
|
return (List[])cfgDes.getSessionProperty(PATH_ENTRY_COLLECTOR_PROPERTY_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setCachedEntries(ICConfigurationDescription cfgDes, List[] es){
|
||||||
|
cfgDes.setSessionProperty(PATH_ENTRY_COLLECTOR_PROPERTY_NAME, es);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static PathEntryCollector getCollector(IProject project){
|
// public static PathEntryCollector getCollector(IProject project){
|
||||||
|
@ -235,28 +255,28 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
||||||
return des.getIndexConfiguration();
|
return des.getIndexConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IPathEntry[] getContainerEntries(IProject project){
|
private static List getContainerEntries(IProject project){
|
||||||
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project, false);
|
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project, false);
|
||||||
if(des != null)
|
if(des != null)
|
||||||
return getContainerEntries(des);
|
return getContainerEntries(des);
|
||||||
return new IPathEntry[0];
|
return new ArrayList(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IPathEntry[] getContainerEntries(ICProjectDescription des){
|
private static List getContainerEntries(ICProjectDescription des){
|
||||||
ICConfigurationDescription cfg = ((CProjectDescription)des).getIndexConfiguration();
|
ICConfigurationDescription cfg = ((CProjectDescription)des).getIndexConfiguration();
|
||||||
PathEntryCollector cr = getCollector(des.getProject(), cfg);
|
List es[] = getEntries(des.getProject(), cfg);
|
||||||
if(cr != null)
|
if(es != null)
|
||||||
return cr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS, cfg);
|
return es[1];
|
||||||
return new IPathEntry[0];
|
return new ArrayList(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ConfigBasedPathEntryContainer createContainer(IProject project){
|
public static ConfigBasedPathEntryContainer createContainer(IProject project){
|
||||||
IPathEntry[] entries = getContainerEntries(project);
|
List list = getContainerEntries(project);
|
||||||
return new ConfigBasedPathEntryContainer(entries);
|
return new ConfigBasedPathEntryContainer(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ConfigBasedPathEntryContainer createContainer(ICProjectDescription des){
|
public static ConfigBasedPathEntryContainer createContainer(ICProjectDescription des){
|
||||||
IPathEntry[] entries = getContainerEntries(des);
|
List list = getContainerEntries(des);
|
||||||
return new ConfigBasedPathEntryContainer(entries);
|
return new ConfigBasedPathEntryContainer(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -388,7 +388,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
if (cf[i].isActive()) {
|
if (cf[i].isActive()) {
|
||||||
ICResourceDescription out = cf[i].getResourceDescription(path, true);
|
ICResourceDescription out = cf[i].getResourceDescription(path, true);
|
||||||
if (out != null) result |= TICK_CONFIGURATION;
|
if (out != null) result |= TICK_CONFIGURATION;
|
||||||
out = cf[i].getResourceDescription(path, false);
|
// out = cf[i].getResourceDescription(path, false);
|
||||||
if (out != null && out.isExcluded()) result |= TICK_EXCLUDE;
|
if (out != null && out.isExcluded()) result |= TICK_EXCLUDE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue