1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Added the 'Auto-Refresh by default' and 'Show ASCII by default' preferences to the 'Memory Views' preference page.

This commit is contained in:
Mikhail Khodjaiants 2002-11-13 18:49:29 +00:00
parent 40e68a1ff3
commit 4b32ececa8
5 changed files with 48 additions and 13 deletions

View file

@ -1,3 +1,11 @@
2002-11-13 Mikhail Khodjaiants
Added the 'Auto-Refresh by default' and 'Show ASCII by default' preferences
to the 'Memory Views' preference page.
* ICDebugPreferenceConstants.java
* MemoryViewPreferencePage.java
* MemoryControlArea.java
* MemoryView.java
2002-11-11 Mikhail Khodjaiants
Fix for PR 25988: The 'Padding Character' preference of the Memory view doesn't work.
* MemoryControlArea.java

View file

@ -26,6 +26,13 @@ import org.eclipse.swt.widgets.Display;
*/
public interface ICDebugPreferenceConstants
{
/**
* Boolean preference controlling whether the debugger shows
* full paths. When <code>true</code> 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";
/**
* The RGB for the color to be used to indicate changed registers
*/
@ -47,7 +54,6 @@ public interface ICDebugPreferenceConstants
public static final String PREF_MEMORY_SIZE = "Memory.Size";
public static final String PREF_MEMORY_FORMAT = "Memory.Format";
public static final String PREF_MEMORY_BYTES_PER_ROW = "Memory.BytesPerRow";
public static final String PREF_MEMORY_DISPLAY_ASCII = "Memory.DisplayASCII";
public static final String PREF_MEMORY_PADDING_CHAR = "Memory.PaddingChar";
/**
@ -93,9 +99,15 @@ public interface ICDebugPreferenceConstants
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 <code>true</code> the debugger
* will show full paths in newly opened views.
* Boolean preference controlling whether the memory view shows ASCII characters.
* When <code>true</code> the memory view will show ASCII characters by default.
*/
public static final String PREF_SHOW_FULL_PATHS = ICDebugUIConstants.PLUGIN_ID + "cDebug.show_full_paths"; //$NON-NLS-1$
public static final String PREF_MEMORY_SHOW_ASCII = ICDebugUIConstants.PLUGIN_ID + "Memory.show_ascii"; //$NON-NLS-1$
/**
* Boolean preference controlling whether the memory view will be refreshed
* every time when the execution of program stops.
* When <code>true</code> the 'Auto-Refresh' option will be checked.
*/
public static final String PREF_MEMORY_AUTO_REFRESH = ICDebugUIConstants.PLUGIN_ID + "Memory.auto_refresh"; //$NON-NLS-1$
}

View file

@ -7,6 +7,7 @@ package org.eclipse.cdt.debug.internal.ui.preferences;
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.ColorFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.FontFieldEditor;
@ -96,10 +97,11 @@ public class MemoryViewPreferencePage extends FieldEditorPreferencePage
// addField( dirty );
addField( font );
// StringFieldEditor paddingChar = new StringFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_PADDING_CHAR, "Padding Character:", 1, getFieldEditorParent() );
StringFieldEditor paddingChar = createPaddingCharacterField();
paddingChar.setTextLimit( 1 );
addField( paddingChar );
createSpacer( getFieldEditorParent(), 1 );
createDefaultSettingsFields();
}
/* (non-Javadoc)
@ -120,6 +122,8 @@ public class MemoryViewPreferencePage extends FieldEditorPreferencePage
public static void initDefaults( IPreferenceStore store )
{
store.setDefault( ICDebugPreferenceConstants.PREF_MEMORY_PADDING_CHAR, ICDebugPreferenceConstants.DEFAULT_MEMORY_PADDING_CHAR );
store.setDefault( ICDebugPreferenceConstants.PREF_MEMORY_AUTO_REFRESH, true );
store.setDefault( ICDebugPreferenceConstants.PREF_MEMORY_SHOW_ASCII, true );
PreferenceConverter.setDefault( store, ICDebugPreferenceConstants.MEMORY_FONT, ICDebugPreferenceConstants.DEFAULT_MEMORY_FONT );
PreferenceConverter.setDefault( store, ICDebugPreferenceConstants.MEMORY_FOREGROUND_RGB, ICDebugPreferenceConstants.DEFAULT_MEMORY_FOREGROUND_RGB );
PreferenceConverter.setDefault( store, ICDebugPreferenceConstants.MEMORY_BACKGROUND_RGB, ICDebugPreferenceConstants.DEFAULT_MEMORY_BACKGROUND_RGB );
@ -148,4 +152,10 @@ public class MemoryViewPreferencePage extends FieldEditorPreferencePage
}
};
}
private void createDefaultSettingsFields()
{
addField( new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_AUTO_REFRESH, "Auto-Refresh by default", SWT.NONE, getFieldEditorParent() ) );
addField( new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_SHOW_ASCII, "Show ASCII by default", SWT.NONE, getFieldEditorParent() ) );
}
}

View file

@ -13,7 +13,6 @@ import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
@ -69,14 +68,18 @@ public class MemoryControlArea extends Composite
fPresentation = createPresentation();
fAddressText = createAddressText( this );
fMemoryText = createMemoryText( this, style, fPresentation );
setDefaultPreferences();
}
private void setDefaultPreferences()
{
char[] paddingCharStr = CDebugUIPlugin.getDefault().getPreferenceStore().getString( ICDebugPreferenceConstants.PREF_MEMORY_PADDING_CHAR ).toCharArray();
setPaddingChar( ( paddingCharStr.length > 0 ) ? paddingCharStr[0] : '.' );
fPresentation.setDisplayAscii( CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_MEMORY_SHOW_ASCII ) );
}
private MemoryPresentation createPresentation()
{
IPreferenceStore pstore = CDebugUIPlugin.getDefault().getPreferenceStore();
char[] paddingCharStr = pstore.getString( ICDebugPreferenceConstants.PREF_MEMORY_PADDING_CHAR ).toCharArray();
setPaddingChar( ( paddingCharStr.length > 0 ) ? paddingCharStr[0] : '.' );
return new MemoryPresentation();
}
@ -250,6 +253,7 @@ public class MemoryControlArea extends Composite
getNumberOfRows(),
getNumberOfColumns(),
getPaddingChar() ) );
getMemoryBlock().setFrozen( !CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_MEMORY_AUTO_REFRESH ) );
getPresentation().setMemoryBlock( getMemoryBlock() );
}
setMemoryTextState();

View file

@ -17,6 +17,7 @@ import org.eclipse.cdt.debug.internal.ui.actions.MemorySizeAction;
import org.eclipse.cdt.debug.internal.ui.actions.RefreshMemoryAction;
import org.eclipse.cdt.debug.internal.ui.actions.SaveMemoryChangesAction;
import org.eclipse.cdt.debug.internal.ui.actions.ShowAsciiAction;
import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandlerView;
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
@ -90,7 +91,7 @@ public class MemoryView extends AbstractDebugEventHandlerView
action = new AutoRefreshMemoryAction( (MemoryViewer)getViewer() );
action.setEnabled( false );
action.setChecked( false );
action.setChecked( CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_MEMORY_AUTO_REFRESH ) );
setAction( "AutoRefreshMemory", action ); //$NON-NLS-1$
add( (AutoRefreshMemoryAction)action );
@ -106,7 +107,7 @@ public class MemoryView extends AbstractDebugEventHandlerView
action = new ShowAsciiAction( (MemoryViewer)getViewer() );
action.setEnabled( false );
action.setChecked( false );
action.setChecked( CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_MEMORY_SHOW_ASCII ) );
setAction( "ShowAscii", action ); //$NON-NLS-1$
add( (ShowAsciiAction)action );