1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

New UI for the 'Debugger' page of launch configuration.

This commit is contained in:
Mikhail Khodjaiants 2003-09-08 21:42:43 +00:00
parent ce59a25fa6
commit 2a80da7743
4 changed files with 426 additions and 326 deletions

View file

@ -1,3 +1,9 @@
2003-09-09 Mikhail Khodjaiants
New UI for the 'Debugger' page of launch configuration.
* CygwinDebuggerPage.java
* GDBDebuggerPage.java
* GDBSolibBlock.java
2003-04-07 Mikhail Khodjaiants
Replaced 'toString()' by 'getMessage()' for CDI exceptions.
* SetAutoSolibActionDelegate.java

View file

@ -4,197 +4,23 @@
*/
package org.eclipse.cdt.debug.mi.internal.ui;
import java.io.File;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
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.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class CygwinDebuggerPage extends AbstractLaunchConfigurationTab {
protected Text fGDBCommandText;
protected Text fGDBInitText;
public void createControl(Composite parent) {
GridData gd;
Label label;
Button button;
Composite comp, subComp;
comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
setControl(comp);
subComp = new Composite(comp, SWT.NONE);
GridLayout gdbLayout = new GridLayout();
gdbLayout.numColumns = 2;
gdbLayout.marginHeight = 0;
gdbLayout.marginWidth = 0;
subComp.setLayout(gdbLayout);
subComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = new Label(subComp, SWT.NONE);
label.setText("GDB debugger:");
gd = new GridData();
gd.horizontalSpan = 2;
label.setLayoutData(gd);
fGDBCommandText = new Text(subComp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
fGDBCommandText.setLayoutData(gd);
fGDBCommandText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
updateLaunchConfigurationDialog();
}
});
button = createPushButton(subComp, "&Browse...", null);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
handleGDBButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBButtonSelected() {
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
dialog.setText("GDB Command");
String gdbCommand = fGDBCommandText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
if (lastSeparatorIndex != -1) {
dialog.setFilterPath(gdbCommand.substring(0, lastSeparatorIndex));
}
String res = dialog.open();
if (res == null) {
return;
}
fGDBCommandText.setText(res);
}
});
subComp = new Composite(comp, SWT.NONE);
gdbLayout = new GridLayout();
gdbLayout.numColumns = 2;
gdbLayout.marginHeight = 0;
gdbLayout.marginWidth = 0;
subComp.setLayout(gdbLayout);
subComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = new Label(subComp, SWT.NONE);
label.setText("GDB command file:");
gd = new GridData();
gd.horizontalSpan = 2;
label.setLayoutData(gd);
fGDBInitText = new Text(subComp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
fGDBInitText.setLayoutData(gd);
fGDBInitText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
updateLaunchConfigurationDialog();
}
});
button = createPushButton(subComp, "&Browse...", null);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
handleGDBInitButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBInitButtonSelected() {
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
dialog.setText("GDB command file");
String gdbCommand = fGDBInitText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
if (lastSeparatorIndex != -1) {
dialog.setFilterPath(gdbCommand.substring(0, lastSeparatorIndex));
}
String res = dialog.open();
if (res == null) {
return;
}
fGDBInitText.setText(res);
}
});
label = new Label(comp,SWT.WRAP);
label.setText("(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example \"run\".)");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1;
gd.widthHint = 200;
label.setLayoutData(gd);
}
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, "");
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_AUTO_SOLIB, true);
}
/**
* @see ILaunchConfigurationTab#isValid(ILaunchConfiguration)
*/
public boolean isValid(ILaunchConfiguration launchConfig) {
boolean valid = fGDBCommandText.getText().length() != 0;
if (valid) {
setErrorMessage(null);
setMessage(null);
} else {
setErrorMessage("Debugger executable must be specified");
setMessage(null);
}
return valid;
}
public void initializeFrom(ILaunchConfiguration configuration) {
String gdbCommand = "gdb";
String gdbInit = "";
try {
gdbCommand = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
gdbInit = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, "");
} catch (CoreException e) {
}
fGDBCommandText.setText(gdbCommand);
fGDBInitText.setText(gdbInit);
}
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
String gdbStr = fGDBCommandText.getText();
gdbStr.trim();
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbStr);
gdbStr = fGDBInitText.getText();
gdbStr.trim();
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, gdbStr);
}
public String getName() {
public class CygwinDebuggerPage extends GDBDebuggerPage
{
public String getName()
{
return "Cygwin GDB Debugger Options";
}
/**
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
*/
protected void updateLaunchConfigurationDialog() {
super.updateLaunchConfigurationDialog();
}
/**
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getShell()
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage#createSolibBlock(org.eclipse.swt.widgets.Composite)
*/
protected Shell getShell() {
return super.getShell();
public GDBSolibBlock createSolibBlock(Composite parent)
{
GDBSolibBlock block = new GDBSolibBlock();
block.createBlock( parent, true, false, true );
return block;
}
}

View file

@ -5,8 +5,11 @@
package org.eclipse.cdt.debug.mi.internal.ui;
import java.io.File;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@ -23,190 +26,263 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
public class GDBDebuggerPage extends AbstractLaunchConfigurationTab {
public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements Observer
{
private TabFolder fTabFolder;
protected Text fGDBCommandText;
protected Text fGDBInitText;
private Button fAutoSoLibButton;
private GDBSolibBlock fSolibBlock;
public void createControl(Composite parent) {
GridData gd;
Label label;
Button button;
Composite comp, subComp;
public void createControl( Composite parent )
{
Composite comp = new Composite( parent, SWT.NONE );
comp.setLayout( new GridLayout() );
comp.setLayoutData( new GridData( GridData.FILL_BOTH ) );
comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
setControl(comp);
fTabFolder = new TabFolder( comp, SWT.NONE );
fTabFolder.setLayoutData( new GridData( GridData.FILL_BOTH | GridData.GRAB_VERTICAL ) );
subComp = new Composite(comp, SWT.NONE);
GridLayout gdbLayout = new GridLayout();
gdbLayout.numColumns = 2;
gdbLayout.marginHeight = 0;
gdbLayout.marginWidth = 0;
subComp.setLayout(gdbLayout);
subComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
createTabs( fTabFolder );
label = new Label(subComp, SWT.NONE);
label.setText("GDB debugger:");
gd = new GridData();
gd.horizontalSpan = 2;
label.setLayoutData(gd);
fGDBCommandText = new Text(subComp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
fGDBCommandText.setLayoutData(gd);
fGDBCommandText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
updateLaunchConfigurationDialog();
}
});
button = createPushButton(subComp, "&Browse...", null);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
handleGDBButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBButtonSelected() {
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
dialog.setText("GDB Command");
String gdbCommand = fGDBCommandText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
if (lastSeparatorIndex != -1) {
dialog.setFilterPath(gdbCommand.substring(0, lastSeparatorIndex));
}
String res = dialog.open();
if (res == null) {
return;
}
fGDBCommandText.setText(res);
}
});
subComp = new Composite(comp, SWT.NONE);
gdbLayout = new GridLayout();
gdbLayout.numColumns = 2;
gdbLayout.marginHeight = 0;
gdbLayout.marginWidth = 0;
subComp.setLayout(gdbLayout);
subComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = new Label(subComp, SWT.NONE);
label.setText("GDB command file:");
gd = new GridData();
gd.horizontalSpan = 2;
label.setLayoutData(gd);
fGDBInitText = new Text(subComp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
fGDBInitText.setLayoutData(gd);
fGDBInitText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
updateLaunchConfigurationDialog();
}
});
button = createPushButton(subComp, "&Browse...", null);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
handleGDBInitButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBInitButtonSelected() {
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
dialog.setText("GDB command file");
String gdbCommand = fGDBInitText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
if (lastSeparatorIndex != -1) {
dialog.setFilterPath(gdbCommand.substring(0, lastSeparatorIndex));
}
String res = dialog.open();
if (res == null) {
return;
}
fGDBInitText.setText(res);
}
});
label = new Label(comp,SWT.WRAP);
label.setText("(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example \"run\".)");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1;
gd.widthHint = 200;
label.setLayoutData(gd);
fAutoSoLibButton = new Button(comp, SWT.CHECK);
fAutoSoLibButton.setText("Load shared library symbols automatically");
fAutoSoLibButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
fTabFolder.setSelection( 0 );
setControl( parent );
}
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, "");
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_AUTO_SOLIB, true);
public void setDefaults( ILaunchConfigurationWorkingCopy configuration )
{
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" );
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, "" );
if ( fSolibBlock != null )
fSolibBlock.setDefaults( configuration );
}
/**
* @see ILaunchConfigurationTab#isValid(ILaunchConfiguration)
*/
public boolean isValid(ILaunchConfiguration launchConfig) {
public boolean isValid( ILaunchConfiguration launchConfig )
{
boolean valid = fGDBCommandText.getText().length() != 0;
if (valid) {
setErrorMessage(null);
setMessage(null);
} else {
setErrorMessage("Debugger executable must be specified");
setMessage(null);
if ( valid )
{
setErrorMessage( null );
setMessage( null );
}
else
{
setErrorMessage( "Debugger executable must be specified" );
setMessage( null );
}
return valid;
}
public void initializeFrom(ILaunchConfiguration configuration) {
public void initializeFrom( ILaunchConfiguration configuration )
{
String gdbCommand = "gdb";
String gdbInit = "";
boolean autosolib = false;
try {
gdbCommand = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
gdbInit = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, "");
autosolib = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_AUTO_SOLIB, true);
} catch (CoreException e) {
try
{
gdbCommand = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" );
gdbInit = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, "" );
}
catch( CoreException e )
{
}
fGDBCommandText.setText(gdbCommand);
fGDBInitText.setText(gdbInit);
fAutoSoLibButton.setSelection(autosolib);
fGDBCommandText.setText( gdbCommand );
fGDBInitText.setText( gdbInit );
if ( fSolibBlock != null )
fSolibBlock.initializeFrom( configuration );
}
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
public void performApply( ILaunchConfigurationWorkingCopy configuration )
{
String gdbStr = fGDBCommandText.getText();
gdbStr.trim();
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbStr);
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbStr );
gdbStr = fGDBInitText.getText();
gdbStr.trim();
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, gdbStr);
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_AUTO_SOLIB, fAutoSoLibButton.getSelection());
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, gdbStr );
if ( fSolibBlock != null )
fSolibBlock.performApply( configuration );
}
public String getName() {
public String getName()
{
return "GDB Debugger Options";
}
/**
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getShell()
*/
protected Shell getShell() {
protected Shell getShell()
{
return super.getShell();
}
/**
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
*/
protected void updateLaunchConfigurationDialog() {
protected void updateLaunchConfigurationDialog()
{
super.updateLaunchConfigurationDialog();
}
/* (non-Javadoc)
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/
public void update( Observable o, Object arg )
{
updateLaunchConfigurationDialog();
}
public GDBSolibBlock createSolibBlock( Composite parent )
{
GDBSolibBlock block = new GDBSolibBlock();
block.createBlock( parent, true, true, true );
return block;
}
public void createTabs( TabFolder tabFolder )
{
createMainTab( tabFolder );
createSolibTab( tabFolder );
}
public void createMainTab( TabFolder tabFolder )
{
TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
tabItem.setText( "Main" );
Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH );
((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
tabItem.setControl( comp );
Composite subComp = ControlFactory.createCompositeEx( comp, 2, GridData.FILL_HORIZONTAL );
((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
Label label = ControlFactory.createLabel( subComp, "GDB debugger:" );
GridData gd = new GridData();
gd.horizontalSpan = 2;
label.setLayoutData( gd );
fGDBCommandText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER );
fGDBCommandText.addModifyListener(
new ModifyListener()
{
public void modifyText( ModifyEvent evt )
{
updateLaunchConfigurationDialog();
}
} );
Button button = createPushButton( subComp, "&Browse...", null );
button.addSelectionListener(
new SelectionAdapter()
{
public void widgetSelected( SelectionEvent evt )
{
handleGDBButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBButtonSelected()
{
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( "GDB Command" );
String gdbCommand = fGDBCommandText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf( File.separator );
if ( lastSeparatorIndex != -1 )
{
dialog.setFilterPath( gdbCommand.substring( 0, lastSeparatorIndex ) );
}
String res = dialog.open();
if ( res == null )
{
return;
}
fGDBCommandText.setText( res );
}
} );
label = ControlFactory.createLabel( subComp, "GDB command file:" );
gd = new GridData();
gd.horizontalSpan = 2;
label.setLayoutData( gd );
fGDBInitText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER );
gd = new GridData( GridData.FILL_HORIZONTAL );
fGDBInitText.setLayoutData( gd );
fGDBInitText.addModifyListener( new ModifyListener()
{
public void modifyText( ModifyEvent evt )
{
updateLaunchConfigurationDialog();
}
} );
button = createPushButton( subComp, "&Browse...", null );
button.addSelectionListener(
new SelectionAdapter()
{
public void widgetSelected( SelectionEvent evt )
{
handleGDBInitButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBInitButtonSelected()
{
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( "GDB command file" );
String gdbCommand = fGDBInitText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf( File.separator );
if ( lastSeparatorIndex != -1 )
{
dialog.setFilterPath( gdbCommand.substring( 0, lastSeparatorIndex ) );
}
String res = dialog.open();
if ( res == null )
{
return;
}
fGDBInitText.setText( res );
}
} );
label = ControlFactory.createLabel( comp,
"(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example \"run\".)",
200,
SWT.DEFAULT,
SWT.WRAP );
gd = new GridData( GridData.FILL_HORIZONTAL );
gd.horizontalSpan = 1;
gd.widthHint = 200;
label.setLayoutData( gd );
}
public void createSolibTab( TabFolder tabFolder )
{
TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
tabItem.setText( "Shared Libraries" );
Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH );
tabItem.setControl( comp );
fSolibBlock = createSolibBlock( comp );
fSolibBlock.addObserver( this );
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
*/
public void dispose()
{
if ( fSolibBlock != null )
{
fSolibBlock.deleteObserver( this );
fSolibBlock.dispose();
}
super.dispose();
}
}

View file

@ -0,0 +1,192 @@
/*
* (c) Copyright QNX Software System Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.internal.ui;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.ui.SolibSearchPathBlock;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
/**
* Enter type comment.
*
* @since Sep 3, 2003
*/
public class GDBSolibBlock extends Observable implements Observer
{
private SolibSearchPathBlock fSolibSearchPathBlock;
private Button fAutoSoLibButton;
private Button fStopOnSolibEventsButton;
private Composite fControl;
public GDBSolibBlock()
{
super();
}
public void createBlock( Composite parent, boolean solibPath, boolean autoSolib, boolean stopOnSolibEvents )
{
Composite subComp = ControlFactory.createCompositeEx( parent, 1, GridData.FILL_HORIZONTAL );
((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
((GridLayout)subComp.getLayout()).marginHeight = 0;
((GridLayout)subComp.getLayout()).marginWidth = 0;
if ( solibPath )
{
fSolibSearchPathBlock = new SolibSearchPathBlock();
fSolibSearchPathBlock.createBlock( subComp );
fSolibSearchPathBlock.addObserver( this );
}
if ( autoSolib )
{
fAutoSoLibButton = ControlFactory.createCheckBox( subComp, "Load shared library symbols automatically" );
fAutoSoLibButton.addSelectionListener(
new SelectionAdapter()
{
public void widgetSelected( SelectionEvent e )
{
updateButtons();
changed();
}
} );
}
if ( stopOnSolibEvents )
{
fStopOnSolibEventsButton = ControlFactory.createCheckBox( subComp, "Stop on shared library events" );
fStopOnSolibEventsButton.addSelectionListener(
new SelectionAdapter()
{
public void widgetSelected( SelectionEvent e )
{
updateButtons();
changed();
}
} );
}
setControl( subComp );
}
public void initializeFrom( ILaunchConfiguration configuration )
{
if ( fSolibSearchPathBlock != null )
fSolibSearchPathBlock.initializeFrom( configuration );
try
{
if ( fAutoSoLibButton != null )
fAutoSoLibButton.setSelection( configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, true ) );
if ( fStopOnSolibEventsButton != null )
fStopOnSolibEventsButton.setSelection( configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false ) );
initializeButtons( configuration );
updateButtons();
}
catch( CoreException e )
{
return;
}
}
public void performApply( ILaunchConfigurationWorkingCopy configuration )
{
if ( fSolibSearchPathBlock != null )
fSolibSearchPathBlock.performApply( configuration );
try
{
Map attrs = configuration.getAttributes();
if ( fAutoSoLibButton != null )
attrs.put( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, new Boolean( fAutoSoLibButton.getSelection() ) );
if ( fStopOnSolibEventsButton != null )
attrs.put( IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, new Boolean( fStopOnSolibEventsButton.getSelection() ) );
configuration.setAttributes( attrs );
}
catch( CoreException e )
{
}
}
public void setDefaults( ILaunchConfigurationWorkingCopy configuration )
{
if ( fSolibSearchPathBlock != null )
fSolibSearchPathBlock.setDefaults( configuration );
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, true );
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false );
}
protected void updateButtons()
{
}
public void dispose()
{
deleteObservers();
if ( fSolibSearchPathBlock != null )
{
fSolibSearchPathBlock.deleteObserver( this );
fSolibSearchPathBlock.dispose();
}
}
public void disable()
{
if ( fAutoSoLibButton != null )
fAutoSoLibButton.setEnabled( false );
if ( fStopOnSolibEventsButton != null )
fStopOnSolibEventsButton.setEnabled( false );
}
/* (non-Javadoc)
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/
public void update( Observable o, Object arg )
{
changed();
}
protected void changed()
{
setChanged();
notifyObservers();
}
public Composite getControl()
{
return fControl;
}
protected void setControl( Composite composite )
{
fControl = composite;
}
protected void initializeButtons( ILaunchConfiguration configuration )
{
try
{
boolean enable = !ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE.equals( configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, "" ) );
if ( fAutoSoLibButton != null )
fAutoSoLibButton.setEnabled( enable );
if ( fStopOnSolibEventsButton != null )
fStopOnSolibEventsButton.setEnabled( enable );
}
catch( CoreException e )
{
}
}
}