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.DebugPlugin; 16 import org.eclipse.debug.core.model.IExpression; 17 import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; 18 import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy; 19 import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; 20 import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy; 21 22 28 public class ExpressionEventHandler extends DebugEventHandler { 29 30 public ExpressionEventHandler(AbstractModelProxy proxy) { 31 super(proxy); 32 } 33 34 protected boolean handlesEvent(DebugEvent event) { 35 return event.getKind() == DebugEvent.CHANGE; 36 } 37 38 protected void handleChange(DebugEvent event) { 39 ModelDelta delta = new ModelDelta(DebugPlugin.getDefault().getExpressionManager(), IModelDelta.NO_CHANGE); 40 IExpression expression = null; 41 if (event.getSource() instanceof IExpression) { 42 expression = (IExpression) event.getSource(); 43 } else { 44 IModelProxy modelProxy = getModelProxy(); 45 if (modelProxy instanceof DefaultExpressionModelProxy) { 46 DefaultExpressionModelProxy proxy = (DefaultExpressionModelProxy) modelProxy; 47 expression = proxy.getExpression(); 48 } 49 } 50 if (expression != null) { 51 int flags = IModelDelta.NO_CHANGE; 52 if ((event.getDetail() & DebugEvent.STATE) != 0) { 53 flags = flags | IModelDelta.STATE; 54 } 55 if ((event.getDetail() & DebugEvent.CONTENT) != 0) { 56 flags = flags | IModelDelta.CONTENT; 57 } 58 delta.addNode(expression, flags); 59 fireDelta(delta); 60 } 61 } 62 63 protected void refreshRoot(DebugEvent event) { 64 ModelDelta delta = new ModelDelta(DebugPlugin.getDefault().getExpressionManager(), IModelDelta.CONTENT); 65 fireDelta(delta); 66 } 67 68 } 69 | Popular Tags |