Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Khodjaiants2004-11-08 18:41:30 -0500
committerMikhail Khodjaiants2004-11-08 18:41:30 -0500
commitf4f6cc774ee0d1e69f8d09d75600ff25625c5633 (patch)
treecf4bd81bc916cd9d5975146021a11ad03b1f48cf
parent92f36abdcefb8ab985a50cdb279712ef8f3c3b0f (diff)
downloadorg.eclipse.cdt-f4f6cc774ee0d1e69f8d09d75600ff25625c5633.tar.gz
org.eclipse.cdt-f4f6cc774ee0d1e69f8d09d75600ff25625c5633.tar.xz
org.eclipse.cdt-f4f6cc774ee0d1e69f8d09d75600ff25625c5633.zip
Added the "Automatically refresh registers" and "Automatically refresh shared libraries" preferences and properties.
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/ChangeLog14
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/plugin.properties2
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/plugin.xml20
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/ActionFilterAdapterFactory.java45
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBTargetActionFilter.java34
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/MIPreferencePage.java327
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/PreferenceMessages.properties2
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/OptionsPropertyPage.java119
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.java37
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.properties2
11 files changed, 586 insertions, 19 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/.settings/org.eclipse.core.resources.prefs b/debug/org.eclipse.cdt.debug.mi.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000000..bc6813d787
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Mon Nov 08 18:15:08 EST 2004
+eclipse.preferences.version=1
+encoding//src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.properties=8859_1
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog b/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog
index 1b6e412054..8a9dbf1085 100644
--- a/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog
@@ -1,3 +1,17 @@
+2004-11-08 Mikhail Khodjaiants
+ Added the "Automatically refresh registers" and "Automatically refresh shared libraries"
+ preferences and properties.
+ * ActionFilterAdapterFactory.java: new
+ * GDBTargetActionFilter.java: new
+ * PreferenceMessages.properties
+ * MIPreferencePage.java
+ * org.eclipse.cdt.debug.mi.internal.ui.propertypages: new package
+ * PropertyMessages.properties
+ * OptionsPropertyPage.java
+ * PropertyMessages.java
+ * plugin.properties
+ * plugin.xml
+
2004-10-29 Alain Magloire
Changes to the CDI interface
* SeAutoSolibActionDelegate.java
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties b/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties
index cd24e3e97f..8408bdf45c 100644
--- a/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties
@@ -15,3 +15,5 @@ MIPreferencePage.name=GDB MI
SetAutoSolibAction.label=Automatically Load Shared Libraries
SetAutoSolibAction.tooltip=Automatically Load Shared Libraries On/Off
+
+TargetOptionsPage.label=GDB/MI Options
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml
index ff081a336c..3682570791 100644
--- a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml
@@ -52,5 +52,25 @@
id="org.eclipse.cdt.debug.mi.ui.MIPreferencePage">
</page>
</extension>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ objectClass="org.eclipse.cdt.debug.core.model.ICDebugTarget"
+ class="org.eclipse.cdt.debug.mi.internal.ui.propertypages.OptionsPropertyPage"
+ name="%TargetOptionsPage.label"
+ id="org.eclipse.cdt.debug.mi.ui.propertypages.target.options">
+ <filter
+ value="isGDBTarget"
+ name="GDBTargetActionFilter"/>
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ class="org.eclipse.cdt.debug.mi.internal.ui.ActionFilterAdapterFactory"
+ adaptableType="org.eclipse.cdt.debug.core.model.ICDebugTarget">
+ <adapter type="org.eclipse.ui.IActionFilter"/>
+ </factory>
+ </extension>
</plugin>
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/ActionFilterAdapterFactory.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/ActionFilterAdapterFactory.java
new file mode 100644
index 0000000000..75892e1f3f
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/ActionFilterAdapterFactory.java
@@ -0,0 +1,45 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ ***********************************************************************/
+package org.eclipse.cdt.debug.mi.internal.ui;
+
+import org.eclipse.cdt.debug.core.model.ICDebugTarget;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.ui.IActionFilter;
+
+/**
+ * The UI adapter factory for GDB/MI Debug extensions
+ */
+public class ActionFilterAdapterFactory implements IAdapterFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter( Object adaptableObject, Class adapterType ) {
+ if ( adapterType.isInstance( adaptableObject ) ) {
+ return adaptableObject;
+ }
+ if ( adapterType == IActionFilter.class ) {
+ if ( adaptableObject instanceof ICDebugTarget ) {
+ return new GDBTargetActionFilter();
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[] {
+ IActionFilter.class
+ };
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBTargetActionFilter.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBTargetActionFilter.java
new file mode 100644
index 0000000000..97c696d927
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/GDBTargetActionFilter.java
@@ -0,0 +1,34 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ ***********************************************************************/
+package org.eclipse.cdt.debug.mi.internal.ui;
+
+import org.eclipse.cdt.debug.core.cdi.ICDISession;
+import org.eclipse.cdt.debug.core.model.ICDebugTarget;
+import org.eclipse.cdt.debug.mi.core.cdi.Session;
+import org.eclipse.ui.IActionFilter;
+
+/**
+ * Comment for .
+ */
+public class GDBTargetActionFilter implements IActionFilter {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
+ */
+ public boolean testAttribute( Object target, String name, String value ) {
+ if ( target instanceof ICDebugTarget ) {
+ if ( name.equals( "GDBTargetActionFilter" ) && value.equals( "isGDBTarget" ) ) { //$NON-NLS-1$//$NON-NLS-2$
+ return ( ((ICDebugTarget)target).getAdapter( ICDISession.class ) instanceof Session );
+ }
+ }
+ return false;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/MIPreferencePage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/MIPreferencePage.java
index 7dca00fb89..a2077c6d66 100644
--- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/MIPreferencePage.java
+++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/MIPreferencePage.java
@@ -11,12 +11,18 @@
package org.eclipse.cdt.debug.mi.internal.ui.preferences;
import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Iterator;
import org.eclipse.cdt.debug.mi.core.IMIConstants;
import org.eclipse.cdt.debug.mi.core.MIPlugin;
import org.eclipse.cdt.debug.mi.internal.ui.IMIHelpContextIds;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.IPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.preference.StringFieldEditor;
@@ -37,13 +43,267 @@ import org.eclipse.ui.help.WorkbenchHelp;
*/
public class MIPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+ public class MIPreferenceStore implements IPreferenceStore {
+
+ private Preferences fPreferences;
+
+ private HashMap fListeners = new HashMap();
+
+ public MIPreferenceStore( Preferences pref ) {
+ fPreferences = pref;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
+ */
+ public void addPropertyChangeListener( final IPropertyChangeListener listener ) {
+ Preferences.IPropertyChangeListener l = new Preferences.IPropertyChangeListener() {
+
+ public void propertyChange( org.eclipse.core.runtime.Preferences.PropertyChangeEvent event ) {
+ listener.propertyChange( new PropertyChangeEvent( MIPreferenceStore.this, event.getProperty(), event.getNewValue(), event.getOldValue() ) );
+ }
+ };
+ fListeners.put( listener, l );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
+ */
+ public boolean contains( String name ) {
+ return getPreferences().contains( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#firePropertyChangeEvent(java.lang.String, java.lang.Object, java.lang.Object)
+ */
+ public void firePropertyChangeEvent( String name, Object oldValue, Object newValue ) {
+ Iterator it = fListeners.keySet().iterator();
+ while( it.hasNext() ) {
+ ((IPropertyChangeListener)it.next()).propertyChange( new PropertyChangeEvent( this, name, oldValue, newValue ) );
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String)
+ */
+ public boolean getBoolean( String name ) {
+ return fPreferences.getBoolean( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String)
+ */
+ public boolean getDefaultBoolean( String name ) {
+ return fPreferences.getDefaultBoolean( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String)
+ */
+ public double getDefaultDouble( String name ) {
+ return fPreferences.getDefaultDouble( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String)
+ */
+ public float getDefaultFloat( String name ) {
+ return fPreferences.getDefaultFloat( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String)
+ */
+ public int getDefaultInt( String name ) {
+ return fPreferences.getDefaultInt( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String)
+ */
+ public long getDefaultLong( String name ) {
+ return fPreferences.getDefaultLong( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String)
+ */
+ public String getDefaultString( String name ) {
+ return fPreferences.getDefaultString( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String)
+ */
+ public double getDouble( String name ) {
+ return fPreferences.getDouble( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String)
+ */
+ public float getFloat( String name ) {
+ return fPreferences.getFloat( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String)
+ */
+ public int getInt( String name ) {
+ return fPreferences.getInt( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String)
+ */
+ public long getLong( String name ) {
+ return fPreferences.getLong( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
+ */
+ public String getString( String name ) {
+ return fPreferences.getString( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String)
+ */
+ public boolean isDefault( String name ) {
+ return fPreferences.isDefault( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#needsSaving()
+ */
+ public boolean needsSaving() {
+ return getPreferences().needsSaving();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String, java.lang.String)
+ */
+ public void putValue( String name, String value ) {
+ getPreferences().setValue( name, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
+ */
+ public void removePropertyChangeListener( IPropertyChangeListener listener ) {
+ fListeners.remove( listener );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, double)
+ */
+ public void setDefault( String name, double value ) {
+ getPreferences().setDefault( name, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, float)
+ */
+ public void setDefault( String name, float value ) {
+ getPreferences().setDefault( name, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, int)
+ */
+ public void setDefault( String name, int value ) {
+ getPreferences().setDefault( name, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, long)
+ */
+ public void setDefault( String name, long value ) {
+ getPreferences().setDefault( name, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, java.lang.String)
+ */
+ public void setDefault( String name, String defaultObject ) {
+ getPreferences().setDefault( name, defaultObject );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, boolean)
+ */
+ public void setDefault( String name, boolean value ) {
+ getPreferences().setDefault( name, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String)
+ */
+ public void setToDefault( String name ) {
+ getPreferences().setToDefault( name );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, double)
+ */
+ public void setValue( String name, double value ) {
+ getPreferences().setValue( name, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, float)
+ */
+ public void setValue( String name, float value ) {
+ getPreferences().setValue( name, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, int)
+ */
+ public void setValue( String name, int value ) {
+ getPreferences().setValue( name, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, long)
+ */
+ public void setValue( String name, long value ) {
+ getPreferences().setValue( name, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, java.lang.String)
+ */
+ public void setValue( String name, String value ) {
+ getPreferences().setValue( name, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, boolean)
+ */
+ public void setValue( String name, boolean value ) {
+ getPreferences().setValue( name, value );
+ }
+
+ protected Preferences getPreferences() {
+ return fPreferences;
+ }
+ }
+
private final static String GDB_MI_HELP_CONTEXT = MIUIPlugin.PLUGIN_ID + "mi_preference_page_context"; //$NON-NLS-1$
// Debugger timeout preference widgets
- IntegerFieldEditor fDebugTimeoutText;
+ private IntegerFieldEditor fDebugTimeoutText;
// Launch timeout preference widgets
- IntegerFieldEditor fLaunchTimeoutText;
+ private IntegerFieldEditor fLaunchTimeoutText;
+
+ private BooleanFieldEditor fRefreshRegistersButton;
+
+ private BooleanFieldEditor fRefreshSolibsButton;
+
+ private MIPreferenceStore fMICorePreferenceStore = new MIPreferenceStore( MIPlugin.getDefault().getPluginPreferences() );
/**
* Constructor for MIPreferencePage.
@@ -74,7 +334,6 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
composite.setLayoutData( data );
createSpacer( composite, 1 );
createCommunicationPreferences( composite );
- setValues();
WorkbenchHelp.setHelp( composite, GDB_MI_HELP_CONTEXT );
return composite;
}
@@ -92,21 +351,14 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
}
/**
- * Set the values of the component widgets based on the values in the preference store
- */
- private void setValues() {
- fDebugTimeoutText.setStringValue( new Integer( MIPlugin.getDefault().getPluginPreferences().getInt( IMIConstants.PREF_REQUEST_TIMEOUT ) ).toString() );
- fLaunchTimeoutText.setStringValue( new Integer( MIPlugin.getDefault().getPluginPreferences().getInt( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT ) ).toString() );
- }
-
- /**
* @see IPreferencePage#performOk()
*/
public boolean performOk() {
+ boolean result = super.performOk();
storeValues();
MIUIPlugin.getDefault().savePluginPreferences();
MIPlugin.getDefault().savePluginPreferences();
- return true;
+ return result;
}
/**
@@ -120,8 +372,10 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
}
private void setDefaultValues() {
- fDebugTimeoutText.setStringValue( new Integer( IMIConstants.DEF_REQUEST_TIMEOUT ).toString() );
- fLaunchTimeoutText.setStringValue( new Integer( IMIConstants.DEF_REQUEST_LAUNCH_TIMEOUT ).toString() );
+ fDebugTimeoutText.loadDefault();
+ fLaunchTimeoutText.loadDefault();
+ fRefreshRegistersButton.loadDefault();
+ fRefreshSolibsButton.loadDefault();
}
/*
@@ -153,7 +407,7 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
public void propertyChange( PropertyChangeEvent event ) {
if ( event.getProperty().equals( FieldEditor.IS_VALID ) )
- setValid( fDebugTimeoutText.isValid() );
+ setValid( getDebugTimeoutText().isValid() );
}
} );
fLaunchTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, PreferenceMessages.getString( "MIPreferencePage.3" ), spacingComposite ); //$NON-NLS-1$
@@ -161,17 +415,21 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
public void propertyChange( PropertyChangeEvent event ) {
if ( event.getProperty().equals( FieldEditor.IS_VALID ) )
- setValid( fLaunchTimeoutText.isValid() );
+ setValid( getLaunchTimeoutText().isValid() );
}
} );
+ fRefreshRegistersButton = createRefreshField( IMIConstants.PREF_REGISTERS_AUTO_REFRESH, PreferenceMessages.getString( "MIPreferencePage.5" ), spacingComposite ); //$NON-NLS-1$
+ fRefreshSolibsButton = createRefreshField( IMIConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH, PreferenceMessages.getString( "MIPreferencePage.6" ), spacingComposite ); //$NON-NLS-1$
}
/**
* Store the preference values based on the state of the component widgets
*/
private void storeValues() {
- MIPlugin.getDefault().getPluginPreferences().setValue( IMIConstants.PREF_REQUEST_TIMEOUT, fDebugTimeoutText.getIntValue() );
- MIPlugin.getDefault().getPluginPreferences().setValue( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, fLaunchTimeoutText.getIntValue() );
+ fDebugTimeoutText.store();
+ fLaunchTimeoutText.store();
+ fRefreshRegistersButton.store();
+ fRefreshSolibsButton.store();
}
private IntegerFieldEditor createTimeoutField( String preference, String label, Composite parent ) {
@@ -179,7 +437,7 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
GridData data = new GridData();
data.widthHint = convertWidthInCharsToPixels( 10 );
toText.getTextControl( parent ).setLayoutData( data );
- toText.setPreferenceStore( MIUIPlugin.getDefault().getPreferenceStore() );
+ toText.setPreferenceStore( getMICorePreferenceStore() );
toText.setPreferencePage( this );
toText.setValidateStrategy( StringFieldEditor.VALIDATE_ON_KEY_STROKE );
toText.setValidRange( IMIConstants.MIN_REQUEST_TIMEOUT, IMIConstants.MAX_REQUEST_TIMEOUT );
@@ -189,4 +447,35 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
toText.load();
return toText;
}
+
+ private BooleanFieldEditor createRefreshField( String preference, String label, Composite parent ) {
+ BooleanFieldEditor field = new BooleanFieldEditor( preference, label, parent );
+ field.setPreferencePage( this );
+ field.setPreferenceStore( new MIPreferenceStore( MIPlugin.getDefault().getPluginPreferences() ) );
+ field.load();
+ return field;
+ }
+
+ protected MIPreferenceStore getMICorePreferenceStore() {
+ return fMICorePreferenceStore;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
+ */
+ public void dispose() {
+ fDebugTimeoutText.dispose();
+ fLaunchTimeoutText.dispose();
+ fRefreshRegistersButton.dispose();
+ fRefreshSolibsButton.dispose();
+ super.dispose();
+ }
+
+ protected IntegerFieldEditor getLaunchTimeoutText() {
+ return fLaunchTimeoutText;
+ }
+
+ protected IntegerFieldEditor getDebugTimeoutText() {
+ return fDebugTimeoutText;
+ }
} \ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/PreferenceMessages.properties b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/PreferenceMessages.properties
index b7afe76a01..a417595fc9 100644
--- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/PreferenceMessages.properties
+++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/preferences/PreferenceMessages.properties
@@ -14,3 +14,5 @@ MIPreferencePage.1=Communication
MIPreferencePage.2=&Debugger timeout (ms):
MIPreferencePage.3=&Launch timeout (ms):
MIPreferencePage.4=The valid value range is [{0},{1}].
+MIPreferencePage.5=Automatically refresh registers
+MIPreferencePage.6=Automatically refresh shared libraries
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/OptionsPropertyPage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/OptionsPropertyPage.java
new file mode 100644
index 0000000000..681ee7d407
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/OptionsPropertyPage.java
@@ -0,0 +1,119 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ ***********************************************************************/
+package org.eclipse.cdt.debug.mi.internal.ui.propertypages;
+
+import org.eclipse.cdt.debug.core.cdi.CDIException;
+import org.eclipse.cdt.debug.core.cdi.ICDISession;
+import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
+import org.eclipse.cdt.debug.mi.core.cdi.Session;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+/**
+ * The property page for the gdb/mi-based debugger options.
+ */
+public class OptionsPropertyPage extends PropertyPage {
+
+ private Button fRefreshRegistersButton;
+
+ private Button fRefreshSolibsButton;
+
+ /**
+ * Constructor for OptionsPropertyPage.
+ */
+ public OptionsPropertyPage() {
+ noDefaultAndApplyButton();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents( Composite parent ) {
+ Composite comp = ControlFactory.createComposite( parent, 1 );
+ fRefreshRegistersButton = createCheckButton( comp, PropertyMessages.getString( "OptionsPropertyPage.0" ) ); //$NON-NLS-1$
+ fRefreshSolibsButton = createCheckButton( comp, PropertyMessages.getString( "OptionsPropertyPage.1" ) ); //$NON-NLS-1$
+ initialize();
+ return comp;
+ }
+
+ private Button createCheckButton( Composite parent, String label ) {
+ Button button = new Button( parent, SWT.CHECK | SWT.LEFT );
+ button.setText( label );
+ // FieldEditor GridData
+ GridData data = new GridData();
+ button.setLayoutData( data );
+ return button;
+ }
+
+ private void initialize() {
+ boolean regUpdate = true;
+ boolean solibUpdate = true;
+ ICDISession session = (ICDISession)getElement().getAdapter( ICDISession.class );
+ if ( session instanceof Session ) {
+ regUpdate = ((Session)session).getRegisterManager().isAutoUpdate();
+ solibUpdate = ((Session)session).getSharedLibraryManager().isAutoUpdate();
+ }
+ fRefreshRegistersButton.setSelection( regUpdate );
+ fRefreshSolibsButton.setSelection( solibUpdate );
+
+ }
+
+ protected void performApply() {
+ storeValues();
+ super.performApply();
+ }
+
+ public boolean performOk() {
+ storeValues();
+ return super.performOk();
+ }
+
+ private void storeValues() {
+ ICDISession session = (ICDISession)getElement().getAdapter( ICDISession.class );
+ final ICDITarget target = (ICDITarget)getElement().getAdapter( ICDITarget.class );
+ if ( session instanceof Session ) {
+ final boolean regUpdate = fRefreshRegistersButton.getSelection();
+ final boolean solibUpdate = fRefreshSolibsButton.getSelection();
+ final Session miSession = ((Session)session);
+ miSession.getRegisterManager().setAutoUpdate( regUpdate );
+ miSession.getSharedLibraryManager().setAutoUpdate( solibUpdate );
+ if ( target.isSuspended() && (regUpdate || solibUpdate) ) {
+ DebugPlugin.getDefault().asyncExec( new Runnable() {
+
+ public void run() {
+ if ( target.isSuspended() ) {
+ if ( regUpdate ) {
+ try {
+ miSession.getRegisterManager().update();
+ }
+ catch( CDIException e ) {
+ }
+ }
+ if ( solibUpdate ) {
+ try {
+ miSession.getSharedLibraryManager().update();
+ }
+ catch( CDIException e ) {
+ }
+ }
+ }
+ }
+ } );
+ }
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.java
new file mode 100644
index 0000000000..1a31bbb538
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.java
@@ -0,0 +1,37 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ ***********************************************************************/
+package org.eclipse.cdt.debug.mi.internal.ui.propertypages;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Comment for .
+ */
+public class PropertyMessages {
+
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.internal.ui.propertypages.PropertyMessages";//$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+ private PropertyMessages() {
+ }
+
+ public static String getString( String key ) {
+ // TODO Auto-generated method stub
+ try {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch( MissingResourceException e ) {
+ return '!' + key + '!';
+ }
+ }
+} \ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.properties b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.properties
new file mode 100644
index 0000000000..d421597a5a
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/propertypages/PropertyMessages.properties
@@ -0,0 +1,2 @@
+OptionsPropertyPage.0=Automatically refresh registers
+OptionsPropertyPage.1=Automatically refresh shared libraries

Back to the top