summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Ostroukhov2011-09-28 06:42:39 (EDT)
committerAndrew Gvozdev2011-09-28 07:03:19 (EDT)
commit0a3729a913b95c7a58f3982e123368a82c7b6fcb (patch)
treec4cb0153a19f25505338ceb21db06a7f49b2acdc
parentaf1c5a901fe350bb27baf0282e40be6f2aa882b8 (diff)
downloadorg.eclipse.cdt-0a3729a913b95c7a58f3982e123368a82c7b6fcb.zip
org.eclipse.cdt-0a3729a913b95c7a58f3982e123368a82c7b6fcb.tar.gz
org.eclipse.cdt-0a3729a913b95c7a58f3982e123368a82c7b6fcb.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();