1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-14 11:45:38 +02:00

Removed the 'Type' field from the 'Display As Array' dialog.

This commit is contained in:
Mikhail Khodjaiants 2003-08-13 21:16:23 +00:00
parent b8b3ffdfed
commit 4214aed737
11 changed files with 72 additions and 65 deletions

View file

@ -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

View file

@ -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.

View file

@ -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;
}

View file

@ -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 );

View file

@ -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.

View file

@ -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(),

View file

@ -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();
}
}

View file

@ -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

View file

@ -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.

View file

@ -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,13 +167,6 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject
{
boolean enabled = true;
String message = "";
if ( fTypeText.getText().trim().length() == 0 )
{
message = "The 'Type' field must not be empty.";
enabled = false;
}
else
{
String firstIndex = fFirstIndexText.getText().trim();
if ( firstIndex.length() == 0 )
{
@ -231,7 +212,6 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject
}
}
}
}
fOkButton.setEnabled( enabled );
getErrorMessageLabel().setText( message );
}
@ -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 );
}
}
}

View file

@ -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;