diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog
index 4427501bb21..04ca88b2a9b 100644
--- a/debug/org.eclipse.cdt.debug.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.core/ChangeLog
@@ -1,3 +1,8 @@
+2006-03-06 Mikhail Khodjaiants
+ Fix for Bug 93777: Postmortem and Local launch need a default preference for selected debugger.
+ * CDebugCorePlugin.java
+ * ICDebugConstants.java
+
2006-02-27 Mikhail Khodjaiants
All serializable objects should have a stable serialVersionUID.
* CDIException.java
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java
index 3e0732c40bf..1e4571924ba 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java
@@ -10,7 +10,12 @@
*******************************************************************************/
package org.eclipse.cdt.debug.core;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.internal.core.DebugConfiguration;
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
@@ -56,6 +61,8 @@ public class CDebugCorePlugin extends Plugin {
private static CDebugCorePlugin plugin;
private HashMap fDebugConfigurations;
+
+ private HashSet fActiveDebugConfigurations;
/**
* Breakpoint listener list.
@@ -158,6 +165,13 @@ public class CDebugCorePlugin extends Plugin {
}
}
+ private void initializeActiveDebugConfigurations() {
+ fActiveDebugConfigurations = new HashSet( getDebugConfigurations().length );
+ fActiveDebugConfigurations.addAll( fDebugConfigurations.keySet() );
+ String[] filteredTypes = CDebugCorePlugin.getDefault().getPluginPreferences().getString( ICDebugConstants.PREF_FILTERED_DEBUGGERS ).split( "\\," ); //$NON-NLS-1$
+ fActiveDebugConfigurations.removeAll( Arrays.asList( filteredTypes ) );
+ }
+
public ICDebugConfiguration[] getDebugConfigurations() {
if ( fDebugConfigurations == null ) {
initializeDebugConfiguration();
@@ -165,6 +179,70 @@ public class CDebugCorePlugin extends Plugin {
return (ICDebugConfiguration[])fDebugConfigurations.values().toArray( new ICDebugConfiguration[0] );
}
+ public ICDebugConfiguration[] getActiveDebugConfigurations() {
+ if ( fDebugConfigurations == null ) {
+ initializeDebugConfiguration();
+ }
+ if ( fActiveDebugConfigurations == null ) {
+ initializeActiveDebugConfigurations();
+ }
+ ArrayList list = new ArrayList( fActiveDebugConfigurations.size() );
+ Iterator it = fActiveDebugConfigurations.iterator();
+ while( it.hasNext() ) {
+ Object o = fDebugConfigurations.get( it.next() );
+ if ( o != null )
+ list.add( o );
+ }
+ return (ICDebugConfiguration[])list.toArray( new ICDebugConfiguration[list.size()] );
+ }
+
+ public ICDebugConfiguration[] getDefaultActiveDebugConfigurations() {
+ List filtered = Arrays.asList( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultString( ICDebugConstants.PREF_FILTERED_DEBUGGERS ).split( "\\," ) ); //$NON-NLS-1$
+ HashMap all = (HashMap)fDebugConfigurations.clone();
+ all.keySet().removeAll( filtered );
+ return (ICDebugConfiguration[])all.values().toArray( new ICDebugConfiguration[all.size()] );
+ }
+
+ public void saveFilteredDebugConfigurations( ICDebugConfiguration[] configurations ) {
+ disposeActiveDebugConfigurations();
+ StringBuffer sb = new StringBuffer();
+ for ( int i = 0; i < configurations.length; ++i ) {
+ sb.append( configurations[i].getID() ).append( ',' );
+ }
+ CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_FILTERED_DEBUGGERS, sb.toString() );
+ CDebugCorePlugin.getDefault().savePluginPreferences();
+ }
+
+ public void saveDefaultDebugConfiguration( String id ) {
+ CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE, ( id != null ) ? id : "" ); //$NON-NLS-1$
+ }
+
+ public ICDebugConfiguration getDefaultDebugConfiguration() {
+ ICDebugConfiguration result = null;
+ try {
+ result = getDebugConfiguration( CDebugCorePlugin.getDefault().getPluginPreferences().getString( ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE ) );
+ }
+ catch( CoreException e ) {
+ }
+ return result;
+ }
+
+ public ICDebugConfiguration getDefaultDefaultDebugConfiguration() {
+ ICDebugConfiguration result = null;
+ try {
+ result = getDebugConfiguration( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultString( ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE ) );
+ }
+ catch( CoreException e ) {
+ }
+ if ( result == null ) {
+ }
+ return result;
+ }
+
+ public boolean isDefaultDebugConfiguration( String id ) {
+ return id.compareTo( CDebugCorePlugin.getDefault().getPluginPreferences().getString( ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE ) ) == 0;
+ }
+
public ICDebugConfiguration getDebugConfiguration( String id ) throws CoreException {
if ( fDebugConfigurations == null ) {
initializeDebugConfiguration();
@@ -265,6 +343,7 @@ public class CDebugCorePlugin extends Plugin {
disposeBreakpointListenersList();
resetBreakpointsInstallCount();
disposeCommonSourceLookupDirector();
+ disposeDebugConfigurations();
super.stop( context );
}
@@ -299,4 +378,19 @@ public class CDebugCorePlugin extends Plugin {
private void convertSourceLocations( CommonSourceLookupDirector director ) {
director.setSourceContainers( SourceUtils.convertSourceLocations( getCommonSourceLocations() ) );
}
+
+ private void disposeActiveDebugConfigurations() {
+ if ( fActiveDebugConfigurations != null ) {
+ fActiveDebugConfigurations.clear();
+ fActiveDebugConfigurations = null;
+ }
+ }
+
+ private void disposeDebugConfigurations() {
+ disposeActiveDebugConfigurations();
+ if ( fDebugConfigurations != null ) {
+ fDebugConfigurations.clear();
+ fDebugConfigurations = null;
+ }
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConstants.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConstants.java
index 3a2d6204830..f45644a57ca 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConstants.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConstants.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.debug.core;
+
/**
* Constant definitions for C/C++ debug plug-in.
*/
@@ -71,7 +72,19 @@ public interface ICDebugConstants {
*/
public static final int MAX_NUMBER_OF_INSTRUCTIONS = 999;
- /**
+ /**
+ * Preference that saves the default debugger type
+ * @since 3.1
+ */
+ public static final String PREF_DEFAULT_DEBUGGER_TYPE = PLUGIN_ID + ".cDebug.defaultDebugger"; //$NON-NLS-1$
+
+ /**
+ * Preference that saves the deactivated debugger types
+ * @since 3.1
+ */
+ public static final String PREF_FILTERED_DEBUGGERS = PLUGIN_ID + ".cDebug.filteredDebuggers"; //$NON-NLS-1$
+
+ /**
* Boolean preference controlling whether the instruction stepping mode should be activated.
*
* Temporary. See bugs 79872 and 80323.
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index 306bdf41121..08ec226b316 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -1,3 +1,11 @@
+2006-03-06 Mikhail Khodjaiants
+ Fix for Bug 93777: Postmortem and Local launch need a default preference for selected debugger.
+ * ICDebugHelpContextIds.java
+ + DebuggerTypesPage.java
+ * PreferenceMessages.properties
+ * plugin.properties
+ * plugin.xml
+
2006-02-27 Mikhail Khodjaiants
Discouraged access to EditorsPlugin.
Added support for SharedTextColors to CDebugUIPlugin.
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties
index cc2938e9f80..01523ba459a 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties
@@ -20,6 +20,7 @@ CDebuggerPage.name=C Debugger UI Page
MemoryPreferencePage.name=Memory View
CDebugPreferencePage.name=Debug
SourcePreferencePage.name=Common Source Lookup Path
+DebuggerTypesPreferencePage.name=Debugger Types
RunMenu.label=&Run
DebugActionSet.label=C/C++ Debug
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index b5ce05e6946..1134772ce5f 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -92,6 +92,11 @@
class="org.eclipse.cdt.debug.internal.ui.preferences.SourcePreferencePage"
id="org.eclipse.cdt.debug.ui.SourcePreferencePage">
+
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java
index 8dc6fd78069..079a585e6c3 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java
@@ -23,8 +23,7 @@ import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
*
* @since Jul 23, 2002
*/
-public interface ICDebugHelpContextIds
-{
+public interface ICDebugHelpContextIds {
/**
* C/C++ Debug UI plug-in identifier (value "org.eclipse.cdt.debug.ui"
).
*/
@@ -62,6 +61,7 @@ public interface ICDebugHelpContextIds
public static final String SHARED_LIBRARIES_PREFERENCE_PAGE = PREFIX + "shared_libraries_preference_page_context"; //$NON-NLS-1$
public static final String MEMORY_PREFERENCE_PAGE = PREFIX + "memory_preference_page_context"; //$NON-NLS-1$
public static final String C_DEBUG_PREFERENCE_PAGE = PREFIX + "c_debug_preference_page_context"; //$NON-NLS-1$
+ public static final String DEBUGGER_TYPES_PAGE = PREFIX + "debugger_typpes_preference_page_context"; //$NON-NLS-1$
// dialogs
public static final String SOURCE_PATH_MAPPING_DIALOG = PREFIX + "source_path_mapping_dialog_context"; //$NON-NLS-1$
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/DebuggerTypesPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/DebuggerTypesPage.java
new file mode 100644
index 00000000000..842f874be62
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/DebuggerTypesPage.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * 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 Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.preferences;
+
+import java.text.MessageFormat;
+import java.util.Arrays;
+import java.util.List;
+import org.eclipse.cdt.debug.core.CDebugCorePlugin;
+import org.eclipse.cdt.debug.core.ICDebugConfiguration;
+import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
+import org.eclipse.cdt.debug.internal.ui.PixelConverter;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.CheckedListDialogField;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.DialogField;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.IListAdapter;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * The "Debugger Types" preference page.
+ */
+public class DebuggerTypesPage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ protected static String[] fgButtonLabels = new String[] { PreferenceMessages.getString( "DebuggerTypesPage.0" ), PreferenceMessages.getString( "DebuggerTypesPage.1" ), PreferenceMessages.getString( "DebuggerTypesPage.2" ) }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ /**
+ * Comment for DebuggerTypesPage.
+ */
+ class DebuggerTypesDialogField extends CheckedListDialogField {
+
+ public DebuggerTypesDialogField() {
+ super( new IListAdapter() {
+ public void customButtonPressed( DialogField field, int index ) {
+ }
+
+ public void selectionChanged( DialogField field ) {
+ }
+ }, fgButtonLabels, new DebuggerTypeLabelProvider() );
+ }
+
+ public Control[] doFillIntoGrid( Composite parent, int nColumns ) {
+ PixelConverter converter = new PixelConverter( parent );
+ assertEnoughColumns( nColumns );
+ Control list = getListControl( parent );
+ GridData gd = new GridData();
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ gd.verticalAlignment = GridData.FILL;
+ gd.grabExcessVerticalSpace = true;
+ gd.horizontalSpan = nColumns - 2;
+ gd.widthHint = converter.convertWidthInCharsToPixels( 50 );
+ gd.heightHint = converter.convertHeightInCharsToPixels( 6 );
+ list.setLayoutData( gd );
+ Composite buttons = getButtonBox( parent );
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = false;
+ gd.verticalAlignment = GridData.FILL;
+ gd.grabExcessVerticalSpace = true;
+ gd.horizontalSpan = 1;
+ buttons.setLayoutData( gd );
+ return new Control[]{ list, buttons };
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.dialogfields.CheckedListDialogField#getManagedButtonState(org.eclipse.jface.viewers.ISelection, int)
+ */
+ protected boolean getManagedButtonState( ISelection sel, int index ) {
+ // Enable/disable the "Default" button
+ if ( index == 2 && sel instanceof IStructuredSelection ) {
+ Object o = ((IStructuredSelection)sel).getFirstElement();
+ return o != null && isChecked( o );
+ }
+ return super.getManagedButtonState( sel, index );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.dialogfields.CheckedListDialogField#managedButtonPressed(int)
+ */
+ protected boolean managedButtonPressed( int index ) {
+ if ( index == 2 ) {
+ List list = getSelectedElements();
+ if ( !list.isEmpty() )
+ setDefault( ((ICDebugConfiguration)list.get( 0 )).getID() );
+ else
+ setDefault( null );
+ refresh();
+ }
+ return super.managedButtonPressed( index );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.dialogfields.ListDialogField#getListStyle()
+ */
+ protected int getListStyle() {
+ return SWT.BORDER + SWT.SINGLE + SWT.H_SCROLL + SWT.V_SCROLL;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.dialogfields.CheckedListDialogField#doCheckStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
+ */
+ protected void doCheckStateChanged( CheckStateChangedEvent e ) {
+ super.doCheckStateChanged( e );
+ ICDebugConfiguration dc = (ICDebugConfiguration)e.getElement();
+ if ( dc.getID().equals( getDefault() ) && !e.getChecked() ) {
+ List list = getCheckedElements();
+ setDefault( ( list.size() > 0 ) ? ((ICDebugConfiguration)list.get( 0 )).getID() : null );
+ refresh();
+ }
+ else if ( e.getChecked() && getDefault() == null ) {
+ setDefault( ((ICDebugConfiguration)e.getElement()).getID() );
+ refresh();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.dialogfields.CheckedListDialogField#checkAll(boolean)
+ */
+ public void checkAll( boolean state ) {
+ super.checkAll( state );
+ List list = getCheckedElements();
+ setDefault( ( list.size() > 0 ) ? ((ICDebugConfiguration)list.get( 0 )).getID() : null );
+ refresh();
+ }
+ }
+
+ /**
+ * Comment for DebuggerTypesPage.
+ */
+ class DebuggerTypeLabelProvider extends LabelProvider {
+
+ public String getText( Object element ) {
+ if ( element instanceof ICDebugConfiguration ) {
+ ICDebugConfiguration dc = (ICDebugConfiguration)element;
+ String label = dc.getName();
+ if ( dc.getID().equals( getDefault() ) )
+ label += MessageFormat.format( " ({0})", new String[] { PreferenceMessages.getString( "DebuggerTypesPage.3" ) } ); //$NON-NLS-1$ //$NON-NLS-2$
+ return label;
+ }
+ return super.getText( element );
+ }
+ }
+
+ private DebuggerTypesDialogField fListField;
+ private IWorkbench fWorkbench;
+ private String fDefault;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents( Composite parent ) {
+ Font font = parent.getFont();
+ Composite comp = new Composite( parent, SWT.NONE );
+ GridLayout topLayout = new GridLayout();
+ topLayout.numColumns = 3;
+ comp.setLayout( topLayout );
+ GridData gd = new GridData( GridData.FILL_BOTH );
+ comp.setLayoutData( gd );
+ comp.setFont( font );
+ Label viewerLabel = new Label( comp, SWT.LEFT );
+ viewerLabel.setText( PreferenceMessages.getString( "DebuggerTypesPage.4" ) ); //$NON-NLS-1$
+ gd = new GridData( GridData.HORIZONTAL_ALIGN_FILL );
+ gd.horizontalSpan = 3;
+ viewerLabel.setLayoutData( gd );
+ viewerLabel.setFont( font );
+ fListField = new DebuggerTypesDialogField();
+ fListField.setCheckAllButtonIndex( 0 );
+ fListField.setUncheckAllButtonIndex( 1 );
+ Dialog.applyDialogFont( comp );
+ fListField.doFillIntoGrid( comp, 3 );
+ initialize();
+ getWorkbench().getHelpSystem().setHelp( comp, ICDebugHelpContextIds.DEBUGGER_TYPES_PAGE );
+ return comp;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init( IWorkbench workbench ) {
+ fWorkbench = workbench;
+ }
+
+ private IWorkbench getWorkbench() {
+ return fWorkbench;
+ }
+
+ private void initialize() {
+ ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration();
+ setDefault( ( dc != null ) ? dc.getID() : null );
+ fListField.addElements( Arrays.asList( CDebugCorePlugin.getDefault().getDebugConfigurations() ) );
+ fListField.setCheckedElements( Arrays.asList( CDebugCorePlugin.getDefault().getActiveDebugConfigurations() ) );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performOk()
+ */
+ public boolean performOk() {
+ CDebugCorePlugin.getDefault().saveDefaultDebugConfiguration( getDefault() );
+ List elements = fListField.getElements();
+ elements.removeAll( fListField.getCheckedElements() );
+ CDebugCorePlugin.getDefault().saveFilteredDebugConfigurations( (ICDebugConfiguration[])elements.toArray( new ICDebugConfiguration[elements.size()] ) );
+ return super.performOk();
+ }
+
+ protected String getDefault() {
+ return fDefault;
+ }
+
+ protected void setDefault( String defaultConfiguration ) {
+ fDefault = defaultConfiguration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ protected void performDefaults() {
+ fListField.setCheckedElements( Arrays.asList( CDebugCorePlugin.getDefault().getDefaultActiveDebugConfigurations() ) );
+ ICDebugConfiguration defaultConfiguration = CDebugCorePlugin.getDefault().getDefaultDefaultDebugConfiguration();
+ if ( defaultConfiguration != null ) {
+ setDefault( defaultConfiguration.getID() );
+ }
+ else {
+ List list = fListField.getCheckedElements();
+ if ( !list.isEmpty() ) {
+ setDefault( ((ICDebugConfiguration)list.get( 0 )).getID() );
+ }
+ }
+ fListField.refresh();
+ super.performDefaults();
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties
index 3ddcbb74ec6..1254b5d1248 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties
@@ -24,3 +24,8 @@ CDebugPreferencePage.12=Maximum number of displayed instructions:
CDebugPreferencePage.13=The valid value range is [{0},{1}].
SourcePreferencePage.0=Common source lookup path settings.
SourcePreferencePage.0=Common S&ource Lookup Path:
+DebuggerTypesPage.0=Select All
+DebuggerTypesPage.1=Deselect All
+DebuggerTypesPage.2=Default
+DebuggerTypesPage.3=default
+DebuggerTypesPage.4=Active debugger types:
diff --git a/launch/org.eclipse.cdt.launch/ChangeLog b/launch/org.eclipse.cdt.launch/ChangeLog
index 89b931ec903..9fa345a17f2 100644
--- a/launch/org.eclipse.cdt.launch/ChangeLog
+++ b/launch/org.eclipse.cdt.launch/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-06 Mikhail Khodjaiants
+ Fix for Bug 93777: Postmortem and Local launch need a default preference for selected debugger.
+ * CApplicationLaunchShortcut.java
+ * CDebuggerTab.java
+ * CoreFileDebuggerTab.java
+
2006-02-27 Mikhail Khodjaiants
Fix for Bug 126025: CApplicationLaunchShortcut call to DebugUITools.saveAndBuild
invokes workspace wide build unnecessarily.
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
index 95fe7ea1805..e2ab20e9a11 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
@@ -107,26 +107,38 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
int candidateCount = candidateConfigs.size();
if (candidateCount < 1) {
String programCPU = bin.getCPU();
-
- // Prompt the user if more then 1 debugger.
- ICDebugConfiguration debugConfig = null;
- ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getDebugConfigurations();
- List debugList = new ArrayList(debugConfigs.length);
+ // Try default debugger first
+ ICDebugConfiguration defaultConfig = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration();
String os = Platform.getOS();
- for (int i = 0; i < debugConfigs.length; i++) {
- String platform = debugConfigs[i].getPlatform();
- if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
+ ICDebugConfiguration debugConfig = null;
+ if ( defaultConfig != null ) {
+ String platform = defaultConfig.getPlatform();
+ if (defaultConfig.supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
if (platform.equals("*") || platform.equals(os)) { //$NON-NLS-1$
- if (debugConfigs[i].supportsCPU(programCPU))
- debugList.add(debugConfigs[i]);
+ if (defaultConfig.supportsCPU(programCPU))
+ debugConfig = defaultConfig;
}
}
}
- debugConfigs = (ICDebugConfiguration[]) debugList.toArray(new ICDebugConfiguration[0]);
- if (debugConfigs.length == 1) {
- debugConfig = debugConfigs[0];
- } else if (debugConfigs.length > 1) {
- debugConfig = chooseDebugConfig(debugConfigs, mode);
+ if ( debugConfig == null ) {
+ // Prompt the user if more then 1 debugger.
+ ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
+ List debugList = new ArrayList(debugConfigs.length);
+ for (int i = 0; i < debugConfigs.length; i++) {
+ String platform = debugConfigs[i].getPlatform();
+ if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
+ if (platform.equals("*") || platform.equals(os)) { //$NON-NLS-1$
+ if (debugConfigs[i].supportsCPU(programCPU))
+ debugList.add(debugConfigs[i]);
+ }
+ }
+ }
+ debugConfigs = (ICDebugConfiguration[]) debugList.toArray(new ICDebugConfiguration[0]);
+ if (debugConfigs.length == 1) {
+ debugConfig = debugConfigs[0];
+ } else if (debugConfigs.length > 1) {
+ debugConfig = chooseDebugConfig(debugConfigs, mode);
+ }
}
if (debugConfig != null) {
configuration = createConfiguration(bin, debugConfig);
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 dffb6691caf..d77f2e23de0 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
@@ -151,7 +151,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
protected void loadDebuggerComboBox(ILaunchConfiguration config, String selection) {
ICDebugConfiguration[] debugConfigs;
String configPlatform = getPlatform(config);
- debugConfigs = CDebugCorePlugin.getDefault().getDebugConfigurations();
+ debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
Arrays.sort(debugConfigs, new Comparator() {
public int compare(Object o1, Object o2) {
@@ -167,6 +167,11 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
} else {
mode = ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN;
}
+ if (selection.equals("")) { //$NON-NLS-1$
+ ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration();
+ if (dc != null)
+ selection = dc.getID();
+ }
String defaultSelection = selection;
for (int i = 0; i < debugConfigs.length; i++) {
if (debugConfigs[i].supportsMode(mode)) {
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CoreFileDebuggerTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CoreFileDebuggerTab.java
index 5688485d59a..7158fc51ec7 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CoreFileDebuggerTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CoreFileDebuggerTab.java
@@ -127,8 +127,13 @@ public class CoreFileDebuggerTab extends AbstractCDebuggerTab {
}
protected void loadDebuggerComboBox(ILaunchConfiguration config, String selection) {
- ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getDebugConfigurations();
+ ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
String projectPlatform = getProjectPlatform(config);
+ if (selection.equals("")) { //$NON-NLS-1$
+ ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration();
+ if (dc != null)
+ selection = dc.getID();
+ }
String defaultSelection = null;
List list = new ArrayList();
for (int i = 0; i < debugConfigs.length; i++) {
@@ -138,7 +143,7 @@ public class CoreFileDebuggerTab extends AbstractCDebuggerTab {
// select first exact matching debugger for platform or
// requested selection
String debuggerPlatform = debugConfigs[i].getPlatform();
- if (defaultSelection == null && debuggerPlatform.equalsIgnoreCase(projectPlatform)) {
+ if (defaultSelection == null && (debuggerPlatform.equals("*") || projectPlatform.equals( "*" ) || debuggerPlatform.equalsIgnoreCase(projectPlatform))) { //$NON-NLS-1$ //$NON-NLS-2$
defaultSelection = debugConfigs[i].getID();
}
}