From 632e0ccde1eba3e686f55814268ff54ad9b735e5 Mon Sep 17 00:00:00 2001 From: Thomas Fletcher Date: Mon, 4 Nov 2002 18:29:31 +0000 Subject: [PATCH] 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). --- .../eclipse/cdt/launch/ui/CDebuggerTab.java | 63 ++++++++++--------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java index 20b482b5ba1..ffe429bb539 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java @@ -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);