KickJava   Java API By Example, From Geeks To Geeks.

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


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.IExpression;
15 import org.eclipse.debug.core.model.IVariable;
16
17 /**
18  * @since 3.2
19  *
20  */

21 public class DefaultExpressionModelProxy extends EventHandlerModelProxy {
22     
23     private IExpression fExpression;
24     
25     public DefaultExpressionModelProxy(IExpression expression) {
26         fExpression = expression;
27     }
28
29     /* (non-Javadoc)
30      * @see org.eclipse.debug.internal.ui.viewers.update.EventHandlerModelProxy#dispose()
31      */

32     public synchronized void dispose() {
33         super.dispose();
34         fExpression = null;
35     }
36     
37     /* (non-Javadoc)
38      * @see org.eclipse.debug.internal.ui.viewers.update.EventHandlerModelProxy#createEventHandlers()
39      */

40     protected DebugEventHandler[] createEventHandlers() {
41         return new DebugEventHandler[]{new ExpressionEventHandler(this)};
42     }
43
44     /* (non-Javadoc)
45      * @see org.eclipse.debug.internal.ui.viewers.update.EventHandlerModelProxy#containsEvent(org.eclipse.debug.core.DebugEvent)
46      */

47     protected boolean containsEvent(DebugEvent event) {
48         // handles change events from expressions and debug targets
49
if (event.getSource().equals(fExpression) || event.getSource().equals(fExpression.getDebugTarget())) {
50             return true;
51         }
52         // have to consider change events on variables
53
return event.getKind() == DebugEvent.CHANGE && event.getSource() instanceof IVariable;
54     }
55
56     /**
57      * Returns this model's expression, or <code>null</code> if disposed.
58      *
59      * @return expression or <code>null</code>
60      */

61     protected IExpression getExpression() {
62         return fExpression;
63     }
64     
65 }
66
Popular Tags