1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Implementing editor features of Memory view.

This commit is contained in:
Mikhail Khodjaiants 2002-10-25 21:58:42 +00:00
parent 23529181b2
commit 49d3b50f8e
2 changed files with 29 additions and 13 deletions

View file

@ -13,7 +13,9 @@ import java.util.List;
import org.eclipse.cdt.debug.core.ICMemoryManager;
import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
import org.eclipse.cdt.debug.core.IFormattedMemoryBlockRow;
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.debug.core.DebugException;
import org.eclipse.swt.graphics.Point;
/**
@ -35,7 +37,7 @@ public class MemoryPresentation
private List fAddressZones;
private List fChangedZones;
private List fDirtyZones;
private boolean fDisplayAscii = true;
/**
@ -78,15 +80,6 @@ public class MemoryPresentation
return sb.toString();
}
public int getItemSize( int offset )
{
return -1;
}
public void setItem( int offset, String item )
{
}
public String[] getText( Point[] zones )
{
return new String[0];
@ -453,4 +446,27 @@ public class MemoryPresentation
return getMemoryBlock().displayASCII();
return false;
}
protected void textChanged( int offset, char newChar, char[] replacedText )
{
byte b = 0;
if ( isInDataArea( offset ) )
{
}
if ( isInAsciiArea( offset ) )
{
b = CDebugUtils.charToByte( newChar );
}
if ( getMemoryBlock() != null )
{
try
{
getMemoryBlock().setValue( offset, new byte[] { b } );
}
catch( DebugException e )
{
// ignore
}
}
}
}

View file

@ -83,9 +83,9 @@ public class MemoryText
{
if ( event.length != 1 )
return;
int offset = fText.getCaretOffset() - 1;
int size = fPresentation.getItemSize( offset );
fPresentation.setItem( offset, fText.getText().substring( offset, offset + size ) );
fPresentation.textChanged( event.start,
fText.getText().charAt( event.start ),
event.replacedText.toCharArray() );
Point[] zones = fPresentation.getDirtyZones();
refresh( zones, fPresentation.getText( zones ) );
}