Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gvozdev2010-10-27 16:55:27 +0000
committerAndrew Gvozdev2010-10-27 16:55:27 +0000
commitcb844bdaedf5d99c03803cd498e7a9ab32f5a971 (patch)
treef728f39007bc62256bcf784a8efe7dc574a64b87
parentc02ebb3cb8fde28559d4219043dbbc049d58a84c (diff)
downloadorg.eclipse.cdt-cb844bdaedf5d99c03803cd498e7a9ab32f5a971.tar.gz
org.eclipse.cdt-cb844bdaedf5d99c03803cd498e7a9ab32f5a971.tar.xz
org.eclipse.cdt-cb844bdaedf5d99c03803cd498e7a9ab32f5a971.zip
bug 327897: [ScannerDiscovery80] Tidy up certain scanner discovery code
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryTranslator.java45
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/UtilMessages.properties2
2 files changed, 22 insertions, 25 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryTranslator.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryTranslator.java
index a2002344bc0..c0d24bccd5e 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryTranslator.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryTranslator.java
@@ -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){
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/UtilMessages.properties b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/UtilMessages.properties
index 4ca6ea0d57a..ee0d81914e2 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/UtilMessages.properties
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/UtilMessages.properties
@@ -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

Back to the top