### Eclipse Workspace Patch 1.0 #P org.eclipse.cdt.debug.ui Index: plugin.properties =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/plugin.properties,v retrieving revision 1.115 diff -u -r1.115 plugin.properties --- plugin.properties 11 Mar 2010 19:19:35 -0000 1.115 +++ plugin.properties 22 Mar 2010 18:19:26 -0000 @@ -243,4 +243,6 @@ viewMemory.label = View Memory disassemblyViewMenu.label = disassemblyViewMenu sourceNotFoundEditor.name = C/C++ Source Not Found Editor -displayMode.name = displayMode \ No newline at end of file +displayMode.name = displayMode +CastingCategory.description = Set of commands for typecasting variables and expressions. +CastingCategory.name = Cast to Type or Array \ No newline at end of file Index: plugin.xml =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/plugin.xml,v retrieving revision 1.235 diff -u -r1.235 plugin.xml --- plugin.xml 15 Mar 2010 16:03:56 -0000 1.235 +++ plugin.xml 22 Mar 2010 18:19:27 -0000 @@ -592,6 +592,7 @@ + @@ -2091,6 +2093,7 @@ name="%BreakpointPropertiesCommand.name"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java =================================================================== RCS file: src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java diff -N src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java --- src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java 23 Jun 2006 17:52:33 -0000 1.12 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,326 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.actions; - -import org.eclipse.cdt.debug.core.model.ICastToArray; -import org.eclipse.cdt.debug.internal.ui.CDebugImages; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.cdt.utils.ui.controls.ControlFactory; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.ui.IDebugView; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -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.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.actions.ActionDelegate; - -/** - * The delegate of the "Display As Array" action. - */ -public class CastToArrayActionDelegate extends ActionDelegate implements IObjectActionDelegate { - - protected class CastToArrayDialog extends Dialog { - - private String fType = ""; //$NON-NLS-1$ - - private int fFirstIndex = 0; - - private int fLength = 0; - - private Button fOkButton; - - private Label fErrorMessageLabel; - - private Text fFirstIndexText; - - private Text fLengthText; - - public CastToArrayDialog( Shell parentShell, String initialType, int initialStart, int initialLength ) { - super( parentShell ); - fType = (initialType == null) ? "" : initialType; //$NON-NLS-1$ - fFirstIndex = initialStart; - fLength = initialLength; - } - - protected String getType() { - return fType; - } - - protected int getFirstIndex() { - return fFirstIndex; - } - - protected int getLength() { - return fLength; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) - */ - protected void configureShell( Shell newShell ) { - super.configureShell( newShell ); - newShell.setText( ActionMessages.getString( "CastToArrayActionDelegate.0" ) ); //$NON-NLS-1$ - newShell.setImage( CDebugImages.get( CDebugImages.IMG_LCL_DISPLAY_AS_ARRAY ) ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) - */ - protected void createButtonsForButtonBar( Composite parent ) { - // create OK and Cancel buttons by default - fOkButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true ); - createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false ); - //do this here because setting the text will set enablement on the ok button - /* - * fTypeText.setFocus(); if ( fType != null ) { fTypeText.setText( fType ); fTypeText.selectAll(); fFirstIndexText.setText( String.valueOf( - * fFirstIndex ) ); fLengthText.setText( String.valueOf( fLength ) ); } - */ - fFirstIndexText.setText( String.valueOf( fFirstIndex ) ); - fLengthText.setText( String.valueOf( fLength ) ); - } - - protected Label getErrorMessageLabel() { - return fErrorMessageLabel; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ - protected Control createDialogArea( Composite parent ) { - Composite composite = (Composite)super.createDialogArea( parent ); - createDialogFields( composite ); - fErrorMessageLabel = new Label( composite, SWT.NONE ); - fErrorMessageLabel.setLayoutData( new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL ) ); - fErrorMessageLabel.setFont( parent.getFont() ); - return composite; - } - - private void createDialogFields( Composite parent ) { - Composite composite = ControlFactory.createComposite( parent, 4 ); - ((GridData)composite.getLayoutData()).widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ); - ((GridLayout)composite.getLayout()).makeColumnsEqualWidth = true; - Label label = ControlFactory.createLabel( composite, ActionMessages.getString( "CastToArrayActionDelegate.1" ) ); //$NON-NLS-1$ - ((GridData)label.getLayoutData()).horizontalSpan = 3; - fFirstIndexText = ControlFactory.createTextField( composite ); - fFirstIndexText.addModifyListener( new ModifyListener() { - - public void modifyText( ModifyEvent e ) { - validateInput(); - } - } ); - label = ControlFactory.createLabel( composite, ActionMessages.getString( "CastToArrayActionDelegate.2" ) ); //$NON-NLS-1$ - ((GridData)label.getLayoutData()).horizontalSpan = 3; - fLengthText = ControlFactory.createTextField( composite ); - fLengthText.addModifyListener( new ModifyListener() { - - public void modifyText( ModifyEvent e ) { - validateInput(); - } - } ); - } - - protected void validateInput() { - boolean enabled = true; - String message = ""; //$NON-NLS-1$ - String firstIndex = fFirstIndexText.getText().trim(); - if ( firstIndex.length() == 0 ) { - message = ActionMessages.getString( "CastToArrayActionDelegate.3" ); //$NON-NLS-1$ - enabled = false; - } - else { - try { - Integer.parseInt( firstIndex ); - } - catch( NumberFormatException e ) { - message = ActionMessages.getString( "CastToArrayActionDelegate.4" ); //$NON-NLS-1$ - enabled = false; - } - if ( enabled ) { - String lengthText = fLengthText.getText().trim(); - if ( lengthText.length() == 0 ) { - message = ActionMessages.getString( "CastToArrayActionDelegate.5" ); //$NON-NLS-1$ - enabled = false; - } - else { - int length = -1; - try { - length = Integer.parseInt( lengthText ); - } - catch( NumberFormatException e ) { - message = ActionMessages.getString( "CastToArrayActionDelegate.6" ); //$NON-NLS-1$ - enabled = false; - } - if ( enabled && length < 1 ) { - message = ActionMessages.getString( "CastToArrayActionDelegate.7" ); //$NON-NLS-1$ - enabled = false; - } - } - } - } - fOkButton.setEnabled( enabled ); - getErrorMessageLabel().setText( message ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int) - */ - protected void buttonPressed( int buttonId ) { - if ( buttonId == IDialogConstants.OK_ID ) { - String firstIndex = fFirstIndexText.getText().trim(); - String lengthText = fLengthText.getText().trim(); - try { - fFirstIndex = Integer.parseInt( firstIndex ); - fLength = Integer.parseInt( lengthText ); - } - catch( NumberFormatException e ) { - fFirstIndex = 0; - fLength = 0; - } - } - else { - fType = null; - } - super.buttonPressed( buttonId ); - } - } - - private ICastToArray fCastToArray = null; - - private IStatus fStatus = null; - - private IWorkbenchPart fTargetPart = null; - - public CastToArrayActionDelegate() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) - */ - public void setActivePart( IAction action, IWorkbenchPart targetPart ) { - fTargetPart = targetPart; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run( IAction action ) { - if ( getCastToArray() == null ) - return; - BusyIndicator.showWhile( Display.getCurrent(), new Runnable() { - - public void run() { - try { - doAction( getCastToArray() ); - setStatus( null ); - } - catch( DebugException e ) { - setStatus( e.getStatus() ); - } - } - } ); - if ( getStatus() != null && !getStatus().isOK() ) { - IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow(); - if ( window != null ) { - CDebugUIPlugin.errorDialog( ActionMessages.getString( "CastToArrayActionDelegate.8" ), getStatus() ); //$NON-NLS-1$ - } - else { - CDebugUIPlugin.log( getStatus() ); - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged( IAction action, ISelection selection ) { - if ( selection instanceof IStructuredSelection ) { - Object element = ((IStructuredSelection)selection).getFirstElement(); - if ( element instanceof ICastToArray ) { - boolean enabled = ((ICastToArray)element).canCastToArray(); - action.setEnabled( enabled ); - if ( enabled ) { - setCastToArray( (ICastToArray)element ); - return; - } - } - } - action.setEnabled( false ); - setCastToArray( null ); - } - - protected ICastToArray getCastToArray() { - return fCastToArray; - } - - protected void setCastToArray( ICastToArray castToArray ) { - fCastToArray = castToArray; - } - - public IStatus getStatus() { - return fStatus; - } - - public void setStatus( IStatus status ) { - fStatus = status; - } - - protected void doAction( ICastToArray castToArray ) throws DebugException { - String currentType = castToArray.getCurrentType().trim(); - CastToArrayDialog dialog = new CastToArrayDialog( CDebugUIPlugin.getActiveWorkbenchShell(), currentType, 0, 1 ); - if ( dialog.open() == Window.OK ) { - int firstIndex = dialog.getFirstIndex(); - int lastIndex = dialog.getLength(); - castToArray.castToArray( firstIndex, lastIndex ); - if ( getSelectionProvider() != null ) - getSelectionProvider().setSelection( new StructuredSelection( castToArray ) ); - } - } - - private ISelectionProvider getSelectionProvider() { - return (fTargetPart instanceof IDebugView) ? ((IDebugView)fTargetPart).getViewer() : null; - } -} Index: src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionHandler.java =================================================================== RCS file: src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionHandler.java diff -N src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionHandler.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionHandler.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,319 @@ +/******************************************************************************* + * Copyright (c) 2004, 2010 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + * Nokia - adapt to new command framework + *******************************************************************************/ +package org.eclipse.cdt.debug.internal.ui.actions; + +import org.eclipse.cdt.debug.core.model.ICastToArray; +import org.eclipse.cdt.debug.internal.ui.CDebugImages; +import org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import org.eclipse.cdt.utils.ui.controls.ControlFactory; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.ui.IDebugView; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +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.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.ISources; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.expressions.IEvaluationContext; + +/** + * The delegate of the "Display As Array" action. + */ +public class CastToArrayActionHandler extends AbstractHandler { + + protected class CastToArrayDialog extends Dialog { + + private String fType = ""; //$NON-NLS-1$ + + private int fFirstIndex = 0; + + private int fLength = 0; + + private Button fOkButton; + + private Label fErrorMessageLabel; + + private Text fFirstIndexText; + + private Text fLengthText; + + public CastToArrayDialog( Shell parentShell, String initialType, int initialStart, int initialLength ) { + super( parentShell ); + fType = (initialType == null) ? "" : initialType; //$NON-NLS-1$ + fFirstIndex = initialStart; + fLength = initialLength; + } + + protected String getType() { + return fType; + } + + protected int getFirstIndex() { + return fFirstIndex; + } + + protected int getLength() { + return fLength; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) + */ + protected void configureShell( Shell newShell ) { + super.configureShell( newShell ); + newShell.setText( ActionMessages.getString( "CastToArrayActionDelegate.0" ) ); //$NON-NLS-1$ + newShell.setImage( CDebugImages.get( CDebugImages.IMG_LCL_DISPLAY_AS_ARRAY ) ); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) + */ + protected void createButtonsForButtonBar( Composite parent ) { + // create OK and Cancel buttons by default + fOkButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true ); + createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false ); + //do this here because setting the text will set enablement on the ok button + /* + * fTypeText.setFocus(); if ( fType != null ) { fTypeText.setText( fType ); fTypeText.selectAll(); fFirstIndexText.setText( String.valueOf( + * fFirstIndex ) ); fLengthText.setText( String.valueOf( fLength ) ); } + */ + fFirstIndexText.setText( String.valueOf( fFirstIndex ) ); + fLengthText.setText( String.valueOf( fLength ) ); + } + + protected Label getErrorMessageLabel() { + return fErrorMessageLabel; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + protected Control createDialogArea( Composite parent ) { + Composite composite = (Composite)super.createDialogArea( parent ); + createDialogFields( composite ); + fErrorMessageLabel = new Label( composite, SWT.NONE ); + fErrorMessageLabel.setLayoutData( new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL ) ); + fErrorMessageLabel.setFont( parent.getFont() ); + return composite; + } + + private void createDialogFields( Composite parent ) { + Composite composite = ControlFactory.createComposite( parent, 4 ); + ((GridData)composite.getLayoutData()).widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ); + ((GridLayout)composite.getLayout()).makeColumnsEqualWidth = true; + Label label = ControlFactory.createLabel( composite, ActionMessages.getString( "CastToArrayActionDelegate.1" ) ); //$NON-NLS-1$ + ((GridData)label.getLayoutData()).horizontalSpan = 3; + fFirstIndexText = ControlFactory.createTextField( composite ); + fFirstIndexText.addModifyListener( new ModifyListener() { + + public void modifyText( ModifyEvent e ) { + validateInput(); + } + } ); + label = ControlFactory.createLabel( composite, ActionMessages.getString( "CastToArrayActionDelegate.2" ) ); //$NON-NLS-1$ + ((GridData)label.getLayoutData()).horizontalSpan = 3; + fLengthText = ControlFactory.createTextField( composite ); + fLengthText.addModifyListener( new ModifyListener() { + + public void modifyText( ModifyEvent e ) { + validateInput(); + } + } ); + } + + protected void validateInput() { + boolean enabled = true; + String message = ""; //$NON-NLS-1$ + String firstIndex = fFirstIndexText.getText().trim(); + if ( firstIndex.length() == 0 ) { + message = ActionMessages.getString( "CastToArrayActionDelegate.3" ); //$NON-NLS-1$ + enabled = false; + } + else { + try { + Integer.parseInt( firstIndex ); + } + catch( NumberFormatException e ) { + message = ActionMessages.getString( "CastToArrayActionDelegate.4" ); //$NON-NLS-1$ + enabled = false; + } + if ( enabled ) { + String lengthText = fLengthText.getText().trim(); + if ( lengthText.length() == 0 ) { + message = ActionMessages.getString( "CastToArrayActionDelegate.5" ); //$NON-NLS-1$ + enabled = false; + } + else { + int length = -1; + try { + length = Integer.parseInt( lengthText ); + } + catch( NumberFormatException e ) { + message = ActionMessages.getString( "CastToArrayActionDelegate.6" ); //$NON-NLS-1$ + enabled = false; + } + if ( enabled && length < 1 ) { + message = ActionMessages.getString( "CastToArrayActionDelegate.7" ); //$NON-NLS-1$ + enabled = false; + } + } + } + } + fOkButton.setEnabled( enabled ); + getErrorMessageLabel().setText( message ); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int) + */ + protected void buttonPressed( int buttonId ) { + if ( buttonId == IDialogConstants.OK_ID ) { + String firstIndex = fFirstIndexText.getText().trim(); + String lengthText = fLengthText.getText().trim(); + try { + fFirstIndex = Integer.parseInt( firstIndex ); + fLength = Integer.parseInt( lengthText ); + } + catch( NumberFormatException e ) { + fFirstIndex = 0; + fLength = 0; + } + } + else { + fType = null; + } + super.buttonPressed( buttonId ); + } + } + + private ICastToArray fCastToArray = null; + + private IStatus fStatus = null; + + private IWorkbenchPart fTargetPart = null; + + public CastToArrayActionHandler() { + super(); + } + + public Object execute(ExecutionEvent event) throws ExecutionException { + fTargetPart = HandlerUtil.getActivePartChecked(event); + if ( getCastToArray() == null ) + return null; + + BusyIndicator.showWhile( Display.getCurrent(), new Runnable() { + + public void run() { + try { + doAction( getCastToArray() ); + setStatus( null ); + } + catch( DebugException e ) { + setStatus( e.getStatus() ); + } + } + } ); + if ( getStatus() != null && !getStatus().isOK() ) { + IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow(); + if ( window != null ) { + CDebugUIPlugin.errorDialog( ActionMessages.getString( "CastToArrayActionDelegate.8" ), getStatus() ); //$NON-NLS-1$ + } + else { + CDebugUIPlugin.log( getStatus() ); + } + } + + return null; + } + + @Override + public void setEnabled(Object evaluationContext) { + ICastToArray castToArray = getCastToArray(evaluationContext); + setBaseEnabled( castToArray != null ); + setCastToArray(castToArray); + } + + private ICastToArray getCastToArray(Object evaluationContext) { + if (evaluationContext instanceof IEvaluationContext) { + Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); + if (s instanceof IStructuredSelection) { + IStructuredSelection ss = (IStructuredSelection)s; + if (!ss.isEmpty()) { + return (ICastToArray)DebugPlugin.getAdapter(ss.getFirstElement(), ICastToArray.class); + } + } + } + return null; + } + + protected ICastToArray getCastToArray() { + return fCastToArray; + } + + protected void setCastToArray( ICastToArray castToArray ) { + fCastToArray = castToArray; + } + + public IStatus getStatus() { + return fStatus; + } + + public void setStatus( IStatus status ) { + fStatus = status; + } + + protected void doAction( ICastToArray castToArray ) throws DebugException { + String currentType = castToArray.getCurrentType().trim(); + CastToArrayDialog dialog = new CastToArrayDialog( CDebugUIPlugin.getActiveWorkbenchShell(), currentType, 0, 1 ); + if ( dialog.open() == Window.OK ) { + int firstIndex = dialog.getFirstIndex(); + int lastIndex = dialog.getLength(); + castToArray.castToArray( firstIndex, lastIndex ); + if ( getSelectionProvider() != null ) + getSelectionProvider().setSelection( new StructuredSelection( castToArray ) ); + } + } + + private ISelectionProvider getSelectionProvider() { + return (fTargetPart instanceof IDebugView) ? ((IDebugView)fTargetPart).getViewer() : null; + } +} Index: src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionDelegate.java =================================================================== RCS file: src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionDelegate.java diff -N src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionDelegate.java --- src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionDelegate.java 23 Jun 2006 17:52:32 -0000 1.12 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,174 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.actions; - -import org.eclipse.cdt.debug.core.model.ICastToType; -import org.eclipse.cdt.debug.internal.ui.CDebugImages; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.ui.IDebugView; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.IInputValidator; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.actions.ActionDelegate; - -/** - * The delegate of the "Cast To Type" action. - */ -public class CastToTypeActionDelegate extends ActionDelegate implements IObjectActionDelegate { - - static protected class CastToTypeInputValidator implements IInputValidator { - - public CastToTypeInputValidator() { - } - - public String isValid( String newText ) { - if ( newText.trim().length() == 0 ) { - return ActionMessages.getString( "CastToTypeActionDelegate.0" ); //$NON-NLS-1$ - } - return null; - } - } - - protected class CastToTypeDialog extends InputDialog { - - public CastToTypeDialog( Shell parentShell, String initialValue ) { - super( parentShell, ActionMessages.getString( "CastToTypeActionDelegate.1" ), //$NON-NLS-1$ - ActionMessages.getString( "CastToTypeActionDelegate.2" ), //$NON-NLS-1$ - initialValue, - new CastToTypeInputValidator() ); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) - */ - protected void configureShell( Shell shell ) { - super.configureShell( shell ); - shell.setImage( CDebugImages.get( CDebugImages.IMG_LCL_CAST_TO_TYPE ) ); - } - } - - private ICastToType fCastToType = null; - - private IStatus fStatus = null; - - private IWorkbenchPart fTargetPart = null; - - public CastToTypeActionDelegate() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) - */ - public void setActivePart( IAction action, IWorkbenchPart targetPart ) { - fTargetPart = targetPart; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run( IAction action ) { - if ( getCastToType() == null ) - return; - BusyIndicator.showWhile( Display.getCurrent(), new Runnable() { - - public void run() { - try { - doAction( getCastToType() ); - setStatus( null ); - } - catch( DebugException e ) { - setStatus( e.getStatus() ); - } - } - } ); - if ( getStatus() != null && !getStatus().isOK() ) { - IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow(); - if ( window != null ) { - CDebugUIPlugin.errorDialog( ActionMessages.getString( "CastToTypeActionDelegate.3" ), getStatus() ); //$NON-NLS-1$ - } - else { - CDebugUIPlugin.log( getStatus() ); - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged( IAction action, ISelection selection ) { - if ( selection instanceof IStructuredSelection ) { - Object element = ((IStructuredSelection)selection).getFirstElement(); - if ( element instanceof ICastToType ) { - boolean enabled = ((ICastToType)element).canCast(); - action.setEnabled( enabled ); - if ( enabled ) { - setCastToType( (ICastToType)element ); - return; - } - } - } - action.setEnabled( false ); - setCastToType( null ); - } - - protected ICastToType getCastToType() { - return fCastToType; - } - - protected void setCastToType( ICastToType castToType ) { - fCastToType = castToType; - } - - public IStatus getStatus() { - return fStatus; - } - - public void setStatus( IStatus status ) { - fStatus = status; - } - - protected void doAction( ICastToType castToType ) throws DebugException { - String currentType = castToType.getCurrentType().trim(); - CastToTypeDialog dialog = new CastToTypeDialog( CDebugUIPlugin.getActiveWorkbenchShell(), currentType ); - if ( dialog.open() == Window.OK ) { - String newType = dialog.getValue().trim(); - castToType.cast( newType ); - if ( getSelectionProvider() != null ) - getSelectionProvider().setSelection( new StructuredSelection( castToType ) ); - } - } - - private ISelectionProvider getSelectionProvider() { - return (fTargetPart instanceof IDebugView) ? ((IDebugView)fTargetPart).getViewer() : null; - } -} Index: src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionHandler.java =================================================================== RCS file: src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionHandler.java diff -N src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionHandler.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionHandler.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,168 @@ +/******************************************************************************* + * Copyright (c) 2004, 2010 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + * Nokia - adapt to new command framework + *******************************************************************************/ +package org.eclipse.cdt.debug.internal.ui.actions; + +import org.eclipse.cdt.debug.core.model.ICastToType; +import org.eclipse.cdt.debug.internal.ui.CDebugImages; +import org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.ui.IDebugView; +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.ISources; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * The delegate of the "Cast To Type" action. + */ +public class CastToTypeActionHandler extends AbstractHandler { + + static protected class CastToTypeInputValidator implements IInputValidator { + + public CastToTypeInputValidator() { + } + + public String isValid( String newText ) { + if ( newText.trim().length() == 0 ) { + return ActionMessages.getString( "CastToTypeActionDelegate.0" ); //$NON-NLS-1$ + } + return null; + } + } + + protected class CastToTypeDialog extends InputDialog { + + public CastToTypeDialog( Shell parentShell, String initialValue ) { + super( parentShell, ActionMessages.getString( "CastToTypeActionDelegate.1" ), //$NON-NLS-1$ + ActionMessages.getString( "CastToTypeActionDelegate.2" ), //$NON-NLS-1$ + initialValue, + new CastToTypeInputValidator() ); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) + */ + protected void configureShell( Shell shell ) { + super.configureShell( shell ); + shell.setImage( CDebugImages.get( CDebugImages.IMG_LCL_CAST_TO_TYPE ) ); + } + } + + private ICastToType fCastToType = null; + + private IStatus fStatus = null; + + private IWorkbenchPart fTargetPart; + + public CastToTypeActionHandler() { + super(); + } + + public Object execute(ExecutionEvent event) throws ExecutionException { + fTargetPart = HandlerUtil.getActivePartChecked(event); + + if ( getCastToType() == null ) + return null; + + BusyIndicator.showWhile( Display.getCurrent(), new Runnable() { + + public void run() { + try { + doAction( getCastToType() ); + setStatus( null ); + } + catch( DebugException e ) { + setStatus( e.getStatus() ); + } + } + } ); + if ( getStatus() != null && !getStatus().isOK() ) { + IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow(); + if ( window != null ) { + CDebugUIPlugin.errorDialog( ActionMessages.getString( "CastToTypeActionDelegate.3" ), getStatus() ); //$NON-NLS-1$ + } + else { + CDebugUIPlugin.log( getStatus() ); + } + } + + return null; + } + + @Override + public void setEnabled(Object evaluationContext) { + ICastToType castToType = getCastToType(evaluationContext); + setBaseEnabled( castToType != null ); + setCastToType(castToType); + } + + private ICastToType getCastToType(Object evaluationContext) { + if (evaluationContext instanceof IEvaluationContext) { + Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); + if (s instanceof IStructuredSelection) { + IStructuredSelection ss = (IStructuredSelection)s; + if (!ss.isEmpty()) { + return (ICastToType)DebugPlugin.getAdapter(ss.getFirstElement(), ICastToType.class); + } + } + } + return null; + } + + protected ICastToType getCastToType() { + return fCastToType; + } + + protected void setCastToType( ICastToType castToType ) { + fCastToType = castToType; + } + + public IStatus getStatus() { + return fStatus; + } + + public void setStatus( IStatus status ) { + fStatus = status; + } + + protected void doAction( ICastToType castToType ) throws DebugException { + String currentType = castToType.getCurrentType().trim(); + CastToTypeDialog dialog = new CastToTypeDialog( CDebugUIPlugin.getActiveWorkbenchShell(), currentType ); + if ( dialog.open() == Window.OK ) { + String newType = dialog.getValue().trim(); + castToType.cast( newType ); + if ( getSelectionProvider() != null ) + getSelectionProvider().setSelection( new StructuredSelection( castToType ) ); + } + } + + private ISelectionProvider getSelectionProvider() { + return (fTargetPart instanceof IDebugView) ? ((IDebugView)fTargetPart).getViewer() : null; + } +} Index: src/org/eclipse/cdt/debug/internal/ui/actions/RestoreDefaultTypeActionDelegate.java =================================================================== RCS file: src/org/eclipse/cdt/debug/internal/ui/actions/RestoreDefaultTypeActionDelegate.java diff -N src/org/eclipse/cdt/debug/internal/ui/actions/RestoreDefaultTypeActionDelegate.java --- src/org/eclipse/cdt/debug/internal/ui/actions/RestoreDefaultTypeActionDelegate.java 23 Jun 2006 17:52:33 -0000 1.8 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.actions; - -import org.eclipse.cdt.debug.core.model.ICastToType; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.debug.core.DebugException; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.actions.ActionDelegate; - -/** - * The delegate of the "Restore Default Type" action. - */ -public class RestoreDefaultTypeActionDelegate extends ActionDelegate implements IObjectActionDelegate { - - private ICastToType fCastToType = null; - - private IStatus fStatus = null; - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) - */ - public void setActivePart( IAction action, IWorkbenchPart targetPart ) { - } - - protected ICastToType getCastToType() { - return fCastToType; - } - - protected void setCastToType( ICastToType castToType ) { - fCastToType = castToType; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run( IAction action ) { - if ( getCastToType() == null ) - return; - BusyIndicator.showWhile( Display.getCurrent(), new Runnable() { - - public void run() { - try { - doAction( getCastToType() ); - setStatus( null ); - } - catch( DebugException e ) { - setStatus( e.getStatus() ); - } - } - } ); - if ( getStatus() != null && !getStatus().isOK() ) { - IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow(); - if ( window != null ) { - CDebugUIPlugin.errorDialog( ActionMessages.getString( "RestoreDefaultTypeActionDelegate.0" ), getStatus() ); //$NON-NLS-1$ - } - else { - CDebugUIPlugin.log( getStatus() ); - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged( IAction action, ISelection selection ) { - if ( selection instanceof IStructuredSelection ) { - Object element = ((IStructuredSelection)selection).getFirstElement(); - if ( element instanceof ICastToType ) { - boolean enabled = ((ICastToType)element).isCasted(); - action.setEnabled( enabled ); - if ( enabled ) { - setCastToType( (ICastToType)element ); - return; - } - } - } - action.setEnabled( false ); - setCastToType( null ); - } - - public IStatus getStatus() { - return fStatus; - } - - public void setStatus( IStatus status ) { - fStatus = status; - } - - protected void doAction( ICastToType castToType ) throws DebugException { - castToType.restoreOriginal(); - } -} Index: src/org/eclipse/cdt/debug/internal/ui/actions/RestoreDefaultTypeActionHandler.java =================================================================== RCS file: src/org/eclipse/cdt/debug/internal/ui/actions/RestoreDefaultTypeActionHandler.java diff -N src/org/eclipse/cdt/debug/internal/ui/actions/RestoreDefaultTypeActionHandler.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/cdt/debug/internal/ui/actions/RestoreDefaultTypeActionHandler.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,106 @@ +/******************************************************************************* + * Copyright (c) 2004, 2010 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + * Nokia - port to command framework + *******************************************************************************/ +package org.eclipse.cdt.debug.internal.ui.actions; + +import org.eclipse.cdt.debug.core.model.ICastToType; +import org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.ISources; +import org.eclipse.ui.IWorkbenchWindow; + +/** + * The delegate of the "Restore Default Type" action. + */ +public class RestoreDefaultTypeActionHandler extends AbstractHandler { + + private ICastToType fCastToType = null; + + private IStatus fStatus = null; + + protected ICastToType getCastToType() { + return fCastToType; + } + + protected void setCastToType( ICastToType castToType ) { + fCastToType = castToType; + } + + public Object execute(ExecutionEvent event) throws ExecutionException { + if ( getCastToType() == null ) + return null; + + BusyIndicator.showWhile( Display.getCurrent(), new Runnable() { + + public void run() { + try { + doAction( getCastToType() ); + setStatus( null ); + } + catch( DebugException e ) { + setStatus( e.getStatus() ); + } + } + } ); + if ( getStatus() != null && !getStatus().isOK() ) { + IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow(); + if ( window != null ) { + CDebugUIPlugin.errorDialog( ActionMessages.getString( "RestoreDefaultTypeActionDelegate.0" ), getStatus() ); //$NON-NLS-1$ + } + else { + CDebugUIPlugin.log( getStatus() ); + } + } + + return null; + } + + @Override + public void setEnabled(Object evaluationContext) { + ICastToType castToType = getCastToType(evaluationContext); + setBaseEnabled( castToType != null && castToType.isCasted() ); + setCastToType(castToType); + } + + private ICastToType getCastToType(Object evaluationContext) { + if (evaluationContext instanceof IEvaluationContext) { + Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); + if (s instanceof IStructuredSelection) { + IStructuredSelection ss = (IStructuredSelection)s; + if (!ss.isEmpty()) { + return (ICastToType)DebugPlugin.getAdapter(ss.getFirstElement(), ICastToType.class); + } + } + } + return null; + } + + public IStatus getStatus() { + return fStatus; + } + + public void setStatus( IStatus status ) { + fStatus = status; + } + + protected void doAction( ICastToType castToType ) throws DebugException { + castToType.restoreOriginal(); + } +} #P org.eclipse.cdt.dsf Index: src/org/eclipse/cdt/dsf/debug/service/IExpressions.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IExpressions.java,v retrieving revision 1.5 diff -u -r1.5 IExpressions.java --- src/org/eclipse/cdt/dsf/debug/service/IExpressions.java 11 Jan 2010 22:08:24 -0000 1.5 +++ src/org/eclipse/cdt/dsf/debug/service/IExpressions.java 22 Mar 2010 18:19:30 -0000 @@ -43,7 +43,6 @@ String getExpression(); } - /** * The address and size of an expression. */ @@ -143,6 +142,9 @@ * "int *", "mytypedef", "(int *)[]", "enum Bar". If the debugger backend cannot supply * this information, this method returns "" (the angle brackets are there just in * case there is a type named "UNKNOWN" in the application). + *

+ * If you implement {@link IExpressions2}, this should return the casted type name, + * if this expression was generated via {@link IExpressions2#createCastedExpression(IDMContext, String, IExpressions2.ICastedExpressionDMContext)} */ String getTypeName(); @@ -175,6 +177,7 @@ */ public interface IExpressionChangedDMEvent extends IDMEvent {} + /** * Retrieves the expression DM data object for the given expression context(dmc). * Index: src/org/eclipse/cdt/dsf/debug/service/IExpressions2.java =================================================================== RCS file: src/org/eclipse/cdt/dsf/debug/service/IExpressions2.java diff -N src/org/eclipse/cdt/dsf/debug/service/IExpressions2.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/cdt/dsf/debug/service/IExpressions2.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,179 @@ +/******************************************************************************* + * Copyright (c) 2010 Nokia and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nokia - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.dsf.debug.service; + +import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; + +/** + * This interface extends the expressions service with support for casting to type or + * array. + * @since 2.1 + */ +public interface IExpressions2 extends IExpressions { + + /** + * This class specifies how an expression should be + * typecast to another type and/or displayed as an array. + */ + public static class CastInfo { + private final String typeString; + private final int arrayCount; + private final int arrayStart; + + /** + * Create an instance of casting information + * @param typeString if not null, the C/C++ type to which to cast the expression (e.g. "char**") + * @param arrayStart if arrayCount > 0, the start index for viewing contents of the expression as an array + * @param arrayCount if > 0, indicates to show [arrayStart ... arrayStart+arrayCount) as child expressions + */ + public CastInfo(String typeString, int arrayStart, int arrayCount) { + this.typeString = typeString; + this.arrayStart = arrayStart; + this.arrayCount = arrayCount; + } + + /** + * Create an instance of casting information for casting to type (only) + * @param typeString must be non-null; the C/C++ type to which to cast the expression (e.g. "char**") + */ + public CastInfo(String typeString) { + if (typeString == null) + throw new IllegalArgumentException(); + this.typeString = typeString; + this.arrayStart = this.arrayCount = 0; + } + + + /** + * Create an instance of casting information for showing as an array (only) + * @param arrayStart the start index for viewing contents of the expression as an array + * @param arrayCount must be > 0; indicates to show [arrayStart ... arrayStart+arrayCount) as child expressions + */ + public CastInfo(int arrayStart, int arrayCount) { + if (arrayCount <= 0) + throw new IllegalArgumentException(); + this.typeString = null; + this.arrayStart = arrayStart; + this.arrayCount = arrayCount; + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + arrayCount; + result = prime * result + arrayStart; + result = prime * result + + ((typeString == null) ? 0 : typeString.hashCode()); + return result; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CastInfo other = (CastInfo) obj; + if (arrayCount != other.arrayCount) + return false; + if (arrayStart != other.arrayStart) + return false; + if (typeString == null) { + if (other.typeString != null) + return false; + } else if (!typeString.equals(other.typeString)) + return false; + return true; + } + + /** + * Get the user-friendly type name. This may be a post-processed string + * but should be semantically equivalent to the type used to create the context. + * @return type string, or null if no type casting performed + */ + public String getTypeString() { + return typeString; + } + + /** + * Get the start index for viewing children as an array. (Only effective if #getCount() > 0) + * @return the index of the first element of the array. 0 means that + * the original element is the first member of the array. This may be negative, too. + */ + public int getArrayStartIndex(){ + return arrayStart; + } + + /** + * Get the number of elements to show when viewing children as an array. + * @return the array size, or <= 0 if not viewing as an array + */ + public int getArrayCount(){ + return arrayCount; + } + } + + /** + * This context identifies a casted expression. Its parent is the original + * {@link IExpressionDMContext}. + */ + public interface ICastedExpressionDMContext extends IExpressionDMContext { + CastInfo getCastInfo(); + + } + + /** + * Create a variant of the expression which is casted with the given casting info. + *

+ * If {@link ICastInfo#getTypeString()} is not null, such an expression should + * report the casted type via {@link IExpressionDMData} and generate subexpressions accordingly. + *

+ * Note that typically, a cast of a primitive type (int, double, etc.) to another + * primitive type is interpreted as "*(other_type*)&(expression)", not merely + * as casting the rvalue of "expression" to another type (which usually only + * truncates or extends the value without much benefit). + *

+ * If {@link ICastInfo#getArrayCount()} is greater than 0, the expression should + * yield that number of elements as subexpressions, as array elements, starting with index + * {@link ICastInfo#getArrayStartIndex()}. (This does not affect the address of the + * expression itself, only which children are returned.) + *

+ * The expected semantics of an array cast ranging from J to K are to take a + * pointer-valued expression whose base type is size N, evaluate its value + * to A, and yield array elements of the pointer base type at locations + * A + N*J, A + N*(J+1), ..., + * A + N*(J+K-1). But the address of the expression is not modified + * when an array cast is applied. + *

An implementation may provide its own semantics for viewing other data as arrays, if so desired. + * @param context an existing expression + * @param castInfo the casting information + * @param rm request monitor returning a casted expression data model context object that must be passed to the appropriate + * data retrieval routine to obtain the value of the expression. The object must + * report the casted type (if any) via {@link #getExpressionData(IExpressionDMContext, DataRequestMonitor)} + * and report alternate children according to the array casting context via + * {@link #getSubExpressionCount(IExpressionDMContext, DataRequestMonitor)} + * and {@link #getSubExpressions}. + */ + ICastedExpressionDMContext createCastedExpression(IExpressionDMContext context, + CastInfo castInfo); + + +} #P org.eclipse.cdt.dsf.ui Index: src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java =================================================================== RCS file: src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java diff -N src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,233 @@ +/******************************************************************************* + * Copyright (c) 2010 Nokia and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nokia - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.cdt.debug.core.model.ICastToArray; +import org.eclipse.cdt.debug.core.model.ICastToType; +import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; +import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent; +import org.eclipse.cdt.dsf.datamodel.DMContexts; +import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionChangedDMEvent; +import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext; +import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMData; +import org.eclipse.cdt.dsf.debug.service.IExpressions2; +import org.eclipse.cdt.dsf.debug.service.IExpressions2.CastInfo; +import org.eclipse.cdt.dsf.debug.service.IExpressions2.ICastedExpressionDMContext; +import org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.MessagesForVariablesVM; +import org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.SyncVariableDataAccess; +import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin; +import org.eclipse.cdt.dsf.service.DsfServicesTracker; +import org.eclipse.cdt.dsf.service.DsfSession; +import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.PlatformObject; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugException; + +/** + * This provides {@link ICastToType} and {@link ICastToArray} support on + * expression nodes. + */ +public class DsfCastToTypeSupport { + private final DsfServicesTracker serviceTracker; + private final AbstractDMVMProvider dmvmProvider; + private final SyncVariableDataAccess fSyncVariableDataAccess; + + /** expression memento to casting context (TODO: persist these; bug 228301)*/ + private Map fCastedExpressionStorage = new HashMap(); + + + public class CastImplementation extends PlatformObject implements ICastToArray { + private final IExpressionDMContext exprDMC; + private String memento; + + public CastImplementation(IExpressionDMContext exprDMC) { + this.exprDMC = exprDMC; + this.memento = createCastedExpressionMemento(exprDMC); + } + + private boolean isValid() { + return (serviceTracker.getService(IExpressions2.class) != null && exprDMC != null); + } + + private void throwIfNotValid() throws DebugException { + if (!isValid()) + throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, + MessagesForVariablesVM.VariableVMNode_CannotCastVariable, null)); + } + + /* + * (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.ICastToType#canCast() + */ + public boolean canCast() { + return isValid(); + } + + /* + * (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.ICastToType#getCurrentType() + */ + public String getCurrentType() { + // get expected casted type first, if possible (if there's an error in the type, + // the expression might not evaluate successfully) + CastInfo castDMC = fCastedExpressionStorage.get(memento); + if (castDMC != null && castDMC.getTypeString() != null) + return castDMC.getTypeString(); + + // else, get the actual type + IExpressionDMData data = fSyncVariableDataAccess.readVariable(exprDMC); + if (data != null) + return data.getTypeName(); + + return ""; //$NON-NLS-1$ + } + + /* + * (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.ICastToType#cast(java.lang.String) + */ + public void cast(String type) throws DebugException { + throwIfNotValid(); + + CastInfo currentContext = fCastedExpressionStorage.get(memento); + + updateCastInformation(type, + currentContext != null ? currentContext.getArrayStartIndex() : 0, + currentContext != null ? currentContext.getArrayCount() : 0); + + } + + /* + * (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.ICastToType#restoreOriginal() + */ + public void restoreOriginal() throws DebugException { + throwIfNotValid(); + fCastedExpressionStorage.remove(memento); + fireExpressionChangedEvent(exprDMC); + } + + /* + * (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.ICastToType#isCasted() + */ + public boolean isCasted() { + if (isValid()) + return fCastedExpressionStorage.containsKey(memento); + else + return false; + } + + /* + * (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.ICastToArray#canCastToArray() + */ + public boolean canCastToArray() { + return isValid(); + } + + /* + * (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.ICastToArray#castToArray(int, int) + */ + public void castToArray(int startIndex, int length) + throws DebugException { + throwIfNotValid(); + + CastInfo currentContext = fCastedExpressionStorage.get(memento); + + updateCastInformation(currentContext != null ? currentContext.getTypeString() : null, + startIndex, + length); + } + + private void updateCastInformation( + String type, int arrayStartIndex, + int arrayCount) { + final CastInfo info = new CastInfo(type, arrayStartIndex, arrayCount); + fCastedExpressionStorage.put(memento, info); + fireExpressionChangedEvent(exprDMC); + } + + private class ExpressionChangedEvent extends AbstractDMEvent implements IExpressionChangedDMEvent { + public ExpressionChangedEvent(IExpressionDMContext context) { + super(context); + } + } + + private void fireExpressionChangedEvent(IExpressionDMContext exprDMC) { + ExpressionChangedEvent event = new ExpressionChangedEvent(exprDMC); + dmvmProvider.handleEvent(event); + dmvmProvider.refresh(); // this seems to be required, esp. for Expressions View + } + } + + public DsfCastToTypeSupport(DsfSession session, AbstractDMVMProvider dmvmProvider, SyncVariableDataAccess fSyncVariableDataAccess) { + this.dmvmProvider = dmvmProvider; + this.fSyncVariableDataAccess = fSyncVariableDataAccess; + this.serviceTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), session.getId()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.ICastSupportTarget#createCastedExpressionMemento(org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext, java.lang.String) + */ + public String createCastedExpressionMemento(IExpressionDMContext exprDMC) { + // go to the original variable first + if (exprDMC instanceof ICastedExpressionDMContext) { + IExpressionDMContext origExpr = DMContexts.getAncestorOfType(exprDMC.getParents()[0], IExpressionDMContext.class); + if (origExpr == null) { + assert false; + } else { + exprDMC = origExpr; + } + } + + // TODO: the memento doesn't really strictly define the expression's context; + // we should fetch module name, function name, etc. to be more useful (but do that asynchronously) + String expression = exprDMC.getExpression(); + String memento = exprDMC.getSessionId() + "." + expression; //$NON-NLS-1$ + return memento; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.ICastSupportTarget#replaceWihCastedExpression(org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext) + */ + public IExpressionDMContext replaceWithCastedExpression( + IExpressionDMContext exprDMC) { + IExpressions2 expression2Service = serviceTracker.getService(IExpressions2.class); + if (expression2Service == null) + return exprDMC; + + if (!fCastedExpressionStorage.isEmpty()) { + String memento = createCastedExpressionMemento(exprDMC); + CastInfo castInfo = fCastedExpressionStorage.get(memento); + if (castInfo != null) { + return expression2Service.createCastedExpression(exprDMC, castInfo); + } + } + return exprDMC; + } + + /** + * Get the ICastToArray (and ICastToType) implementation for the expression. + * This does not necessarily return a unique object for each call. + * @param exprDMC + * @return {@link ICastToArray} + */ + public ICastToArray getCastImpl(IExpressionDMContext exprDMC) { + return new CastImplementation(exprDMC); + } +} Index: src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java,v retrieving revision 1.3 diff -u -r1.3 ExpressionVMProvider.java --- src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java 17 Dec 2009 09:43:46 -0000 1.3 +++ src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProvider.java 22 Mar 2010 18:19:30 -0000 @@ -16,8 +16,10 @@ import org.eclipse.cdt.dsf.concurrent.DsfRunnable; import org.eclipse.cdt.dsf.concurrent.RequestMonitor; +import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.DsfCastToTypeSupport; import org.eclipse.cdt.dsf.debug.service.ICachingService; import org.eclipse.cdt.dsf.debug.service.IExpressions; +import org.eclipse.cdt.dsf.debug.service.IExpressions2; import org.eclipse.cdt.dsf.debug.service.IRegisters; import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent; @@ -239,9 +241,16 @@ * view comes in as a fully qualified expression so we go directly to the SubExpression layout * node. */ - IExpressionVMNode variableNode = new VariableVMNode(this, getSession(), syncvarDataAccess); + VariableVMNode variableNode = new VariableVMNode(this, getSession(), syncvarDataAccess); addChildNodes(variableNode, new IExpressionVMNode[] {variableNode}); + /* Wire up the casting support if the IExpressions2 service is available. */ + DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), getSession().getId()); + IExpressions2 expressions2 = tracker.getService(IExpressions2.class); + if (expressions2 != null) { + variableNode.setCastToTypeSupport(new DsfCastToTypeSupport(getSession(), this, syncvarDataAccess)); + } + /* * Tell the expression node which sub-nodes it will directly support. It is very important * that the variables node be the last in this chain. The model assumes that there is some Index: src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/MessagesForVariablesVM.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/MessagesForVariablesVM.java,v retrieving revision 1.6 diff -u -r1.6 MessagesForVariablesVM.java --- src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/MessagesForVariablesVM.java 11 Jan 2010 22:08:22 -0000 1.6 +++ src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/MessagesForVariablesVM.java 22 Mar 2010 18:19:30 -0000 @@ -24,7 +24,9 @@ public static String VariableColumnPresentation_value; public static String VariableColumnPresentation_location; - public static String VariableVMNode_Location_column__Error__text_format; + public static String VariableVMNode_CannotCastVariable; + + public static String VariableVMNode_Location_column__Error__text_format; public static String VariableVMNode_Location_column__text_format; public static String VariableVMNode_Description_column__text_format; public static String VariableVMNode_Expression_column__text_format; Index: src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java,v retrieving revision 1.15 diff -u -r1.15 VariableVMNode.java --- src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java 9 Mar 2010 23:11:09 -0000 1.15 +++ src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java 22 Mar 2010 18:19:31 -0000 @@ -17,6 +17,8 @@ import java.util.Map; import java.util.concurrent.RejectedExecutionException; +import org.eclipse.cdt.debug.core.model.ICastToArray; +import org.eclipse.cdt.debug.core.model.ICastToType; import org.eclipse.cdt.debug.internal.ui.CDebugImages; import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor; import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor; @@ -28,7 +30,9 @@ import org.eclipse.cdt.dsf.concurrent.RequestMonitor; import org.eclipse.cdt.dsf.datamodel.DMContexts; import org.eclipse.cdt.dsf.datamodel.IDMContext; +import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.DsfCastToTypeSupport; import org.eclipse.cdt.dsf.debug.service.IExpressions; +import org.eclipse.cdt.dsf.debug.service.IExpressions2; import org.eclipse.cdt.dsf.debug.service.IFormattedValues; import org.eclipse.cdt.dsf.debug.service.IStack; import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionChangedDMEvent; @@ -149,13 +153,17 @@ fExpression = expression; } - @SuppressWarnings("rawtypes") + @SuppressWarnings({"unchecked", "rawtypes"}) @Override public Object getAdapter(Class adapter) { if (fExpression != null && adapter.isAssignableFrom(fExpression.getClass())) { return fExpression; } else if (adapter.isAssignableFrom(IWatchExpressionFactoryAdapter2.class)) { return fVariableExpressionFactory; + } else if (fCastToTypeSupport != null && getDMContext() instanceof IExpressionDMContext + && (adapter.isAssignableFrom(ICastToType.class) + || adapter.isAssignableFrom(ICastToArray.class))) { + return fCastToTypeSupport.getCastImpl((IExpressionDMContext) getDMContext()); } else { return super.getAdapter(adapter); } @@ -198,6 +206,8 @@ final protected VariableExpressionFactory fVariableExpressionFactory = new VariableExpressionFactory(); + protected DsfCastToTypeSupport fCastToTypeSupport; + public VariableVMNode(AbstractDMVMProvider provider, DsfSession session, SyncVariableDataAccess syncVariableDataAccess) { @@ -207,6 +217,15 @@ } /** + * Set the cast support target. This is only meaningful if the {@link IExpressions2} + * service is available. + * @param castToTypeSupport + */ + public void setCastToTypeSupport(DsfCastToTypeSupport castToTypeSupport) { + this.fCastToTypeSupport = castToTypeSupport; + } + + /** * Creates the label provider delegate. This VM node will delegate label * updates to this provider which can be created by sub-classes. * @@ -821,9 +840,10 @@ public void run() { final IExpressions expressionService = getServicesTracker().getService(IExpressions.class); if (expressionService != null) { - IExpressionDMContext expressionDMC = expressionService.createExpression( - createCompositeDMVMContext(update), - update.getExpression().getExpressionText()); + IExpressionDMContext expressionDMC = createExpression(expressionService, + createCompositeDMVMContext(update), + update.getExpression().getExpressionText()); + VariableExpressionVMC variableVmc = (VariableExpressionVMC)createVMContext(expressionDMC); variableVmc.setExpression(update.getExpression()); @@ -965,10 +985,20 @@ handleFailedUpdate(update); return; } - if (update.getOffset() < 0) { - fillUpdateWithVMCs(update, getData()); + + IExpressionDMContext[] data = getData(); + + // If any of these expressions use casts, replace them. + if (fCastToTypeSupport != null) { + for (int i = 0; i < data.length; i++) { + data[i] = fCastToTypeSupport.replaceWithCastedExpression(data[i]); + } + } + + if (update.getOffset() < 0) { + fillUpdateWithVMCs(update, data); } else { - fillUpdateWithVMCs(update, getData(), update.getOffset()); + fillUpdateWithVMCs(update, data, update.getOffset()); } update.done(); } @@ -1058,7 +1088,7 @@ int i = 0; for (IVariableDMData localDMData : localsDMData) { - expressionDMCs[i++] = expressionService.createExpression(frameDmc, localDMData.getName()); + expressionDMCs[i++] = createExpression(expressionService, frameDmc, localDMData.getName()); } // Lastly, we fill the update from the array of view model context objects @@ -1099,7 +1129,19 @@ stackFrameService.getLocals(frameDmc, rm); } - public int getDeltaFlags(Object e) { + + private IExpressionDMContext createExpression( + IExpressions expressionService, + final IDMContext dmc, final String expression) { + IExpressionDMContext exprDMC = expressionService.createExpression(dmc, expression); + + if (fCastToTypeSupport != null) { + exprDMC = fCastToTypeSupport.replaceWithCastedExpression(exprDMC); + } + return exprDMC; + } + + public int getDeltaFlags(Object e) { if ( e instanceof ISuspendedDMEvent || e instanceof IMemoryChangedEvent || e instanceof IExpressionChangedDMEvent || Index: src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMProvider.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMProvider.java,v retrieving revision 1.5 diff -u -r1.5 VariableVMProvider.java --- src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMProvider.java 19 Feb 2010 23:47:03 -0000 1.5 +++ src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMProvider.java 22 Mar 2010 18:19:31 -0000 @@ -13,8 +13,10 @@ import java.util.concurrent.RejectedExecutionException; import org.eclipse.cdt.dsf.concurrent.DsfRunnable; +import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.DsfCastToTypeSupport; import org.eclipse.cdt.dsf.debug.service.ICachingService; import org.eclipse.cdt.dsf.debug.service.IExpressions; +import org.eclipse.cdt.dsf.debug.service.IExpressions2; import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent; import org.eclipse.cdt.dsf.debug.ui.DsfDebugUITools; import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants; @@ -95,8 +97,15 @@ setRootNode(rootNode); // Create the next level which represents members of structs/unions/enums and elements of arrays. - IVMNode subExpressioNode = new VariableVMNode(this, getSession(), varAccess); + VariableVMNode subExpressioNode = new VariableVMNode(this, getSession(), varAccess); addChildNodes(rootNode, new IVMNode[] { subExpressioNode }); + + // Wire up the casting support if the IExpressions2 service is available. + DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), getSession().getId()); + IExpressions2 expressions2 = tracker.getService(IExpressions2.class); + if (expressions2 != null) { + subExpressioNode.setCastToTypeSupport(new DsfCastToTypeSupport(getSession(), this, varAccess)); + } // Configure the sub-expression node to be a child of itself. This way the content // provider will recursively drill-down the variable hierarchy. Index: src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/messages.properties =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/messages.properties,v retrieving revision 1.5 diff -u -r1.5 messages.properties --- src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/messages.properties 11 Jan 2010 22:08:22 -0000 1.5 +++ src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/messages.properties 22 Mar 2010 18:19:31 -0000 @@ -16,6 +16,7 @@ VariableColumnPresentation_value=Value VariableColumnPresentation_location=Location +VariableVMNode_CannotCastVariable=Cannot cast this variable VariableVMNode_Location_column__Error__text_format= VariableVMNode_Location_column__text_format={0} VariableVMNode_Description_column__text_format=