1 11 package org.eclipse.debug.internal.ui.viewers.update; 12 13 import org.eclipse.debug.core.DebugEvent; 14 import org.eclipse.debug.core.DebugPlugin; 15 import org.eclipse.debug.core.model.IDebugTarget; 16 import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; 17 import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; 18 import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy; 19 20 21 24 public class DebugTargetEventHandler extends DebugEventHandler { 25 26 31 public DebugTargetEventHandler(AbstractModelProxy proxy) { 32 super(proxy); 33 } 34 35 38 protected boolean handlesEvent(DebugEvent event) { 39 return event.getSource() instanceof IDebugTarget; 40 } 41 42 protected void handleChange(DebugEvent event) { 43 int flags = IModelDelta.STATE; 44 if (event.getDetail() == DebugEvent.CONTENT) { 45 flags = flags | IModelDelta.CONTENT; 46 } 47 fireDelta((IDebugTarget) event.getSource(), flags); 48 } 49 50 protected void handleCreate(DebugEvent event) { 51 fireDelta((IDebugTarget) event.getSource(), IModelDelta.EXPAND); 52 } 53 54 protected void handleResume(DebugEvent event) { 55 fireDelta((IDebugTarget) event.getSource(), IModelDelta.CONTENT | IModelDelta.STATE | IModelDelta.SELECT); 56 } 57 58 protected void handleSuspend(DebugEvent event) { 59 fireDelta((IDebugTarget) event.getSource(), IModelDelta.CONTENT | IModelDelta.STATE); 60 } 61 62 protected void handleTerminate(DebugEvent event) { 63 fireDelta((IDebugTarget) event.getSource(), IModelDelta.CONTENT | IModelDelta.STATE | IModelDelta.UNINSTALL); 64 } 65 66 private void fireDelta(IDebugTarget target, int flags) { 67 ModelDelta root = new ModelDelta(DebugPlugin.getDefault().getLaunchManager(), IModelDelta.NO_CHANGE); 68 ModelDelta delta = root.addNode(target.getLaunch(), IModelDelta.NO_CHANGE); 69 delta.addNode(target, flags); 70 fireDelta(root); 71 } 72 73 } 74 | Popular Tags |