From 239af2b4b6f41b9b56978f19ddfd31b0c1ffdc5b Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Mon, 9 Jun 2003 18:11:40 +0000 Subject: [PATCH] Default format preferences for variables, registers and expressions. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 6 ++++ .../internal/core/model/CExpression.java | 3 ++ .../debug/internal/core/model/CRegister.java | 3 ++ .../debug/internal/core/model/CVariable.java | 5 ++- debug/org.eclipse.cdt.debug.ui/ChangeLog | 4 +++ .../ui/preferences/CDebugPreferencePage.java | 32 +++++++------------ 6 files changed, 31 insertions(+), 22 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 50ac226977a..b2b54a059ff 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,9 @@ +2003-06-09 Mikhail Khodjaiants + Added default format preferences for variables, registers and expressions. + * CExpression.java + * CRegister.java + * CVariable.java + 2003-06-09 Mikhail Khodjaiants Renamed the 'refresh' method of ICVariable to 'reset'. Added new method - 'reset' to CValue instead of using the 'setChanged' method. diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java index 00dd608aac3..3bdd61912ef 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java @@ -6,6 +6,7 @@ package org.eclipse.cdt.debug.internal.core.model; import org.eclipse.cdt.debug.core.CDebugCorePlugin; +import org.eclipse.cdt.debug.core.ICDebugConstants; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent; import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; @@ -32,6 +33,7 @@ public class CExpression extends CModificationVariable public CExpression( CDebugTarget target, ICDIExpression cdiExpression ) { super( target, cdiExpression ); + fFormat = CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ); } /** @@ -42,6 +44,7 @@ public class CExpression extends CModificationVariable public CExpression( CDebugTarget target, ICDIVariable cdiVariable ) { super( target, cdiVariable ); + fFormat = CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ); } /* (non-Javadoc) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java index 99be7ff2cd0..9651a90155f 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java @@ -5,6 +5,8 @@ */ package org.eclipse.cdt.debug.internal.core.model; +import org.eclipse.cdt.debug.core.CDebugCorePlugin; +import org.eclipse.cdt.debug.core.ICDebugConstants; import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IRegister; @@ -27,6 +29,7 @@ public class CRegister extends CGlobalVariable implements IRegister public CRegister( CRegisterGroup parent, ICDIRegister cdiRegister ) { super( parent, cdiRegister ); + fFormat = CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ); } /* (non-Javadoc) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java index 1013c3440ca..9be457fadb1 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java @@ -7,6 +7,8 @@ package org.eclipse.cdt.debug.internal.core.model; import java.util.LinkedList; +import org.eclipse.cdt.debug.core.CDebugCorePlugin; +import org.eclipse.cdt.debug.core.ICDebugConstants; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDIFormat; import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent; @@ -102,7 +104,7 @@ public abstract class CVariable extends CDebugElement /** * The current format of this variable. */ - private int fFormat = ICDIFormat.NATURAL; + protected int fFormat = ICDIFormat.NATURAL; /** * Constructor for CVariable. @@ -114,6 +116,7 @@ public abstract class CVariable extends CDebugElement fParent = parent; fCDIVariable = cdiVariable; fShadow = null; + fFormat = CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ); getCDISession().getEventManager().addEventListener( this ); } diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index d8ed164a0bb..6a324bb09f4 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,7 @@ +2003-06-09 Mikhail Khodjaiants + Added default format preferences for variables, registers and expressions. + * CDebugPreferencePage.java + 2003-06-09 Mikhail Khodjaiants Renamed the 'refresh' method of ICVariable to 'reset'. * VariableFormatActionDelegate.java 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 01d1e301ca1..7c825865a94 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 @@ -30,6 +30,7 @@ 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.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; @@ -51,11 +52,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr { // View setting widgets private Button fPathsButton; -/* private Combo fVariableFormatCombo; private Combo fExpressionFormatCombo; private Combo fRegisterFormatCombo; -*/ // Disassembly setting widgets private Button fAutoDisassemblyButton; @@ -65,8 +64,8 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr private static final int NUMBER_OF_DIGITS = 3; // Format constants -// private static int[] fFormatIds = new int[]{ ICDIFormat.NATURAL, ICDIFormat.HEXADECIMAL, ICDIFormat.DECIMAL }; -// private static String[] fFormatLabels = new String[] { "Natural", "Hexadecimal", "Decimal" }; + private static int[] fFormatIds = new int[]{ ICDIFormat.NATURAL, ICDIFormat.HEXADECIMAL, ICDIFormat.DECIMAL }; + private static String[] fFormatLabels = new String[] { "Natural", "Hexadecimal", "Decimal" }; private PropertyChangeListener fPropertyChangeListener; @@ -155,11 +154,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr fPathsButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) ); fAutoDisassemblyButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY ) ); fMaxNumberOfInstructionsText.setStringValue( new Integer( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS ) ).toString() ); -/* fVariableFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ) ); fExpressionFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) ); fRegisterFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) ); -*/ } /* (non-Javadoc) @@ -208,13 +205,11 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr { Composite comp = createGroupComposite( parent, 1, "Opened view default settings" ); fPathsButton = createCheckButton( comp, "Show full &paths" ); -/* Composite formatComposite = ControlFactory.createCompositeEx( comp, 2, 0 ); ((GridLayout)formatComposite.getLayout()).makeColumnsEqualWidth = true; fVariableFormatCombo = createComboBox( formatComposite, "Default variable format:", fFormatLabels, fFormatLabels[0] ); fExpressionFormatCombo = createComboBox( formatComposite, "Default expression format:", fFormatLabels, fFormatLabels[0] ); fRegisterFormatCombo = createComboBox( formatComposite, "Default register format:", fFormatLabels, fFormatLabels[0] ); -*/ } /** @@ -273,13 +268,13 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr * Creates a button with the given label and sets the default * configuration data. */ -// private Combo createComboBox( Composite parent, String label, String[] items, String selection ) -// { -// ControlFactory.createLabel( parent, label ); -// Combo combo = ControlFactory.createSelectCombo( parent, items, selection ); -// combo.setLayoutData( new GridData() ); -// return combo; -// } + private Combo createComboBox( Composite parent, String label, String[] items, String selection ) + { + ControlFactory.createLabel( parent, label ); + Combo combo = ControlFactory.createSelectCombo( parent, items, selection ); + combo.setLayoutData( new GridData() ); + return combo; + } protected void createSpacer( Composite composite, int columnSpan ) { @@ -362,11 +357,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr store.setValue( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, fPathsButton.getSelection() ); CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_AUTO_DISASSEMBLY, fAutoDisassemblyButton.getSelection() ); CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS, fMaxNumberOfInstructionsText.getIntValue() ); -/* CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT, getFormatId( fVariableFormatCombo.getSelectionIndex() ) ); CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT, getFormatId( fExpressionFormatCombo.getSelectionIndex() ) ); CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT, getFormatId( fRegisterFormatCombo.getSelectionIndex() ) ); -*/ } /** @@ -385,13 +378,11 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr fPathsButton.setSelection( store.getDefaultBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) ); fAutoDisassemblyButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY ) ); fMaxNumberOfInstructionsText.setStringValue( new Integer( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS ) ).toString() ); -/* fVariableFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ) ); fExpressionFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) ); fRegisterFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) ); -*/ } -/* + private static int getFormatId( int index ) { return ( index >= 0 && index < fFormatIds.length ) ? fFormatIds[index] : fFormatIds[0]; @@ -404,5 +395,4 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr return i; return -1; } -*/ }