mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Cleanup.
This commit is contained in:
parent
202ea7ef21
commit
48d23480f7
3 changed files with 3 additions and 185 deletions
|
@ -96,9 +96,9 @@ public class CDebugImages
|
||||||
private static final String T_WIZBAN = "wizban"; //$NON-NLS-1$
|
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_LCL = "lcl16"; //$NON-NLS-1$
|
||||||
private static final String T_CTOOL = "ctool16"; //$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_CVIEW = "cview16"; //$NON-NLS-1$
|
||||||
private static final String T_DTOOL = "dtool16"; //$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_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 = createManaged( T_OVR, IMG_OBJS_BREAKPOINT_INSTALLED );
|
||||||
public static final ImageDescriptor DESC_OBJS_BREAKPOINT_INSTALLED_DISABLED = createManaged( T_OVR, IMG_OBJS_BREAKPOINT_INSTALLED_DISABLED );
|
public static final ImageDescriptor DESC_OBJS_BREAKPOINT_INSTALLED_DISABLED = createManaged( T_OVR, IMG_OBJS_BREAKPOINT_INSTALLED_DISABLED );
|
||||||
|
|
|
@ -368,13 +368,6 @@ public class ListDialogField extends DialogField {
|
||||||
updateButtonState();
|
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
|
* Updates the enable state of the all buttons
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.debug.ui.sourcelookup;
|
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.model.IStackFrameInfo;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
|
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.ILaunchConfigurationWorkingCopy;
|
||||||
import org.eclipse.debug.core.model.IPersistableSourceLocator;
|
import org.eclipse.debug.core.model.IPersistableSourceLocator;
|
||||||
import org.eclipse.debug.core.model.IStackFrame;
|
import org.eclipse.debug.core.model.IStackFrame;
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
|
||||||
import org.eclipse.jface.window.Window;
|
import org.eclipse.jface.window.Window;
|
||||||
import org.eclipse.jface.wizard.WizardDialog;
|
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
|
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 ¬ 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.
|
* The project being debugged.
|
||||||
*/
|
*/
|
||||||
|
@ -220,42 +75,12 @@ public class CUISourceLocator implements IAdaptable
|
||||||
IStackFrameInfo frameInfo = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class );
|
IStackFrameInfo frameInfo = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class );
|
||||||
if ( frameInfo != null && frameInfo.getFile() != null && frameInfo.getFile().length() > 0 )
|
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 );
|
res = new FileNotFoundElement( stackFrame );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
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 )
|
protected void attachSourceLocation( ILaunch launch, String fileName )
|
||||||
{
|
{
|
||||||
IPath path = new Path( fileName );
|
IPath path = new Path( fileName );
|
||||||
|
|
Loading…
Add table
Reference in a new issue