1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 281970: Cleanup based on John's review

This commit is contained in:
Marc Khouzam 2010-05-07 18:02:49 +00:00
parent 443bcd6c99
commit 6ad86fa192

View file

@ -13,9 +13,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.launching; package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
import java.util.LinkedHashSet;
import java.util.Map; import java.util.Map;
import java.util.Set;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
@ -145,16 +143,13 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
protected void initDebuggerTypes(String selection) { protected void initDebuggerTypes(String selection) {
if (fAttachMode) { if (fAttachMode) {
// Use a LinkedHashSet to keep ordering setInitializeDefault(selection.equals("") ? true : false); //$NON-NLS-1$
Set<String> set = new LinkedHashSet<String>();
set.add(LOCAL_DEBUGGER_ID);
set.add(REMOTE_DEBUGGER_ID);
if (selection.equals("")) { //$NON-NLS-1$ if (selection.equals("")) { //$NON-NLS-1$
selection = LOCAL_DEBUGGER_ID; selection = LOCAL_DEBUGGER_ID;
} }
setInitializeDefault(selection.equals("") ? true : false); //$NON-NLS-1$ loadDebuggerCombo(new String[] { LOCAL_DEBUGGER_ID, REMOTE_DEBUGGER_ID }, selection);
loadDebuggerCombo(set.toArray(new String[set.size()]), selection);
} else { } else {
if (fRemoteMode) { if (fRemoteMode) {
setDebuggerId(REMOTE_DEBUGGER_ID); setDebuggerId(REMOTE_DEBUGGER_ID);
@ -385,8 +380,9 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
} }
protected void loadDynamicDebugArea() { protected void loadDynamicDebugArea() {
Composite dynamicTabHolder = getDynamicTabHolder();
// Dispose of any current child widgets in the tab holder area // Dispose of any current child widgets in the tab holder area
Control[] children = getDynamicTabHolder().getChildren(); Control[] children = dynamicTabHolder.getChildren();
for (int i = 0; i < children.length; i++) { for (int i = 0; i < children.length; i++) {
children[i].dispose(); children[i].dispose();
} }
@ -403,18 +399,21 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
} }
} else if (debuggerId.equals(REMOTE_DEBUGGER_ID)) { } else if (debuggerId.equals(REMOTE_DEBUGGER_ID)) {
setDynamicTab(new GdbServerDebuggerPage()); setDynamicTab(new GdbServerDebuggerPage());
} else {
assert false : "Unknown debugger id"; //$NON-NLS-1$
} }
} }
setDebuggerId(debuggerId); setDebuggerId(debuggerId);
if (getDynamicTab() == null) { ICDebuggerPage debuggerPage = getDynamicTab();
if (debuggerPage == null) {
return; return;
} }
// Ask the dynamic UI to create its Control // Ask the dynamic UI to create its Control
getDynamicTab().setLaunchConfigurationDialog(getLaunchConfigurationDialog()); debuggerPage.setLaunchConfigurationDialog(getLaunchConfigurationDialog());
getDynamicTab().createControl(getDynamicTabHolder()); debuggerPage.createControl(dynamicTabHolder);
getDynamicTab().getControl().setVisible(true); debuggerPage.getControl().setVisible(true);
getDynamicTabHolder().layout(true); dynamicTabHolder.layout(true);
contentsChanged(); contentsChanged();
} }
@ -594,10 +593,10 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
tabHolderLayout.marginHeight = 0; tabHolderLayout.marginHeight = 0;
tabHolderLayout.marginWidth = 0; tabHolderLayout.marginWidth = 0;
tabHolderLayout.numColumns = 1; tabHolderLayout.numColumns = 1;
getDynamicTabHolder().setLayout(tabHolderLayout); debuggerGroup.setLayout(tabHolderLayout);
GridData gd = new GridData(GridData.FILL_BOTH); GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = colspan; gd.horizontalSpan = colspan;
getDynamicTabHolder().setLayoutData(gd); debuggerGroup.setLayoutData(gd);
} }
protected void updateComboFromSelection() { protected void updateComboFromSelection() {