mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
bug 327897: [ScannerDiscovery80] Tidy up certain scanner discovery code
This commit is contained in:
parent
c02ebb3cb8
commit
cb844bdaed
2 changed files with 22 additions and 25 deletions
|
@ -84,6 +84,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
||||
public class PathEntryTranslator {
|
||||
public static final int OP_ADD = 1;
|
||||
|
@ -2045,7 +2046,7 @@ public class PathEntryTranslator {
|
|||
PathEntryCollector child = cr.createChild(container.getPath());
|
||||
for (int kind : kinds) {
|
||||
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>();
|
||||
if(collectEntries(kind, data, list)){
|
||||
if(collectResourceDataEntries(kind, data, list)){
|
||||
ICLanguageSettingEntry[] entries = list.toArray(new ICLanguageSettingEntry[list.size()]);
|
||||
child.setEntries(kind, entries, exportedSettings);
|
||||
}
|
||||
|
@ -2058,36 +2059,32 @@ public class PathEntryTranslator {
|
|||
return cr;
|
||||
}
|
||||
|
||||
private static boolean collectEntries(int kind, CResourceData data, List<ICLanguageSettingEntry> list){
|
||||
if(data.getType() == ICSettingBase.SETTING_FOLDER){
|
||||
return collectEntries(kind, (CFolderData)data, list);
|
||||
private static boolean collectResourceDataEntries(int kind, CResourceData data, List<ICLanguageSettingEntry> list){
|
||||
CLanguageData[] lDatas = null;
|
||||
if(data instanceof CFolderData) {
|
||||
lDatas = ((CFolderData)data).getLanguageDatas();
|
||||
} else if(data instanceof CFileData) {
|
||||
CLanguageData lData = ((CFileData)data).getLanguageData();
|
||||
if (lData!=null)
|
||||
lDatas = new CLanguageData[] {lData};
|
||||
} else {
|
||||
Exception e = new Exception(UtilMessages.getString("PathEntryTranslator.1") + data.getClass().getName()); //$NON-NLS-1$
|
||||
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, e.getMessage(), e);
|
||||
CCorePlugin.log(status);
|
||||
}
|
||||
if (lDatas==null || lDatas.length==0) {
|
||||
return false;
|
||||
}
|
||||
return collectEntries(kind, (CFileData)data, list);
|
||||
}
|
||||
|
||||
private static boolean collectEntries(int kind, CFolderData data, List<ICLanguageSettingEntry> list){
|
||||
|
||||
CLanguageData lDatas[] = data.getLanguageDatas();
|
||||
boolean supported = false;
|
||||
if(lDatas != null && lDatas.length != 0){
|
||||
for (CLanguageData lData : lDatas) {
|
||||
if(collectEntries(kind, lData, list))
|
||||
supported = true;
|
||||
}
|
||||
for (CLanguageData lData : lDatas) {
|
||||
if(collectLanguageDataEntries(kind, lData, list))
|
||||
supported = true;
|
||||
}
|
||||
return supported;
|
||||
}
|
||||
|
||||
private static boolean collectEntries(int kind, CFileData data, List<ICLanguageSettingEntry> list){
|
||||
|
||||
CLanguageData lData = data.getLanguageData();
|
||||
if(lData != null){
|
||||
return collectEntries(kind, lData, list);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean collectEntries(int kind, CLanguageData lData, List<ICLanguageSettingEntry> list){
|
||||
private static boolean collectLanguageDataEntries(int kind, CLanguageData lData, List<ICLanguageSettingEntry> list){
|
||||
if((kind & lData.getSupportedEntryKinds()) != 0){
|
||||
ICLanguageSettingEntry[] entries = lData.getEntries(kind);
|
||||
if(entries != null && entries.length != 0){
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
KindBasedStore.0=illegal kind
|
||||
KindBasedStore.1=illegal kind
|
||||
PathEntryTranslator.0=illegal kind
|
||||
PathEntryTranslator.1=illegal kind
|
||||
PathEntryTranslator.1=illegal type
|
||||
PathEntryTranslator.2=PathEntryTranslator: failed to apply output entries: Build Data is null, ignoring..
|
||||
CDataSerializer.20=no id attribute for configuration
|
||||
CDataSerializer.21=failed to create configuration
|
||||
|
|
Loading…
Add table
Reference in a new issue