From 48d23480f78148b473cc51a1a7bdd4c71ee13c6f Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Tue, 1 Apr 2003 16:52:28 +0000 Subject: [PATCH] Cleanup. --- .../cdt/debug/internal/ui/CDebugImages.java | 6 +- .../ui/dialogfields/ListDialogField.java | 7 - .../ui/sourcelookup/CUISourceLocator.java | 175 ------------------ 3 files changed, 3 insertions(+), 185 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java index 75ca621262c..abf894d3481 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java @@ -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 ); diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogfields/ListDialogField.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogfields/ListDialogField.java index 60e9ea723fe..c3fccc28ccf 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogfields/ListDialogField.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogfields/ListDialogField.java @@ -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 */ diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/CUISourceLocator.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/CUISourceLocator.java index 7360d3198b2..a4c8e566b49 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/CUISourceLocator.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/CUISourceLocator.java @@ -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 ¬ 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 );