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:
parent
23529181b2
commit
49d3b50f8e
2 changed files with 29 additions and 13 deletions
|
@ -13,7 +13,9 @@ import java.util.List;
|
||||||
import org.eclipse.cdt.debug.core.ICMemoryManager;
|
import org.eclipse.cdt.debug.core.ICMemoryManager;
|
||||||
import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
|
import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
|
||||||
import org.eclipse.cdt.debug.core.IFormattedMemoryBlockRow;
|
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.cdt.debug.internal.ui.CDebugUIUtils;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,15 +80,6 @@ public class MemoryPresentation
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemSize( int offset )
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItem( int offset, String item )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getText( Point[] zones )
|
public String[] getText( Point[] zones )
|
||||||
{
|
{
|
||||||
return new String[0];
|
return new String[0];
|
||||||
|
@ -453,4 +446,27 @@ public class MemoryPresentation
|
||||||
return getMemoryBlock().displayASCII();
|
return getMemoryBlock().displayASCII();
|
||||||
return false;
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,9 +83,9 @@ public class MemoryText
|
||||||
{
|
{
|
||||||
if ( event.length != 1 )
|
if ( event.length != 1 )
|
||||||
return;
|
return;
|
||||||
int offset = fText.getCaretOffset() - 1;
|
fPresentation.textChanged( event.start,
|
||||||
int size = fPresentation.getItemSize( offset );
|
fText.getText().charAt( event.start ),
|
||||||
fPresentation.setItem( offset, fText.getText().substring( offset, offset + size ) );
|
event.replacedText.toCharArray() );
|
||||||
Point[] zones = fPresentation.getDirtyZones();
|
Point[] zones = fPresentation.getDirtyZones();
|
||||||
refresh( zones, fPresentation.getText( zones ) );
|
refresh( zones, fPresentation.getText( zones ) );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue