1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00
This commit is contained in:
Mikhail Khodjaiants 2003-04-01 16:52:28 +00:00
parent 202ea7ef21
commit 48d23480f7
3 changed files with 3 additions and 185 deletions

View file

@ -96,9 +96,9 @@ public class CDebugImages
private static final String T_WIZBAN = "wizban"; //$NON-NLS-1$
private static final String T_LCL = "lcl16"; //$NON-NLS-1$
private static final String T_CTOOL = "ctool16"; //$NON-NLS-1$
private static final String T_CVIEW = "cview16"; //$NON-NLS-1$
private static final String T_DTOOL = "dtool16"; //$NON-NLS-1$
private static final String T_ETOOL = "etool16"; //$NON-NLS-1$
// private static final String T_CVIEW = "cview16"; //$NON-NLS-1$
// private static final String T_DTOOL = "dtool16"; //$NON-NLS-1$
// private static final String T_ETOOL = "etool16"; //$NON-NLS-1$
public static final ImageDescriptor DESC_OBJS_BREAKPOINT_INSTALLED = createManaged( T_OVR, IMG_OBJS_BREAKPOINT_INSTALLED );
public static final ImageDescriptor DESC_OBJS_BREAKPOINT_INSTALLED_DISABLED = createManaged( T_OVR, IMG_OBJS_BREAKPOINT_INSTALLED_DISABLED );

View file

@ -368,13 +368,6 @@ public class ListDialogField extends DialogField {
updateButtonState();
}
private Button getButton(int index) {
if (fButtonControls != null && index >= 0 && index < fButtonControls.length) {
return fButtonControls[index];
}
return null;
}
/*
* Updates the enable state of the all buttons
*/

View file

@ -5,8 +5,6 @@
*/
package org.eclipse.cdt.debug.ui.sourcelookup;
import java.text.MessageFormat;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
@ -27,22 +25,8 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell;
/**
*
@ -53,135 +37,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class CUISourceLocator implements IAdaptable
{
/**
* Dialog that prompts for source lookup path.
*/
private static class SourceLookupDialog extends Dialog
{
public static final int ATTACH_ID = 1000;
public static final int ATTACH = 1000;
private String fFileName;
private boolean fNotAskAgain;
private Button fAskAgainCheckBox;
public SourceLookupDialog( Shell shell,
String fileName )
{
super( shell );
fFileName = fileName;
fNotAskAgain = false;
fAskAgainCheckBox = null;
}
public boolean isNotAskAgain()
{
return fNotAskAgain;
}
protected Control createDialogArea( Composite parent )
{
getShell().setText( "Debugger Source Lookup" );
Composite composite = (Composite)super.createDialogArea( parent );
composite.setLayout( new GridLayout() );
Composite group = new Composite( composite, SWT.NONE );
group.setLayout( new GridLayout() );
createMessageControls( group );
createControls( group );
return composite;
}
protected void createMessageControls( Composite parent )
{
Label message = new Label( parent, SWT.LEFT + SWT.WRAP );
message.setText( MessageFormat.format( "The source could not be shown as the file ''{0}'' was not found.", new String[] { fFileName } ) );
GridData data = new GridData();
data.widthHint = convertWidthInCharsToPixels( message, 70 );
message.setLayoutData( data );
}
protected void createControls( Composite parent )
{
Composite composite = new Composite( parent, SWT.NONE );
Layout layout = new GridLayout();
composite.setLayout( layout );
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
composite.setLayoutData( data );
fAskAgainCheckBox = new Button( composite, SWT.CHECK + SWT.WRAP );
data = new GridData();
data.horizontalAlignment = GridData.FILL;
fAskAgainCheckBox.setLayoutData( data );
data.grabExcessHorizontalSpace = true;
fAskAgainCheckBox.setText( "Do &not ask again" );
fAskAgainCheckBox.addSelectionListener( new SelectionAdapter()
{
/* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(SelectionEvent)
*/
public void widgetSelected( SelectionEvent e )
{
askAgainSelected();
}
} );
}
protected void askAgainSelected()
{
getButton( ATTACH_ID ).setEnabled( !fAskAgainCheckBox.getSelection() );
}
/**
* @see Dialog#convertWidthInCharsToPixels(FontMetrics, int)
*/
protected int convertWidthInCharsToPixels( Control control, int chars )
{
GC gc = new GC( control );
gc.setFont( control.getFont() );
FontMetrics fontMetrics = gc.getFontMetrics();
gc.dispose();
return Dialog.convertWidthInCharsToPixels( fontMetrics, chars );
}
protected void okPressed()
{
if ( fAskAgainCheckBox != null )
{
fNotAskAgain = fAskAgainCheckBox.getSelection();
}
super.okPressed();
}
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(Composite)
*/
protected void createButtonsForButtonBar( Composite parent )
{
super.createButtonsForButtonBar( parent );
Button button = createButton( parent, ATTACH_ID, "&Attach ...", false );
button.setToolTipText( "Attach New Source Location" );
}
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
*/
protected void buttonPressed( int buttonId )
{
super.buttonPressed( buttonId );
if ( buttonId == ATTACH_ID )
attachPressed();
}
protected void attachPressed()
{
setReturnCode( ATTACH );
close();
}
}
/**
* The project being debugged.
*/
@ -220,42 +75,12 @@ public class CUISourceLocator implements IAdaptable
IStackFrameInfo frameInfo = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class );
if ( frameInfo != null && frameInfo.getFile() != null && frameInfo.getFile().length() > 0 )
{
/*
showDebugSourcePage( stackFrame.getLaunch(), frameInfo.getFile() );
if ( fNewLocationAttached )
{
res = fSourceLocator.getSourceElement( stackFrame );
}
*/
res = new FileNotFoundElement( stackFrame );
}
}
return res;
}
/**
* Prompts to locate the source of the given type.
*
* @param frameInfo the frame information for which source
* could not be located
*/
private void showDebugSourcePage( final ILaunch launch, final String fileName )
{
Runnable prompter = new Runnable()
{
public void run()
{
SourceLookupDialog dialog = new SourceLookupDialog( CDebugUIPlugin.getActiveWorkbenchShell(), fileName );
if ( dialog.open() == SourceLookupDialog.ATTACH )
{
attachSourceLocation( launch, fileName );
}
fAllowedToAsk = !dialog.isNotAskAgain();
}
};
CDebugUIPlugin.getStandardDisplay().syncExec( prompter );
}
protected void attachSourceLocation( ILaunch launch, String fileName )
{
IPath path = new Path( fileName );