1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

Bug 84929: The "Expression to watch" field of the "Add Watchpoint" dialog is editable.

This commit is contained in:
Mikhail Khodjaiants 2005-06-10 19:08:56 +00:00
parent 60bb3058a1
commit 38e72c571b
6 changed files with 46 additions and 5 deletions

View file

@ -1,3 +1,11 @@
2005-06-10 Mikhail Khodjaiants
Bug 84929: The "Expression to watch" field of the "Add Watchpoint" dialog is editable.
* CDebugModelPresentation.java
* AddWatchpointActionDelegate.java
* AddWatchpointDialog.java
* ToggleBreakpointAdapter.java
* ModulesView.java
2005-06-10 Mikhail Khodjaiants
Bug 83465: Add "Run to line" and "Resume at line" actions to the context menu of Disassembly view.
* plugin.xml

View file

@ -295,7 +295,10 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
}
public String getText( Object element ) {
StringBuffer baseText = new StringBuffer( getBaseText( element ) );
String bt = getBaseText( element );
if ( bt == null )
return null;
StringBuffer baseText = new StringBuffer( bt );
if ( element instanceof ICDebugElementStatus && !((ICDebugElementStatus)element).isOK() ) {
baseText.append( getFormattedString( " <{0}>", ((ICDebugElementStatus)element).getMessage() ) ); //$NON-NLS-1$
}

View file

@ -77,7 +77,7 @@ public class AddWatchpointActionDelegate extends ActionDelegate implements IWork
*/
public void run( IAction action ) {
String expression = getSelectedExpression();
AddWatchpointDialog dlg = new AddWatchpointDialog( CDebugUIPlugin.getActiveWorkbenchShell(), true, false, expression );
AddWatchpointDialog dlg = new AddWatchpointDialog( CDebugUIPlugin.getActiveWorkbenchShell(), true, false, expression, true );
if ( dlg.open() != Window.OK )
return;
if ( getTextEditor() != null ) {

View file

@ -47,17 +47,20 @@ public class AddWatchpointDialog extends Dialog {
private String fExpression = ""; //$NON-NLS-1$
private boolean fEditable = true;
/**
* Constructor for AddWatchpointDialog.
*
* @param parentShell
*/
public AddWatchpointDialog( Shell parentShell, boolean write, boolean read, String expression ) {
public AddWatchpointDialog( Shell parentShell, boolean write, boolean read, String expression, boolean editable ) {
super( parentShell );
fWrite = write;
fRead = read;
if ( expression != null )
fExpression = expression;
fEditable = editable;
}
protected void configureShell( Shell shell ) {
@ -106,6 +109,7 @@ public class AddWatchpointDialog extends Dialog {
GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
gridData.widthHint = 300;
text.setLayoutData( gridData );
text.setEnabled( fEditable );
addModifyListener( text );
return text;
}

View file

@ -328,7 +328,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( watchpoint, true );
}
else {
AddWatchpointDialog dlg = new AddWatchpointDialog( part.getSite().getShell(), true, false, expression );
AddWatchpointDialog dlg = new AddWatchpointDialog( part.getSite().getShell(), true, false, expression, false );
if ( dlg.open() != Window.OK )
return;
expression = dlg.getExpression();

View file

@ -27,6 +27,7 @@ import org.eclipse.cdt.debug.internal.ui.views.AbstractViewerState;
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IValue;
@ -40,6 +41,7 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.DocumentEvent;
@ -87,6 +89,7 @@ import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.texteditor.IUpdate;
/**
@ -110,7 +113,19 @@ public class ModulesView extends AbstractDebugEventHandlerView implements IDebug
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
*/
public Image getImage( Object element ) {
return getModelPresentation().getImage( element );
Image image = getModelPresentation().getImage( element );
if ( image == null ) {
if ( element instanceof IAdaptable ) {
IWorkbenchAdapter de = (IWorkbenchAdapter)((IAdaptable)element).getAdapter( IWorkbenchAdapter.class );
if ( de != null ) {
ImageDescriptor descriptor = de.getImageDescriptor( element );
if ( descriptor != null ) {
image = descriptor.createImage();
}
}
}
}
return image;
}
/* (non-Javadoc)
@ -118,6 +133,17 @@ public class ModulesView extends AbstractDebugEventHandlerView implements IDebug
*/
public String getText( Object element ) {
String text = getModelPresentation().getText( element );
if ( text == null ) {
if ( element instanceof IAdaptable ) {
IWorkbenchAdapter de = (IWorkbenchAdapter)((IAdaptable)element).getAdapter( IWorkbenchAdapter.class );
if ( de != null ) {
text = de.getLabel( element );
}
else {
text = element.toString();
}
}
}
if ( element instanceof ICModule ) {
ICModule module = (ICModule)element;
text += ( module.areSymbolsLoaded() ) ? ModulesMessages.getString( "ModulesView.11" ) : ModulesMessages.getString( "ModulesView.12" ); //$NON-NLS-1$ //$NON-NLS-2$