mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-11 11:05:24 +02:00
Bug #210835 : NPE in Preferences "Binary Parsers"
This commit is contained in:
parent
438bcfd697
commit
99e39db8a4
1 changed files with 27 additions and 4 deletions
|
@ -38,6 +38,7 @@ import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.CoreModelUtil;
|
import org.eclipse.cdt.core.model.CoreModelUtil;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting;
|
import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
@ -71,6 +72,8 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
||||||
protected Table table;
|
protected Table table;
|
||||||
protected CheckboxTableViewer tv;
|
protected CheckboxTableViewer tv;
|
||||||
protected Composite parserGroup;
|
protected Composite parserGroup;
|
||||||
|
|
||||||
|
private ICTargetPlatformSetting tps;
|
||||||
|
|
||||||
protected class BinaryParserConfiguration {
|
protected class BinaryParserConfiguration {
|
||||||
IExtension fExtension;
|
IExtension fExtension;
|
||||||
|
@ -167,7 +170,19 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateData(ICResourceDescription cfgd) {
|
public void updateData(ICResourceDescription cfgd) {
|
||||||
String[] ids = CoreModelUtil.getBinaryParserIds(page.getCfgsEditable());
|
String[] ids = null;
|
||||||
|
if (page.isForPrefs()) { // prefs
|
||||||
|
if (cfgd != null && cfgd.getConfiguration() != null) {
|
||||||
|
tps = cfgd.getConfiguration().getTargetPlatformSetting();
|
||||||
|
if (tps != null)
|
||||||
|
ids = tps.getBinaryParserIds();
|
||||||
|
}
|
||||||
|
if (ids == null)
|
||||||
|
ids = new String[0]; // no selection
|
||||||
|
} else { // project
|
||||||
|
ICConfigurationDescription[] cfgs = page.getCfgsEditable();
|
||||||
|
ids = CoreModelUtil.getBinaryParserIds(cfgs);
|
||||||
|
}
|
||||||
Object[] data = new Object[configMap.size()];
|
Object[] data = new Object[configMap.size()];
|
||||||
HashMap clone = new HashMap(configMap);
|
HashMap clone = new HashMap(configMap);
|
||||||
// add checked elements
|
// add checked elements
|
||||||
|
@ -292,8 +307,12 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void performDefaults() {
|
protected void performDefaults() {
|
||||||
CoreModelUtil.setBinaryParserIds(page.getCfgsEditable(), null);
|
if (page.isForProject())
|
||||||
|
CoreModelUtil.setBinaryParserIds(page.getCfgsEditable(), null);
|
||||||
|
else
|
||||||
|
if (tps != null)
|
||||||
|
tps.setBinaryParserIds(null);
|
||||||
informPages(false);
|
informPages(false);
|
||||||
updateData(getResDesc());
|
updateData(getResDesc());
|
||||||
}
|
}
|
||||||
|
@ -355,7 +374,11 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
||||||
ids[i] = ((BinaryParserConfiguration)objs[i]).getID();
|
ids[i] = ((BinaryParserConfiguration)objs[i]).getID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CoreModelUtil.setBinaryParserIds(page.getCfgsEditable(), ids);
|
if (page.isForPrefs()) {
|
||||||
|
if (tps != null) tps.setBinaryParserIds(ids);
|
||||||
|
} else {
|
||||||
|
CoreModelUtil.setBinaryParserIds(page.getCfgsEditable(), ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// This page can be displayed for project only
|
// This page can be displayed for project only
|
||||||
public boolean canBeVisible() {
|
public boolean canBeVisible() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue