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

Changes in the "Debugger" tab of the launch configuration dialog.

Replaced the "Run in debugger/Attach to running process" radio button by the "Attach to running process" check box.
Added the "Advanced" button that opens the "Advanced options" dialog.
The "Automatically track the values of variables" check box is moved to the dialog.
The "CoreFileDebuggerTab" class is implemented as an extension of "CDebuggerTab".
This commit is contained in:
Mikhail Khodjaiants 2004-08-23 19:59:19 +00:00
parent 72ff239e40
commit 2798c3a121
7 changed files with 463 additions and 433 deletions

View file

@ -1,3 +1,16 @@
2004-08-23 Mikhail Khodjaiants
Changes in the "Debugger" tab of the launch configuration dialog.
Replaced the "Run in debugger/Attach to running process" radio button by
the "Attach to running process" check box.
Added the "Advanced" button that opens the "Advanced options" dialog.
The "Automatically track the values of variables" check box is moved to the dialog.
The "CoreFileDebuggerTab" class is implemented as an extension of "CDebuggerTab".
* LaunchUIPluginResources.properties
* AbstractCDebuggerTab.java
* CoreFileCLaunchConfigurationTabGroup.java
* CDebuggerTab.java
* CorefileDebuggerTab.java renamed to CoreFileDebuggerTab.java
2004-08-12 Mikhail Khodjaiants 2004-08-12 Mikhail Khodjaiants
Warning cleanup. Warning cleanup.
* CApplicationLaunchShortcut.java * CApplicationLaunchShortcut.java

View file

@ -153,10 +153,6 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
LaunchUIPlugin.errorDialog(LaunchUIPlugin.getResourceString("AbstractCDebuggerTab.ErrorLoadingDebuggerPage"), e.getStatus()); //$NON-NLS-1$ LaunchUIPlugin.errorDialog(LaunchUIPlugin.getResourceString("AbstractCDebuggerTab.ErrorLoadingDebuggerPage"), e.getStatus()); //$NON-NLS-1$
} }
setDynamicTab(tab); setDynamicTab(tab);
ICDebugConfiguration oldConfig = getDebugConfig();
if ( oldConfig != null && oldConfig != debugConfig ) {
setInitializeDefault(true);
}
} }
setDebugConfig(debugConfig); setDebugConfig(debugConfig);
if (getDynamicTab() == null) { if (getDynamicTab() == null) {

View file

@ -13,7 +13,7 @@ package org.eclipse.cdt.launch.internal.ui;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.launch.ui.CMainTab; import org.eclipse.cdt.launch.ui.CMainTab;
import org.eclipse.cdt.launch.ui.CSourceLookupTab; import org.eclipse.cdt.launch.ui.CSourceLookupTab;
import org.eclipse.cdt.launch.ui.CorefileDebuggerTab; import org.eclipse.cdt.launch.ui.CoreFileDebuggerTab;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab; import org.eclipse.debug.ui.CommonTab;
@ -28,7 +28,7 @@ public class CoreFileCLaunchConfigurationTabGroup extends AbstractLaunchConfigur
public void createTabs(ILaunchConfigurationDialog dialog, String mode) { public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] { ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
new CMainTab(), new CMainTab(),
new CorefileDebuggerTab(), new CoreFileDebuggerTab(),
new CSourceLookupTab(), new CSourceLookupTab(),
new CommonTab() new CommonTab()
}; };

View file

@ -90,13 +90,15 @@ CMainTab.Search...=Searc&h...
CMainTab.Choose_program_to_run=Choose a &program to run: CMainTab.Choose_program_to_run=Choose a &program to run:
CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}: CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}:
CDebuggerTab.Run_program_in_debugger=Run program in debugger. CDebuggerTab.Attach_to_running_process=Attach to running process
CDebuggerTab.Attach_to_running_process=Attach to running process. CDebuggerTab.Advanced_Options_Dialog_Title=Advanced Options
CDebuggerTab.Stop_at_main_on_startup=Stop at main() on startup. CDebuggerTab.Stop_at_main_on_startup=Stop at main() on startup
CDebuggerTab.Automatically_track_values_of_variables=Automatically track the values of variables. CDebuggerTab.Automatically_track_values_of_variables=Automatically track the values of variables.
CDebuggerTab.Debugger_Options=Debugger Options CDebuggerTab.Debugger_Options=Debugger Options
CDebuggerTab.Mode_not_supported=Mode ''{0}'' is not supported by selected debugger
CDebuggerTab.Advanced=Advanced...
CDebuggerTab.No_debugger_available=No debugger available CDebuggerTab.No_debugger_available=No debugger available
CDebuggerTab.Select_Debug_mode=Select a Debug mode. CDebuggerTab.CPU_is_not_supported=The CPU is not supported by selected debugger.
CEnvironmentTab.Edit_Variable=Edit Variable CEnvironmentTab.Edit_Variable=Edit Variable
CEnvironmentTab.New_Variable=New Variable CEnvironmentTab.New_Variable=New Variable

View file

@ -10,19 +10,24 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.launch.ui; package org.eclipse.cdt.launch.ui;
import java.text.MessageFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
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;
import org.eclipse.cdt.debug.core.ICDebugConfiguration; import org.eclipse.cdt.debug.core.ICDebugConfiguration;
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
import org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab; import org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.ModifyListener;
@ -33,295 +38,246 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.ui.help.WorkbenchHelp;
public class CDebuggerTab extends AbstractCDebuggerTab { public class CDebuggerTab extends AbstractCDebuggerTab {
protected Combo fDCombo; public class AdvancedDebuggerOptionsDialog extends Dialog {
protected Button fStopInMain;
protected Button fAttachButton;
protected Button fRunButton;
protected Button fVarBookKeeping;
private final boolean DEFAULT_STOP_AT_MAIN = true; private Button fVarBookKeeping;
private boolean pageUpdated;
public void createControl(Composite parent) { private Map fAttributes;
GridData gd;
Composite comp = new Composite(parent, SWT.NONE); /**
setControl(comp); * Constructor for AdvancedDebuggerOptionsDialog.
*/
public AdvancedDebuggerOptionsDialog( Shell parentShell, Map attributes ) {
super( parentShell );
fAttributes = attributes;
}
WorkbenchHelp.setHelp(getControl(), ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_DEBBUGER_TAB); /* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea( Composite parent ) {
Composite composite = (Composite)super.createDialogArea( parent );
fVarBookKeeping = new Button( composite, SWT.CHECK );
fVarBookKeeping.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Automatically_track_values_of_variables" ) ); //$NON-NLS-1$
initialize();
return composite;
}
GridLayout layout = new GridLayout(2, false); private Map getAttributes() {
comp.setLayout(layout); return fAttributes;
}
Composite comboComp = new Composite(comp, SWT.NONE); protected void okPressed() {
layout = new GridLayout(2, false); saveValues();
comboComp.setLayout(layout); super.okPressed();
Label dlabel = new Label(comboComp, SWT.NONE); }
dlabel.setText(LaunchUIPlugin.getResourceString("Launch.common.DebuggerColon")); //$NON-NLS-1$
fDCombo = new Combo(comboComp, SWT.DROP_DOWN | SWT.READ_ONLY);
fDCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) { private void initialize() {
updateComboFromSelection(); Map attr = getAttributes();
} Object varBookkeeping = attr.get( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING );
}); fVarBookKeeping.setSelection( ( varBookkeeping instanceof Boolean ) ? !((Boolean)varBookkeeping).booleanValue() : true );
}
Composite radioComp = new Composite(comp, SWT.NONE); private void saveValues() {
GridLayout radioLayout = new GridLayout(2, true); Map attr = getAttributes();
radioLayout.marginHeight = 0; Boolean varBookkeeping = ( fVarBookKeeping.getSelection() ) ? Boolean.FALSE : Boolean.TRUE;
radioLayout.marginWidth = 0; attr.put( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, varBookkeeping );
radioComp.setLayout(radioLayout); updateLaunchConfigurationDialog();
fRunButton = createRadioButton(radioComp, LaunchUIPlugin.getResourceString("CDebuggerTab.Run_program_in_debugger")); //$NON-NLS-1$ }
fRunButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { /* (non-Javadoc)
if (fRunButton.getSelection() == true) { * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
fStopInMain.setEnabled(true); */
} else { protected void configureShell( Shell newShell ) {
fStopInMain.setEnabled(false); super.configureShell( newShell );
} newShell.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Advanced_Options_Dialog_Title" ) ); //$NON-NLS-1$
updateLaunchConfigurationDialog(); }
}
});
fAttachButton = createRadioButton(radioComp, LaunchUIPlugin.getResourceString("CDebuggerTab.Attach_to_running_process")); //$NON-NLS-1$
fAttachButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { /* (non-Javadoc)
updateLaunchConfigurationDialog(); * @see org.eclipse.jface.window.Window#close()
} */
}); public boolean close() {
fAttributes.clear();
Composite optionComp = new Composite(comp, SWT.NONE); return super.close();
layout = new GridLayout(2, false); }
optionComp.setLayout(layout);
gd = new GridData();
gd.horizontalSpan = 2;
optionComp.setLayoutData(gd);
fStopInMain = new Button(optionComp, SWT.CHECK);
fStopInMain.setText(LaunchUIPlugin.getResourceString("CDebuggerTab.Stop_at_main_on_startup")); //$NON-NLS-1$
fStopInMain.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
fVarBookKeeping = new Button(optionComp, SWT.CHECK);
fVarBookKeeping.setText(LaunchUIPlugin.getResourceString("CDebuggerTab.Automatically_track_values_of_variables")); //$NON-NLS-1$
fVarBookKeeping.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
Group debuggerGroup = new Group(comp, SWT.SHADOW_ETCHED_IN);
debuggerGroup.setText(LaunchUIPlugin.getResourceString("CDebuggerTab.Debugger_Options")); //$NON-NLS-1$
setDynamicTabHolder(debuggerGroup);
GridLayout tabHolderLayout = new GridLayout();
tabHolderLayout.marginHeight = 0;
tabHolderLayout.marginWidth = 0;
tabHolderLayout.numColumns = 1;
getDynamicTabHolder().setLayout(tabHolderLayout);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
getDynamicTabHolder().setLayoutData(gd);
} }
protected void loadDebuggerComboBox(ILaunchConfiguration config, String selection) { protected Combo fDCombo;
protected Button fAdvancedButton;
protected Button fStopInMain;
protected Button fAttachButton;
private Map fAdvancedAttributes = new HashMap( 5 );
private boolean fPageUpdated;
private boolean fIsInitializing = false;
public void createControl( Composite parent ) {
Composite comp = new Composite( parent, SWT.NONE );
setControl( comp );
WorkbenchHelp.setHelp( getControl(), ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_DEBBUGER_TAB );
GridLayout layout = new GridLayout( 2, true );
comp.setLayout( layout );
GridData gd = new GridData();
gd.horizontalAlignment = GridData.FILL_HORIZONTAL;
gd.grabExcessHorizontalSpace = true;
comp.setLayoutData( gd );
createDebuggerCombo( comp );
createAttachButton( comp );
createOptionsComposite( comp );
createDebuggerGroup( comp );
}
protected void loadDebuggerComboBox( ILaunchConfiguration config, String selection ) {
ICDebugConfiguration[] debugConfigs; ICDebugConfiguration[] debugConfigs;
String configPlatform = getPlatform(config); String configPlatform = getPlatform( config );
String programCPU = ICDebugConfiguration.CPU_NATIVE;
ICElement ce = getContext(config, configPlatform);
if (ce instanceof IBinary) {
IBinary bin = (IBinary) ce;
programCPU = bin.getCPU();
}
fDCombo.removeAll(); fDCombo.removeAll();
debugConfigs = CDebugCorePlugin.getDefault().getDebugConfigurations(); debugConfigs = CDebugCorePlugin.getDefault().getDebugConfigurations();
Arrays.sort(debugConfigs, new Comparator() { Arrays.sort( debugConfigs, new Comparator() {
public int compare(Object o1, Object o2) { public int compare( Object o1, Object o2 ) {
ICDebugConfiguration ic1 = (ICDebugConfiguration) o1; ICDebugConfiguration ic1 = (ICDebugConfiguration)o1;
ICDebugConfiguration ic2 = (ICDebugConfiguration) o2; ICDebugConfiguration ic2 = (ICDebugConfiguration)o2;
return ic1.getName().compareTo(ic2.getName()); return ic1.getName().compareTo( ic2.getName() );
} }
}); } );
int x = 0;
int selndx = -1; int selndx = -1;
for (int i = 0; i < debugConfigs.length; i++) { int x = 0;
if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN) for( int i = 0; i < debugConfigs.length; i++ ) {
|| debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) { if ( debugConfigs[i].supportsMode( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN ) || debugConfigs[i].supportsMode( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH ) ) {
String debuggerPlatform = debugConfigs[i].getPlatform(); String debuggerPlatform = debugConfigs[i].getPlatform();
if (debuggerPlatform.equalsIgnoreCase(configPlatform) if ( validatePlatform( config, debugConfigs[i] ) ) {
|| (debuggerPlatform.equalsIgnoreCase("*"))) { //$NON-NLS-1$ fDCombo.add( debugConfigs[i].getName() );
if (debugConfigs[i].supportsCPU(programCPU)) { fDCombo.setData( Integer.toString( x ), debugConfigs[i] );
fDCombo.add(debugConfigs[i].getName()); // select first exact matching debugger for platform or requested selection
fDCombo.setData(Integer.toString(x), debugConfigs[i]); if ( (selndx == -1 && debuggerPlatform.equalsIgnoreCase( configPlatform )) || selection.equals( debugConfigs[i].getID() ) ) {
// select first exact matching debugger for platform or requested selection selndx = x;
if ((selndx == -1 && debuggerPlatform.equalsIgnoreCase(configPlatform))
|| selection.equals(debugConfigs[i].getID())) {
selndx = x;
}
x++;
} }
x++;
} }
} }
} }
// if no selection meaning nothing in config the force initdefault on tab // if no selection meaning nothing in config the force initdefault on tab
setInitializeDefault(selection.equals("") ? true : false); //$NON-NLS-1$ setInitializeDefault( selection.equals( "" ) ? true : false ); //$NON-NLS-1$
fPageUpdated = false;
pageUpdated = false; fDCombo.select( selndx == -1 ? 0 : selndx );
fDCombo.select(selndx == -1 ? 0 : selndx);
//The behaviour is undefined for if the callbacks should be triggered for this, //The behaviour is undefined for if the callbacks should be triggered for this,
//so force page update if needed. //so force page update if needed.
if (!pageUpdated) { if ( !fPageUpdated ) {
updateComboFromSelection(); updateComboFromSelection();
} }
pageUpdated = false; fPageUpdated = false;
getControl().getParent().layout(true); getControl().getParent().layout( true );
} }
protected void updateComboFromSelection() { protected void updateComboFromSelection() {
pageUpdated = true; fPageUpdated = true;
handleDebuggerChanged(); handleDebuggerChanged();
ICDebugConfiguration debugConfig = getConfigForCurrentDebugger(); initializeCommonControls( getLaunchConfigurationWorkingCopy() );
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) {
}
}
updateLaunchConfigurationDialog(); updateLaunchConfigurationDialog();
} }
public void setDefaults(ILaunchConfigurationWorkingCopy config) { public void setDefaults( ILaunchConfigurationWorkingCopy config ) {
super.setDefaults(config); super.setDefaults( config );
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, DEFAULT_STOP_AT_MAIN); config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT );
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false); config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false );
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
} }
public void activated(ILaunchConfigurationWorkingCopy workingCopy) { public void initializeFrom( ILaunchConfiguration config ) {
super.activated(workingCopy); setInitializing( true );
super.initializeFrom( config );
try { try {
String id = workingCopy.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, ""); //$NON-NLS-1$ String id = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, "" ); //$NON-NLS-1$
loadDebuggerComboBox(workingCopy, id); loadDebuggerComboBox( config, id );
} catch (CoreException e) { initializeCommonControls( config );
} }
catch( CoreException e ) {
}
setInitializing( false );
} }
public void initializeFrom(ILaunchConfiguration config) { public void performApply( ILaunchConfigurationWorkingCopy config ) {
super.initializeFrom(config); super.performApply( config );
try { if ( fAttachButton.getSelection() ) {
String id = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, ""); //$NON-NLS-1$ config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH );
loadDebuggerComboBox(config, id);
String mode = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
if (mode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
fRunButton.setSelection(true);
fAttachButton.setSelection(false);
} else if (mode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
fAttachButton.setSelection(true);
fRunButton.setSelection(false);
}
if (config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, DEFAULT_STOP_AT_MAIN) == true) {
fStopInMain.setSelection(true);
}
if (config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false) == false) {
fVarBookKeeping.setSelection(true);
}
} catch (CoreException e) {
return;
} }
else {
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, fStopInMain.getSelection() );
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
}
applyAdvancedAttributes( config );
} }
public void performApply(ILaunchConfigurationWorkingCopy config) { public boolean isValid( ILaunchConfiguration config ) {
if (isValid(config)) { if ( !validateDebuggerConfig( config ) ) {
super.performApply(config);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING,
!fVarBookKeeping.getSelection());
if (fAttachButton.getSelection() == true) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
} else {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, fStopInMain.getSelection());
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
}
}
}
public boolean isValid(ILaunchConfiguration config) {
if (!validateDebuggerConfig(config)) {
setErrorMessage(LaunchUIPlugin.getResourceString("CDebuggerTab.No_debugger_available")); //$NON-NLS-1$
return false; return false;
} }
if (super.isValid(config) == false) { ICDebugConfiguration debugConfig = getDebugConfig();
if ( debugConfig == null ) {
setErrorMessage( LaunchUIPlugin.getResourceString( "CDebuggerTab.No_debugger_available" ) ); //$NON-NLS-1$
return false; return false;
} }
if (!fRunButton.getSelection() && !fAttachButton.getSelection()) { if ( fAttachButton != null ) {
setErrorMessage(LaunchUIPlugin.getResourceString("CDebuggerTab.Select_Debug_mode")); //$NON-NLS-1$ String mode = ( fAttachButton.getSelection() ) ? ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH : ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN;
if ( !debugConfig.supportsMode( mode ) ) {
setErrorMessage( MessageFormat.format( LaunchUIPlugin.getResourceString( "CDebuggerTab.Mode_not_supported" ), new String[] { mode } ) ); //$NON-NLS-1$
return false;
}
}
if ( super.isValid( config ) == false ) {
return false; return false;
} }
return true; return true;
} }
private boolean validateDebuggerConfig(ILaunchConfiguration config) { protected boolean validatePlatform( ILaunchConfiguration config, ICDebugConfiguration debugConfig ) {
ICElement ce = getContext(config, null); String configPlatform = getPlatform( config );
String projectPlatform = getPlatform(config); String debuggerPlatform = debugConfig.getPlatform();
return ( debuggerPlatform.equals( "*" ) || debuggerPlatform.equalsIgnoreCase( configPlatform ) ); //$NON-NLS-1$
}
protected boolean validateCPU( ILaunchConfiguration config, ICDebugConfiguration debugConfig ) {
ICElement ce = getContext( config, null );
String projectCPU = ICDebugConfiguration.CPU_NATIVE; String projectCPU = ICDebugConfiguration.CPU_NATIVE;
if (ce != null) { if ( ce != null ) {
if (ce instanceof IBinary) { if ( ce instanceof IBinary ) {
IBinary bin = (IBinary) ce; IBinary bin = (IBinary)ce;
projectCPU = bin.getCPU(); projectCPU = bin.getCPU();
} }
} }
return debugConfig.supportsCPU( projectCPU );
}
protected boolean validateDebuggerConfig( ILaunchConfiguration config ) {
ICDebugConfiguration debugConfig = getDebugConfig(); ICDebugConfiguration debugConfig = getDebugConfig();
if (debugConfig == null) { if ( debugConfig == null ) {
setErrorMessage( LaunchUIPlugin.getResourceString( "CDebuggerTab.No_debugger_available" ) ); //$NON-NLS-1$
return false; return false;
} }
String debuggerPlatform = debugConfig.getPlatform(); if ( !validatePlatform( config, debugConfig ) || !validateCPU( config, debugConfig ) ) {
if (debuggerPlatform.equalsIgnoreCase(projectPlatform) setErrorMessage( LaunchUIPlugin.getResourceString( "CDebuggerTab.CPU_is_not_supported" ) ); //$NON-NLS-1$
|| (debuggerPlatform.equalsIgnoreCase("*"))) { //$NON-NLS-1$ return false;
if (debugConfig.supportsCPU(projectCPU)) {
return true;
}
} }
return false; return true;
} }
/** /**
* Return the class that implements <code>ILaunchConfigurationTab</code> that is registered against the debugger id of the * Return the class that implements <code>ILaunchConfigurationTab</code> that is registered against the debugger id of the currently selected debugger.
* currently selected debugger.
*/ */
protected ICDebugConfiguration getConfigForCurrentDebugger() { protected ICDebugConfiguration getConfigForCurrentDebugger() {
int selectedIndex = fDCombo.getSelectionIndex(); int selectedIndex = fDCombo.getSelectionIndex();
return (ICDebugConfiguration) fDCombo.getData(Integer.toString(selectedIndex)); return (ICDebugConfiguration)fDCombo.getData( Integer.toString( selectedIndex ) );
} }
/** /**
@ -331,4 +287,149 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
super.updateLaunchConfigurationDialog(); super.updateLaunchConfigurationDialog();
} }
protected void createDebuggerCombo( Composite parent ) {
Composite comboComp = new Composite( parent, SWT.NONE );
GridLayout layout = new GridLayout( 2, false );
comboComp.setLayout( layout );
Label dlabel = new Label( comboComp, SWT.NONE );
dlabel.setText( LaunchUIPlugin.getResourceString( "Launch.common.DebuggerColon" ) ); //$NON-NLS-1$
fDCombo = new Combo( comboComp, SWT.DROP_DOWN | SWT.READ_ONLY );
fDCombo.addModifyListener( new ModifyListener() {
public void modifyText( ModifyEvent e ) {
if ( !isInitializing() ) {
setInitializeDefault( true );
updateComboFromSelection();
}
}
} );
}
protected void createAttachButton( Composite parent ) {
Composite attachComp = new Composite( parent, SWT.NONE );
GridLayout attachLayout = new GridLayout();
attachLayout.marginHeight = 0;
attachLayout.marginWidth = 0;
attachComp.setLayout( attachLayout );
fAttachButton = createCheckButton( attachComp, LaunchUIPlugin.getResourceString( "CDebuggerTab.Attach_to_running_process" ) ); //$NON-NLS-1$
fAttachButton.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent e ) {
if ( !isInitializing() ) {
fStopInMain.setSelection( !fAttachButton.getSelection() );
fStopInMain.setEnabled( !fAttachButton.getSelection() );
updateLaunchConfigurationDialog();
}
}
} );
}
protected void createOptionsComposite( Composite parent ) {
Composite optionsComp = new Composite( parent, SWT.NONE );
GridLayout layout = new GridLayout( 2, true );
optionsComp.setLayout( layout );
optionsComp.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 2, 1 ) );
fStopInMain = createCheckButton( optionsComp, LaunchUIPlugin.getResourceString( "CDebuggerTab.Stop_at_main_on_startup" ) ); //$NON-NLS-1$
fStopInMain.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent e ) {
if ( !isInitializing() ) {
updateLaunchConfigurationDialog();
}
}
} );
fAdvancedButton = createPushButton( optionsComp, LaunchUIPlugin.getResourceString( "CDebuggerTab.Advanced" ), null ); //$NON-NLS-1$
GridData data = new GridData();
data.horizontalAlignment = GridData.END;
PixelConverter pc = new PixelConverter( parent );
data.widthHint = pc.convertHorizontalDLUsToPixels( IDialogConstants.BUTTON_WIDTH );
fAdvancedButton.setLayoutData( data );
fAdvancedButton.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent e ) {
Dialog dialog = new AdvancedDebuggerOptionsDialog( getShell(), getAdvancedAttributes() );
dialog.open();
}
} );
}
protected void createDebuggerGroup( Composite parent ) {
Group debuggerGroup = new Group( parent, SWT.SHADOW_ETCHED_IN );
debuggerGroup.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Debugger_Options" ) ); //$NON-NLS-1$
setDynamicTabHolder( debuggerGroup );
GridLayout tabHolderLayout = new GridLayout();
tabHolderLayout.marginHeight = 0;
tabHolderLayout.marginWidth = 0;
tabHolderLayout.numColumns = 1;
getDynamicTabHolder().setLayout( tabHolderLayout );
GridData gd = new GridData( GridData.FILL_BOTH );
gd.horizontalSpan = 2;
getDynamicTabHolder().setLayoutData( gd );
}
protected Map getAdvancedAttributes() {
return fAdvancedAttributes;
}
private void initializeAdvancedAttributes( ILaunchConfiguration config ) {
Map attr = getAdvancedAttributes();
try {
Boolean varBookkeeping = ( config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false ) ) ? Boolean.TRUE : Boolean.FALSE;
attr.put( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, varBookkeeping );
}
catch( CoreException e ) {
}
}
private void applyAdvancedAttributes( ILaunchConfigurationWorkingCopy config ) {
Map attr = getAdvancedAttributes();
Object varBookkeeping = attr.get( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING );
if ( varBookkeeping instanceof Boolean )
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, ((Boolean)varBookkeeping).booleanValue() );
}
protected Shell getShell() {
return super.getShell();
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
*/
public void dispose() {
getAdvancedAttributes().clear();
super.dispose();
}
protected void initializeCommonControls( ILaunchConfiguration config ) {
ICDebugConfiguration debugConfig = getConfigForCurrentDebugger();
try {
String mode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
fAttachButton.setEnabled( debugConfig != null && debugConfig.supportsMode( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH ) );
if ( fAttachButton.isEnabled() )
fAttachButton.setSelection( mode.equals( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH ) );
fStopInMain.setEnabled( debugConfig != null && !fAttachButton.getSelection() );
if ( fStopInMain.isEnabled() )
fStopInMain.setSelection( ( fAttachButton.getSelection() ) ? false : config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT ) );
initializeAdvancedAttributes( config );
}
catch( CoreException e ) {
}
}
protected boolean isInitializing() {
return fIsInitializing;
}
private void setInitializing( boolean isInitializing ) {
fIsInitializing = isInitializing;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab#setInitializeDefault(boolean)
*/
protected void setInitializeDefault( boolean init ) {
super.setInitializeDefault( init );
}
} }

View file

@ -0,0 +1,124 @@
/**********************************************************************
* Copyright (c) 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.ui;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.help.WorkbenchHelp;
public class CoreFileDebuggerTab extends CDebuggerTab {
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl( Composite parent ) {
Composite comp = new Composite( parent, SWT.NONE );
setControl( comp );
WorkbenchHelp.setHelp( getControl(), ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_DEBBUGER_TAB );
GridLayout topLayout = new GridLayout( 2, false );
comp.setLayout( topLayout );
createDebuggerCombo( comp );
createDebuggerGroup( comp );
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void setDefaults( ILaunchConfigurationWorkingCopy config ) {
super.setDefaults( config );
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.launch.ui.CDebuggerTab#initializeCommonControls(org.eclipse.debug.core.ILaunchConfiguration)
*/
protected void initializeCommonControls( ILaunchConfiguration config ) {
// no common controls for this tab
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void performApply( ILaunchConfigurationWorkingCopy config ) {
if ( getDebugConfig() != null ) {
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, getDebugConfig().getID() );
ILaunchConfigurationTab dynamicTab = getDynamicTab();
if ( dynamicTab == null ) {
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map)null );
}
else {
dynamicTab.performApply( config );
}
}
}
protected void loadDebuggerComboBox( ILaunchConfiguration config, String selection ) {
fDCombo.removeAll();
ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getDebugConfigurations();
String projectPlatform = getProjectPlatform( config );
int x = 0;
int selndx = -1;
for( int i = 0; i < debugConfigs.length; i++ ) {
if ( debugConfigs[i].supportsMode( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE ) ) {
if ( validatePlatform( config, debugConfigs[i] ) ) {
fDCombo.add( debugConfigs[i].getName() );
fDCombo.setData( Integer.toString( x ), debugConfigs[i] );
// select first exact matching debugger for platform or requested selection
String debuggerPlatform = debugConfigs[i].getPlatform();
if ( (selndx == -1 && debuggerPlatform.equalsIgnoreCase( projectPlatform )) || selection.equals( debugConfigs[i].getID() ) ) {
selndx = x;
}
x++;
}
}
}
// if no selection meaning nothing in config the force initdefault on tab
setInitializeDefault( selection.equals( "" ) ? true : false ); //$NON-NLS-1$
fDCombo.select( selndx == -1 ? 0 : selndx );
//The behaviour is undefined for if the callbacks should be triggered for this,
//so to avoid unnecessary confusion, we force an update.
handleDebuggerChanged();
getControl().getParent().layout( true );
}
protected boolean validatePlatform( ILaunchConfiguration config, ICDebugConfiguration debugConfig ) {
String projectPlatform = getProjectPlatform( config );
String debuggerPlatform = debugConfig.getPlatform();
return ( debuggerPlatform.equals( "*" ) || debuggerPlatform.equalsIgnoreCase( projectPlatform ) ); //$NON-NLS-1$
}
private String getProjectPlatform( ILaunchConfiguration config ) {
ICElement ce = getContext( config, null );
String projectPlatform = "*"; //$NON-NLS-1$
if ( ce != null ) {
try {
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription( ce.getCProject().getProject(), false );
if ( descriptor != null ) {
projectPlatform = descriptor.getPlatform();
}
}
catch( Exception e ) {
}
}
return projectPlatform;
}
}

View file

@ -1,206 +0,0 @@
/**********************************************************************
* Copyright (c) 2002 - 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.launch.ui;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
import org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.help.WorkbenchHelp;
public class CorefileDebuggerTab extends AbstractCDebuggerTab {
protected Combo fDCombo;
private boolean initializingComboBox = false;
public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
setControl(comp);
WorkbenchHelp.setHelp(getControl(), ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_DEBBUGER_TAB);
GridLayout topLayout = new GridLayout(2, false);
comp.setLayout(topLayout);
Label dlabel = new Label(comp, SWT.NONE);
dlabel.setText(LaunchUIPlugin.getResourceString("Launch.common.DebuggerColon")); //$NON-NLS-1$
fDCombo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
fDCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
handleDebuggerChanged();
}
});
Group debuggerGroup = new Group(comp, SWT.SHADOW_ETCHED_IN);
debuggerGroup.setText(LaunchUIPlugin.getResourceString("CorefileDebuggerTab.Debugger_Options")); //$NON-NLS-1$
setDynamicTabHolder(debuggerGroup);
GridLayout tabHolderLayout = new GridLayout();
tabHolderLayout.marginHeight = 0;
tabHolderLayout.marginWidth = 0;
tabHolderLayout.numColumns = 1;
getDynamicTabHolder().setLayout(tabHolderLayout);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
getDynamicTabHolder().setLayoutData(gd);
}
protected void loadDebuggerComboBox(ILaunchConfiguration config, String selection) {
if (initializingComboBox) {
return;
}
initializingComboBox = true;
ICDebugConfiguration[] debugConfigs;
String configPlatform = getPlatform(config);
ICElement ce = getContext(config, null);
String projectPlatform = "*"; //$NON-NLS-1$
String projectCPU = "*"; //$NON-NLS-1$
if (ce != null) {
try {
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject(), false);
if (descriptor != null) {
projectPlatform = descriptor.getPlatform();
}
IBinary bin = (IBinary) ce;
projectCPU = bin.getCPU();
} catch (Exception e) {
}
}
fDCombo.removeAll();
debugConfigs = CDebugCorePlugin.getDefault().getDebugConfigurations();
int x = 0;
int selndx = -1;
for (int i = 0; i < debugConfigs.length; i++) {
if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
String debuggerPlatform = debugConfigs[i].getPlatform();
boolean platformMatch = configPlatform.equals(projectPlatform);
if (debuggerPlatform.equalsIgnoreCase(projectPlatform) || (platformMatch && projectPlatform.equals("*"))) { //$NON-NLS-1$
if (debugConfigs[i].supportsCPU(projectCPU)) {
fDCombo.add(debugConfigs[i].getName());
fDCombo.setData(Integer.toString(x), debugConfigs[i]);
// select first exact matching debugger for platform or requested selection
if ((selndx == -1 && debuggerPlatform.equalsIgnoreCase(projectPlatform))
|| selection.equals(debugConfigs[i].getID())) {
selndx = x;
}
x++;
}
}
}
}
// if no selection meaning nothing in config the force initdefault on tab
setInitializeDefault(selection.equals("") ? true : false); //$NON-NLS-1$
fDCombo.select(selndx == -1 ? 0 : selndx);
//The behaviour is undefined for if the callbacks should be triggered for this,
//so to avoid unnecessary confusion, we force an update.
handleDebuggerChanged();
getControl().getParent().layout(true);
initializingComboBox = false;
}
public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
super.activated(workingCopy);
try {
String id = workingCopy.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, ""); //$NON-NLS-1$
if (getDebugConfig() == null || !getDebugConfig().getID().equals(id) || !validateDebuggerConfig(workingCopy)) {
loadDebuggerComboBox(workingCopy, id);
}
} catch (CoreException e) {
}
}
public void initializeFrom(ILaunchConfiguration config) {
super.initializeFrom(config);
try {
String id = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, ""); //$NON-NLS-1$
loadDebuggerComboBox(config, id);
} catch (CoreException e) {
return;
}
}
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
super.setDefaults(config);
config.setAttribute(
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
}
public boolean isValid(ILaunchConfiguration config) {
if (!validateDebuggerConfig(config)) {
setErrorMessage(LaunchUIPlugin.getResourceString("CorefileDebuggerTab.No_debugger_available")); //$NON-NLS-1$
return false;
}
return super.isValid(config);
}
private boolean validateDebuggerConfig(ILaunchConfiguration config) {
String platform = getPlatform(config);
ICElement ce = getContext(config, null);
String projectPlatform = "*"; //$NON-NLS-1$
String projectCPU = "*"; //$NON-NLS-1$
if (ce != null) {
try {
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject(), false);
if (descriptor != null) {
projectPlatform = descriptor.getPlatform();
}
IBinary bin = (IBinary) ce;
projectCPU = bin.getCPU();
} catch (Exception e) {
}
}
ICDebugConfiguration debugConfig = getDebugConfig();
if (debugConfig == null) {
return false;
}
String debuggerPlatform = debugConfig.getPlatform();
boolean platformMatch = platform.equals(projectPlatform);
if (debuggerPlatform.equalsIgnoreCase(projectPlatform) || (platformMatch && projectPlatform.equals("*"))) { //$NON-NLS-1$
if (debugConfig.supportsCPU(projectCPU)) {
return true;
}
}
return false;
}
/**
* Return the class that implements <code>ILaunchConfigurationTab</code>
* that is registered against the debugger id of the currently selected debugger.
*/
protected ICDebugConfiguration getConfigForCurrentDebugger() {
int selectedIndex = fDCombo.getSelectionIndex();
return (ICDebugConfiguration) fDCombo.getData(Integer.toString(selectedIndex));
}
/**
* @see org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab#handleDebuggerChanged()
*/
protected void handleDebuggerChanged() {
super.handleDebuggerChanged();
}
}