1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 03:45:35 +02:00

Default format preferences for variables, registers and expressions.

This commit is contained in:
Mikhail Khodjaiants 2003-06-09 18:11:40 +00:00
parent 3fda0f49bb
commit 239af2b4b6
6 changed files with 31 additions and 22 deletions

View file

@ -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 2003-06-09 Mikhail Khodjaiants
Renamed the 'refresh' method of ICVariable to 'reset'. Added new method - Renamed the 'refresh' method of ICVariable to 'reset'. Added new method -
'reset' to CValue instead of using the 'setChanged' method. 'reset' to CValue instead of using the 'setChanged' method.

View file

@ -6,6 +6,7 @@
package org.eclipse.cdt.debug.internal.core.model; package org.eclipse.cdt.debug.internal.core.model;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; 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.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
@ -32,6 +33,7 @@ public class CExpression extends CModificationVariable
public CExpression( CDebugTarget target, ICDIExpression cdiExpression ) public CExpression( CDebugTarget target, ICDIExpression cdiExpression )
{ {
super( target, 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 ) public CExpression( CDebugTarget target, ICDIVariable cdiVariable )
{ {
super( target, cdiVariable ); super( target, cdiVariable );
fFormat = CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT );
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -5,6 +5,8 @@
*/ */
package org.eclipse.cdt.debug.internal.core.model; 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.cdt.debug.core.cdi.model.ICDIRegister;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IRegister; import org.eclipse.debug.core.model.IRegister;
@ -27,6 +29,7 @@ public class CRegister extends CGlobalVariable implements IRegister
public CRegister( CRegisterGroup parent, ICDIRegister cdiRegister ) public CRegister( CRegisterGroup parent, ICDIRegister cdiRegister )
{ {
super( parent, cdiRegister ); super( parent, cdiRegister );
fFormat = CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT );
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -7,6 +7,8 @@ package org.eclipse.cdt.debug.internal.core.model;
import java.util.LinkedList; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIFormat; import org.eclipse.cdt.debug.core.cdi.ICDIFormat;
import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent; 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. * The current format of this variable.
*/ */
private int fFormat = ICDIFormat.NATURAL; protected int fFormat = ICDIFormat.NATURAL;
/** /**
* Constructor for CVariable. * Constructor for CVariable.
@ -114,6 +116,7 @@ public abstract class CVariable extends CDebugElement
fParent = parent; fParent = parent;
fCDIVariable = cdiVariable; fCDIVariable = cdiVariable;
fShadow = null; fShadow = null;
fFormat = CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT );
getCDISession().getEventManager().addEventListener( this ); getCDISession().getEventManager().addEventListener( this );
} }

View file

@ -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 2003-06-09 Mikhail Khodjaiants
Renamed the 'refresh' method of ICVariable to 'reset'. Renamed the 'refresh' method of ICVariable to 'reset'.
* VariableFormatActionDelegate.java * VariableFormatActionDelegate.java

View file

@ -30,6 +30,7 @@ import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; 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.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
@ -51,11 +52,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
{ {
// View setting widgets // View setting widgets
private Button fPathsButton; private Button fPathsButton;
/*
private Combo fVariableFormatCombo; private Combo fVariableFormatCombo;
private Combo fExpressionFormatCombo; private Combo fExpressionFormatCombo;
private Combo fRegisterFormatCombo; private Combo fRegisterFormatCombo;
*/
// Disassembly setting widgets // Disassembly setting widgets
private Button fAutoDisassemblyButton; private Button fAutoDisassemblyButton;
@ -65,8 +64,8 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
private static final int NUMBER_OF_DIGITS = 3; private static final int NUMBER_OF_DIGITS = 3;
// Format constants // Format constants
// private static int[] fFormatIds = new int[]{ ICDIFormat.NATURAL, ICDIFormat.HEXADECIMAL, ICDIFormat.DECIMAL }; private static int[] fFormatIds = new int[]{ ICDIFormat.NATURAL, ICDIFormat.HEXADECIMAL, ICDIFormat.DECIMAL };
// private static String[] fFormatLabels = new String[] { "Natural", "Hexadecimal", "Decimal" }; private static String[] fFormatLabels = new String[] { "Natural", "Hexadecimal", "Decimal" };
private PropertyChangeListener fPropertyChangeListener; private PropertyChangeListener fPropertyChangeListener;
@ -155,11 +154,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
fPathsButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) ); fPathsButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) );
fAutoDisassemblyButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY ) ); 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() ); 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 ) ) ); fVariableFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ) );
fExpressionFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_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 ) ) ); fRegisterFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) );
*/
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -208,13 +205,11 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
{ {
Composite comp = createGroupComposite( parent, 1, "Opened view default settings" ); Composite comp = createGroupComposite( parent, 1, "Opened view default settings" );
fPathsButton = createCheckButton( comp, "Show full &paths" ); fPathsButton = createCheckButton( comp, "Show full &paths" );
/*
Composite formatComposite = ControlFactory.createCompositeEx( comp, 2, 0 ); Composite formatComposite = ControlFactory.createCompositeEx( comp, 2, 0 );
((GridLayout)formatComposite.getLayout()).makeColumnsEqualWidth = true; ((GridLayout)formatComposite.getLayout()).makeColumnsEqualWidth = true;
fVariableFormatCombo = createComboBox( formatComposite, "Default variable format:", fFormatLabels, fFormatLabels[0] ); fVariableFormatCombo = createComboBox( formatComposite, "Default variable format:", fFormatLabels, fFormatLabels[0] );
fExpressionFormatCombo = createComboBox( formatComposite, "Default expression format:", fFormatLabels, fFormatLabels[0] ); fExpressionFormatCombo = createComboBox( formatComposite, "Default expression format:", fFormatLabels, fFormatLabels[0] );
fRegisterFormatCombo = createComboBox( formatComposite, "Default register 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 * Creates a button with the given label and sets the default
* configuration data. * configuration data.
*/ */
// private Combo createComboBox( Composite parent, String label, String[] items, String selection ) private Combo createComboBox( Composite parent, String label, String[] items, String selection )
// { {
// ControlFactory.createLabel( parent, label ); ControlFactory.createLabel( parent, label );
// Combo combo = ControlFactory.createSelectCombo( parent, items, selection ); Combo combo = ControlFactory.createSelectCombo( parent, items, selection );
// combo.setLayoutData( new GridData() ); combo.setLayoutData( new GridData() );
// return combo; return combo;
// } }
protected void createSpacer( Composite composite, int columnSpan ) 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() ); 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_AUTO_DISASSEMBLY, fAutoDisassemblyButton.getSelection() );
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS, fMaxNumberOfInstructionsText.getIntValue() ); 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_VARIABLE_FORMAT, getFormatId( fVariableFormatCombo.getSelectionIndex() ) );
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT, getFormatId( fExpressionFormatCombo.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() ) ); 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 ) ); fPathsButton.setSelection( store.getDefaultBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) );
fAutoDisassemblyButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY ) ); 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() ); 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 ) ) ); fVariableFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ) );
fExpressionFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_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 ) ) ); fRegisterFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) );
*/
} }
/*
private static int getFormatId( int index ) private static int getFormatId( int index )
{ {
return ( index >= 0 && index < fFormatIds.length ) ? fFormatIds[index] : fFormatIds[0]; return ( index >= 0 && index < fFormatIds.length ) ? fFormatIds[index] : fFormatIds[0];
@ -404,5 +395,4 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
return i; return i;
return -1; return -1;
} }
*/
} }