1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-04 14:13:24 +02:00

[268693] [TraditionalRendering] update mode support

This commit is contained in:
Ted Williams 2009-03-15 22:56:45 +00:00
parent 88f16a48e3
commit 4276eab9a2
3 changed files with 89 additions and 18 deletions

View file

@ -143,6 +143,12 @@ public class Rendering extends Composite implements IDebugEventSetListener
// flag whether the memory cache is dirty // flag whether the memory cache is dirty
private boolean fCacheDirty = false; private boolean fCacheDirty = false;
// update modes
public final static int UPDATE_ALWAYS = 1;
public final static int UPDATE_ON_BREAKPOINT = 2;
public final static int UPDATE_MANUAL = 3;
public int fUpdateMode = UPDATE_ALWAYS;
public Rendering(Composite parent, TraditionalRendering renderingParent) public Rendering(Composite parent, TraditionalRendering renderingParent)
{ {
super(parent, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND | SWT.H_SCROLL super(parent, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND | SWT.H_SCROLL
@ -535,6 +541,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
boolean isChangeOnly = false; boolean isChangeOnly = false;
boolean isSuspend = false; boolean isSuspend = false;
boolean isBreakpointHit = false;
for(int i = 0; i < events.length; i++) for(int i = 0; i < events.length; i++)
{ {
@ -548,6 +555,8 @@ public class Rendering extends Composite implements IDebugEventSetListener
if(source.getDebugTarget() == getMemoryBlock() if(source.getDebugTarget() == getMemoryBlock()
.getDebugTarget()) .getDebugTarget())
{ {
if((detail & DebugEvent.BREAKPOINT) != 0)
isBreakpointHit = true;
if(kind == DebugEvent.SUSPEND) if(kind == DebugEvent.SUSPEND)
{ {
handleSuspendEvent(detail); handleSuspendEvent(detail);
@ -563,32 +572,39 @@ public class Rendering extends Composite implements IDebugEventSetListener
} }
if(isSuspend) if(isSuspend)
handleSuspend(); handleSuspend(isBreakpointHit);
else if(isChangeOnly) else if(isChangeOnly)
handleChange(); handleChange();
} }
protected void handleSuspend() protected void handleSuspend(boolean isBreakpointHit)
{ {
Display.getDefault().asyncExec(new Runnable() if(getUpdateMode() == UPDATE_ALWAYS ||
{ (getUpdateMode() == UPDATE_ON_BREAKPOINT && isBreakpointHit))
public void run() {
Display.getDefault().asyncExec(new Runnable()
{ {
archiveDeltas(); public void run()
refresh(); {
} archiveDeltas();
}); refresh();
}
});
}
} }
protected void handleChange() protected void handleChange()
{ {
Display.getDefault().asyncExec(new Runnable() if(getUpdateMode() == UPDATE_ALWAYS)
{ {
public void run() Display.getDefault().asyncExec(new Runnable()
{ {
refresh(); public void run()
} {
}); refresh();
}
});
}
} }
protected void handleSuspendEvent(int detail) protected void handleSuspendEvent(int detail)
@ -1629,7 +1645,15 @@ public class Rendering extends Composite implements IDebugEventSetListener
return fTextMode; return fTextMode;
} }
protected String getCharacterSet(int mode) public int getUpdateMode() {
return fUpdateMode;
}
public void setUpdateMode(int fUpdateMode) {
this.fUpdateMode = fUpdateMode;
}
protected String getCharacterSet(int mode)
{ {
switch(mode) switch(mode)
{ {

View file

@ -1061,6 +1061,49 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
sub.add(displayColumnCountCustom); sub.add(displayColumnCountCustom);
manager.add(sub); manager.add(sub);
final Action updateAlwaysAction = new Action(
TraditionalRenderingMessages
.getString("TraditionalRendering.UPDATE_ALWAYS"), //$NON-NLS-1$
IAction.AS_RADIO_BUTTON)
{
public void run()
{
fRendering.setUpdateMode(Rendering.UPDATE_ALWAYS);
}
};
updateAlwaysAction.setChecked(fRendering.getUpdateMode() == Rendering.UPDATE_ALWAYS);
final Action updateOnBreakpointAction = new Action(
TraditionalRenderingMessages
.getString("TraditionalRendering.UPDATE_ON_BREAKPOINT"), //$NON-NLS-1$
IAction.AS_RADIO_BUTTON)
{
public void run()
{
fRendering.setUpdateMode(Rendering.UPDATE_ON_BREAKPOINT);
}
};
updateOnBreakpointAction.setChecked(fRendering.getUpdateMode() == Rendering.UPDATE_ON_BREAKPOINT);
final Action updateManualAction = new Action(
TraditionalRenderingMessages
.getString("TraditionalRendering.UPDATE_MANUAL"), //$NON-NLS-1$
IAction.AS_RADIO_BUTTON)
{
public void run()
{
fRendering.setUpdateMode(Rendering.UPDATE_MANUAL);
}
};
updateManualAction.setChecked(fRendering.getUpdateMode() == Rendering.UPDATE_MANUAL);
sub = new MenuManager(TraditionalRenderingMessages
.getString("TraditionalRendering.UPDATEMODE")); //$NON-NLS-1$
sub.add(updateAlwaysAction);
sub.add(updateOnBreakpointAction);
sub.add(updateManualAction);
manager.add(sub);
manager.add(new Separator()); manager.add(new Separator());
BigInteger start = fRendering.getSelection().getStart(); BigInteger start = fRendering.getSelection().getStart();

View file

@ -47,3 +47,7 @@ TraditionalRendering.COLUMN_COUNT_64=64
TraditionalRendering.COLUMN_COUNT_128=128 TraditionalRendering.COLUMN_COUNT_128=128
TraditionalRendering.COLUMN_COUNT_CUSTOM=Custom... TraditionalRendering.COLUMN_COUNT_CUSTOM=Custom...
TraditionalRendering.COPY_ADDRESS=Copy Address TraditionalRendering.COPY_ADDRESS=Copy Address
TraditionalRendering.UPDATEMODE=Update Mode
TraditionalRendering.UPDATE_ALWAYS=Always
TraditionalRendering.UPDATE_ON_BREAKPOINT=On Breakpoint
TraditionalRendering.UPDATE_MANUAL=Manual