1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-12 02:35:37 +02:00

bug 291869: Index out of bounds exception- if try to add DiscoveryOptionsBlock tab-cdt 6.0.1

This commit is contained in:
Andrew Gvozdev 2009-10-13 03:38:34 +00:00
parent 9ee66f7728
commit 271832d5e4

View file

@ -170,7 +170,9 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
((GridData)scEnabledButton.getLayoutData()).horizontalSpan = numColumns;
((GridData)scEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true;
// VMIR* old projects will have discovery disabled by default
scEnabledButton.setSelection(needsSCNature ? false : getBuildInfo().isAutoDiscoveryEnabled());
scEnabledButton.setSelection(needsSCNature ? false
: (getBuildInfo().isAutoDiscoveryEnabled()
&& !getBuildInfo().getSelectedProfileId().equals(ScannerConfigProfileManager.NULL_PROFILE_ID)));
scEnabledButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
enableAllControls();
@ -246,9 +248,12 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
* @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryOptionsBlock#getCurrentProfileId()
*/
protected String getCurrentProfileId() {
String selectedProfileName = profileComboBox.getItem(profileComboBox.getSelectionIndex());
String selectedProfileId = getDiscoveryProfileId(selectedProfileName);
return selectedProfileId;
int pos = profileComboBox.getSelectionIndex();
if (pos >= 0) {
String selectedProfileName = profileComboBox.getItem(pos);
return getDiscoveryProfileId(selectedProfileName);
}
return null;
}
/* (non-Javadoc)
@ -369,7 +374,7 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
private void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
if (buildInfo != null) {
scEnabledButton.setSelection(buildInfo.isAutoDiscoveryEnabled());
scEnabledButton.setSelection(buildInfo.isAutoDiscoveryEnabled() && !buildInfo.getSelectedProfileId().equals(ScannerConfigProfileManager.NULL_PROFILE_ID));
String profileId = buildInfo.getSelectedProfileId();
profileComboBox.setText(getDiscoveryProfileName(profileId));
scProblemReportingEnabledButton.setSelection(buildInfo.isProblemReportingEnabled());