diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index dc991a17291..87971b70425 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,8 @@ +2003-08-13 Mikhail Khodjaiants + * ICDIVariableManager.java: removed the 'type' parameter from the 'getVariableObjectAsArray' method + * ICastToArray.java: removed the 'type' parameter from the 'castToArray' method + * CVariable.java: changed the implementation of the 'ICastToArray' interface + 2003-08-13 Mikhail Khodjaiants * ICDIVariable.java: removed the 'isEditable' method * ICDIVariableObject.java: added the 'isEditable', 'getQualifiedName' and 'sizeof' methods diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/ICDIVariableManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/ICDIVariableManager.java index cd74aba96b5..5af41f7c773 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/ICDIVariableManager.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/ICDIVariableManager.java @@ -48,7 +48,7 @@ public interface ICDIVariableManager extends ICDIManager { * @return ICDIVariableObject * @throws CDIException */ - ICDIVariableObject getVariableObjectAsArray(ICDIVariableObject var, String type, int start, int length) throws CDIException; + ICDIVariableObject getVariableObjectAsArray(ICDIVariableObject var, int start, int length) throws CDIException; /** * Consider the variable object as type. diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICastToArray.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICastToArray.java index cbfca37f368..554f416a99c 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICastToArray.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICastToArray.java @@ -17,5 +17,5 @@ public interface ICastToArray extends ICastToType { boolean supportsCastToArray(); - void castToArray( String type, int startIndex, int length ) throws DebugException; + void castToArray( int startIndex, int length ) throws DebugException; } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java index 16b75b754b6..a392d81c1ea 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java @@ -818,11 +818,11 @@ public abstract class CVariable extends CDebugElement return null; } - private InternalVariable createShadow( ICDIStackFrame cdiFrame, String type, int start, int length ) throws DebugException + private InternalVariable createShadow( ICDIStackFrame cdiFrame, int start, int length ) throws DebugException { try { - return new InternalVariable( getCDISession().getVariableManager().getVariableObjectAsArray( getOriginalCDIVariable(), type, start, length ) ); + return new InternalVariable( getCDISession().getVariableManager().getVariableObjectAsArray( getCDIVariable(), start, length ) ); } catch( CDIException e ) { @@ -840,13 +840,13 @@ public abstract class CVariable extends CDebugElement } /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.model.ICastToArray#castToArray(java.lang.String, int, int) + * @see org.eclipse.cdt.debug.core.model.ICastToArray#castToArray(int, int) */ - public void castToArray( String type, int startIndex, int length ) throws DebugException + public void castToArray( int startIndex, int length ) throws DebugException { try { - InternalVariable newVar = createShadow( getOriginalCDIVariable().getStackFrame(), type, startIndex, length ); + InternalVariable newVar = createShadow( getOriginalCDIVariable().getStackFrame(), startIndex, length ); if ( getShadow() != null ) getShadow().dispose(); setShadow( newVar ); diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog index 1022b5a92b3..0f74b2013ca 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog @@ -1,3 +1,8 @@ +2003-08-11 Mikhail Khodjaiants + * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java: + * src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java: + Removed the 'type' parameter from the 'getVariableObjectAsArray' method. + 2003-08-11 Mikhail Khodjaiants * src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java: The 'type' argument of the 'getVariableObjectAsArray' method shouldn't be null. diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java index 39cc6e66f68..2c103b522f2 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java @@ -292,17 +292,15 @@ public class VariableManager extends SessionObject implements ICDIVariableManage } /** - * @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObjectAsArray(ICDIVariableObject, String, int, int) + * @see org.eclipse.cdt.debug.core.cdi.ICDIVariableManager#getVariableObjectAsArray(ICDIVariableObject, int, int) */ - public ICDIVariableObject getVariableObjectAsArray(ICDIVariableObject object, String type, int start, int length) + public ICDIVariableObject getVariableObjectAsArray(ICDIVariableObject object, int start, int length) throws CDIException { VariableObject obj = null; if (object instanceof VariableObject) { obj = (VariableObject) object; } if (obj != null) { - // Check if the type is valid. - checkType(type); VariableObject vo = new VariableObject( obj.getTarget(), diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java index 5d4482bb617..e6382e1e084 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java @@ -56,7 +56,7 @@ public class ArrayValue extends DerivedValue implements ICDIArrayValue { ICDITarget target = getTarget(); Session session = (Session) (target.getSession()); ICDIVariableManager mgr = session.getVariableManager(); - ICDIVariableObject vo = mgr.getVariableObjectAsArray(variable, variable.getTypeName(), index, length); + ICDIVariableObject vo = mgr.getVariableObjectAsArray(variable, index, length); return mgr.createVariable(vo).getValue().getVariables(); } } diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index 333ff00e229..4ebf0e5cc2c 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,8 @@ +2003-08-13 Mikhail Khodjaiants + * CDebugImages.java: new images for the 'Cast to type" and 'Display As Array' dialogs + * CastToTypeActionDelegate.java: new image + * CastToArrayActionDelegate.java: removed the 'type' field, added new image + 2003-08-13 Mikhail Khodjaiants Display the proper image for reference types. * CDTDebugModelPresentation.java 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 9ad60f65615..bd50eb985e4 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 @@ -95,6 +95,8 @@ public class CDebugImages public static final String IMG_LCL_MEMORY_CLEAR = NAME_PREFIX + "memory_clear.gif"; //$NON-NLS-1$ public static final String IMG_LCL_SHOW_ASCII = NAME_PREFIX + "show_ascii.gif"; //$NON-NLS-1$ public static final String IMG_LCL_LOAD_ALL_SYMBOLS = NAME_PREFIX + "load_all_symbols_co.gif"; //$NON-NLS-1$ + public static final String IMG_LCL_CAST_TO_TYPE = NAME_PREFIX + "casttotype_co.gif"; //$NON-NLS-1$ + public static final String IMG_LCL_DISPLAY_AS_ARRAY = NAME_PREFIX + "showasarray_co.gif"; //$NON-NLS-1$ public static final String IMG_TOOLS_ADD_DIR_SOURCE_LOCATION = NAME_PREFIX + "adddirsource_wiz.gif"; //$NON-NLS-1$ public static final String IMG_TOOLS_ADD_PRJ_SOURCE_LOCATION = NAME_PREFIX + "addprjsource_wiz.gif"; //$NON-NLS-1$ @@ -110,6 +112,7 @@ public class CDebugImages private static final String T_OVR = "ovr16"; //$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_CLCL = "clcl16"; //$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$ @@ -153,6 +156,8 @@ public class CDebugImages public static final ImageDescriptor DESC_WIZBAN_ADD_DIR_SOURCE_LOCATION = createManaged( T_WIZBAN, IMG_WIZBAN_ADD_DIR_SOURCE_LOCATION ); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOLS_ADD_PRJ_SOURCE_LOCATION = createManaged( T_CTOOL, IMG_TOOLS_ADD_PRJ_SOURCE_LOCATION ); //$NON-NLS-1$ public static final ImageDescriptor DESC_TOOLS_ADD_DIR_SOURCE_LOCATION = createManaged( T_CTOOL, IMG_TOOLS_ADD_DIR_SOURCE_LOCATION ); //$NON-NLS-1$ + public static final ImageDescriptor DESC_LCL_CAST_TO_TYPE = createManaged( T_CLCL, IMG_LCL_CAST_TO_TYPE ); //$NON-NLS-1$ + public static final ImageDescriptor DESC_LCL_DISPLAY_AS_ARRAY = createManaged( T_CLCL, IMG_LCL_DISPLAY_AS_ARRAY ); //$NON-NLS-1$ /** * Returns the image managed under the given key in this registry. diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java index e65e872d772..520f5a2418a 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java @@ -7,6 +7,7 @@ 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; @@ -51,7 +52,6 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject private Button fOkButton; private Label fErrorMessageLabel; - private Text fTypeText; private Text fFirstIndexText; private Text fLengthText; @@ -85,6 +85,7 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject { super.configureShell( newShell ); newShell.setText( "Display As Array" ); + newShell.setImage( CDebugImages.get( CDebugImages.IMG_LCL_DISPLAY_AS_ARRAY ) ); } /* (non-Javadoc) @@ -97,6 +98,7 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject 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 ) { @@ -105,6 +107,9 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject fFirstIndexText.setText( String.valueOf( fFirstIndex ) ); fLengthText.setText( String.valueOf( fLength ) ); } +*/ + fFirstIndexText.setText( String.valueOf( fFirstIndex ) ); + fLengthText.setText( String.valueOf( fLength ) ); } protected Label getErrorMessageLabel() @@ -133,23 +138,6 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject ((GridData)composite.getLayoutData()).widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ); ((GridLayout)composite.getLayout()).makeColumnsEqualWidth = true; - ControlFactory.createLabel( composite, "Type:" ); - - fTypeText = ControlFactory.createTextField( composite ); - GridData data = new GridData( GridData.FILL_HORIZONTAL ); - data.horizontalSpan = 3; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - fTypeText.setLayoutData( data ); - fTypeText.addModifyListener( - new ModifyListener() - { - public void modifyText( ModifyEvent e ) - { - validateInput(); - } - } ); - Label label = ControlFactory.createLabel( composite, "Start index:" ); ((GridData)label.getLayoutData()).horizontalSpan = 3; fFirstIndexText = ControlFactory.createTextField( composite ); @@ -179,55 +167,47 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject { boolean enabled = true; String message = ""; - if ( fTypeText.getText().trim().length() == 0 ) + String firstIndex = fFirstIndexText.getText().trim(); + if ( firstIndex.length() == 0 ) { - message = "The 'Type' field must not be empty."; + message = "The 'First index' field must not be empty."; enabled = false; } else { - String firstIndex = fFirstIndexText.getText().trim(); - if ( firstIndex.length() == 0 ) + try { - message = "The 'First index' field must not be empty."; + Integer.parseInt( firstIndex ); + } + catch( NumberFormatException e ) + { + message = "Invalid first index."; enabled = false; } - else + if ( enabled ) { - try + String lengthText = fLengthText.getText().trim(); + if ( lengthText.length() == 0 ) { - Integer.parseInt( firstIndex ); - } - catch( NumberFormatException e ) - { - message = "Invalid first index."; + message = "The 'Last index' field must not be empty."; enabled = false; } - if ( enabled ) + else { - String lengthText = fLengthText.getText().trim(); - if ( lengthText.length() == 0 ) + int length = -1; + try { - message = "The 'Last index' field must not be empty."; + length = Integer.parseInt( lengthText ); + } + catch( NumberFormatException e ) + { + message = "Invalid last index."; enabled = false; } - else + if ( enabled && length < 1 ) { - int length = -1; - try - { - length = Integer.parseInt( lengthText ); - } - catch( NumberFormatException e ) - { - message = "Invalid last index."; - enabled = false; - } - if ( enabled && length < 1 ) - { - message = "The length must be greater than 0."; - enabled = false; - } + message = "The length must be greater than 0."; + enabled = false; } } } @@ -243,7 +223,6 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject { if ( buttonId == IDialogConstants.OK_ID ) { - fType = fTypeText.getText().trim(); String firstIndex = fFirstIndexText.getText().trim(); String lengthText = fLengthText.getText().trim(); try @@ -366,10 +345,9 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject CastToArrayDialog dialog = new CastToArrayDialog( CDebugUIPlugin.getActiveWorkbenchShell(), currentType, 0, 1 ); if ( dialog.open() == Window.OK ) { - String newType = dialog.getType().trim(); int firstIndex = dialog.getFirstIndex(); int lastIndex = dialog.getLength(); - castToArray.castToArray( newType, firstIndex, lastIndex ); + castToArray.castToArray( firstIndex, lastIndex ); } } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionDelegate.java index 5cfeb78ad91..0c13af49de4 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionDelegate.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionDelegate.java @@ -7,6 +7,7 @@ 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; @@ -55,6 +56,16 @@ public class CastToTypeActionDelegate extends ActionDelegate { super( parentShell, "Cast To Type", "Enter type:", 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;