1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

The 'Auto-Refresh' preferences were moved to the code plugin. Changed the preference pages for the Registers and Shared Libraries views to reflect this.

This commit is contained in:
Mikhail Khodjaiants 2003-04-01 22:34:11 +00:00
parent 6dbbe6eae9
commit c4787b1801
4 changed files with 79 additions and 21 deletions

View file

@ -1,3 +1,10 @@
2003-04-01 Mikhail Khodjaiants
The 'Auto-Refresh' preferences were moved to the code plugin. Changed the preference
pages for the Registers and Shared Libraries views to reflect this.
* ICDebugPreferenceConstants.java
* RegistersViewPreferencePage.java
* SharedLibrariesViewPreferencePage.java
2003-04-01 Mikhail Khodjaiants
Changed implementation and initialization of 'AutoRefreshAction'.
* AutoRefreshAction.java

View file

@ -110,18 +110,4 @@ public interface ICDebugPreferenceConstants
* 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$
/**
* Boolean preference controlling whether the shared libraries 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_SHARED_LIBRARIES_AUTO_REFRESH = ICDebugUIConstants.PLUGIN_ID + "SharedLibraries.auto_refresh"; //$NON-NLS-1$
/**
* Boolean preference controlling whether the registers 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_REGISTERS_AUTO_REFRESH = ICDebugUIConstants.PLUGIN_ID + "Registers.auto_refresh"; //$NON-NLS-1$
}

View file

@ -5,9 +5,11 @@
*/
package org.eclipse.cdt.debug.internal.ui.preferences;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDebugConstants;
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.jface.preference.ColorFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
@ -15,6 +17,7 @@ import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
@ -30,6 +33,8 @@ import org.eclipse.ui.help.WorkbenchHelp;
public class RegistersViewPreferencePage extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage
{
private Button fAutoRefreshField = null;
/**
* Constructor for RegistersViewPreferencePage.
* @param style
@ -56,8 +61,9 @@ public class RegistersViewPreferencePage extends FieldEditorPreferencePage
protected void createFieldEditors()
{
addField( new ColorFieldEditor( ICDebugPreferenceConstants.CHANGED_REGISTER_RGB, "&Changed register value color:", getFieldEditorParent() ) );
createSpacer( getFieldEditorParent(), 1 );
addField( new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_REGISTERS_AUTO_REFRESH, "Auto-Refresh by default", getFieldEditorParent() ) );
createSpacer( getFieldEditorParent(), 2 );
fAutoRefreshField = ControlFactory.createCheckBox( getFieldEditorParent(), "Auto-Refresh by default" );
fAutoRefreshField.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_REGISTERS_AUTO_REFRESH ) );
}
/* (non-Javadoc)
@ -72,7 +78,7 @@ public class RegistersViewPreferencePage extends FieldEditorPreferencePage
PreferenceConverter.setDefault( store,
ICDebugPreferenceConstants.CHANGED_REGISTER_RGB,
new RGB( 255, 0, 0 ) );
store.setDefault( ICDebugPreferenceConstants.PREF_REGISTERS_AUTO_REFRESH, true );
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_REGISTERS_AUTO_REFRESH, true );
}
protected void createSpacer( Composite composite, int columnSpan )
@ -89,7 +95,28 @@ public class RegistersViewPreferencePage extends FieldEditorPreferencePage
public boolean performOk()
{
boolean ok = super.performOk();
storeValues();
CDebugUIPlugin.getDefault().savePluginPreferences();
CDebugCorePlugin.getDefault().savePluginPreferences();
return ok;
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
protected void performDefaults()
{
setDefaultValues();
super.performDefaults();
}
private void setDefaultValues()
{
fAutoRefreshField.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultBoolean( ICDebugConstants.PREF_REGISTERS_AUTO_REFRESH ) );
}
private void storeValues()
{
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_REGISTERS_AUTO_REFRESH, fAutoRefreshField.getSelection() );
}
}

View file

@ -5,13 +5,17 @@
*/
package org.eclipse.cdt.debug.internal.ui.preferences;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDebugConstants;
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT;
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.Label;
import org.eclipse.ui.IWorkbench;
@ -26,6 +30,7 @@ import org.eclipse.ui.help.WorkbenchHelp;
public class SharedLibrariesViewPreferencePage extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage
{
private Button fAutoRefreshField = null;
/**
* Constructor for SharedLibrariesViewPreferencePage.
@ -43,7 +48,8 @@ public class SharedLibrariesViewPreferencePage extends FieldEditorPreferencePage
*/
protected void createFieldEditors()
{
addField( new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH, "Auto-Refresh by default", getFieldEditorParent() ) );
fAutoRefreshField = ControlFactory.createCheckBox( getFieldEditorParent(), "Auto-Refresh by default" );
fAutoRefreshField.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH ) );
}
/* (non-Javadoc)
@ -64,7 +70,7 @@ public class SharedLibrariesViewPreferencePage extends FieldEditorPreferencePage
public static void initDefaults( IPreferenceStore store )
{
store.setDefault( ICDebugPreferenceConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH, true );
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH, true );
}
protected void createSpacer( Composite composite, int columnSpan )
@ -81,7 +87,39 @@ public class SharedLibrariesViewPreferencePage extends FieldEditorPreferencePage
public boolean performOk()
{
boolean ok = super.performOk();
storeValues();
CDebugUIPlugin.getDefault().savePluginPreferences();
CDebugCorePlugin.getDefault().savePluginPreferences();
return ok;
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
protected void performDefaults()
{
setDefaultValues();
super.performDefaults();
}
private void setDefaultValues()
{
fAutoRefreshField.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultBoolean( ICDebugConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH ) );
}
private void storeValues()
{
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH, fAutoRefreshField.getSelection() );
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#adjustGridLayout()
*/
protected void adjustGridLayout()
{
super.adjustGridLayout();
// If there are no editor fields on this page set the number of columns to prevent stack overflow
if ( ((GridLayout)getFieldEditorParent().getLayout()).numColumns == 0 )
((GridLayout)getFieldEditorParent().getLayout()).numColumns = 2;
}
}