summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Ostroukhov2011-09-28 06:42:39 (EDT)
committerAndrew Gvozdev2011-09-28 06:42:39 (EDT)
commit210549ba6139c0b74c9f67f2dc2ece4d626d5fc1 (patch)
tree144f03adf6324e5a2385f512c0148b0ce5d71cd4
parenta4d4dec51fd31d09a92c669267d069b333b84ec9 (diff)
downloadorg.eclipse.cdt-210549ba6139c0b74c9f67f2dc2ece4d626d5fc1.zip
org.eclipse.cdt-210549ba6139c0b74c9f67f2dc2ece4d626d5fc1.tar.gz
org.eclipse.cdt-210549ba6139c0b74c9f67f2dc2ece4d626d5fc1.tar.bz2
bug 359176: NPE in XL C++ project
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java
index 354891f..dc5365b 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java
@@ -291,7 +291,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
ICLanguageSetting langSetting = (ICLanguageSetting) items[0].getData();
if (langSetting != null) {
lang = langSetting;
- selectedLanguageId = lang.getLanguageId();
+ selectedLanguageId = getLanguageId(lang);
update();
}
}
@@ -380,20 +380,11 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
for (ICLanguageSetting langSetting : ls) {
if ((langSetting.getSupportedEntryKinds() & getKind()) != 0) {
TreeItem t = new TreeItem(langTree, SWT.NONE);
- String langId = langSetting.getLanguageId();
- if (langId != null && !langId.equals(EMPTY_STR)) {
- // Bug #178033: get language name via LangManager.
- ILanguageDescriptor langDes = LanguageManager.getInstance().getLanguageDescriptor(langId);
- if (langDes == null)
- langId = null;
- else
- langId = langDes.getName();
- }
- if (langId == null || langId.equals(EMPTY_STR))
- langId = langSetting.getName();
+ String langId = getLanguageId(langSetting);
t.setText(0, langId);
t.setData(langSetting);
- if (selectedItem == null || langSetting.getLanguageId().equals(selectedLanguageId)) {
+ if (selectedItem == null
+ || (selectedLanguageId != null && selectedLanguageId.equals(langId))) {
selectedItem = t;
lang = langSetting;
}
@@ -407,6 +398,21 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
update();
}
+ private String getLanguageId(ICLanguageSetting langSetting) {
+ String langId = langSetting.getLanguageId();
+ if (langId != null && !langId.equals(EMPTY_STR)) {
+ // Bug #178033: get language name via LangManager.
+ ILanguageDescriptor langDes = LanguageManager.getInstance().getLanguageDescriptor(langId);
+ if (langDes == null)
+ langId = null;
+ else
+ langId = langDes.getName();
+ }
+ if (langId == null || langId.equals(EMPTY_STR))
+ langId = langSetting.getName();
+ return langId;
+ }
+
private void updateExport() {
exported = new ArrayList<ICSettingEntry>();
ICExternalSetting[] extSettings = getResDesc().getConfiguration().getExternalSettings();