KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > viewers > update > StackFrameEventHandler


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.viewers.update;
12
13 import org.eclipse.debug.core.DebugEvent;
14 import org.eclipse.debug.core.model.IStackFrame;
15 import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
16 import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
17 import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
18
19 /**
20  * Default stack frame event handler for the debug view.
21  *
22  * @since 3.3
23  */

24 public class StackFrameEventHandler extends DebugEventHandler {
25     
26     ThreadEventHandler fThreadHandler = null;
27
28     /**
29      * Constructs a new stack frame event handler
30      */

31     public StackFrameEventHandler(AbstractModelProxy proxy, ThreadEventHandler threadHandler) {
32         super(proxy);
33         fThreadHandler = threadHandler;
34     }
35
36     /* (non-Javadoc)
37      * @see org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler#handlesEvent(org.eclipse.debug.core.DebugEvent)
38      */

39     protected boolean handlesEvent(DebugEvent event) {
40         return event.getSource() instanceof IStackFrame;
41     }
42
43     /* (non-Javadoc)
44      * @see org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler#handleChange(org.eclipse.debug.core.DebugEvent)
45      */

46     protected void handleChange(DebugEvent event) {
47         IStackFrame frame = (IStackFrame) event.getSource();
48         ModelDelta root = fThreadHandler.buildRootDelta();
49         ModelDelta delta = fThreadHandler.addPathToThread(root, frame.getThread());
50         delta = delta.addNode(frame.getThread(), IModelDelta.NO_CHANGE);
51         int flags = IModelDelta.NO_CHANGE;
52         if (event.getDetail() == DebugEvent.CONTENT) {
53             flags = flags | IModelDelta.CONTENT;
54         } else if (event.getDetail() == DebugEvent.STATE) {
55             flags = flags | IModelDelta.STATE;
56         }
57         delta = delta.addNode(frame, flags);
58         fireDelta(root);
59     }
60
61 }
62
Popular Tags