diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index 86c9d58fd20..3f6c1623f9f 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -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
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 db9d2949b6c..96c77a4faeb 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
@@ -110,18 +110,4 @@ public interface ICDebugPreferenceConstants
* When true
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
- * true
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
- * true
the 'Auto-Refresh' option will be checked.
- */
- public static final String PREF_REGISTERS_AUTO_REFRESH = ICDebugUIConstants.PLUGIN_ID + "Registers.auto_refresh"; //$NON-NLS-1$
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/RegistersViewPreferencePage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/RegistersViewPreferencePage.java
index 9a6dde85d76..92e47e75f3d 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/RegistersViewPreferencePage.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/RegistersViewPreferencePage.java
@@ -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() );
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SharedLibrariesViewPreferencePage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SharedLibrariesViewPreferencePage.java
index 94595f1ab7b..2001f13fa85 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SharedLibrariesViewPreferencePage.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SharedLibrariesViewPreferencePage.java
@@ -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;
+ }
}