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

[200853] Refacted patch to make getSelection() return an IMemorySelection

This commit is contained in:
Ted Williams 2007-11-26 04:35:39 +00:00
parent a89f437145
commit 0669b2c27a
2 changed files with 35 additions and 11 deletions

View file

@ -0,0 +1,24 @@
package org.eclipse.dd.debug.memory.renderings.traditional;
import java.math.BigInteger;
public interface IMemorySelection
{
public boolean hasSelection();
public boolean isSelected(BigInteger address);
public BigInteger getStart();
public BigInteger getEnd();
public void setStart(BigInteger high, BigInteger low);
public void setEnd(BigInteger high, BigInteger low);
public BigInteger getHigh();
public BigInteger getLow();
public void clear();
}

View file

@ -455,7 +455,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
setCurrentScrollSelection(); setCurrentScrollSelection();
} }
public Selection getSelection() public IMemorySelection getSelection()
{ {
return fSelection; return fSelection;
} }
@ -1045,7 +1045,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
super.dispose(); super.dispose();
} }
class Selection class Selection implements IMemorySelection
{ {
private BigInteger fStartHigh; private BigInteger fStartHigh;
private BigInteger fStartLow; private BigInteger fStartLow;
@ -1053,19 +1053,19 @@ public class Rendering extends Composite implements IDebugEventSetListener
private BigInteger fEndHigh; private BigInteger fEndHigh;
private BigInteger fEndLow; private BigInteger fEndLow;
protected void clear() public void clear()
{ {
fEndHigh = fEndLow = fStartHigh = fStartLow = null; fEndHigh = fEndLow = fStartHigh = fStartLow = null;
redrawPanes(); redrawPanes();
} }
protected boolean hasSelection() public boolean hasSelection()
{ {
return fStartHigh != null && fStartLow != null return fStartHigh != null && fStartLow != null
&& fEndHigh != null && fEndLow != null; && fEndHigh != null && fEndLow != null;
} }
protected boolean isSelected(BigInteger address) public boolean isSelected(BigInteger address)
{ {
// do we have valid start and end addresses // do we have valid start and end addresses
if(getEnd() == null || getStart() == null) if(getEnd() == null || getStart() == null)
@ -1089,7 +1089,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
return false; return false;
} }
protected void setStart(BigInteger high, BigInteger low) public void setStart(BigInteger high, BigInteger low)
{ {
if(high == null && low == null) if(high == null && low == null)
{ {
@ -1121,7 +1121,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
redrawPanes(); redrawPanes();
} }
protected void setEnd(BigInteger high, BigInteger low) public void setEnd(BigInteger high, BigInteger low)
{ {
if(high == null && low == null) if(high == null && low == null)
{ {
@ -1153,7 +1153,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
redrawPanes(); redrawPanes();
} }
protected BigInteger getHigh() public BigInteger getHigh()
{ {
if(!hasSelection()) if(!hasSelection())
return null; return null;
@ -1161,7 +1161,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
return getStart().max(getEnd()); return getStart().max(getEnd());
} }
protected BigInteger getLow() public BigInteger getLow()
{ {
if(!hasSelection()) if(!hasSelection())
return null; return null;
@ -1169,7 +1169,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
return getStart().min(getEnd()); return getStart().min(getEnd());
} }
protected BigInteger getStart() public BigInteger getStart()
{ {
// if there is no start, return null // if there is no start, return null
if(fStartHigh == null) if(fStartHigh == null)
@ -1194,7 +1194,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
return fStartLow; return fStartLow;
} }
protected BigInteger getEnd() public BigInteger getEnd()
{ {
// if there is no end, return null // if there is no end, return null
if(fEndHigh == null) if(fEndHigh == null)