1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Update to appease the SWT versions which do not initially provide a callback when the index is set in the combo box (no SWT policy defined on this).

This commit is contained in:
Thomas Fletcher 2002-11-04 18:29:31 +00:00
parent 5a7c3f8110
commit 632e0ccde1

View file

@ -45,34 +45,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
fDCombo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
fDCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
handleDebuggerChanged();
ICDebugConfiguration debugConfig = getConfigForCurrentDebugger();
if ( debugConfig != null ) {
fRunButton.setEnabled(debugConfig.supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN));
fRunButton.setSelection(false);
fAttachButton.setEnabled(debugConfig.supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH));
fAttachButton.setSelection(false);
try {
String mode =
getLaunchConfiguration().getAttribute(
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
if (mode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN) && fRunButton.isEnabled()) {
fRunButton.setSelection(true);
}
else if (mode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH) && fAttachButton.isEnabled()) {
fAttachButton.setSelection(true);
}
if (fRunButton.getSelection() == true) {
fStopInMain.setEnabled(true);
}
else {
fStopInMain.setEnabled(false);
}
}
catch (CoreException ex) {
}
}
updateComboFromSelection();
}
});
@ -148,9 +121,43 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
}
}
fDCombo.select(selndx);
//The behaviour is undefined for if the callbacks should be triggered for this,
//so to avoid unnecessary confusion, we force an update.
updateComboFromSelection();
fDCombo.getParent().layout(true);
}
protected void updateComboFromSelection() {
handleDebuggerChanged();
ICDebugConfiguration debugConfig = getConfigForCurrentDebugger();
if ( debugConfig != null ) {
fRunButton.setEnabled(debugConfig.supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN));
fRunButton.setSelection(false);
fAttachButton.setEnabled(debugConfig.supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH));
fAttachButton.setSelection(false);
try {
String mode =
getLaunchConfiguration().getAttribute(
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
if (mode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN) && fRunButton.isEnabled()) {
fRunButton.setSelection(true);
}
else if (mode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH) && fAttachButton.isEnabled()) {
fAttachButton.setSelection(true);
}
if (fRunButton.getSelection() == true) {
fStopInMain.setEnabled(true);
}
else {
fStopInMain.setEnabled(false);
}
}
catch (CoreException ex) {
}
}
}
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
super.setDefaults(config);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, DEFAULT_STOP_AT_MAIN);