KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2005, 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.IDebugElement;
15 import org.eclipse.debug.core.model.IDebugTarget;
16 import org.eclipse.debug.core.model.IStackFrame;
17
18 /**
19  * Default update for variables view.
20  *
21  * @since 3.2
22  */

23 public class DefaultVariableViewModelProxy extends EventHandlerModelProxy {
24
25     /**
26      * Root model element for this update policy
27      */

28     private IStackFrame fFrame;
29
30     /**
31      * Constructs an update policy on the given target.
32      *
33      * @param target
34      */

35     public DefaultVariableViewModelProxy(IStackFrame frame) {
36         super();
37         fFrame = frame;
38     }
39
40     public void dispose() {
41         super.dispose();
42         fFrame = null;
43     }
44
45     protected DebugEventHandler[] createEventHandlers() {
46         return new DebugEventHandler[] { new VariablesViewEventHandler(this, fFrame) };
47     }
48     
49    /* (non-Javadoc)
50     * @see org.eclipse.debug.internal.ui.viewers.update.EventHandlerModelProxy#containsEvent(org.eclipse.debug.core.DebugEvent)
51     */

52     protected synchronized boolean containsEvent(DebugEvent event) {
53         if (!isDisposed()) {
54             Object JavaDoc source = event.getSource();
55             if (source instanceof IDebugElement) {
56                 IDebugTarget debugTarget = ((IDebugElement) source).getDebugTarget();
57                 if (debugTarget != null) {
58                     // a debug target can be null for an IExpression
59
return debugTarget.equals(fFrame.getDebugTarget());
60                 }
61             }
62         }
63         return false;
64     }
65     
66 }
67
Popular Tags