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 d070ce3982b..981d4dd00b2 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 @@ -44,7 +44,7 @@ public class CDebugCorePlugin extends Plugin */ public CDebugCorePlugin( IPluginDescriptor descriptor ) { - super(descriptor); + super( descriptor ); plugin = this; } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java index cac0068372e..223fbbd1893 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java @@ -50,26 +50,6 @@ import org.eclipse.debug.core.model.IProcess; */ public class CDebugModel { - /** - * Preference key for default CDI request timeout value. - */ - public static final String PREF_REQUEST_TIMEOUT = getPluginIdentifier() + ".PREF_REQUEST_TIMEOUT"; //$NON-NLS-1$ - - /** - * The default CDI request timeout when no preference is set. - */ - public static final int DEF_REQUEST_TIMEOUT = 10000; - - /** - * The minimum value the CDI request timeout can have. - */ - public static final int MIN_REQUEST_TIMEOUT = 100; - - /** - * The maximum value the CDI request timeout can have. - */ - public static final int MAX_REQUEST_TIMEOUT = Integer.MAX_VALUE; - /** * Constructor for CDebugModel. */ diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMIConstants.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMIConstants.java new file mode 100644 index 00000000000..5f672d4e89b --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMIConstants.java @@ -0,0 +1,40 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.mi.core; + +/** + * + * Constant definitions for GDB MI plug-in. + * + * @since Oct 4, 2002 + */ +public interface IMIConstants +{ + /** + * MI plug-in identifier (value "org.eclipse.cdt.debug.mi"). + */ + public static final String PLUGIN_ID = MIPlugin.getDefault().getDescriptor().getUniqueIdentifier(); + + /** + * Preference key for default MI request timeout value. + */ + public static final String PREF_REQUEST_TIMEOUT = PLUGIN_ID + ".PREF_REQUEST_TIMEOUT"; //$NON-NLS-1$ + + /** + * The default MI request timeout when no preference is set. + */ + public static final int DEF_REQUEST_TIMEOUT = 10000; + + /** + * The minimum value the MI request timeout can have. + */ + public static final int MIN_REQUEST_TIMEOUT = 100; + + /** + * The maximum value the MI request timeout can have. + */ + public static final int MAX_REQUEST_TIMEOUT = Integer.MAX_VALUE; +} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java index aefa9e18b0c..a565d4fbb8f 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java @@ -14,6 +14,7 @@ import org.eclipse.cdt.debug.mi.core.command.MITargetAttach; import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.utils.pty.PTY; import org.eclipse.cdt.utils.spawner.ProcessFactory; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPluginDescriptor; import org.eclipse.core.runtime.Plugin; @@ -21,7 +22,6 @@ import org.eclipse.core.runtime.Plugin; * GDB/MI Plugin. */ public class MIPlugin extends Plugin { - //The shared instance. private static MIPlugin plugin; @@ -171,4 +171,21 @@ public class MIPlugin extends Plugin { } // } } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.Plugin#startup() + */ + public void startup() throws CoreException { + super.startup(); + getPluginPreferences().setDefault( IMIConstants.PREF_REQUEST_TIMEOUT, IMIConstants.DEF_REQUEST_TIMEOUT ); + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.Plugin#shutdown() + */ + public void shutdown() throws CoreException { + savePluginPreferences(); + super.shutdown(); + } + } diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties b/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties index 9960270771f..efdba4504df 100644 --- a/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties +++ b/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties @@ -1,2 +1,4 @@ pluginName=C/C++ Development Tools GDB/MI CDI Debugger UI providerName=Eclipse.org + +MIPreferencePage.name=GDB MI diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml index 7e129f728cf..3ee502d8dc3 100644 --- a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml @@ -32,5 +32,14 @@ debuggerID="org.eclipse.cdt.debug.mi.core.CDebugger"> + + + + diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/IMIHelpContextIds.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/IMIHelpContextIds.java new file mode 100644 index 00000000000..dc8207c843c --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/IMIHelpContextIds.java @@ -0,0 +1,24 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.mi.internal.ui; + +/** + * + * Help context ids for the C/C++ debug ui. + *

+ * This interface contains constants only; it is not intended to be implemented + * or extended. + *

+ * + * @since Oct 4, 2002 + */ +public interface IMIHelpContextIds +{ + public static final String PREFIX = IMIUIConstants.PLUGIN_ID + "."; //$NON-NLS-1$ + + // Preference pages + public static final String MI_PREFERENCE_PAGE = PREFIX + "mi_preference_page_context"; //$NON-NLS-1$ +} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/IMIUIConstants.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/IMIUIConstants.java new file mode 100644 index 00000000000..462eeca6e46 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/IMIUIConstants.java @@ -0,0 +1,20 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.mi.internal.ui; + +/** + * + * Constant definitions for MI UI plug-in. + * + * @since Oct 4, 2002 + */ +public interface IMIUIConstants +{ + /** + * C/C++ Debug UI plug-in identifier (value "org.eclipse.cdt.debug.ui"). + */ + public static final String PLUGIN_ID = MIUIPlugin.getDefault().getDescriptor().getUniqueIdentifier(); +} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/MIPreferencePage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/MIPreferencePage.java new file mode 100644 index 00000000000..d4e3f00cfeb --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/MIPreferencePage.java @@ -0,0 +1,192 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.mi.internal.ui.preferences; + +import java.text.MessageFormat; + +import org.eclipse.cdt.debug.mi.core.IMIConstants; +import org.eclipse.cdt.debug.mi.core.MIPlugin; +import org.eclipse.cdt.debug.mi.internal.ui.IMIHelpContextIds; +import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin; +import org.eclipse.jface.preference.FieldEditor; +import org.eclipse.jface.preference.IntegerFieldEditor; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.preference.StringFieldEditor; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.swt.SWT; +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.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.help.WorkbenchHelp; + +/** + * + * Page for preferences that apply specifically to GDB MI. + * + * @since Oct 4, 2002 + */ +public class MIPreferencePage extends PreferencePage implements IWorkbenchPreferencePage +{ + // Timeout preference widgets + private IntegerFieldEditor fTimeoutText; + + /** + * Constructor for MIPreferencePage. + */ + public MIPreferencePage() + { + super(); + setPreferenceStore( MIUIPlugin.getDefault().getPreferenceStore() ); + setDescription( "General settings for GDB MI." ); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite) + */ + protected Control createContents( Composite parent ) + { + WorkbenchHelp.setHelp( getControl(), IMIHelpContextIds.MI_PREFERENCE_PAGE ); + + //The main composite + Composite composite = new Composite( parent, SWT.NULL ); + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + layout.marginHeight = 0; + layout.marginWidth = 0; + composite.setLayout( layout ); + GridData data = new GridData(); + data.verticalAlignment = GridData.FILL; + data.horizontalAlignment = GridData.FILL; + composite.setLayoutData( data ); + + createSpacer( composite, 1 ); + createCommunicationPreferences( composite ); + + setValues(); + + return composite; + } + + /** + * Creates composite group and sets the default layout data. + * + * @param parent the parent of the new composite + * @param numColumns the number of columns for the new composite + * @param labelText the text label of the new composite + * @return the newly-created composite + */ + private Composite createGroupComposite( Composite parent, int numColumns, String labelText ) + { + Group comp = new Group( parent, SWT.NONE ); + //GridLayout + GridLayout layout = new GridLayout(); + layout.numColumns = numColumns; + comp.setLayout( layout ); + //GridData + GridData gd = new GridData(); + gd.verticalAlignment = GridData.FILL; + gd.horizontalAlignment = GridData.FILL; + comp.setLayoutData( gd ); + comp.setText( labelText ); + return comp; + } + + /** + * Set the values of the component widgets based on the + * values in the preference store + */ + private void setValues() + { + fTimeoutText.setStringValue( new Integer( MIPlugin.getDefault().getPluginPreferences().getInt( IMIConstants.PREF_REQUEST_TIMEOUT ) ).toString() ); + } + + /** + * @see IPreferencePage#performOk() + */ + public boolean performOk() + { + storeValues(); + MIUIPlugin.getDefault().savePluginPreferences(); + MIPlugin.getDefault().savePluginPreferences(); + return true; + } + + /** + * Sets the default preferences. + * @see PreferencePage#performDefaults() + */ + protected void performDefaults() + { + setDefaultValues(); + super.performDefaults(); + } + + private void setDefaultValues() + { + fTimeoutText.setStringValue( new Integer( IMIConstants.DEF_REQUEST_TIMEOUT ).toString() ); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IWorkbenchPreferencePage#init(IWorkbench) + */ + public void init( IWorkbench workbench ) + { + } + + protected void createSpacer( Composite composite, int columnSpan ) + { + Label label = new Label( composite, SWT.NONE ); + GridData gd = new GridData(); + gd.horizontalSpan = columnSpan; + label.setLayoutData( gd ); + } + + private void createCommunicationPreferences( Composite composite ) + { + Composite comp = createGroupComposite( composite, 1, "Communication" ); + //Add in an intermediate composite to allow for spacing + Composite spacingComposite = new Composite( comp, SWT.NONE ); + GridLayout layout = new GridLayout(); + spacingComposite.setLayout( layout ); + GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL ); + data.horizontalSpan = 2; + spacingComposite.setLayoutData( data ); + + fTimeoutText = new IntegerFieldEditor( IMIConstants.PREF_REQUEST_TIMEOUT, "Debugger &timeout (ms):", spacingComposite ); + fTimeoutText.setPreferenceStore( MIUIPlugin.getDefault().getPreferenceStore() ); + fTimeoutText.setPreferencePage( this ); + fTimeoutText.setValidateStrategy( StringFieldEditor.VALIDATE_ON_KEY_STROKE ); + fTimeoutText.setValidRange( IMIConstants.MIN_REQUEST_TIMEOUT, IMIConstants.MAX_REQUEST_TIMEOUT ); + String minValue = Integer.toString( IMIConstants.MIN_REQUEST_TIMEOUT ); + String maxValue = Integer.toString( IMIConstants.MAX_REQUEST_TIMEOUT ); + fTimeoutText.setErrorMessage( MessageFormat.format( "The valid value range is [{0},{1}].", new String[]{ minValue, maxValue } ) ); + fTimeoutText.load(); + fTimeoutText.setPropertyChangeListener( + new IPropertyChangeListener() + { + public void propertyChange( PropertyChangeEvent event ) + { + if ( event.getProperty().equals( FieldEditor.IS_VALID ) ) + setValid( fTimeoutText.isValid() ); + } + } ); + } + + /** + * Store the preference values based on the state of the + * component widgets + */ + private void storeValues() + { + MIPlugin.getDefault().getPluginPreferences().setValue( IMIConstants.PREF_REQUEST_TIMEOUT, fTimeoutText.getIntValue() ); + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java index 89943219688..8c7665565c3 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java @@ -5,28 +5,31 @@ */ package org.eclipse.cdt.debug.internal.ui.preferences; -import java.text.MessageFormat; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.CDebugModel; import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.jface.preference.FieldEditor; +import org.eclipse.cdt.debug.ui.ICDebugUIConstants; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.debug.ui.IDebugView; import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.IntegerFieldEditor; import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.preference.StringFieldEditor; -import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.help.WorkbenchHelp; /** @@ -38,8 +41,11 @@ import org.eclipse.ui.help.WorkbenchHelp; */ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - // Timeout preference widgets - private IntegerFieldEditor fTimeoutText; + // Primitive display preference widgets + private Button fHexButton; + + // View setting widgets + private Button fPathsButton; private PropertyChangeListener fPropertyChangeListener; @@ -95,34 +101,10 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr data.horizontalAlignment = GridData.FILL; composite.setLayoutData( data ); - Composite comp = createGroupComposite( composite, 1, "Communication" ); - //Add in an intermediate composite to allow for spacing - Composite spacingComposite = new Composite( comp, SWT.NONE ); - layout = new GridLayout(); - spacingComposite.setLayout( layout ); - data = new GridData( GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL ); - data.horizontalSpan = 2; - spacingComposite.setLayoutData( data ); - - fTimeoutText = new IntegerFieldEditor( CDebugModel.PREF_REQUEST_TIMEOUT, "Debugger &timeout (ms):", spacingComposite ); - fTimeoutText.setPreferenceStore( CDebugUIPlugin.getDefault().getPreferenceStore() ); - fTimeoutText.setPreferencePage( this ); - fTimeoutText.setValidateStrategy( StringFieldEditor.VALIDATE_ON_KEY_STROKE ); - fTimeoutText.setValidRange( CDebugModel.MIN_REQUEST_TIMEOUT, CDebugModel.MAX_REQUEST_TIMEOUT ); - String minValue = Integer.toString( CDebugModel.MIN_REQUEST_TIMEOUT ); - String maxValue = Integer.toString( CDebugModel.MAX_REQUEST_TIMEOUT ); - fTimeoutText.setErrorMessage( MessageFormat.format( "The valid value range is [{0},{1}].", new String[]{ minValue, maxValue } ) ); - fTimeoutText.load(); - fTimeoutText.setPropertyChangeListener( - new IPropertyChangeListener() - { - public void propertyChange( PropertyChangeEvent event ) - { - if ( event.getProperty().equals( FieldEditor.IS_VALID ) ) - setValid( fTimeoutText.isValid() ); - } - } ); - + createSpacer( composite, 1 ); + createPrimitiveDisplayPreferences( composite ); + createSpacer( composite, 1 ); + createViewSettingPreferences( composite ); setValues(); return composite; @@ -160,7 +142,8 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr { IPreferenceStore store = getPreferenceStore(); - fTimeoutText.setStringValue( new Integer( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( CDebugModel.PREF_REQUEST_TIMEOUT ) ).toString() ); + fHexButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES ) ); + fPathsButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) ); } /* (non-Javadoc) @@ -185,7 +168,7 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr public static void initDefaults(IPreferenceStore store) { store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, false ); - store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_CHAR_VALUES, false ); + store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, true ); } /** @@ -196,4 +179,133 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr super.dispose(); getPreferenceStore().removePropertyChangeListener( getPropertyChangeListener() ); } + + /** + * Create the primitive display preferences composite widget + */ + private void createPrimitiveDisplayPreferences( Composite parent ) + { + Composite comp = createGroupComposite( parent, 1, "Primitive type display options" ); + fHexButton = createCheckButton( comp, "Display &hexadecimal values (short, char, int, long)" ); + } + + /** + * Create the view setting preferences composite widget + */ + private void createViewSettingPreferences( Composite parent ) + { + Composite comp = createGroupComposite( parent, 1, "Opened view default settings" ); + fPathsButton = createCheckButton( comp, "Show full &paths" ); + } + + /** + * Creates a button with the given label and sets the default + * configuration data. + */ + private Button createCheckButton( Composite parent, String label ) + { + Button button = new Button( parent, SWT.CHECK | SWT.LEFT ); + button.setText( label ); + // FieldEditor GridData + GridData data = new GridData(); + button.setLayoutData( data ); + return button; + } + + protected void createSpacer( Composite composite, int columnSpan ) + { + Label label = new Label( composite, SWT.NONE ); + GridData gd = new GridData(); + gd.horizontalSpan = columnSpan; + label.setLayoutData( gd ); + } + + /** + * @see IPreferencePage#performOk() + * Also, notifies interested listeners + */ + public boolean performOk() + { + storeValues(); + if ( getPropertyChangeListener().hasStateChanged() ) + { + refreshViews(); + } + CDebugUIPlugin.getDefault().savePluginPreferences(); + return true; + } + + /** + * Refresh the variables and expression views as changes + * have occurred that affects these views. + */ + private void refreshViews() + { + BusyIndicator.showWhile( getShell().getDisplay(), + new Runnable() + { + public void run() + { + // Refresh interested views + IWorkbenchWindow[] windows = CDebugUIPlugin.getDefault().getWorkbench().getWorkbenchWindows(); + IWorkbenchPage page = null; + for ( int i = 0; i < windows.length; i++ ) + { + page = windows[i].getActivePage(); + if ( page != null ) + { + refreshViews( page, IDebugUIConstants.ID_EXPRESSION_VIEW ); + refreshViews( page, IDebugUIConstants.ID_VARIABLE_VIEW ); + refreshViews( page, ICDebugUIConstants.ID_REGISTERS_VIEW ); + } + } + } + } ); + } + + /** + * Refresh all views in the given workbench page with the given view id + */ + private void refreshViews( IWorkbenchPage page, String viewID ) + { + IViewPart part = page.findView( viewID ); + if ( part != null ) + { + IDebugView adapter = (IDebugView)part.getAdapter( IDebugView.class ); + if ( adapter != null ) + { + Viewer viewer = adapter.getViewer(); + if ( viewer instanceof StructuredViewer ) + { + ((StructuredViewer)viewer).refresh(); + } + } + } + } + + /** + * Store the preference values based on the state of the component widgets + */ + private void storeValues() + { + IPreferenceStore store = getPreferenceStore(); + store.setValue( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, fHexButton.getSelection() ); + store.setValue( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, fPathsButton.getSelection() ); + } + + /** + * Sets the default preferences. + * @see PreferencePage#performDefaults() + */ + protected void performDefaults() + { + setDefaultValues(); + super.performDefaults(); + } + + private void setDefaultValues() + { + IPreferenceStore store = getPreferenceStore(); + fHexButton.setSelection( store.getDefaultBoolean( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES ) ); + } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java index eafdf7e3463..c229addd3b1 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java @@ -91,4 +91,11 @@ public interface ICDebugPreferenceConstants * types display char values. */ public static final String PREF_SHOW_CHAR_VALUES = ICDebugUIConstants.PLUGIN_ID + "cDebug.showCharValues"; //$NON-NLS-1$ + + /** + * Boolean preference controlling whether the debugger shows + * full paths. When true the debugger + * will show full paths in newly opened views. + */ + public static final String PREF_SHOW_FULL_PATHS = ICDebugUIConstants.PLUGIN_ID + "cDebug.show_full_paths"; //$NON-NLS-1$ } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java index 4fc5be79839..3ded3125792 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java @@ -12,6 +12,7 @@ import org.eclipse.cdt.debug.core.ISwitchToThread; import org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation; import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry; import org.eclipse.cdt.debug.internal.ui.ColorManager; +import org.eclipse.cdt.debug.internal.ui.preferences.CDebugPreferencePage; import org.eclipse.cdt.debug.internal.ui.preferences.MemoryViewPreferencePage; import org.eclipse.cdt.debug.internal.ui.preferences.RegistersViewPreferencePage; import org.eclipse.core.resources.IWorkspace; @@ -147,6 +148,7 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen { MemoryViewPreferencePage.initDefaults( pstore ); RegistersViewPreferencePage.initDefaults( pstore ); + CDebugPreferencePage.initDefaults( pstore ); } public static CDTDebugModelPresentation getDebugModelPresentation()