1 11 12 package org.eclipse.debug.internal.ui.viewers.update; 13 14 import org.eclipse.debug.core.DebugEvent; 15 import org.eclipse.debug.core.model.IDebugElement; 16 import org.eclipse.debug.core.model.IMemoryBlock; 17 import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; 18 import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; 19 20 public class MemoryBlockProxy extends EventHandlerModelProxy { 21 22 private IMemoryBlock fMemoryBlock; 23 private DebugEventHandler fDebugEventHandler = new DebugEventHandler(this) { 24 25 protected boolean handlesEvent(DebugEvent event) { 26 if (event.getKind() == DebugEvent.CHANGE && event.getSource() == fMemoryBlock) 27 return true; 28 29 Object src = event.getSource(); 30 if (src instanceof IDebugElement) 31 { 32 if (event.getKind() == DebugEvent.SUSPEND && ((IDebugElement)src).getDebugTarget() == fMemoryBlock.getDebugTarget()) 33 return true; 34 } 35 return false; 36 } 37 38 protected void handleChange(DebugEvent event) { 39 if (event.getDetail() == DebugEvent.STATE) 40 { 41 ModelDelta delta = new ModelDelta(fMemoryBlock, IModelDelta.STATE); 42 fireModelChanged(delta); 43 } 44 else 45 { 46 ModelDelta delta = new ModelDelta(fMemoryBlock, IModelDelta.CONTENT); 47 fireModelChanged(delta); 48 } 49 } 50 51 protected void handleSuspend(DebugEvent event) { 52 ModelDelta delta = new ModelDelta(fMemoryBlock, IModelDelta.CONTENT); 53 fireModelChanged(delta); 54 } 55 56 public synchronized void dispose() { 57 super.dispose(); 58 }}; 59 60 public MemoryBlockProxy(IMemoryBlock mb) 61 { 62 fMemoryBlock = mb; 63 } 64 65 66 protected DebugEventHandler[] createEventHandlers() { 67 return new DebugEventHandler[]{fDebugEventHandler}; 68 } 69 70 71 } 72 | Popular Tags |