mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-07 00:05:53 +02:00
A change to make discovered path entries to be displayed in UI for per-file discovery
This commit is contained in:
parent
5cb6f4c74c
commit
e421f95030
1 changed files with 57 additions and 11 deletions
|
@ -856,29 +856,31 @@ public class PathEntryTranslator {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPathEntry toPathEntry(ICConfigurationDescription cfg){
|
public IPathEntry toPathEntry(ICConfigurationDescription cfg, boolean keepPathInfo){
|
||||||
|
IPath path = keepPathInfo ? fPath : fProject.getFullPath();
|
||||||
|
|
||||||
if(fLangEntry != null){
|
if(fLangEntry != null){
|
||||||
switch(fLangEntry.getKind()){
|
switch(fLangEntry.getKind()){
|
||||||
case ICLanguageSettingEntry.INCLUDE_FILE:{
|
case ICLanguageSettingEntry.INCLUDE_FILE:{
|
||||||
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
||||||
return CoreModel.newIncludeFileEntry(fPath, null, paths[0], paths[1], getExclusionPatterns(), fIsExported);
|
return CoreModel.newIncludeFileEntry(path, null, paths[0], paths[1], getExclusionPatterns(), fIsExported);
|
||||||
}
|
}
|
||||||
case ICLanguageSettingEntry.INCLUDE_PATH:{
|
case ICLanguageSettingEntry.INCLUDE_PATH:{
|
||||||
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
||||||
ICIncludePathEntry ipe = (ICIncludePathEntry)fLangEntry;
|
ICIncludePathEntry ipe = (ICIncludePathEntry)fLangEntry;
|
||||||
return CoreModel.newIncludeEntry(fPath, paths[0], paths[1], !ipe.isLocal(), getExclusionPatterns(), fIsExported);
|
return CoreModel.newIncludeEntry(path, paths[0], paths[1], !ipe.isLocal(), getExclusionPatterns(), fIsExported);
|
||||||
}
|
}
|
||||||
case ICLanguageSettingEntry.MACRO:
|
case ICLanguageSettingEntry.MACRO:
|
||||||
return CoreModel.newMacroEntry(fPath, fLangEntry.getName(), fLangEntry.getValue(), getExclusionPatterns(), fIsExported);
|
return CoreModel.newMacroEntry(path, fLangEntry.getName(), fLangEntry.getValue(), getExclusionPatterns(), fIsExported);
|
||||||
case ICLanguageSettingEntry.MACRO_FILE:{
|
case ICLanguageSettingEntry.MACRO_FILE:{
|
||||||
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
||||||
return CoreModel.newMacroFileEntry(fPath, paths[0], null, paths[1], getExclusionPatterns(), fIsExported);
|
return CoreModel.newMacroFileEntry(path, paths[0], null, paths[1], getExclusionPatterns(), fIsExported);
|
||||||
}
|
}
|
||||||
case ICLanguageSettingEntry.LIBRARY_PATH:
|
case ICLanguageSettingEntry.LIBRARY_PATH:
|
||||||
return null;
|
return null;
|
||||||
case ICLanguageSettingEntry.LIBRARY_FILE:{
|
case ICLanguageSettingEntry.LIBRARY_FILE:{
|
||||||
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
IPath paths[] = getEntryPath(fLangEntry, cfg);
|
||||||
return CoreModel.newLibraryEntry(fPath, paths[0], paths[1], null, null, null, fIsExported);
|
return CoreModel.newLibraryEntry(path, paths[0], paths[1], null, null, null, fIsExported);
|
||||||
}
|
}
|
||||||
case ICLanguageSettingEntry.OUTPUT_PATH:
|
case ICLanguageSettingEntry.OUTPUT_PATH:
|
||||||
return CoreModel.newOutputEntry(fPath, getExclusionPatterns());
|
return CoreModel.newOutputEntry(fPath, getExclusionPatterns());
|
||||||
|
@ -914,6 +916,28 @@ public class PathEntryTranslator {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int lsKindToPeKind(int kind){
|
||||||
|
switch(kind){
|
||||||
|
case ICLanguageSettingEntry.INCLUDE_FILE:
|
||||||
|
return IPathEntry.CDT_INCLUDE_FILE;
|
||||||
|
case ICLanguageSettingEntry.INCLUDE_PATH:
|
||||||
|
return IPathEntry.CDT_INCLUDE;
|
||||||
|
case ICLanguageSettingEntry.MACRO:
|
||||||
|
return IPathEntry.CDT_MACRO;
|
||||||
|
case ICLanguageSettingEntry.MACRO_FILE:
|
||||||
|
return IPathEntry.CDT_MACRO_FILE;
|
||||||
|
case ICLanguageSettingEntry.LIBRARY_PATH:
|
||||||
|
return 0;
|
||||||
|
case ICLanguageSettingEntry.LIBRARY_FILE:
|
||||||
|
return IPathEntry.CDT_LIBRARY;
|
||||||
|
case ICLanguageSettingEntry.OUTPUT_PATH:
|
||||||
|
return IPathEntry.CDT_OUTPUT;
|
||||||
|
case ICLanguageSettingEntry.SOURCE_PATH:
|
||||||
|
return IPathEntry.CDT_SOURCE;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
public static class PathEntryCollector {
|
public static class PathEntryCollector {
|
||||||
private PathSettingsContainer fStorage;
|
private PathSettingsContainer fStorage;
|
||||||
private KindBasedStore fStore;
|
private KindBasedStore fStore;
|
||||||
|
@ -1099,11 +1123,29 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(composerList != null){
|
if(composerList != null){
|
||||||
|
PathEntryKyndStore store = new PathEntryKyndStore();
|
||||||
|
|
||||||
for(Iterator iter = composerList.iterator(); iter.hasNext();){
|
for(Iterator iter = composerList.iterator(); iter.hasNext();){
|
||||||
PathEntryComposer cs = (PathEntryComposer)iter.next();
|
PathEntryComposer cs = (PathEntryComposer)iter.next();
|
||||||
ICSettingEntry entry = cs.getSettingEntry();
|
ICSettingEntry entry = cs.getSettingEntry();
|
||||||
if(checkFilter(cs, entry, flags)){
|
if(checkFilter(cs, entry, flags)){
|
||||||
IPathEntry pe = cs.toPathEntry(cfg);
|
IPathEntry pe = null;
|
||||||
|
if(isBuiltIn(entry) && cs.getPath().segmentCount() > 1){
|
||||||
|
String name = entry.getName();
|
||||||
|
Map map = (Map)store.get(peKind);
|
||||||
|
if(map == null){
|
||||||
|
map = new HashMap();
|
||||||
|
store.put(peKind, map);
|
||||||
|
}
|
||||||
|
if(!map.containsKey(name)){
|
||||||
|
pe = cs.toPathEntry(cfg, false);
|
||||||
|
if(pe != null){
|
||||||
|
map.put(name, pe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pe = cs.toPathEntry(cfg, true);
|
||||||
|
}
|
||||||
if(pe != null)
|
if(pe != null)
|
||||||
list.add(pe);
|
list.add(pe);
|
||||||
}
|
}
|
||||||
|
@ -1114,11 +1156,10 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean checkFilter(PathEntryComposer cs, ICSettingEntry entry, int flags){
|
private static boolean checkFilter(PathEntryComposer cs, ICSettingEntry entry, int flags){
|
||||||
boolean builtIn = entry != null ?
|
boolean builtIn = isBuiltIn(entry);
|
||||||
entry.isBuiltIn() || entry.isReadOnly() : false;
|
|
||||||
|
|
||||||
if(builtIn && cs.getPath().segmentCount() > 1)
|
// if(builtIn && cs.getPath().segmentCount() > 1)
|
||||||
return false;
|
// return false;
|
||||||
if((flags & INCLUDE_BUILT_INS) != 0 && builtIn)
|
if((flags & INCLUDE_BUILT_INS) != 0 && builtIn)
|
||||||
return true;
|
return true;
|
||||||
if((flags & INCLUDE_USER) != 0 && !builtIn)
|
if((flags & INCLUDE_USER) != 0 && !builtIn)
|
||||||
|
@ -1126,6 +1167,11 @@ public class PathEntryTranslator {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isBuiltIn(ICSettingEntry entry){
|
||||||
|
return entry != null ?
|
||||||
|
entry.isBuiltIn() || entry.isReadOnly() : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List getEntries(List list, int flags, ICConfigurationDescription cfg){
|
public List getEntries(List list, int flags, ICConfigurationDescription cfg){
|
||||||
if(list == null)
|
if(list == null)
|
||||||
|
|
Loading…
Add table
Reference in a new issue