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

Added API to allow the access to the internal MI UI components by client plugins.

Changed the "Solib search path" component.
Reformatting and cleanup.
This commit is contained in:
Mikhail Khodjaiants 2004-08-23 20:39:04 +00:00
parent 45787ce6ed
commit 6e702766cb
17 changed files with 1025 additions and 890 deletions

View file

@ -1,3 +1,24 @@
2004-08-23 Mikhail Khodjaiants
Added API to allow the access to the internal MI UI components by client plugins.
Changed the "Solib search path" component.
Reformatting and cleanup.
* MIUIMessages.properties
* CygwinDebuggerPage.java
* GDBDebuggerPage.java
* GDBServerDebuggerPage.java
* GDBSolibBlock.java
* IMIHelpContextIds.java
* IMILaunchConfigurationComponent.java: new
* IMIUIConstants.java
* IPathProvider.java: new
* MIUIUtils.java: new
* PixelConverter.java
* SerialPortSettingsBlock.java
* SolibSearchPathBlock.java
* TCPSettingsBlock.java
* SetAutoSolibActionDelegate.java
* MIPreferencePage.java
2004-07-14 Mikhail Khodjaiants 2004-07-14 Mikhail Khodjaiants
Wrong fix. Falling back. Wrong fix. Falling back.
* GDBSolibBlock.java * GDBSolibBlock.java

View file

@ -12,6 +12,9 @@ package org.eclipse.cdt.debug.mi.internal.ui;
import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabFolder;
/**
* CygWin-specific extension of <code>GDBDebuggerPage</code>.
*/
public class CygwinDebuggerPage extends GDBDebuggerPage { public class CygwinDebuggerPage extends GDBDebuggerPage {
public String getName() { public String getName() {

View file

@ -14,6 +14,8 @@ import java.io.File;
import java.util.Observable; import java.util.Observable;
import java.util.Observer; import java.util.Observer;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.ui.IMILaunchConfigurationComponent;
import org.eclipse.cdt.debug.mi.ui.MIUIUtils;
import org.eclipse.cdt.utils.ui.controls.ControlFactory; import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
@ -36,75 +38,73 @@ import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements Observer /**
{ * The dynamic tab for gdb-based debugger implementations.
protected TabFolder fTabFolder; */
protected Text fGDBCommandText; public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements Observer {
protected Text fGDBInitText;
private GDBSolibBlock fSolibBlock;
public void createControl( Composite parent ) protected TabFolder fTabFolder;
{
protected Text fGDBCommandText;
protected Text fGDBInitText;
private IMILaunchConfigurationComponent fSolibBlock;
private boolean fIsInitializing = false;
public void createControl( Composite parent ) {
Composite comp = new Composite( parent, SWT.NONE ); Composite comp = new Composite( parent, SWT.NONE );
comp.setLayout( new GridLayout() ); comp.setLayout( new GridLayout() );
comp.setLayoutData( new GridData( GridData.FILL_BOTH ) ); comp.setLayoutData( new GridData( GridData.FILL_BOTH ) );
fTabFolder = new TabFolder( comp, SWT.NONE ); fTabFolder = new TabFolder( comp, SWT.NONE );
fTabFolder.setLayoutData( new GridData( GridData.FILL_BOTH | GridData.GRAB_VERTICAL ) ); fTabFolder.setLayoutData( new GridData( GridData.FILL_BOTH | GridData.GRAB_VERTICAL ) );
createTabs( fTabFolder ); createTabs( fTabFolder );
fTabFolder.setSelection( 0 );
fTabFolder.setSelection( 0 );
setControl( parent ); setControl( parent );
} }
public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) {
{
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$ configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, "" ); //$NON-NLS-1$ configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, "" ); //$NON-NLS-1$
if ( fSolibBlock != null ) if ( fSolibBlock != null )
fSolibBlock.setDefaults( configuration ); fSolibBlock.setDefaults( configuration );
} }
/** /**
* @see ILaunchConfigurationTab#isValid(ILaunchConfiguration) * @see ILaunchConfigurationTab#isValid(ILaunchConfiguration)
*/ */
public boolean isValid( ILaunchConfiguration launchConfig ) public boolean isValid( ILaunchConfiguration launchConfig ) {
{
boolean valid = fGDBCommandText.getText().length() != 0; boolean valid = fGDBCommandText.getText().length() != 0;
if ( valid ) if ( valid ) {
{
setErrorMessage( null ); setErrorMessage( null );
setMessage( null ); setMessage( null );
} }
else else {
{
setErrorMessage( MIUIMessages.getString( "GDBDebuggerPage.0" ) ); //$NON-NLS-1$ setErrorMessage( MIUIMessages.getString( "GDBDebuggerPage.0" ) ); //$NON-NLS-1$
setMessage( null ); setMessage( null );
} }
return valid; return valid;
} }
public void initializeFrom( ILaunchConfiguration configuration ) public void initializeFrom( ILaunchConfiguration configuration ) {
{ setInitializing( true );
String gdbCommand = "gdb"; //$NON-NLS-1$ String gdbCommand = "gdb"; //$NON-NLS-1$
String gdbInit = ""; //$NON-NLS-1$ String gdbInit = ""; //$NON-NLS-1$
try try {
{
gdbCommand = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$ gdbCommand = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$
gdbInit = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, "" ); //$NON-NLS-1$ gdbInit = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, "" ); //$NON-NLS-1$
} }
catch( CoreException e ) catch( CoreException e ) {
{
} }
if ( fSolibBlock != null ) if ( fSolibBlock != null )
fSolibBlock.initializeFrom( configuration ); fSolibBlock.initializeFrom( configuration );
fGDBCommandText.setText( gdbCommand ); fGDBCommandText.setText( gdbCommand );
fGDBInitText.setText( gdbInit ); fGDBInitText.setText( gdbInit );
setInitializing( false );
} }
public void performApply( ILaunchConfigurationWorkingCopy configuration ) public void performApply( ILaunchConfigurationWorkingCopy configuration ) {
{
String gdbStr = fGDBCommandText.getText(); String gdbStr = fGDBCommandText.getText();
gdbStr.trim(); gdbStr.trim();
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbStr ); configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbStr );
@ -115,181 +115,169 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
fSolibBlock.performApply( configuration ); fSolibBlock.performApply( configuration );
} }
public String getName() public String getName() {
{
return MIUIMessages.getString( "GDBDebuggerPage.1" ); //$NON-NLS-1$ return MIUIMessages.getString( "GDBDebuggerPage.1" ); //$NON-NLS-1$
} }
/** /**
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getShell() * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getShell()
*/ */
protected Shell getShell() protected Shell getShell() {
{
return super.getShell(); return super.getShell();
} }
/** /**
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog() * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
*/ */
protected void updateLaunchConfigurationDialog() protected void updateLaunchConfigurationDialog() {
{
super.updateLaunchConfigurationDialog(); super.updateLaunchConfigurationDialog();
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see java.util.Observer#update(java.util.Observable, java.lang.Object) * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/ */
public void update( Observable o, Object arg ) public void update( Observable o, Object arg ) {
{ if ( !isInitializing() )
updateLaunchConfigurationDialog(); updateLaunchConfigurationDialog();
} }
public GDBSolibBlock createSolibBlock( Composite parent ) public IMILaunchConfigurationComponent createSolibBlock( Composite parent ) {
{ IMILaunchConfigurationComponent block = MIUIUtils.createGDBSolibBlock( MIUIUtils.createSolibSearchPathBlock( null ), true, true );
GDBSolibBlock block = new GDBSolibBlock(); block.createControl( parent );
block.createBlock( parent, true, true, true );
return block; return block;
} }
public void createTabs( TabFolder tabFolder ) public void createTabs( TabFolder tabFolder ) {
{
createMainTab( tabFolder ); createMainTab( tabFolder );
createSolibTab( tabFolder ); createSolibTab( tabFolder );
} }
public void createMainTab( TabFolder tabFolder ) public void createMainTab( TabFolder tabFolder ) {
{
TabItem tabItem = new TabItem( tabFolder, SWT.NONE ); TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
tabItem.setText( MIUIMessages.getString( "GDBDebuggerPage.2" ) ); //$NON-NLS-1$ tabItem.setText( MIUIMessages.getString( "GDBDebuggerPage.2" ) ); //$NON-NLS-1$
Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH ); Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH );
((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
tabItem.setControl( comp ); tabItem.setControl( comp );
Composite subComp = ControlFactory.createCompositeEx( comp, 3, GridData.FILL_HORIZONTAL ); Composite subComp = ControlFactory.createCompositeEx( comp, 3, GridData.FILL_HORIZONTAL );
((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false; ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
Label label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBDebuggerPage.3" ) ); //$NON-NLS-1$ Label label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBDebuggerPage.3" ) ); //$NON-NLS-1$
GridData gd = new GridData(); GridData gd = new GridData();
// gd.horizontalSpan = 2; // gd.horizontalSpan = 2;
label.setLayoutData( gd ); label.setLayoutData( gd );
fGDBCommandText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER ); fGDBCommandText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER );
fGDBCommandText.addModifyListener( fGDBCommandText.addModifyListener( new ModifyListener() {
new ModifyListener()
{
public void modifyText( ModifyEvent evt )
{
updateLaunchConfigurationDialog();
}
} );
public void modifyText( ModifyEvent evt ) {
if ( !isInitializing() )
updateLaunchConfigurationDialog();
}
} );
Button button = createPushButton( subComp, MIUIMessages.getString( "GDBDebuggerPage.4" ), null ); //$NON-NLS-1$ Button button = createPushButton( subComp, MIUIMessages.getString( "GDBDebuggerPage.4" ), null ); //$NON-NLS-1$
button.addSelectionListener( button.addSelectionListener( new SelectionAdapter() {
new SelectionAdapter()
{
public void widgetSelected( SelectionEvent evt )
{
handleGDBButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBButtonSelected()
{
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( MIUIMessages.getString( "GDBDebuggerPage.5" ) ); //$NON-NLS-1$
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 );
}
} );
public void widgetSelected( SelectionEvent evt ) {
handleGDBButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBButtonSelected() {
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( MIUIMessages.getString( "GDBDebuggerPage.5" ) ); //$NON-NLS-1$
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, MIUIMessages.getString( "GDBDebuggerPage.6" ) ); //$NON-NLS-1$ label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBDebuggerPage.6" ) ); //$NON-NLS-1$
gd = new GridData(); gd = new GridData();
// gd.horizontalSpan = 2; // gd.horizontalSpan = 2;
label.setLayoutData( gd ); label.setLayoutData( gd );
fGDBInitText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER ); fGDBInitText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER );
gd = new GridData( GridData.FILL_HORIZONTAL ); gd = new GridData( GridData.FILL_HORIZONTAL );
fGDBInitText.setLayoutData( gd ); fGDBInitText.setLayoutData( gd );
fGDBInitText.addModifyListener( new ModifyListener() fGDBInitText.addModifyListener( new ModifyListener() {
{
public void modifyText( ModifyEvent evt )
{
updateLaunchConfigurationDialog();
}
} );
button = createPushButton( subComp, MIUIMessages.getString( "GDBDebuggerPage.7" ), null ); //$NON-NLS-1$
button.addSelectionListener(
new SelectionAdapter()
{
public void widgetSelected( SelectionEvent evt )
{
handleGDBInitButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBInitButtonSelected()
{
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( MIUIMessages.getString( "GDBDebuggerPage.8" ) ); //$NON-NLS-1$
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, public void modifyText( ModifyEvent evt ) {
MIUIMessages.getString( "GDBDebuggerPage.9" ), //$NON-NLS-1$ if ( !isInitializing() )
200, updateLaunchConfigurationDialog();
SWT.DEFAULT, }
SWT.WRAP ); } );
button = createPushButton( subComp, MIUIMessages.getString( "GDBDebuggerPage.7" ), null ); //$NON-NLS-1$
button.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent evt ) {
handleGDBInitButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBInitButtonSelected() {
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( MIUIMessages.getString( "GDBDebuggerPage.8" ) ); //$NON-NLS-1$
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, MIUIMessages.getString( "GDBDebuggerPage.9" ), //$NON-NLS-1$
200, SWT.DEFAULT, SWT.WRAP );
gd = new GridData( GridData.FILL_HORIZONTAL ); gd = new GridData( GridData.FILL_HORIZONTAL );
gd.horizontalSpan = 1; gd.horizontalSpan = 1;
gd.widthHint = 200; gd.widthHint = 200;
label.setLayoutData( gd ); label.setLayoutData( gd );
} }
public void createSolibTab( TabFolder tabFolder ) public void createSolibTab( TabFolder tabFolder ) {
{
TabItem tabItem = new TabItem( tabFolder, SWT.NONE ); TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
tabItem.setText( MIUIMessages.getString( "GDBDebuggerPage.10" ) ); //$NON-NLS-1$ tabItem.setText( MIUIMessages.getString( "GDBDebuggerPage.10" ) ); //$NON-NLS-1$
Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH ); Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH );
tabItem.setControl( comp ); tabItem.setControl( comp );
fSolibBlock = createSolibBlock( comp ); fSolibBlock = createSolibBlock( comp );
fSolibBlock.addObserver( this ); if ( fSolibBlock instanceof Observable )
} ((Observable)fSolibBlock).addObserver( this );
/* (non-Javadoc) }
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose() * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
*/ */
public void dispose() public void dispose() {
{ if ( fSolibBlock != null ) {
if ( fSolibBlock != null ) if ( fSolibBlock instanceof Observable )
{ ((Observable)fSolibBlock).deleteObserver( this );
fSolibBlock.deleteObserver( this ); fSolibBlock.dispose();
fSolibBlock.dispose(); }
}
super.dispose(); super.dispose();
} }
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void activated( ILaunchConfigurationWorkingCopy workingCopy ) {
// Override the default behavior
}
protected boolean isInitializing() {
return fIsInitializing;
}
private void setInitializing( boolean isInitializing ) {
fIsInitializing = isInitializing;
}
}

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.mi.internal.ui; package org.eclipse.cdt.debug.mi.internal.ui;
import java.io.File; import java.io.File;
@ -37,24 +36,27 @@ import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.TabItem;
/** /**
* Enter type comment. * The dynamic debugger tab for remote launches using gdb server.
*
* @since Nov 20, 2003
*/ */
public class GDBServerDebuggerPage extends GDBDebuggerPage public class GDBServerDebuggerPage extends GDBDebuggerPage {
{
private final static String CONNECTION_TCP = MIUIMessages.getString( "GDBServerDebuggerPage.0" ); //$NON-NLS-1$ private final static String CONNECTION_TCP = MIUIMessages.getString( "GDBServerDebuggerPage.0" ); //$NON-NLS-1$
private final static String CONNECTION_SERIAL = MIUIMessages.getString( "GDBServerDebuggerPage.1" ); //$NON-NLS-1$ private final static String CONNECTION_SERIAL = MIUIMessages.getString( "GDBServerDebuggerPage.1" ); //$NON-NLS-1$
private ComboDialogField fConnectionField; private ComboDialogField fConnectionField;
private String[] fConnections = new String[] { CONNECTION_TCP, CONNECTION_SERIAL }; private String[] fConnections = new String[]{ CONNECTION_TCP, CONNECTION_SERIAL };
private TCPSettingsBlock fTCPBlock; private TCPSettingsBlock fTCPBlock;
private SerialPortSettingsBlock fSerialBlock; private SerialPortSettingsBlock fSerialBlock;
private Composite fConnectionStack; private Composite fConnectionStack;
public GDBServerDebuggerPage() private boolean fIsInitializing = false;
{
public GDBServerDebuggerPage() {
super(); super();
fConnectionField = createConnectionField(); fConnectionField = createConnectionField();
fTCPBlock = new TCPSettingsBlock(); fTCPBlock = new TCPSettingsBlock();
@ -63,118 +65,101 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
fSerialBlock.addObserver( this ); fSerialBlock.addObserver( this );
} }
public void createMainTab( TabFolder tabFolder ) public void createMainTab( TabFolder tabFolder ) {
{
TabItem tabItem = new TabItem( tabFolder, SWT.NONE ); TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
tabItem.setText( MIUIMessages.getString( "GDBServerDebuggerPage.2" ) ); //$NON-NLS-1$ tabItem.setText( MIUIMessages.getString( "GDBServerDebuggerPage.2" ) ); //$NON-NLS-1$
Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH ); Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH );
((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
tabItem.setControl( comp ); tabItem.setControl( comp );
Composite subComp = ControlFactory.createCompositeEx( comp, 3, GridData.FILL_HORIZONTAL ); Composite subComp = ControlFactory.createCompositeEx( comp, 3, GridData.FILL_HORIZONTAL );
((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false; ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
Label label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.3" ) ); //$NON-NLS-1$ Label label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.3" ) ); //$NON-NLS-1$
GridData gd = new GridData(); GridData gd = new GridData();
// gd.horizontalSpan = 2; // gd.horizontalSpan = 2;
label.setLayoutData( gd ); label.setLayoutData( gd );
fGDBCommandText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER ); fGDBCommandText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER );
fGDBCommandText.addModifyListener( fGDBCommandText.addModifyListener( new ModifyListener() {
new ModifyListener()
{
public void modifyText( ModifyEvent evt )
{
updateLaunchConfigurationDialog();
}
} );
public void modifyText( ModifyEvent evt ) {
if ( !isInitializing() )
updateLaunchConfigurationDialog();
}
} );
Button button = createPushButton( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.4" ), null ); //$NON-NLS-1$ Button button = createPushButton( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.4" ), null ); //$NON-NLS-1$
button.addSelectionListener( button.addSelectionListener( new SelectionAdapter() {
new SelectionAdapter()
{
public void widgetSelected( SelectionEvent evt )
{
handleGDBButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBButtonSelected()
{
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( MIUIMessages.getString( "GDBServerDebuggerPage.5" ) ); //$NON-NLS-1$
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 );
}
} );
public void widgetSelected( SelectionEvent evt ) {
if ( !isInitializing() ) {
handleGDBButtonSelected();
updateLaunchConfigurationDialog();
}
}
private void handleGDBButtonSelected() {
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( MIUIMessages.getString( "GDBServerDebuggerPage.5" ) ); //$NON-NLS-1$
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, MIUIMessages.getString( "GDBServerDebuggerPage.6" ) ); //$NON-NLS-1$ label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.6" ) ); //$NON-NLS-1$
gd = new GridData(); gd = new GridData();
// gd.horizontalSpan = 2; // gd.horizontalSpan = 2;
label.setLayoutData( gd ); label.setLayoutData( gd );
fGDBInitText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER ); fGDBInitText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER );
gd = new GridData( GridData.FILL_HORIZONTAL ); gd = new GridData( GridData.FILL_HORIZONTAL );
fGDBInitText.setLayoutData( gd ); fGDBInitText.setLayoutData( gd );
fGDBInitText.addModifyListener( new ModifyListener() fGDBInitText.addModifyListener( new ModifyListener() {
{
public void modifyText( ModifyEvent evt )
{
updateLaunchConfigurationDialog();
}
} );
button = createPushButton( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.7" ), null ); //$NON-NLS-1$
button.addSelectionListener(
new SelectionAdapter()
{
public void widgetSelected( SelectionEvent evt )
{
handleGDBInitButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBInitButtonSelected()
{
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( MIUIMessages.getString( "GDBServerDebuggerPage.8" ) ); //$NON-NLS-1$
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 );
}
} );
public void modifyText( ModifyEvent evt ) {
if ( !isInitializing() )
updateLaunchConfigurationDialog();
}
} );
button = createPushButton( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.7" ), null ); //$NON-NLS-1$
button.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent evt ) {
if ( !isInitializing() ) {
handleGDBInitButtonSelected();
updateLaunchConfigurationDialog();
}
}
private void handleGDBInitButtonSelected() {
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( MIUIMessages.getString( "GDBServerDebuggerPage.8" ) ); //$NON-NLS-1$
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 );
}
} );
extendMainTab( comp ); extendMainTab( comp );
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage#extendMainTab(org.eclipse.swt.widgets.Composite) * @see org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage#extendMainTab(org.eclipse.swt.widgets.Composite)
*/ */
protected void extendMainTab( Composite parent ) protected void extendMainTab( Composite parent ) {
{
Composite comp = ControlFactory.createCompositeEx( parent, 2, GridData.FILL_BOTH ); Composite comp = ControlFactory.createCompositeEx( parent, 2, GridData.FILL_BOTH );
((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
fConnectionField.doFillIntoGrid( comp, 2 ); fConnectionField.doFillIntoGrid( comp, 2 );
((GridData)fConnectionField.getComboControl( null ).getLayoutData()).horizontalAlignment = GridData.BEGINNING; ((GridData)fConnectionField.getComboControl( null ).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
PixelConverter converter = new PixelConverter( comp ); PixelConverter converter = new PixelConverter( comp );
@ -185,31 +170,31 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
((GridData)fConnectionStack.getLayoutData()).horizontalSpan = 2; ((GridData)fConnectionStack.getLayoutData()).horizontalSpan = 2;
fTCPBlock.createBlock( fConnectionStack ); fTCPBlock.createBlock( fConnectionStack );
fSerialBlock.createBlock( fConnectionStack ); fSerialBlock.createBlock( fConnectionStack );
connectionTypeChanged();
} }
private ComboDialogField createConnectionField() private ComboDialogField createConnectionField() {
{
ComboDialogField field = new ComboDialogField( SWT.DROP_DOWN | SWT.READ_ONLY ); ComboDialogField field = new ComboDialogField( SWT.DROP_DOWN | SWT.READ_ONLY );
field.setLabelText( MIUIMessages.getString( "GDBServerDebuggerPage.9" ) ); //$NON-NLS-1$ field.setLabelText( MIUIMessages.getString( "GDBServerDebuggerPage.9" ) ); //$NON-NLS-1$
field.setItems( fConnections ); field.setItems( fConnections );
field.setDialogFieldListener( field.setDialogFieldListener( new IDialogFieldListener() {
new IDialogFieldListener()
{ public void dialogFieldChanged( DialogField f ) {
public void dialogFieldChanged( DialogField f ) if ( !isInitializing() )
{ connectionTypeChanged();
connectionTypeChanged(); }
} } );
} );
return field; return field;
} }
protected void connectionTypeChanged() protected void connectionTypeChanged() {
{ connectionTypeChanged0();
updateLaunchConfigurationDialog();
}
private void connectionTypeChanged0() {
((StackLayout)fConnectionStack.getLayout()).topControl = null; ((StackLayout)fConnectionStack.getLayout()).topControl = null;
int index = fConnectionField.getSelectionIndex(); int index = fConnectionField.getSelectionIndex();
if ( index >= 0 && index < fConnections.length ) if ( index >= 0 && index < fConnections.length ) {
{
String[] connTypes = fConnectionField.getItems(); String[] connTypes = fConnectionField.getItems();
if ( CONNECTION_TCP.equals( connTypes[index] ) ) if ( CONNECTION_TCP.equals( connTypes[index] ) )
((StackLayout)fConnectionStack.getLayout()).topControl = fTCPBlock.getControl(); ((StackLayout)fConnectionStack.getLayout()).topControl = fTCPBlock.getControl();
@ -217,32 +202,23 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
((StackLayout)fConnectionStack.getLayout()).topControl = fSerialBlock.getControl(); ((StackLayout)fConnectionStack.getLayout()).topControl = fSerialBlock.getControl();
} }
fConnectionStack.layout(); fConnectionStack.layout();
updateLaunchConfigurationDialog();
} }
public boolean isValid( ILaunchConfiguration launchConfig ) public boolean isValid( ILaunchConfiguration launchConfig ) {
{ if ( super.isValid( launchConfig ) ) {
if ( super.isValid( launchConfig ) )
{
setErrorMessage( null ); setErrorMessage( null );
setMessage( null ); setMessage( null );
int index = fConnectionField.getSelectionIndex(); int index = fConnectionField.getSelectionIndex();
if ( index >= 0 && index < fConnections.length ) if ( index >= 0 && index < fConnections.length ) {
{
String[] connTypes = fConnectionField.getItems(); String[] connTypes = fConnectionField.getItems();
if ( CONNECTION_TCP.equals( connTypes[index] ) ) if ( CONNECTION_TCP.equals( connTypes[index] ) ) {
{ if ( !fTCPBlock.isValid( launchConfig ) ) {
if ( !fTCPBlock.isValid( launchConfig ) )
{
setErrorMessage( fTCPBlock.getErrorMessage() ); setErrorMessage( fTCPBlock.getErrorMessage() );
return false; return false;
} }
} }
else if ( CONNECTION_SERIAL.equals( connTypes[index] ) ) else if ( CONNECTION_SERIAL.equals( connTypes[index] ) ) {
{ if ( !fSerialBlock.isValid( launchConfig ) ) {
if ( !fSerialBlock.isValid( launchConfig ) )
{
setErrorMessage( fSerialBlock.getErrorMessage() ); setErrorMessage( fSerialBlock.getErrorMessage() );
return false; return false;
} }
@ -253,27 +229,23 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
return false; return false;
} }
public void initializeFrom( ILaunchConfiguration configuration ) public void initializeFrom( ILaunchConfiguration configuration ) {
{ setInitializing( true );
super.initializeFrom( configuration ); super.initializeFrom( configuration );
boolean isTcp = false; boolean isTcp = false;
try try {
{
isTcp = configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, false ); isTcp = configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, false );
}
catch( CoreException e )
{
} }
catch( CoreException e ) {
}
fTCPBlock.initializeFrom( configuration ); fTCPBlock.initializeFrom( configuration );
fSerialBlock.initializeFrom( configuration ); fSerialBlock.initializeFrom( configuration );
fConnectionField.selectItem( (isTcp) ? 0 : 1 );
fConnectionField.selectItem( ( isTcp ) ? 0 : 1 ); connectionTypeChanged0();
setInitializing( false );
} }
public void performApply( ILaunchConfigurationWorkingCopy configuration ) public void performApply( ILaunchConfigurationWorkingCopy configuration ) {
{
super.performApply( configuration ); super.performApply( configuration );
if ( fConnectionField != null ) if ( fConnectionField != null )
configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, fConnectionField.getSelectionIndex() == 0 ); configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, fConnectionField.getSelectionIndex() == 0 );
@ -281,12 +253,18 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
fSerialBlock.performApply( configuration ); fSerialBlock.performApply( configuration );
} }
public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) {
{
super.setDefaults( configuration ); super.setDefaults( configuration );
configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, false ); configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, false );
fTCPBlock.setDefaults( configuration ); fTCPBlock.setDefaults( configuration );
fSerialBlock.setDefaults( configuration ); fSerialBlock.setDefaults( configuration );
} }
}
protected boolean isInitializing() {
return fIsInitializing;
}
private void setInitializing( boolean isInitializing ) {
fIsInitializing = isInitializing;
}
}

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.mi.internal.ui; package org.eclipse.cdt.debug.mi.internal.ui;
import java.util.Map; import java.util.Map;
@ -16,6 +15,7 @@ import java.util.Observable;
import java.util.Observer; import java.util.Observer;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.ui.IMILaunchConfigurationComponent;
import org.eclipse.cdt.utils.ui.controls.ControlFactory; import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
@ -26,74 +26,75 @@ 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.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
/** /**
* Enter type comment. * The content of the <code>Shared Libraries</code> tab of the <code>GDBDebuggerPage</code>.
*
* @since Sep 3, 2003
*/ */
public class GDBSolibBlock extends Observable implements Observer public class GDBSolibBlock extends Observable implements IMILaunchConfigurationComponent, Observer {
{
private SolibSearchPathBlock fSolibSearchPathBlock; private IMILaunchConfigurationComponent fSolibSearchPathBlock;
private Button fAutoSoLibButton; private Button fAutoSoLibButton;
private Button fStopOnSolibEventsButton; private Button fStopOnSolibEventsButton;
private Composite fControl; private Composite fControl;
private boolean fAutoSolib = false;
public GDBSolibBlock() private boolean fStopOnSolibEvents = false;
{
public GDBSolibBlock( IMILaunchConfigurationComponent solibSearchBlock, boolean autoSolib, boolean stopOnSolibEvents ) {
super(); super();
fSolibSearchPathBlock = solibSearchBlock;
fAutoSolib = autoSolib;
fStopOnSolibEvents = stopOnSolibEvents;
} }
public void createBlock( Composite parent, boolean solibPath, boolean autoSolib, boolean stopOnSolibEvents ) /* (non-Javadoc)
{ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl( Composite parent ) {
Composite subComp = ControlFactory.createCompositeEx( parent, 1, GridData.FILL_HORIZONTAL ); Composite subComp = ControlFactory.createCompositeEx( parent, 1, GridData.FILL_HORIZONTAL );
((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false; ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
((GridLayout)subComp.getLayout()).marginHeight = 0; ((GridLayout)subComp.getLayout()).marginHeight = 0;
((GridLayout)subComp.getLayout()).marginWidth = 0; ((GridLayout)subComp.getLayout()).marginWidth = 0;
if ( fSolibSearchPathBlock != null ) {
if ( solibPath ) fSolibSearchPathBlock.createControl( subComp );
{ if ( fSolibSearchPathBlock instanceof Observable )
fSolibSearchPathBlock = new SolibSearchPathBlock(); ((Observable)fSolibSearchPathBlock).addObserver( this );
fSolibSearchPathBlock.createBlock( subComp );
fSolibSearchPathBlock.addObserver( this );
} }
if ( fAutoSolib ) {
if ( autoSolib )
{
fAutoSoLibButton = ControlFactory.createCheckBox( subComp, MIUIMessages.getString( "GDBSolibBlock.0" ) ); //$NON-NLS-1$ fAutoSoLibButton = ControlFactory.createCheckBox( subComp, MIUIMessages.getString( "GDBSolibBlock.0" ) ); //$NON-NLS-1$
fAutoSoLibButton.addSelectionListener( fAutoSoLibButton.addSelectionListener( new SelectionAdapter() {
new SelectionAdapter()
{
public void widgetSelected( SelectionEvent e )
{
updateButtons();
changed();
}
} );
}
if ( stopOnSolibEvents ) public void widgetSelected( SelectionEvent e ) {
{ updateButtons();
fStopOnSolibEventsButton = ControlFactory.createCheckBox( subComp, MIUIMessages.getString( "GDBSolibBlock.1" ) ); //$NON-NLS-1$ changed();
fStopOnSolibEventsButton.addSelectionListener( }
new SelectionAdapter() } );
{
public void widgetSelected( SelectionEvent e )
{
updateButtons();
changed();
}
} );
} }
setControl( subComp ); if ( fStopOnSolibEvents ) {
fStopOnSolibEventsButton = ControlFactory.createCheckBox( subComp, MIUIMessages.getString( "GDBSolibBlock.1" ) ); //$NON-NLS-1$
fStopOnSolibEventsButton.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent e ) {
updateButtons();
changed();
}
} );
}
fControl = subComp;
} }
public void initializeFrom( ILaunchConfiguration configuration ) /* (non-Javadoc)
{ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
public void initializeFrom( ILaunchConfiguration configuration ) {
if ( fSolibSearchPathBlock != null ) if ( fSolibSearchPathBlock != null )
fSolibSearchPathBlock.initializeFrom( configuration ); fSolibSearchPathBlock.initializeFrom( configuration );
try try {
{
if ( fAutoSoLibButton != null ) if ( fAutoSoLibButton != null )
fAutoSoLibButton.setSelection( configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, IMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT ) ); fAutoSoLibButton.setSelection( configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, IMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT ) );
if ( fStopOnSolibEventsButton != null ) if ( fStopOnSolibEventsButton != null )
@ -101,18 +102,17 @@ public class GDBSolibBlock extends Observable implements Observer
initializeButtons( configuration ); initializeButtons( configuration );
updateButtons(); updateButtons();
} }
catch( CoreException e ) catch( CoreException e ) {
{
return;
} }
} }
public void performApply( ILaunchConfigurationWorkingCopy configuration ) /* (non-Javadoc)
{ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void performApply( ILaunchConfigurationWorkingCopy configuration ) {
if ( fSolibSearchPathBlock != null ) if ( fSolibSearchPathBlock != null )
fSolibSearchPathBlock.performApply( configuration ); fSolibSearchPathBlock.performApply( configuration );
try try {
{
Map attrs = configuration.getAttributes(); Map attrs = configuration.getAttributes();
if ( fAutoSoLibButton != null ) if ( fAutoSoLibButton != null )
attrs.put( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, new Boolean( fAutoSoLibButton.getSelection() ) ); attrs.put( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, new Boolean( fAutoSoLibButton.getSelection() ) );
@ -120,80 +120,73 @@ public class GDBSolibBlock extends Observable implements Observer
attrs.put( IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, new Boolean( fStopOnSolibEventsButton.getSelection() ) ); attrs.put( IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, new Boolean( fStopOnSolibEventsButton.getSelection() ) );
configuration.setAttributes( attrs ); configuration.setAttributes( attrs );
} }
catch( CoreException e ) catch( CoreException e ) {
{
} }
} }
public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) /* (non-Javadoc)
{ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) {
if ( fSolibSearchPathBlock != null ) if ( fSolibSearchPathBlock != null )
fSolibSearchPathBlock.setDefaults( configuration ); fSolibSearchPathBlock.setDefaults( configuration );
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, IMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT );
IMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT ); configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, IMILaunchConfigurationConstants.DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT );
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS,
IMILaunchConfigurationConstants.DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT );
} }
protected void updateButtons() protected void updateButtons() {
{
} }
public void dispose() /* (non-Javadoc)
{ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#dispose()
*/
public void dispose() {
deleteObservers(); deleteObservers();
if ( fSolibSearchPathBlock != null ) if ( fSolibSearchPathBlock != null ) {
{ if ( fSolibSearchPathBlock instanceof Observable )
fSolibSearchPathBlock.deleteObserver( this ); ((Observable)fSolibSearchPathBlock).deleteObserver( this );
fSolibSearchPathBlock.dispose(); fSolibSearchPathBlock.dispose();
} }
} }
public void disable() /*
{ * (non-Javadoc)
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) * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/ */
public void update( Observable o, Object arg ) public void update( Observable o, Object arg ) {
{
changed(); changed();
} }
protected void changed() protected void changed() {
{
setChanged(); setChanged();
notifyObservers(); notifyObservers();
} }
public Composite getControl() protected void initializeButtons( ILaunchConfiguration configuration ) {
{ try {
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, "" ) ); //$NON-NLS-1$ boolean enable = !ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE.equals( configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, "" ) ); //$NON-NLS-1$
if ( fAutoSoLibButton != null ) if ( fAutoSoLibButton != null )
fAutoSoLibButton.setEnabled( enable ); fAutoSoLibButton.setEnabled( enable );
if ( fStopOnSolibEventsButton != null ) if ( fStopOnSolibEventsButton != null )
fStopOnSolibEventsButton.setEnabled( enable ); fStopOnSolibEventsButton.setEnabled( enable );
} }
catch( CoreException e ) catch( CoreException e ) {
{
} }
} }
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#getControl()
*/
public Control getControl() {
return fControl;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#isValid(org.eclipse.debug.core.ILaunchConfiguration)
*/
public boolean isValid( ILaunchConfiguration launchConfig ) {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -11,19 +11,15 @@
package org.eclipse.cdt.debug.mi.internal.ui; package org.eclipse.cdt.debug.mi.internal.ui;
/** /**
*
* Help context ids for the C/C++ debug ui. * Help context ids for the C/C++ debug ui.
* <p> * <p>
* This interface contains constants only; it is not intended to be implemented * This interface contains constants only; it is not intended to be implemented or extended.
* or extended.
* </p> * </p>
*
* @since Oct 4, 2002
*/ */
public interface IMIHelpContextIds public interface IMIHelpContextIds {
{
public static final String PREFIX = IMIUIConstants.PLUGIN_ID + "."; //$NON-NLS-1$ public static final String PREFIX = IMIUIConstants.PLUGIN_ID + "."; //$NON-NLS-1$
// Preference pages // Preference pages
public static final String MI_PREFERENCE_PAGE = PREFIX + "mi_preference_page_context"; //$NON-NLS-1$ public static final String MI_PREFERENCE_PAGE = PREFIX + "mi_preference_page_context"; //$NON-NLS-1$
} }

View file

@ -11,15 +11,12 @@
package org.eclipse.cdt.debug.mi.internal.ui; package org.eclipse.cdt.debug.mi.internal.ui;
/** /**
*
* Constant definitions for MI UI plug-in. * Constant definitions for MI UI plug-in.
*
* @since Oct 4, 2002
*/ */
public interface IMIUIConstants public interface IMIUIConstants {
{
/** /**
* Plug-in identifier (value <code>"org.eclipse.cdt.debug.mi.ui"</code>). * Plug-in identifier (value <code>"org.eclipse.cdt.debug.mi.ui"</code>).
*/ */
public static final String PLUGIN_ID = MIUIPlugin.getUniqueIdentifier(); public static final String PLUGIN_ID = MIUIPlugin.getUniqueIdentifier();
} }

View file

@ -44,6 +44,8 @@ SolibSearchPathBlock.2=Down
SolibSearchPathBlock.3=Remove SolibSearchPathBlock.3=Remove
SolibSearchPathBlock.4=Directories: SolibSearchPathBlock.4=Directories:
SolibSearchPathBlock.5=Select directory that contains shared library. SolibSearchPathBlock.5=Select directory that contains shared library.
SolibSearchPathBlock.Add_Directory=Add Directory
SolibSearchPathBlock.Auto=Auto
TCPSettingsBlock.0=Host name or IP address: TCPSettingsBlock.0=Host name or IP address:
TCPSettingsBlock.1=Port number: TCPSettingsBlock.1=Port number:
TCPSettingsBlock.2=Host name or IP address must be specified. TCPSettingsBlock.2=Host name or IP address must be specified.

View file

@ -10,19 +10,16 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.mi.internal.ui; package org.eclipse.cdt.debug.mi.internal.ui;
import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.graphics.FontMetrics; import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
public class PixelConverter public class PixelConverter {
{
private FontMetrics fFontMetrics; private FontMetrics fFontMetrics;
public PixelConverter( Control control ) public PixelConverter( Control control ) {
{
GC gc = new GC( control ); GC gc = new GC( control );
gc.setFont( control.getFont() ); gc.setFont( control.getFont() );
fFontMetrics = gc.getFontMetrics(); fFontMetrics = gc.getFontMetrics();
@ -32,32 +29,28 @@ public class PixelConverter
/** /**
* @see org.eclipse.jface.dialogs.DialogPage#convertHeightInCharsToPixels(int) * @see org.eclipse.jface.dialogs.DialogPage#convertHeightInCharsToPixels(int)
*/ */
public int convertHeightInCharsToPixels( int chars ) public int convertHeightInCharsToPixels( int chars ) {
{
return Dialog.convertHeightInCharsToPixels( fFontMetrics, chars ); return Dialog.convertHeightInCharsToPixels( fFontMetrics, chars );
} }
/** /**
* @see org.eclipse.jface.dialogs.DialogPage#convertHorizontalDLUsToPixels(int) * @see org.eclipse.jface.dialogs.DialogPage#convertHorizontalDLUsToPixels(int)
*/ */
public int convertHorizontalDLUsToPixels( int dlus ) public int convertHorizontalDLUsToPixels( int dlus ) {
{
return Dialog.convertHorizontalDLUsToPixels( fFontMetrics, dlus ); return Dialog.convertHorizontalDLUsToPixels( fFontMetrics, dlus );
} }
/** /**
* @see org.eclipse.jface.dialogs.DialogPage#convertVerticalDLUsToPixels(int) * @see org.eclipse.jface.dialogs.DialogPage#convertVerticalDLUsToPixels(int)
*/ */
public int convertVerticalDLUsToPixels( int dlus ) public int convertVerticalDLUsToPixels( int dlus ) {
{
return Dialog.convertVerticalDLUsToPixels( fFontMetrics, dlus ); return Dialog.convertVerticalDLUsToPixels( fFontMetrics, dlus );
} }
/** /**
* @see org.eclipse.jface.dialogs.DialogPage#convertWidthInCharsToPixels(int) * @see org.eclipse.jface.dialogs.DialogPage#convertWidthInCharsToPixels(int)
*/ */
public int convertWidthInCharsToPixels( int chars ) public int convertWidthInCharsToPixels( int chars ) {
{
return Dialog.convertWidthInCharsToPixels( fFontMetrics, chars ); return Dialog.convertWidthInCharsToPixels( fFontMetrics, chars );
} }
} }

View file

@ -30,195 +30,158 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
/** public class SerialPortSettingsBlock extends Observable {
* Enter type comment.
*
* @since Nov 20, 2003
*/
public class SerialPortSettingsBlock extends Observable
{
private final static String DEFAULT_ASYNC_DEVICE = "/dev/ttyS0"; //$NON-NLS-1$ private final static String DEFAULT_ASYNC_DEVICE = "/dev/ttyS0"; //$NON-NLS-1$
private final static String DEFAULT_ASYNC_DEVICE_SPEED = "115200"; //$NON-NLS-1$ private final static String DEFAULT_ASYNC_DEVICE_SPEED = "115200"; //$NON-NLS-1$
private Shell fShell; private Shell fShell;
private StringDialogField fDeviceField; private StringDialogField fDeviceField;
private ComboDialogField fSpeedField; private ComboDialogField fSpeedField;
private String fSpeedChoices[] = { "9600", "19200", "38400", "57600", "115200" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ private String fSpeedChoices[] = { "9600", "19200", "38400", "57600", "115200" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
private Control fControl; private Control fControl;
private String fErrorMessage = null; private String fErrorMessage = null;
public SerialPortSettingsBlock() public SerialPortSettingsBlock() {
{
super(); super();
fDeviceField = createDeviceField(); fDeviceField = createDeviceField();
fSpeedField = createSpeedField(); fSpeedField = createSpeedField();
} }
public void createBlock( Composite parent ) public void createBlock( Composite parent ) {
{
fShell = parent.getShell(); fShell = parent.getShell();
Composite comp = ControlFactory.createCompositeEx( parent, 2, GridData.FILL_BOTH ); Composite comp = ControlFactory.createCompositeEx( parent, 2, GridData.FILL_BOTH );
((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
((GridLayout)comp.getLayout()).marginHeight = 0; ((GridLayout)comp.getLayout()).marginHeight = 0;
((GridLayout)comp.getLayout()).marginWidth = 0; ((GridLayout)comp.getLayout()).marginWidth = 0;
comp.setFont( JFaceResources.getDialogFont() ); comp.setFont( JFaceResources.getDialogFont() );
PixelConverter converter = new PixelConverter( comp ); PixelConverter converter = new PixelConverter( comp );
fDeviceField.doFillIntoGrid( comp, 2 ); fDeviceField.doFillIntoGrid( comp, 2 );
LayoutUtil.setWidthHint( fDeviceField.getTextControl( null ), converter.convertWidthInCharsToPixels( 20 ) ); LayoutUtil.setWidthHint( fDeviceField.getTextControl( null ), converter.convertWidthInCharsToPixels( 20 ) );
fSpeedField.doFillIntoGrid( comp, 2 ); fSpeedField.doFillIntoGrid( comp, 2 );
((GridData)fSpeedField.getComboControl( null ).getLayoutData()).horizontalAlignment = GridData.BEGINNING; ((GridData)fSpeedField.getComboControl( null ).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
setControl( comp ); setControl( comp );
} }
protected Shell getShell() protected Shell getShell() {
{
return fShell; return fShell;
} }
public void dispose() public void dispose() {
{
deleteObservers(); deleteObservers();
} }
public void initializeFrom( ILaunchConfiguration configuration ) public void initializeFrom( ILaunchConfiguration configuration ) {
{
initializeDevice( configuration ); initializeDevice( configuration );
initializeSpeed( configuration ); initializeSpeed( configuration );
} }
public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) {
{
configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV, DEFAULT_ASYNC_DEVICE ); configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV, DEFAULT_ASYNC_DEVICE );
configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, DEFAULT_ASYNC_DEVICE_SPEED ); configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, DEFAULT_ASYNC_DEVICE_SPEED );
} }
public void performApply( ILaunchConfigurationWorkingCopy configuration ) public void performApply( ILaunchConfigurationWorkingCopy configuration ) {
{
if ( fDeviceField != null ) if ( fDeviceField != null )
configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV, fDeviceField.getText().trim() ); configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV, fDeviceField.getText().trim() );
if ( fSpeedField != null ) if ( fSpeedField != null ) {
{
int index = fSpeedField.getSelectionIndex(); int index = fSpeedField.getSelectionIndex();
configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, getSpeedItem( index ) ); configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, getSpeedItem( index ) );
} }
} }
private StringDialogField createDeviceField() private StringDialogField createDeviceField() {
{
StringDialogField field = new StringDialogField(); StringDialogField field = new StringDialogField();
field.setLabelText( MIUIMessages.getString( "SerialPortSettingsBlock.0" ) ); //$NON-NLS-1$ field.setLabelText( MIUIMessages.getString( "SerialPortSettingsBlock.0" ) ); //$NON-NLS-1$
field.setDialogFieldListener( field.setDialogFieldListener( new IDialogFieldListener() {
new IDialogFieldListener()
{
public void dialogFieldChanged( DialogField f )
{
deviceFieldChanged();
}
} );
return field;
}
private ComboDialogField createSpeedField() public void dialogFieldChanged( DialogField f ) {
{ deviceFieldChanged();
ComboDialogField field = new ComboDialogField( SWT.DROP_DOWN | SWT.READ_ONLY ); }
field.setLabelText( MIUIMessages.getString( "SerialPortSettingsBlock.1" ) ); //$NON-NLS-1$ } );
field.setItems( fSpeedChoices );
field.setDialogFieldListener(
new IDialogFieldListener()
{
public void dialogFieldChanged( DialogField f )
{
speedFieldChanged();
}
} );
return field; return field;
} }
protected void deviceFieldChanged() private ComboDialogField createSpeedField() {
{ ComboDialogField field = new ComboDialogField( SWT.DROP_DOWN | SWT.READ_ONLY );
field.setLabelText( MIUIMessages.getString( "SerialPortSettingsBlock.1" ) ); //$NON-NLS-1$
field.setItems( fSpeedChoices );
field.setDialogFieldListener( new IDialogFieldListener() {
public void dialogFieldChanged( DialogField f ) {
speedFieldChanged();
}
} );
return field;
}
protected void deviceFieldChanged() {
updateErrorMessage(); updateErrorMessage();
setChanged(); setChanged();
notifyObservers(); notifyObservers();
} }
protected void speedFieldChanged() protected void speedFieldChanged() {
{
updateErrorMessage(); updateErrorMessage();
setChanged(); setChanged();
notifyObservers(); notifyObservers();
} }
private void initializeDevice( ILaunchConfiguration configuration ) private void initializeDevice( ILaunchConfiguration configuration ) {
{ if ( fDeviceField != null ) {
if ( fDeviceField != null ) try {
{
try
{
fDeviceField.setText( configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV, DEFAULT_ASYNC_DEVICE ) ); fDeviceField.setText( configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV, DEFAULT_ASYNC_DEVICE ) );
} }
catch( CoreException e ) catch( CoreException e ) {
{
} }
} }
} }
private void initializeSpeed( ILaunchConfiguration configuration ) private void initializeSpeed( ILaunchConfiguration configuration ) {
{ if ( fSpeedField != null ) {
if ( fSpeedField != null )
{
int index = 0; int index = 0;
try try {
{ index = getSpeedItemIndex( configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, DEFAULT_ASYNC_DEVICE_SPEED ) );
index = getSpeedItemIndex( configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, DEFAULT_ASYNC_DEVICE_SPEED ) );
} }
catch( CoreException e ) catch( CoreException e ) {
{
} }
fSpeedField.selectItem( index ); fSpeedField.selectItem( index );
} }
} }
private String getSpeedItem( int index ) private String getSpeedItem( int index ) {
{ return (index >= 0 && index < fSpeedChoices.length) ? fSpeedChoices[index] : null;
return ( index >= 0 && index < fSpeedChoices.length ) ? fSpeedChoices[index] : null;
} }
private int getSpeedItemIndex( String item ) private int getSpeedItemIndex( String item ) {
{ for( int i = 0; i < fSpeedChoices.length; ++i )
for ( int i = 0; i < fSpeedChoices.length; ++i )
if ( fSpeedChoices[i].equals( item ) ) if ( fSpeedChoices[i].equals( item ) )
return i; return i;
return 0; return 0;
} }
public Control getControl() public Control getControl() {
{
return fControl; return fControl;
} }
protected void setControl( Control control ) protected void setControl( Control control ) {
{
fControl = control; fControl = control;
} }
public boolean isValid( ILaunchConfiguration configuration ) public boolean isValid( ILaunchConfiguration configuration ) {
{
updateErrorMessage(); updateErrorMessage();
return ( getErrorMessage() == null ); return (getErrorMessage() == null);
} }
private void updateErrorMessage() private void updateErrorMessage() {
{
setErrorMessage( null ); setErrorMessage( null );
if ( fDeviceField != null && fSpeedField != null ) if ( fDeviceField != null && fSpeedField != null ) {
{
if ( fDeviceField.getText().trim().length() == 0 ) if ( fDeviceField.getText().trim().length() == 0 )
setErrorMessage( MIUIMessages.getString( "SerialPortSettingsBlock.2" ) ); //$NON-NLS-1$ setErrorMessage( MIUIMessages.getString( "SerialPortSettingsBlock.2" ) ); //$NON-NLS-1$
else if ( !deviceIsValid( fDeviceField.getText().trim() ) ) else if ( !deviceIsValid( fDeviceField.getText().trim() ) )
@ -228,19 +191,15 @@ public class SerialPortSettingsBlock extends Observable
} }
} }
public String getErrorMessage() public String getErrorMessage() {
{
return fErrorMessage; return fErrorMessage;
} }
private void setErrorMessage( String string ) private void setErrorMessage( String string ) {
{
fErrorMessage = string; fErrorMessage = string;
} }
private boolean deviceIsValid( String hostName ) private boolean deviceIsValid( String hostName ) {
{
return true; return true;
} }
} }

View file

@ -8,161 +8,331 @@
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.mi.internal.ui; package org.eclipse.cdt.debug.mi.internal.ui;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Observable; import java.util.Observable;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.DialogField; import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.DialogField;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.IListAdapter; import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.IListAdapter;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.LayoutUtil; import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.LayoutUtil;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.ListDialogField; import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.ListDialogField;
import org.eclipse.cdt.debug.mi.ui.IMILaunchConfigurationComponent;
import org.eclipse.cdt.debug.mi.ui.IPathProvider;
import org.eclipse.cdt.utils.ui.controls.ControlFactory; import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.LabelProvider;
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.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.DirectoryDialog; import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
/** /**
* Enter type comment. * The UI component to access the shared libraries search path.
*
* @since Sep 4, 2003
*/ */
public class SolibSearchPathBlock extends Observable public class SolibSearchPathBlock extends Observable implements IMILaunchConfigurationComponent {
{
public class SolibSearchPathListDialogField extends ListDialogField class AddDirectoryDialog extends Dialog {
{
public SolibSearchPathListDialogField( IListAdapter adapter, String[] buttonLabels, ILabelProvider lprovider ) protected Text fText;
{
private Button fBrowseButton;
private String fValue;
/**
* Constructor for AddDirectoryDialog.
*/
public AddDirectoryDialog( Shell parentShell ) {
super( parentShell );
}
protected Control createDialogArea( Composite parent ) {
Composite composite = (Composite)super.createDialogArea( parent );
Composite subComp = ControlFactory.createCompositeEx( composite, 2, GridData.FILL_HORIZONTAL );
((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER );
data.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
subComp.setLayoutData( data );
subComp.setFont( parent.getFont() );
fText = new Text( subComp, SWT.SINGLE | SWT.BORDER );
fText.setLayoutData( new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL ) );
fText.addModifyListener( new ModifyListener() {
public void modifyText( ModifyEvent e ) {
updateOKButton();
}
} );
fBrowseButton = ControlFactory.createPushButton( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.7" ) ); //$NON-NLS-1$
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.BUTTON_WIDTH );
fBrowseButton.setLayoutData( data );
fBrowseButton.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent evt ) {
DirectoryDialog dialog = new DirectoryDialog( getShell() );
dialog.setMessage( MIUIMessages.getString( "SolibSearchPathBlock.5" ) ); //$NON-NLS-1$
String res = dialog.open();
if ( res != null ) {
fText.setText( res );
}
}
} );
applyDialogFont( composite );
return composite;
}
protected void configureShell( Shell newShell ) {
super.configureShell( newShell );
newShell.setText( MIUIMessages.getString( "SolibSearchPathBlock.Add_Directory" ) ); //$NON-NLS-1$
}
public String getValue() {
return fValue;
}
private void setValue( String value ) {
fValue = value;
}
protected void buttonPressed( int buttonId ) {
if ( buttonId == IDialogConstants.OK_ID ) {
setValue( fText.getText() );
}
else {
setValue( null );
}
super.buttonPressed( buttonId );
}
protected void updateOKButton() {
Button okButton = getButton( IDialogConstants.OK_ID );
String text = fText.getText();
okButton.setEnabled( isValid( text ) );
}
protected boolean isValid( String text ) {
return ( text.trim().length() > 0 );
}
protected Control createButtonBar( Composite parent ) {
Control control = super.createButtonBar( parent );
updateOKButton();
return control;
}
}
private Composite fControl;
public class SolibSearchPathListDialogField extends ListDialogField {
public SolibSearchPathListDialogField( IListAdapter adapter, String[] buttonLabels, ILabelProvider lprovider ) {
super( adapter, buttonLabels, lprovider ); super( adapter, buttonLabels, lprovider );
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.dialogfields.ListDialogField#managedButtonPressed(int) * @see org.eclipse.cdt.debug.internal.ui.dialogfields.ListDialogField#managedButtonPressed(int)
*/ */
protected boolean managedButtonPressed( int index ) protected boolean managedButtonPressed( int index ) {
{
boolean result = super.managedButtonPressed( index ); boolean result = super.managedButtonPressed( index );
if ( result ) if ( result )
buttonPressed( index ); buttonPressed( index );
return result; return result;
} }
} }
private Shell fShell; private Shell fShell;
private SolibSearchPathListDialogField fDirList; private SolibSearchPathListDialogField fDirList;
public SolibSearchPathBlock() private IPathProvider fPathProvider;
{
public SolibSearchPathBlock( IPathProvider pathProvider ) {
super(); super();
setPathProvider( pathProvider );
int length = ( getPathProvider() != null ) ? 6 : 4;
String[] buttonLabels = new String[length];
buttonLabels[0] = MIUIMessages.getString( "SolibSearchPathBlock.0" ); //$NON-NLS-1$
buttonLabels[1] = MIUIMessages.getString( "SolibSearchPathBlock.1" ); //$NON-NLS-1$
buttonLabels[2] = MIUIMessages.getString( "SolibSearchPathBlock.2" ); //$NON-NLS-1$
buttonLabels[3] = MIUIMessages.getString( "SolibSearchPathBlock.3" ); //$NON-NLS-1$
if ( buttonLabels.length == 6 ) {
buttonLabels[4] = null;
buttonLabels[5] = MIUIMessages.getString( "SolibSearchPathBlock.Auto" ); //$NON-NLS-1$
}
IListAdapter listAdapter = new IListAdapter() {
String[] buttonLabels = new String[] public void customButtonPressed( DialogField field, int index ) {
{ buttonPressed( index );
/* 0 */ MIUIMessages.getString( "SolibSearchPathBlock.0" ), //$NON-NLS-1$ }
/* 1 */ null,
/* 2 */ MIUIMessages.getString( "SolibSearchPathBlock.1" ), //$NON-NLS-1$ public void selectionChanged( DialogField field ) {
/* 3 */ MIUIMessages.getString( "SolibSearchPathBlock.2" ), //$NON-NLS-1$ }
/* 4 */ null,
/* 5 */ MIUIMessages.getString( "SolibSearchPathBlock.3" ), //$NON-NLS-1$
}; };
IListAdapter listAdapter = new IListAdapter()
{
public void customButtonPressed( DialogField field, int index )
{
buttonPressed( index );
}
public void selectionChanged( DialogField field )
{
}
};
fDirList = new SolibSearchPathListDialogField( listAdapter, buttonLabels, new LabelProvider() ); fDirList = new SolibSearchPathListDialogField( listAdapter, buttonLabels, new LabelProvider() );
fDirList.setLabelText( MIUIMessages.getString( "SolibSearchPathBlock.4" ) ); //$NON-NLS-1$ fDirList.setLabelText( MIUIMessages.getString( "SolibSearchPathBlock.4" ) ); //$NON-NLS-1$
fDirList.setUpButtonIndex( 2 ); fDirList.setUpButtonIndex( 1 );
fDirList.setDownButtonIndex( 3 ); fDirList.setDownButtonIndex( 2 );
fDirList.setRemoveButtonIndex( 5 ); fDirList.setRemoveButtonIndex( 3 );
} }
public void createBlock( Composite parent ) /* (non-Javadoc)
{ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl( Composite parent ) {
fShell = parent.getShell(); fShell = parent.getShell();
Composite comp = ControlFactory.createCompositeEx( parent, 2, GridData.FILL_BOTH ); Composite comp = ControlFactory.createCompositeEx( parent, 2, GridData.FILL_BOTH );
((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
((GridLayout)comp.getLayout()).marginHeight = 0; ((GridLayout)comp.getLayout()).marginHeight = 0;
((GridLayout)comp.getLayout()).marginWidth = 0; ((GridLayout)comp.getLayout()).marginWidth = 0;
comp.setFont( JFaceResources.getDialogFont() ); comp.setFont( JFaceResources.getDialogFont() );
PixelConverter converter = new PixelConverter( comp ); PixelConverter converter = new PixelConverter( comp );
fDirList.doFillIntoGrid( comp, 3 ); fDirList.doFillIntoGrid( comp, 3 );
LayoutUtil.setHorizontalSpan( fDirList.getLabelControl( null ), 2 ); LayoutUtil.setHorizontalSpan( fDirList.getLabelControl( null ), 2 );
LayoutUtil.setWidthHint( fDirList.getLabelControl( null ), converter.convertWidthInCharsToPixels( 30 ) ); LayoutUtil.setWidthHint( fDirList.getLabelControl( null ), converter.convertWidthInCharsToPixels( 30 ) );
LayoutUtil.setHorizontalGrabbing( fDirList.getListControl( null ) ); LayoutUtil.setHorizontalGrabbing( fDirList.getListControl( null ) );
fControl = comp;
} }
public void initializeFrom( ILaunchConfiguration configuration ) /* (non-Javadoc)
{ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
if ( fDirList != null ) */
{ public void initializeFrom( ILaunchConfiguration configuration ) {
try if ( fDirList != null ) {
{ try {
fDirList.addElements( configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST ) ); fDirList.addElements( configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST ) );
} }
catch( CoreException e ) catch( CoreException e ) {
{
} }
} }
} }
public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) /* (non-Javadoc)
{ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) {
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST ); configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST );
} }
public void performApply( ILaunchConfigurationWorkingCopy configuration ) /* (non-Javadoc)
{ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
if ( fDirList != null ) */
{ public void performApply( ILaunchConfigurationWorkingCopy configuration ) {
if ( fDirList != null ) {
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, fDirList.getElements() ); configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, fDirList.getElements() );
} }
} }
protected void buttonPressed( int index ) protected void buttonPressed( int index ) {
{ switch( index ) {
if ( index == 0 ) case 0:
addDirectory(); addDirectory();
break;
case 5:
generatePaths();
break;
}
setChanged(); setChanged();
notifyObservers(); notifyObservers();
} }
protected Shell getShell() protected Shell getShell() {
{
return fShell; return fShell;
} }
private void addDirectory() private void addDirectory() {
{ AddDirectoryDialog dialog = new AddDirectoryDialog( getShell() );
DirectoryDialog dialog = new DirectoryDialog( getShell() ); dialog.open();
dialog.setMessage( MIUIMessages.getString( "SolibSearchPathBlock.5" ) ); //$NON-NLS-1$ String result = dialog.getValue();
String res = dialog.open(); if ( result != null && !contains( result ) ) {
if ( res != null ) fDirList.addElement( result.trim() );
fDirList.addElement( res ); }
} }
public void dispose() /* (non-Javadoc)
{ * @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#dispose()
*/
public void dispose() {
deleteObservers(); deleteObservers();
} }
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#getControl()
*/
public Control getControl() {
return fControl;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.internal.ui.IMILaunchConfigurationComponent#isValid(org.eclipse.debug.core.ILaunchConfiguration)
*/
public boolean isValid( ILaunchConfiguration launchConfig ) {
// TODO Auto-generated method stub
return false;
}
private void generatePaths() {
IPathProvider pp = getPathProvider();
if ( pp != null ) {
IPath[] dirs = pp.getPaths();
for ( int i = 0; i < dirs.length; ++i )
if ( !contains( dirs[i] ) )
fDirList.addElement( dirs[i].toOSString() );
}
}
private IPathProvider getPathProvider() {
return fPathProvider;
}
private void setPathProvider( IPathProvider pathProvider ) {
fPathProvider = pathProvider;
}
private boolean contains( IPath path ) {
List list = fDirList.getElements();
Iterator it = list.iterator();
while( it.hasNext() ) {
IPath p = new Path( (String)it.next() );
if ( p.toFile().compareTo( path.toFile() ) == 0 )
return true;
}
return false;
}
private boolean contains( String dir ) {
IPath path = new Path( dir );
List list = fDirList.getElements();
Iterator it = list.iterator();
while( it.hasNext() ) {
IPath p = new Path( (String)it.next() );
if ( p.toFile().compareTo( path.toFile() ) == 0 )
return true;
}
return false;
}
}

View file

@ -28,175 +28,141 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
/** public class TCPSettingsBlock extends Observable {
* Enter type comment.
*
* @since Nov 20, 2003
*/
public class TCPSettingsBlock extends Observable
{
private final static String DEFAULT_HOST_NAME = "localhost"; //$NON-NLS-1$ private final static String DEFAULT_HOST_NAME = "localhost"; //$NON-NLS-1$
private final static String DEFAULT_PORT_NUMBER = "10000"; //$NON-NLS-1$ private final static String DEFAULT_PORT_NUMBER = "10000"; //$NON-NLS-1$
private Shell fShell; private Shell fShell;
private StringDialogField fHostNameField; private StringDialogField fHostNameField;
private StringDialogField fPortNumberField; private StringDialogField fPortNumberField;
private Control fControl; private Control fControl;
private String fErrorMessage = null; private String fErrorMessage = null;
public TCPSettingsBlock() public TCPSettingsBlock() {
{
super(); super();
fHostNameField = createHostNameField(); fHostNameField = createHostNameField();
fPortNumberField = createPortNumberField(); fPortNumberField = createPortNumberField();
} }
public void createBlock( Composite parent ) public void createBlock( Composite parent ) {
{
fShell = parent.getShell(); fShell = parent.getShell();
Composite comp = ControlFactory.createCompositeEx( parent, 2, GridData.FILL_BOTH ); Composite comp = ControlFactory.createCompositeEx( parent, 2, GridData.FILL_BOTH );
((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false; ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
((GridLayout)comp.getLayout()).marginHeight = 0; ((GridLayout)comp.getLayout()).marginHeight = 0;
((GridLayout)comp.getLayout()).marginWidth = 0; ((GridLayout)comp.getLayout()).marginWidth = 0;
comp.setFont( JFaceResources.getDialogFont() ); comp.setFont( JFaceResources.getDialogFont() );
PixelConverter converter = new PixelConverter( comp ); PixelConverter converter = new PixelConverter( comp );
fHostNameField.doFillIntoGrid( comp, 2 ); fHostNameField.doFillIntoGrid( comp, 2 );
LayoutUtil.setWidthHint( fHostNameField.getTextControl( null ), converter.convertWidthInCharsToPixels( 20 ) ); LayoutUtil.setWidthHint( fHostNameField.getTextControl( null ), converter.convertWidthInCharsToPixels( 20 ) );
fPortNumberField.doFillIntoGrid( comp, 2 ); fPortNumberField.doFillIntoGrid( comp, 2 );
((GridData)fPortNumberField.getTextControl( null ).getLayoutData()).horizontalAlignment = GridData.BEGINNING; ((GridData)fPortNumberField.getTextControl( null ).getLayoutData()).horizontalAlignment = GridData.BEGINNING;
LayoutUtil.setWidthHint( fPortNumberField.getTextControl( null ), converter.convertWidthInCharsToPixels( 10 ) ); LayoutUtil.setWidthHint( fPortNumberField.getTextControl( null ), converter.convertWidthInCharsToPixels( 10 ) );
setControl( comp ); setControl( comp );
} }
protected Shell getShell() protected Shell getShell() {
{
return fShell; return fShell;
} }
public void dispose() public void dispose() {
{
deleteObservers(); deleteObservers();
} }
public void initializeFrom( ILaunchConfiguration configuration ) public void initializeFrom( ILaunchConfiguration configuration ) {
{
initializeHostName( configuration ); initializeHostName( configuration );
initializePortNumber( configuration ); initializePortNumber( configuration );
} }
public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) {
{
configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_HOST, DEFAULT_HOST_NAME ); configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_HOST, DEFAULT_HOST_NAME );
configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_PORT, DEFAULT_PORT_NUMBER ); configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_PORT, DEFAULT_PORT_NUMBER );
} }
public void performApply( ILaunchConfigurationWorkingCopy configuration ) public void performApply( ILaunchConfigurationWorkingCopy configuration ) {
{
if ( fHostNameField != null ) if ( fHostNameField != null )
configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_HOST, fHostNameField.getText().trim() ); configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_HOST, fHostNameField.getText().trim() );
if ( fPortNumberField != null ) if ( fPortNumberField != null )
configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_PORT, fPortNumberField.getText().trim() ); configuration.setAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_PORT, fPortNumberField.getText().trim() );
} }
private StringDialogField createHostNameField() private StringDialogField createHostNameField() {
{
StringDialogField field = new StringDialogField(); StringDialogField field = new StringDialogField();
field.setLabelText( MIUIMessages.getString( "TCPSettingsBlock.0" ) ); //$NON-NLS-1$ field.setLabelText( MIUIMessages.getString( "TCPSettingsBlock.0" ) ); //$NON-NLS-1$
field.setDialogFieldListener( field.setDialogFieldListener( new IDialogFieldListener() {
new IDialogFieldListener()
{ public void dialogFieldChanged( DialogField f ) {
public void dialogFieldChanged( DialogField f ) hostNameFieldChanged();
{ }
hostNameFieldChanged(); } );
} return field;
} );
return field;
} }
private StringDialogField createPortNumberField() private StringDialogField createPortNumberField() {
{
StringDialogField field = new StringDialogField(); StringDialogField field = new StringDialogField();
field.setLabelText( MIUIMessages.getString( "TCPSettingsBlock.1" ) ); //$NON-NLS-1$ field.setLabelText( MIUIMessages.getString( "TCPSettingsBlock.1" ) ); //$NON-NLS-1$
field.setDialogFieldListener( field.setDialogFieldListener( new IDialogFieldListener() {
new IDialogFieldListener()
{ public void dialogFieldChanged( DialogField f ) {
public void dialogFieldChanged( DialogField f ) portNumberFieldChanged();
{ }
portNumberFieldChanged(); } );
} return field;
} );
return field;
} }
protected void hostNameFieldChanged() protected void hostNameFieldChanged() {
{
updateErrorMessage(); updateErrorMessage();
setChanged(); setChanged();
notifyObservers(); notifyObservers();
} }
protected void portNumberFieldChanged() protected void portNumberFieldChanged() {
{
updateErrorMessage(); updateErrorMessage();
setChanged(); setChanged();
notifyObservers(); notifyObservers();
} }
private void initializeHostName( ILaunchConfiguration configuration ) private void initializeHostName( ILaunchConfiguration configuration ) {
{ if ( fHostNameField != null ) {
if ( fHostNameField != null ) try {
{
try
{
fHostNameField.setText( configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_HOST, DEFAULT_HOST_NAME ) ); fHostNameField.setText( configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_HOST, DEFAULT_HOST_NAME ) );
} }
catch( CoreException e ) catch( CoreException e ) {
{
} }
} }
} }
private void initializePortNumber( ILaunchConfiguration configuration ) private void initializePortNumber( ILaunchConfiguration configuration ) {
{ if ( fPortNumberField != null ) {
if ( fPortNumberField != null ) try {
{
try
{
fPortNumberField.setText( configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_PORT, DEFAULT_PORT_NUMBER ) ); fPortNumberField.setText( configuration.getAttribute( IGDBServerMILaunchConfigurationConstants.ATTR_PORT, DEFAULT_PORT_NUMBER ) );
} }
catch( CoreException e ) catch( CoreException e ) {
{
} }
} }
} }
public Control getControl() public Control getControl() {
{
return fControl; return fControl;
} }
protected void setControl( Control control ) protected void setControl( Control control ) {
{
fControl = control; fControl = control;
} }
public boolean isValid( ILaunchConfiguration configuration ) public boolean isValid( ILaunchConfiguration configuration ) {
{
updateErrorMessage(); updateErrorMessage();
return ( getErrorMessage() == null ); return (getErrorMessage() == null);
} }
private void updateErrorMessage() private void updateErrorMessage() {
{
setErrorMessage( null ); setErrorMessage( null );
if ( fHostNameField != null && fPortNumberField != null ) if ( fHostNameField != null && fPortNumberField != null ) {
{
if ( fHostNameField.getText().trim().length() == 0 ) if ( fHostNameField.getText().trim().length() == 0 )
setErrorMessage( MIUIMessages.getString( "TCPSettingsBlock.2" ) ); //$NON-NLS-1$ setErrorMessage( MIUIMessages.getString( "TCPSettingsBlock.2" ) ); //$NON-NLS-1$
else if ( !hostNameIsValid( fHostNameField.getText().trim() ) ) else if ( !hostNameIsValid( fHostNameField.getText().trim() ) )
@ -208,34 +174,27 @@ public class TCPSettingsBlock extends Observable
} }
} }
public String getErrorMessage() public String getErrorMessage() {
{
return fErrorMessage; return fErrorMessage;
} }
private void setErrorMessage( String string ) private void setErrorMessage( String string ) {
{
fErrorMessage = string; fErrorMessage = string;
} }
private boolean hostNameIsValid( String hostName ) private boolean hostNameIsValid( String hostName ) {
{
return true; return true;
} }
private boolean portNumberIsValid( String portNumber ) private boolean portNumberIsValid( String portNumber ) {
{ try {
try
{
int port = Short.parseShort( portNumber ); int port = Short.parseShort( portNumber );
if ( port < 0 ) if ( port < 0 )
return false; return false;
} }
catch( NumberFormatException e ) catch( NumberFormatException e ) {
{
return false; return false;
} }
return true; return true;
} }
} }

View file

@ -36,251 +36,217 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindow;
/** /**
* Enter type comment. * The delegate for the "Automatically Load Symbols" action.
*
* @since: Feb 11, 2003
*/ */
public class SetAutoSolibActionDelegate implements IViewActionDelegate, public class SetAutoSolibActionDelegate implements IViewActionDelegate, ISelectionListener, IPartListener {
ISelectionListener,
IPartListener
{
private IViewPart fView = null; private IViewPart fView = null;
private IAction fAction; private IAction fAction;
private IStatus fStatus = null; private IStatus fStatus = null;
/** /**
* Constructor for SetAutoSolibActionDelegate. * Constructor for SetAutoSolibActionDelegate.
*/ */
public SetAutoSolibActionDelegate() public SetAutoSolibActionDelegate() {
{
super(); super();
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
*/ */
public void init( IViewPart view ) public void init( IViewPart view ) {
{
fView = view; fView = view;
view.getSite().getPage().addPartListener( this ); view.getSite().getPage().addPartListener( this );
view.getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); view.getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection) * @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
*/ */
public void selectionChanged( IWorkbenchPart part, ISelection selection ) public void selectionChanged( IWorkbenchPart part, ISelection selection ) {
{ if ( part.getSite().getId().equals( IDebugUIConstants.ID_DEBUG_VIEW ) ) {
if ( part.getSite().getId().equals( IDebugUIConstants.ID_DEBUG_VIEW ) )
{
update( getAction() ); update( getAction() );
} }
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#run(IAction) * @see org.eclipse.ui.IActionDelegate#run(IAction)
*/ */
public void run( IAction action ) public void run( IAction action ) {
{ BusyIndicator.showWhile( Display.getCurrent(), new Runnable() {
BusyIndicator.showWhile( Display.getCurrent(),
new Runnable() public void run() {
{ try {
public void run() doAction( DebugUITools.getDebugContext() );
{ setStatus( null );
try }
{ catch( DebugException e ) {
doAction( DebugUITools.getDebugContext() ); setStatus( e.getStatus() );
setStatus( null ); }
} }
catch( DebugException e ) } );
{ if ( getStatus() != null && !getStatus().isOK() ) {
setStatus( e.getStatus() ); IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
} if ( window != null ) {
}
} );
if ( getStatus() != null && !getStatus().isOK() )
{
IWorkbenchWindow window= CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null )
{
CDebugUIPlugin.errorDialog( getErrorDialogMessage(), getStatus() ); CDebugUIPlugin.errorDialog( getErrorDialogMessage(), getStatus() );
} }
else else {
{
CDebugUIPlugin.log( getStatus() ); CDebugUIPlugin.log( getStatus() );
} }
} }
update( action ); update( action );
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
*/ */
public void selectionChanged( IAction action, ISelection selection ) public void selectionChanged( IAction action, ISelection selection ) {
{
setAction( action ); setAction( action );
if ( getView() != null ) if ( getView() != null ) {
{
update( action ); update( action );
} }
} }
protected void update( IAction action ) protected void update( IAction action ) {
{ if ( action != null ) {
if ( action != null )
{
IAdaptable element = DebugUITools.getDebugContext(); IAdaptable element = DebugUITools.getDebugContext();
action.setEnabled( getEnableStateForSelection( element ) ); action.setEnabled( getEnableStateForSelection( element ) );
action.setChecked( getCheckStateForSelection( element ) ); action.setChecked( getCheckStateForSelection( element ) );
} }
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.ui.IPartListener#partActivated(IWorkbenchPart) * @see org.eclipse.ui.IPartListener#partActivated(IWorkbenchPart)
*/ */
public void partActivated( IWorkbenchPart part ) public void partActivated( IWorkbenchPart part ) {
{
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.ui.IPartListener#partBroughtToTop(IWorkbenchPart) * @see org.eclipse.ui.IPartListener#partBroughtToTop(IWorkbenchPart)
*/ */
public void partBroughtToTop( IWorkbenchPart part ) public void partBroughtToTop( IWorkbenchPart part ) {
{
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.ui.IPartListener#partClosed(IWorkbenchPart) * @see org.eclipse.ui.IPartListener#partClosed(IWorkbenchPart)
*/ */
public void partClosed( IWorkbenchPart part ) public void partClosed( IWorkbenchPart part ) {
{ if ( part.equals( getView() ) ) {
if ( part.equals( getView() ) )
{
dispose(); dispose();
} }
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.ui.IPartListener#partDeactivated(IWorkbenchPart) * @see org.eclipse.ui.IPartListener#partDeactivated(IWorkbenchPart)
*/ */
public void partDeactivated( IWorkbenchPart part ) public void partDeactivated( IWorkbenchPart part ) {
{
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.ui.IPartListener#partOpened(IWorkbenchPart) * @see org.eclipse.ui.IPartListener#partOpened(IWorkbenchPart)
*/ */
public void partOpened( IWorkbenchPart part ) public void partOpened( IWorkbenchPart part ) {
{
} }
protected IViewPart getView() protected IViewPart getView() {
{
return fView; return fView;
} }
protected void setView( IViewPart viewPart ) protected void setView( IViewPart viewPart ) {
{
fView = viewPart; fView = viewPart;
} }
protected void setAction( IAction action ) protected void setAction( IAction action ) {
{
fAction = action; fAction = action;
} }
protected IAction getAction() protected IAction getAction() {
{
return fAction; return fAction;
} }
protected void dispose() protected void dispose() {
{ if ( getView() != null ) {
if ( getView() != null )
{
getView().getViewSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); getView().getViewSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
getView().getViewSite().getPage().removePartListener( this ); getView().getViewSite().getPage().removePartListener( this );
} }
} }
protected boolean getCheckStateForSelection( IAdaptable element ) protected boolean getCheckStateForSelection( IAdaptable element ) {
{
SharedLibraryManager slm = getSharedLibraryManager( element ); SharedLibraryManager slm = getSharedLibraryManager( element );
if ( slm != null ) if ( slm != null ) {
{ try {
try
{
return slm.isAutoLoadSymbols(); return slm.isAutoLoadSymbols();
} }
catch( CDIException e ) catch( CDIException e ) {
{
} }
} }
return false; return false;
} }
protected boolean getEnableStateForSelection( IAdaptable element ) protected boolean getEnableStateForSelection( IAdaptable element ) {
{ return (element instanceof IDebugElement && ((IDebugElement)element).getDebugTarget().isSuspended() && getSharedLibraryManager( element ) != null);
return ( element instanceof IDebugElement &&
((IDebugElement)element).getDebugTarget().isSuspended() &&
getSharedLibraryManager( element ) != null );
} }
protected String getStatusMessage() protected String getStatusMessage() {
{
return ActionMessages.getString( "SetAutoSolibActionDelegate.0" ); //$NON-NLS-1$ return ActionMessages.getString( "SetAutoSolibActionDelegate.0" ); //$NON-NLS-1$
} }
/** /**
* @see AbstractDebugActionDelegate#getErrorDialogMessage() * @see AbstractDebugActionDelegate#getErrorDialogMessage()
*/ */
protected String getErrorDialogMessage() protected String getErrorDialogMessage() {
{
return ActionMessages.getString( "SetAutoSolibActionDelegate.1" ); //$NON-NLS-1$ return ActionMessages.getString( "SetAutoSolibActionDelegate.1" ); //$NON-NLS-1$
} }
protected void setStatus( IStatus status ) protected void setStatus( IStatus status ) {
{
fStatus = status; fStatus = status;
} }
protected IStatus getStatus() protected IStatus getStatus() {
{
return fStatus; return fStatus;
} }
protected void doAction( IAdaptable element ) throws DebugException protected void doAction( IAdaptable element ) throws DebugException {
{
if ( getView() == null ) if ( getView() == null )
return; return;
SharedLibraryManager slm = getSharedLibraryManager( element ); SharedLibraryManager slm = getSharedLibraryManager( element );
if ( slm != null && getAction() != null ) if ( slm != null && getAction() != null ) {
{ try {
try
{
slm.setAutoLoadSymbols( getAction().isChecked() ); slm.setAutoLoadSymbols( getAction().isChecked() );
} }
catch( CDIException e ) catch( CDIException e ) {
{
getAction().setChecked( !getAction().isChecked() ); getAction().setChecked( !getAction().isChecked() );
throw new DebugException( new Status( IStatus.ERROR, throw new DebugException( new Status( IStatus.ERROR, MIPlugin.getUniqueIdentifier(), DebugException.TARGET_REQUEST_FAILED, e.getMessage(), null ) );
MIPlugin.getUniqueIdentifier(),
DebugException.TARGET_REQUEST_FAILED,
e.getMessage(),
null ) );
} }
} }
} }
private SharedLibraryManager getSharedLibraryManager( IAdaptable element ) private SharedLibraryManager getSharedLibraryManager( IAdaptable element ) {
{ if ( element != null ) {
if ( element != null )
{
ICDISession session = (ICDISession)element.getAdapter( ICDISession.class ); ICDISession session = (ICDISession)element.getAdapter( ICDISession.class );
if ( session instanceof Session && ((Session)session).getSharedLibraryManager() instanceof SharedLibraryManager ) if ( session instanceof Session && ((Session)session).getSharedLibraryManager() instanceof SharedLibraryManager )
return (SharedLibraryManager)((Session)session).getSharedLibraryManager(); return (SharedLibraryManager)((Session)session).getSharedLibraryManager();
} }
return null; return null;
} }
} }

View file

@ -11,7 +11,6 @@
package org.eclipse.cdt.debug.mi.internal.ui.preferences; package org.eclipse.cdt.debug.mi.internal.ui.preferences;
import java.text.MessageFormat; import java.text.MessageFormat;
import org.eclipse.cdt.debug.mi.core.IMIConstants; import org.eclipse.cdt.debug.mi.core.IMIConstants;
import org.eclipse.cdt.debug.mi.core.MIPlugin; 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.IMIHelpContextIds;
@ -34,14 +33,12 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.ui.help.WorkbenchHelp;
/** /**
*
* Page for preferences that apply specifically to GDB MI. * Page for preferences that apply specifically to GDB MI.
*
* @since Oct 4, 2002
*/ */
public class MIPreferencePage extends PreferencePage implements IWorkbenchPreferencePage public class MIPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
{
private final static String GDB_MI_HELP_CONTEXT = MIUIPlugin.PLUGIN_ID + "mi_preference_page_context"; //$NON-NLS-1$ private final static String GDB_MI_HELP_CONTEXT = MIUIPlugin.PLUGIN_ID + "mi_preference_page_context"; //$NON-NLS-1$
// Debugger timeout preference widgets // Debugger timeout preference widgets
IntegerFieldEditor fDebugTimeoutText; IntegerFieldEditor fDebugTimeoutText;
@ -51,20 +48,19 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
/** /**
* Constructor for MIPreferencePage. * Constructor for MIPreferencePage.
*/ */
public MIPreferencePage() public MIPreferencePage() {
{
super(); super();
setPreferenceStore( MIUIPlugin.getDefault().getPreferenceStore() ); setPreferenceStore( MIUIPlugin.getDefault().getPreferenceStore() );
setDescription( PreferenceMessages.getString( "MIPreferencePage.0" ) ); //$NON-NLS-1$ setDescription( PreferenceMessages.getString( "MIPreferencePage.0" ) ); //$NON-NLS-1$
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#createContents(Composite) * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
*/ */
protected Control createContents( Composite parent ) protected Control createContents( Composite parent ) {
{
WorkbenchHelp.setHelp( getControl(), IMIHelpContextIds.MI_PREFERENCE_PAGE ); WorkbenchHelp.setHelp( getControl(), IMIHelpContextIds.MI_PREFERENCE_PAGE );
//The main composite //The main composite
Composite composite = new Composite( parent, SWT.NULL ); Composite composite = new Composite( parent, SWT.NULL );
GridLayout layout = new GridLayout(); GridLayout layout = new GridLayout();
@ -76,36 +72,29 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
data.verticalAlignment = GridData.FILL; data.verticalAlignment = GridData.FILL;
data.horizontalAlignment = GridData.FILL; data.horizontalAlignment = GridData.FILL;
composite.setLayoutData( data ); composite.setLayoutData( data );
createSpacer( composite, 1 ); createSpacer( composite, 1 );
createCommunicationPreferences( composite ); createCommunicationPreferences( composite );
setValues(); setValues();
WorkbenchHelp.setHelp( composite, GDB_MI_HELP_CONTEXT );
WorkbenchHelp.setHelp(composite, GDB_MI_HELP_CONTEXT);
return composite; return composite;
} }
/** /**
* Creates composite group and sets the default layout data. * Creates composite group and sets the default layout data.
* *
* @param parent the parent of the new composite * @param parent the parent of the new composite
* @param numColumns the number of columns for the new composite * @param numColumns the number of columns for the new composite
* @param labelText the text label of the new composite * @param labelText the text label of the new composite
* @return the newly-created composite * @return the newly-created composite
*/ */
private Composite createGroupComposite( Composite parent, int numColumns, String labelText ) private Composite createGroupComposite( Composite parent, int numColumns, String labelText ) {
{
return ControlFactory.createGroup( parent, labelText, numColumns ); return ControlFactory.createGroup( parent, labelText, numColumns );
} }
/** /**
* Set the values of the component widgets based on the * Set the values of the component widgets based on the values in the preference store
* values in the preference store
*/ */
private void setValues() private void setValues() {
{
fDebugTimeoutText.setStringValue( new Integer( MIPlugin.getDefault().getPluginPreferences().getInt( IMIConstants.PREF_REQUEST_TIMEOUT ) ).toString() ); 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() ); fLaunchTimeoutText.setStringValue( new Integer( MIPlugin.getDefault().getPluginPreferences().getInt( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT ) ).toString() );
} }
@ -113,8 +102,7 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
/** /**
* @see IPreferencePage#performOk() * @see IPreferencePage#performOk()
*/ */
public boolean performOk() public boolean performOk() {
{
storeValues(); storeValues();
MIUIPlugin.getDefault().savePluginPreferences(); MIUIPlugin.getDefault().savePluginPreferences();
MIPlugin.getDefault().savePluginPreferences(); MIPlugin.getDefault().savePluginPreferences();
@ -123,37 +111,35 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
/** /**
* Sets the default preferences. * Sets the default preferences.
*
* @see PreferencePage#performDefaults() * @see PreferencePage#performDefaults()
*/ */
protected void performDefaults() protected void performDefaults() {
{
setDefaultValues(); setDefaultValues();
super.performDefaults(); super.performDefaults();
} }
private void setDefaultValues() private void setDefaultValues() {
{
fDebugTimeoutText.setStringValue( new Integer( IMIConstants.DEF_REQUEST_TIMEOUT ).toString() ); fDebugTimeoutText.setStringValue( new Integer( IMIConstants.DEF_REQUEST_TIMEOUT ).toString() );
fLaunchTimeoutText.setStringValue( new Integer( IMIConstants.DEF_REQUEST_LAUNCH_TIMEOUT ).toString() ); fLaunchTimeoutText.setStringValue( new Integer( IMIConstants.DEF_REQUEST_LAUNCH_TIMEOUT ).toString() );
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(IWorkbench) * @see org.eclipse.ui.IWorkbenchPreferencePage#init(IWorkbench)
*/ */
public void init( IWorkbench workbench ) public void init( IWorkbench workbench ) {
{
} }
protected void createSpacer( Composite composite, int columnSpan ) protected void createSpacer( Composite composite, int columnSpan ) {
{
Label label = new Label( composite, SWT.NONE ); Label label = new Label( composite, SWT.NONE );
GridData gd = new GridData(); GridData gd = new GridData();
gd.horizontalSpan = columnSpan; gd.horizontalSpan = columnSpan;
label.setLayoutData( gd ); label.setLayoutData( gd );
} }
private void createCommunicationPreferences( Composite composite ) private void createCommunicationPreferences( Composite composite ) {
{
Composite comp = createGroupComposite( composite, 1, PreferenceMessages.getString( "MIPreferencePage.1" ) ); //$NON-NLS-1$ Composite comp = createGroupComposite( composite, 1, PreferenceMessages.getString( "MIPreferencePage.1" ) ); //$NON-NLS-1$
//Add in an intermediate composite to allow for spacing //Add in an intermediate composite to allow for spacing
Composite spacingComposite = new Composite( comp, SWT.NONE ); Composite spacingComposite = new Composite( comp, SWT.NONE );
@ -162,42 +148,33 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
GridData data = new GridData(); GridData data = new GridData();
data.horizontalSpan = 2; data.horizontalSpan = 2;
spacingComposite.setLayoutData( data ); spacingComposite.setLayoutData( data );
fDebugTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_TIMEOUT, PreferenceMessages.getString( "MIPreferencePage.2" ), spacingComposite ); //$NON-NLS-1$ fDebugTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_TIMEOUT, PreferenceMessages.getString( "MIPreferencePage.2" ), spacingComposite ); //$NON-NLS-1$
fDebugTimeoutText.setPropertyChangeListener( fDebugTimeoutText.setPropertyChangeListener( new IPropertyChangeListener() {
new IPropertyChangeListener()
{
public void propertyChange( PropertyChangeEvent event )
{
if ( event.getProperty().equals( FieldEditor.IS_VALID ) )
setValid( fDebugTimeoutText.isValid() );
}
} );
public void propertyChange( PropertyChangeEvent event ) {
if ( event.getProperty().equals( FieldEditor.IS_VALID ) )
setValid( fDebugTimeoutText.isValid() );
}
} );
fLaunchTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, PreferenceMessages.getString( "MIPreferencePage.3" ), spacingComposite ); //$NON-NLS-1$ fLaunchTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, PreferenceMessages.getString( "MIPreferencePage.3" ), spacingComposite ); //$NON-NLS-1$
fLaunchTimeoutText.setPropertyChangeListener( fLaunchTimeoutText.setPropertyChangeListener( new IPropertyChangeListener() {
new IPropertyChangeListener()
{ public void propertyChange( PropertyChangeEvent event ) {
public void propertyChange( PropertyChangeEvent event ) if ( event.getProperty().equals( FieldEditor.IS_VALID ) )
{ setValid( fLaunchTimeoutText.isValid() );
if ( event.getProperty().equals( FieldEditor.IS_VALID ) ) }
setValid( fLaunchTimeoutText.isValid() ); } );
}
} );
} }
/** /**
* Store the preference values based on the state of the * Store the preference values based on the state of the component widgets
* component widgets
*/ */
private void storeValues() private void storeValues() {
{
MIPlugin.getDefault().getPluginPreferences().setValue( IMIConstants.PREF_REQUEST_TIMEOUT, fDebugTimeoutText.getIntValue() ); MIPlugin.getDefault().getPluginPreferences().setValue( IMIConstants.PREF_REQUEST_TIMEOUT, fDebugTimeoutText.getIntValue() );
MIPlugin.getDefault().getPluginPreferences().setValue( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, fLaunchTimeoutText.getIntValue() ); MIPlugin.getDefault().getPluginPreferences().setValue( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, fLaunchTimeoutText.getIntValue() );
} }
private IntegerFieldEditor createTimeoutField( String preference, String label, Composite parent ) private IntegerFieldEditor createTimeoutField( String preference, String label, Composite parent ) {
{
IntegerFieldEditor toText = new IntegerFieldEditor( preference, label, parent ); IntegerFieldEditor toText = new IntegerFieldEditor( preference, label, parent );
GridData data = new GridData(); GridData data = new GridData();
data.widthHint = convertWidthInCharsToPixels( 10 ); data.widthHint = convertWidthInCharsToPixels( 10 );
@ -212,5 +189,4 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
toText.load(); toText.load();
return toText; return toText;
} }
} }

View file

@ -0,0 +1,84 @@
/**********************************************************************
* 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.ui;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
/**
* The common interface for UI components of the launch configuration tabs.
*/
public interface IMILaunchConfigurationComponent {
/**
* Creates the top level control for this component under the given parent composite.
* <p>
* Implementors are responsible for ensuring that the created control can be accessed via <code>getControl</code>
* </p>
*
* @param parent the parent composite
*/
public void createControl( Composite parent );
/**
* Returns the top level control for this component.
* <p>
* May return <code>null</code> if the control has not been created yet.
* </p>
*
* @return the top level control or <code>null</code>
*/
public Control getControl();
/**
* Initializes the given component with default values.
* This method may be called before this tab's control is created.
*
* @param configuration launch configuration
*/
public void setDefaults( ILaunchConfigurationWorkingCopy configuration );
/**
* Initializes this component's controls with values from the given
* launch configuration.
*
* @param configuration launch configuration
*/
public void initializeFrom( ILaunchConfiguration configuration );
/**
* Notifies this component that it has been disposed.
* Marks the end of this component's lifecycle, allowing
* to perform any cleanup required.
*/
public void dispose();
/**
* Copies values from this component into the given launch configuration.
*
* @param configuration launch configuration
*/
public void performApply( ILaunchConfigurationWorkingCopy configuration );
/**
* Returns whether this component is in a valid state in the context
* of the specified launch configuration.
*
* @param launchConfig launch configuration which provides context
* for validating this component.
* This value must not be <code>null</code>.
*
* @return whether this component is in a valid state
*/
public boolean isValid(ILaunchConfiguration launchConfig);
}

View file

@ -0,0 +1,20 @@
/**********************************************************************
* 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.ui;
import org.eclipse.core.runtime.IPath;
/**
* Comment for .
*/
public interface IPathProvider {
public IPath[] getPaths();
}

View file

@ -0,0 +1,30 @@
/**********************************************************************
* 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.ui;
import org.eclipse.cdt.debug.mi.internal.ui.GDBSolibBlock;
import org.eclipse.cdt.debug.mi.internal.ui.SolibSearchPathBlock;
/**
* This class provides utilities for clients of the MI UI.
*/
public class MIUIUtils {
public static IMILaunchConfigurationComponent createGDBSolibBlock( IMILaunchConfigurationComponent solibSearchBlock,
boolean autoSolib,
boolean stopOnSolibEvents ) {
return new GDBSolibBlock( solibSearchBlock, autoSolib, stopOnSolibEvents );
}
public static IMILaunchConfigurationComponent createSolibSearchPathBlock( IPathProvider pp ) {
return new SolibSearchPathBlock( pp );
}
}