mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Implementation of preference pages.
This commit is contained in:
parent
452737ae51
commit
1145258fd6
12 changed files with 467 additions and 62 deletions
|
@ -44,7 +44,7 @@ public class CDebugCorePlugin extends Plugin
|
||||||
*/
|
*/
|
||||||
public CDebugCorePlugin( IPluginDescriptor descriptor )
|
public CDebugCorePlugin( IPluginDescriptor descriptor )
|
||||||
{
|
{
|
||||||
super(descriptor);
|
super( descriptor );
|
||||||
plugin = this;
|
plugin = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,26 +50,6 @@ import org.eclipse.debug.core.model.IProcess;
|
||||||
*/
|
*/
|
||||||
public class CDebugModel
|
public class CDebugModel
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Preference key for default CDI request timeout value.
|
|
||||||
*/
|
|
||||||
public static final String PREF_REQUEST_TIMEOUT = getPluginIdentifier() + ".PREF_REQUEST_TIMEOUT"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default CDI request timeout when no preference is set.
|
|
||||||
*/
|
|
||||||
public static final int DEF_REQUEST_TIMEOUT = 10000;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The minimum value the CDI request timeout can have.
|
|
||||||
*/
|
|
||||||
public static final int MIN_REQUEST_TIMEOUT = 100;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The maximum value the CDI request timeout can have.
|
|
||||||
*/
|
|
||||||
public static final int MAX_REQUEST_TIMEOUT = Integer.MAX_VALUE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CDebugModel.
|
* Constructor for CDebugModel.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.mi.core;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Constant definitions for GDB MI plug-in.
|
||||||
|
*
|
||||||
|
* @since Oct 4, 2002
|
||||||
|
*/
|
||||||
|
public interface IMIConstants
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* MI plug-in identifier (value <code>"org.eclipse.cdt.debug.mi"</code>).
|
||||||
|
*/
|
||||||
|
public static final String PLUGIN_ID = MIPlugin.getDefault().getDescriptor().getUniqueIdentifier();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preference key for default MI request timeout value.
|
||||||
|
*/
|
||||||
|
public static final String PREF_REQUEST_TIMEOUT = PLUGIN_ID + ".PREF_REQUEST_TIMEOUT"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default MI request timeout when no preference is set.
|
||||||
|
*/
|
||||||
|
public static final int DEF_REQUEST_TIMEOUT = 10000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The minimum value the MI request timeout can have.
|
||||||
|
*/
|
||||||
|
public static final int MIN_REQUEST_TIMEOUT = 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum value the MI request timeout can have.
|
||||||
|
*/
|
||||||
|
public static final int MAX_REQUEST_TIMEOUT = Integer.MAX_VALUE;
|
||||||
|
}
|
|
@ -14,6 +14,7 @@ import org.eclipse.cdt.debug.mi.core.command.MITargetAttach;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||||
import org.eclipse.cdt.utils.pty.PTY;
|
import org.eclipse.cdt.utils.pty.PTY;
|
||||||
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPluginDescriptor;
|
import org.eclipse.core.runtime.IPluginDescriptor;
|
||||||
import org.eclipse.core.runtime.Plugin;
|
import org.eclipse.core.runtime.Plugin;
|
||||||
|
|
||||||
|
@ -21,7 +22,6 @@ import org.eclipse.core.runtime.Plugin;
|
||||||
* GDB/MI Plugin.
|
* GDB/MI Plugin.
|
||||||
*/
|
*/
|
||||||
public class MIPlugin extends Plugin {
|
public class MIPlugin extends Plugin {
|
||||||
|
|
||||||
//The shared instance.
|
//The shared instance.
|
||||||
private static MIPlugin plugin;
|
private static MIPlugin plugin;
|
||||||
|
|
||||||
|
@ -171,4 +171,21 @@ public class MIPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.core.runtime.Plugin#startup()
|
||||||
|
*/
|
||||||
|
public void startup() throws CoreException {
|
||||||
|
super.startup();
|
||||||
|
getPluginPreferences().setDefault( IMIConstants.PREF_REQUEST_TIMEOUT, IMIConstants.DEF_REQUEST_TIMEOUT );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.core.runtime.Plugin#shutdown()
|
||||||
|
*/
|
||||||
|
public void shutdown() throws CoreException {
|
||||||
|
savePluginPreferences();
|
||||||
|
super.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
pluginName=C/C++ Development Tools GDB/MI CDI Debugger UI
|
pluginName=C/C++ Development Tools GDB/MI CDI Debugger UI
|
||||||
providerName=Eclipse.org
|
providerName=Eclipse.org
|
||||||
|
|
||||||
|
MIPreferencePage.name=GDB MI
|
||||||
|
|
|
@ -32,5 +32,14 @@
|
||||||
debuggerID="org.eclipse.cdt.debug.mi.core.CDebugger">
|
debuggerID="org.eclipse.cdt.debug.mi.core.CDebugger">
|
||||||
</debugPage>
|
</debugPage>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.ui.preferencePages">
|
||||||
|
<page
|
||||||
|
name="%MIPreferencePage.name"
|
||||||
|
category="org.eclipse.cdt.debug.ui.CDebugPreferencePage"
|
||||||
|
class="org.eclipse.cdt.debug.mi.internal.ui.preferences.MIPreferencePage"
|
||||||
|
id="org.eclipse.cdt.debug.mi.ui.MIPreferencePage">
|
||||||
|
</page>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.mi.internal.ui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Help context ids for the C/C++ debug ui.
|
||||||
|
* <p>
|
||||||
|
* This interface contains constants only; it is not intended to be implemented
|
||||||
|
* or extended.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @since Oct 4, 2002
|
||||||
|
*/
|
||||||
|
public interface IMIHelpContextIds
|
||||||
|
{
|
||||||
|
public static final String PREFIX = IMIUIConstants.PLUGIN_ID + "."; //$NON-NLS-1$
|
||||||
|
|
||||||
|
// Preference pages
|
||||||
|
public static final String MI_PREFERENCE_PAGE = PREFIX + "mi_preference_page_context"; //$NON-NLS-1$
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.mi.internal.ui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Constant definitions for MI UI plug-in.
|
||||||
|
*
|
||||||
|
* @since Oct 4, 2002
|
||||||
|
*/
|
||||||
|
public interface IMIUIConstants
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* C/C++ Debug UI plug-in identifier (value <code>"org.eclipse.cdt.debug.ui"</code>).
|
||||||
|
*/
|
||||||
|
public static final String PLUGIN_ID = MIUIPlugin.getDefault().getDescriptor().getUniqueIdentifier();
|
||||||
|
}
|
|
@ -0,0 +1,192 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.mi.internal.ui.preferences;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
|
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.jface.preference.FieldEditor;
|
||||||
|
import org.eclipse.jface.preference.IntegerFieldEditor;
|
||||||
|
import org.eclipse.jface.preference.PreferencePage;
|
||||||
|
import org.eclipse.jface.preference.StringFieldEditor;
|
||||||
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Group;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.ui.IWorkbench;
|
||||||
|
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||||
|
import org.eclipse.ui.help.WorkbenchHelp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Page for preferences that apply specifically to GDB MI.
|
||||||
|
*
|
||||||
|
* @since Oct 4, 2002
|
||||||
|
*/
|
||||||
|
public class MIPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
|
||||||
|
{
|
||||||
|
// Timeout preference widgets
|
||||||
|
private IntegerFieldEditor fTimeoutText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for MIPreferencePage.
|
||||||
|
*/
|
||||||
|
public MIPreferencePage()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
setPreferenceStore( MIUIPlugin.getDefault().getPreferenceStore() );
|
||||||
|
setDescription( "General settings for GDB MI." );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
|
||||||
|
*/
|
||||||
|
protected Control createContents( Composite parent )
|
||||||
|
{
|
||||||
|
WorkbenchHelp.setHelp( getControl(), IMIHelpContextIds.MI_PREFERENCE_PAGE );
|
||||||
|
|
||||||
|
//The main composite
|
||||||
|
Composite composite = new Composite( parent, SWT.NULL );
|
||||||
|
GridLayout layout = new GridLayout();
|
||||||
|
layout.numColumns = 1;
|
||||||
|
layout.marginHeight = 0;
|
||||||
|
layout.marginWidth = 0;
|
||||||
|
composite.setLayout( layout );
|
||||||
|
GridData data = new GridData();
|
||||||
|
data.verticalAlignment = GridData.FILL;
|
||||||
|
data.horizontalAlignment = GridData.FILL;
|
||||||
|
composite.setLayoutData( data );
|
||||||
|
|
||||||
|
createSpacer( composite, 1 );
|
||||||
|
createCommunicationPreferences( composite );
|
||||||
|
|
||||||
|
setValues();
|
||||||
|
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates composite group and sets the default layout data.
|
||||||
|
*
|
||||||
|
* @param parent the parent of the new composite
|
||||||
|
* @param numColumns the number of columns for the new composite
|
||||||
|
* @param labelText the text label of the new composite
|
||||||
|
* @return the newly-created composite
|
||||||
|
*/
|
||||||
|
private Composite createGroupComposite( Composite parent, int numColumns, String labelText )
|
||||||
|
{
|
||||||
|
Group comp = new Group( parent, SWT.NONE );
|
||||||
|
//GridLayout
|
||||||
|
GridLayout layout = new GridLayout();
|
||||||
|
layout.numColumns = numColumns;
|
||||||
|
comp.setLayout( layout );
|
||||||
|
//GridData
|
||||||
|
GridData gd = new GridData();
|
||||||
|
gd.verticalAlignment = GridData.FILL;
|
||||||
|
gd.horizontalAlignment = GridData.FILL;
|
||||||
|
comp.setLayoutData( gd );
|
||||||
|
comp.setText( labelText );
|
||||||
|
return comp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the values of the component widgets based on the
|
||||||
|
* values in the preference store
|
||||||
|
*/
|
||||||
|
private void setValues()
|
||||||
|
{
|
||||||
|
fTimeoutText.setStringValue( new Integer( MIPlugin.getDefault().getPluginPreferences().getInt( IMIConstants.PREF_REQUEST_TIMEOUT ) ).toString() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IPreferencePage#performOk()
|
||||||
|
*/
|
||||||
|
public boolean performOk()
|
||||||
|
{
|
||||||
|
storeValues();
|
||||||
|
MIUIPlugin.getDefault().savePluginPreferences();
|
||||||
|
MIPlugin.getDefault().savePluginPreferences();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the default preferences.
|
||||||
|
* @see PreferencePage#performDefaults()
|
||||||
|
*/
|
||||||
|
protected void performDefaults()
|
||||||
|
{
|
||||||
|
setDefaultValues();
|
||||||
|
super.performDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setDefaultValues()
|
||||||
|
{
|
||||||
|
fTimeoutText.setStringValue( new Integer( IMIConstants.DEF_REQUEST_TIMEOUT ).toString() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(IWorkbench)
|
||||||
|
*/
|
||||||
|
public void init( IWorkbench workbench )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createSpacer( Composite composite, int columnSpan )
|
||||||
|
{
|
||||||
|
Label label = new Label( composite, SWT.NONE );
|
||||||
|
GridData gd = new GridData();
|
||||||
|
gd.horizontalSpan = columnSpan;
|
||||||
|
label.setLayoutData( gd );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createCommunicationPreferences( Composite composite )
|
||||||
|
{
|
||||||
|
Composite comp = createGroupComposite( composite, 1, "Communication" );
|
||||||
|
//Add in an intermediate composite to allow for spacing
|
||||||
|
Composite spacingComposite = new Composite( comp, SWT.NONE );
|
||||||
|
GridLayout layout = new GridLayout();
|
||||||
|
spacingComposite.setLayout( layout );
|
||||||
|
GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL );
|
||||||
|
data.horizontalSpan = 2;
|
||||||
|
spacingComposite.setLayoutData( data );
|
||||||
|
|
||||||
|
fTimeoutText = new IntegerFieldEditor( IMIConstants.PREF_REQUEST_TIMEOUT, "Debugger &timeout (ms):", spacingComposite );
|
||||||
|
fTimeoutText.setPreferenceStore( MIUIPlugin.getDefault().getPreferenceStore() );
|
||||||
|
fTimeoutText.setPreferencePage( this );
|
||||||
|
fTimeoutText.setValidateStrategy( StringFieldEditor.VALIDATE_ON_KEY_STROKE );
|
||||||
|
fTimeoutText.setValidRange( IMIConstants.MIN_REQUEST_TIMEOUT, IMIConstants.MAX_REQUEST_TIMEOUT );
|
||||||
|
String minValue = Integer.toString( IMIConstants.MIN_REQUEST_TIMEOUT );
|
||||||
|
String maxValue = Integer.toString( IMIConstants.MAX_REQUEST_TIMEOUT );
|
||||||
|
fTimeoutText.setErrorMessage( MessageFormat.format( "The valid value range is [{0},{1}].", new String[]{ minValue, maxValue } ) );
|
||||||
|
fTimeoutText.load();
|
||||||
|
fTimeoutText.setPropertyChangeListener(
|
||||||
|
new IPropertyChangeListener()
|
||||||
|
{
|
||||||
|
public void propertyChange( PropertyChangeEvent event )
|
||||||
|
{
|
||||||
|
if ( event.getProperty().equals( FieldEditor.IS_VALID ) )
|
||||||
|
setValid( fTimeoutText.isValid() );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store the preference values based on the state of the
|
||||||
|
* component widgets
|
||||||
|
*/
|
||||||
|
private void storeValues()
|
||||||
|
{
|
||||||
|
MIPlugin.getDefault().getPluginPreferences().setValue( IMIConstants.PREF_REQUEST_TIMEOUT, fTimeoutText.getIntValue() );
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,28 +5,31 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.debug.internal.ui.preferences;
|
package org.eclipse.cdt.debug.internal.ui.preferences;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
|
||||||
import org.eclipse.cdt.debug.core.CDebugModel;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.jface.preference.FieldEditor;
|
import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
|
||||||
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
|
import org.eclipse.debug.ui.IDebugView;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.preference.IntegerFieldEditor;
|
|
||||||
import org.eclipse.jface.preference.PreferencePage;
|
import org.eclipse.jface.preference.PreferencePage;
|
||||||
import org.eclipse.jface.preference.StringFieldEditor;
|
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
import org.eclipse.jface.viewers.StructuredViewer;
|
||||||
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
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.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.ui.IViewPart;
|
||||||
import org.eclipse.ui.IWorkbench;
|
import org.eclipse.ui.IWorkbench;
|
||||||
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||||
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.help.WorkbenchHelp;
|
import org.eclipse.ui.help.WorkbenchHelp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,8 +41,11 @@ import org.eclipse.ui.help.WorkbenchHelp;
|
||||||
*/
|
*/
|
||||||
public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
|
public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
|
||||||
{
|
{
|
||||||
// Timeout preference widgets
|
// Primitive display preference widgets
|
||||||
private IntegerFieldEditor fTimeoutText;
|
private Button fHexButton;
|
||||||
|
|
||||||
|
// View setting widgets
|
||||||
|
private Button fPathsButton;
|
||||||
|
|
||||||
private PropertyChangeListener fPropertyChangeListener;
|
private PropertyChangeListener fPropertyChangeListener;
|
||||||
|
|
||||||
|
@ -95,34 +101,10 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
data.horizontalAlignment = GridData.FILL;
|
data.horizontalAlignment = GridData.FILL;
|
||||||
composite.setLayoutData( data );
|
composite.setLayoutData( data );
|
||||||
|
|
||||||
Composite comp = createGroupComposite( composite, 1, "Communication" );
|
createSpacer( composite, 1 );
|
||||||
//Add in an intermediate composite to allow for spacing
|
createPrimitiveDisplayPreferences( composite );
|
||||||
Composite spacingComposite = new Composite( comp, SWT.NONE );
|
createSpacer( composite, 1 );
|
||||||
layout = new GridLayout();
|
createViewSettingPreferences( composite );
|
||||||
spacingComposite.setLayout( layout );
|
|
||||||
data = new GridData( GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL );
|
|
||||||
data.horizontalSpan = 2;
|
|
||||||
spacingComposite.setLayoutData( data );
|
|
||||||
|
|
||||||
fTimeoutText = new IntegerFieldEditor( CDebugModel.PREF_REQUEST_TIMEOUT, "Debugger &timeout (ms):", spacingComposite );
|
|
||||||
fTimeoutText.setPreferenceStore( CDebugUIPlugin.getDefault().getPreferenceStore() );
|
|
||||||
fTimeoutText.setPreferencePage( this );
|
|
||||||
fTimeoutText.setValidateStrategy( StringFieldEditor.VALIDATE_ON_KEY_STROKE );
|
|
||||||
fTimeoutText.setValidRange( CDebugModel.MIN_REQUEST_TIMEOUT, CDebugModel.MAX_REQUEST_TIMEOUT );
|
|
||||||
String minValue = Integer.toString( CDebugModel.MIN_REQUEST_TIMEOUT );
|
|
||||||
String maxValue = Integer.toString( CDebugModel.MAX_REQUEST_TIMEOUT );
|
|
||||||
fTimeoutText.setErrorMessage( MessageFormat.format( "The valid value range is [{0},{1}].", new String[]{ minValue, maxValue } ) );
|
|
||||||
fTimeoutText.load();
|
|
||||||
fTimeoutText.setPropertyChangeListener(
|
|
||||||
new IPropertyChangeListener()
|
|
||||||
{
|
|
||||||
public void propertyChange( PropertyChangeEvent event )
|
|
||||||
{
|
|
||||||
if ( event.getProperty().equals( FieldEditor.IS_VALID ) )
|
|
||||||
setValid( fTimeoutText.isValid() );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
setValues();
|
setValues();
|
||||||
|
|
||||||
return composite;
|
return composite;
|
||||||
|
@ -160,7 +142,8 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
{
|
{
|
||||||
IPreferenceStore store = getPreferenceStore();
|
IPreferenceStore store = getPreferenceStore();
|
||||||
|
|
||||||
fTimeoutText.setStringValue( new Integer( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( CDebugModel.PREF_REQUEST_TIMEOUT ) ).toString() );
|
fHexButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES ) );
|
||||||
|
fPathsButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -185,7 +168,7 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
public static void initDefaults(IPreferenceStore store)
|
public static void initDefaults(IPreferenceStore store)
|
||||||
{
|
{
|
||||||
store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, false );
|
store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, false );
|
||||||
store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_CHAR_VALUES, false );
|
store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,4 +179,133 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
super.dispose();
|
super.dispose();
|
||||||
getPreferenceStore().removePropertyChangeListener( getPropertyChangeListener() );
|
getPreferenceStore().removePropertyChangeListener( getPropertyChangeListener() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the primitive display preferences composite widget
|
||||||
|
*/
|
||||||
|
private void createPrimitiveDisplayPreferences( Composite parent )
|
||||||
|
{
|
||||||
|
Composite comp = createGroupComposite( parent, 1, "Primitive type display options" );
|
||||||
|
fHexButton = createCheckButton( comp, "Display &hexadecimal values (short, char, int, long)" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the view setting preferences composite widget
|
||||||
|
*/
|
||||||
|
private void createViewSettingPreferences( Composite parent )
|
||||||
|
{
|
||||||
|
Composite comp = createGroupComposite( parent, 1, "Opened view default settings" );
|
||||||
|
fPathsButton = createCheckButton( comp, "Show full &paths" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a button with the given label and sets the default
|
||||||
|
* configuration data.
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createSpacer( Composite composite, int columnSpan )
|
||||||
|
{
|
||||||
|
Label label = new Label( composite, SWT.NONE );
|
||||||
|
GridData gd = new GridData();
|
||||||
|
gd.horizontalSpan = columnSpan;
|
||||||
|
label.setLayoutData( gd );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IPreferencePage#performOk()
|
||||||
|
* Also, notifies interested listeners
|
||||||
|
*/
|
||||||
|
public boolean performOk()
|
||||||
|
{
|
||||||
|
storeValues();
|
||||||
|
if ( getPropertyChangeListener().hasStateChanged() )
|
||||||
|
{
|
||||||
|
refreshViews();
|
||||||
|
}
|
||||||
|
CDebugUIPlugin.getDefault().savePluginPreferences();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refresh the variables and expression views as changes
|
||||||
|
* have occurred that affects these views.
|
||||||
|
*/
|
||||||
|
private void refreshViews()
|
||||||
|
{
|
||||||
|
BusyIndicator.showWhile( getShell().getDisplay(),
|
||||||
|
new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
// Refresh interested views
|
||||||
|
IWorkbenchWindow[] windows = CDebugUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
|
||||||
|
IWorkbenchPage page = null;
|
||||||
|
for ( int i = 0; i < windows.length; i++ )
|
||||||
|
{
|
||||||
|
page = windows[i].getActivePage();
|
||||||
|
if ( page != null )
|
||||||
|
{
|
||||||
|
refreshViews( page, IDebugUIConstants.ID_EXPRESSION_VIEW );
|
||||||
|
refreshViews( page, IDebugUIConstants.ID_VARIABLE_VIEW );
|
||||||
|
refreshViews( page, ICDebugUIConstants.ID_REGISTERS_VIEW );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refresh all views in the given workbench page with the given view id
|
||||||
|
*/
|
||||||
|
private void refreshViews( IWorkbenchPage page, String viewID )
|
||||||
|
{
|
||||||
|
IViewPart part = page.findView( viewID );
|
||||||
|
if ( part != null )
|
||||||
|
{
|
||||||
|
IDebugView adapter = (IDebugView)part.getAdapter( IDebugView.class );
|
||||||
|
if ( adapter != null )
|
||||||
|
{
|
||||||
|
Viewer viewer = adapter.getViewer();
|
||||||
|
if ( viewer instanceof StructuredViewer )
|
||||||
|
{
|
||||||
|
((StructuredViewer)viewer).refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store the preference values based on the state of the component widgets
|
||||||
|
*/
|
||||||
|
private void storeValues()
|
||||||
|
{
|
||||||
|
IPreferenceStore store = getPreferenceStore();
|
||||||
|
store.setValue( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, fHexButton.getSelection() );
|
||||||
|
store.setValue( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, fPathsButton.getSelection() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the default preferences.
|
||||||
|
* @see PreferencePage#performDefaults()
|
||||||
|
*/
|
||||||
|
protected void performDefaults()
|
||||||
|
{
|
||||||
|
setDefaultValues();
|
||||||
|
super.performDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setDefaultValues()
|
||||||
|
{
|
||||||
|
IPreferenceStore store = getPreferenceStore();
|
||||||
|
fHexButton.setSelection( store.getDefaultBoolean( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,4 +91,11 @@ public interface ICDebugPreferenceConstants
|
||||||
* types display char values.
|
* types display char values.
|
||||||
*/
|
*/
|
||||||
public static final String PREF_SHOW_CHAR_VALUES = ICDebugUIConstants.PLUGIN_ID + "cDebug.showCharValues"; //$NON-NLS-1$
|
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.
|
||||||
|
*/
|
||||||
|
public static final String PREF_SHOW_FULL_PATHS = ICDebugUIConstants.PLUGIN_ID + "cDebug.show_full_paths"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.eclipse.cdt.debug.core.ISwitchToThread;
|
||||||
import org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation;
|
import org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation;
|
||||||
import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
|
import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
|
||||||
import org.eclipse.cdt.debug.internal.ui.ColorManager;
|
import org.eclipse.cdt.debug.internal.ui.ColorManager;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.preferences.CDebugPreferencePage;
|
||||||
import org.eclipse.cdt.debug.internal.ui.preferences.MemoryViewPreferencePage;
|
import org.eclipse.cdt.debug.internal.ui.preferences.MemoryViewPreferencePage;
|
||||||
import org.eclipse.cdt.debug.internal.ui.preferences.RegistersViewPreferencePage;
|
import org.eclipse.cdt.debug.internal.ui.preferences.RegistersViewPreferencePage;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
|
@ -147,6 +148,7 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
|
||||||
{
|
{
|
||||||
MemoryViewPreferencePage.initDefaults( pstore );
|
MemoryViewPreferencePage.initDefaults( pstore );
|
||||||
RegistersViewPreferencePage.initDefaults( pstore );
|
RegistersViewPreferencePage.initDefaults( pstore );
|
||||||
|
CDebugPreferencePage.initDefaults( pstore );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CDTDebugModelPresentation getDebugModelPresentation()
|
public static CDTDebugModelPresentation getDebugModelPresentation()
|
||||||
|
|
Loading…
Add table
Reference in a new issue