KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > EvaluationStackFrameContextStatusHandler


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 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.jdt.internal.debug.ui;
12
13 import org.eclipse.core.runtime.IStatus;
14 import org.eclipse.debug.core.IStatusHandler;
15 import org.eclipse.debug.core.model.IDebugElement;
16 import org.eclipse.jdt.debug.core.IJavaDebugTarget;
17 import org.eclipse.jdt.debug.core.IJavaStackFrame;
18 import org.eclipse.ui.IWorkbenchWindow;
19
20 /**
21  * Supplies the current stack frame context. Currently use for logical object structure
22  * computations.
23  *
24  * @since 3.1
25  */

26 public class EvaluationStackFrameContextStatusHandler implements IStatusHandler {
27
28     /* (non-Javadoc)
29      * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
30      */

31     public Object JavaDoc handleStatus(IStatus status, Object JavaDoc source) {
32         if (source instanceof IDebugElement) {
33             IDebugElement element = (IDebugElement) source;
34             IJavaDebugTarget target = (IJavaDebugTarget) element.getDebugTarget().getAdapter(IJavaDebugTarget.class);
35             if (target != null) {
36                 IJavaStackFrame frame = EvaluationContextManager.getEvaluationContext((IWorkbenchWindow)null);
37                 if (frame != null && frame.getDebugTarget().equals(target)) {
38                     return frame;
39                 }
40             }
41         }
42         return null;
43     }
44
45 }
46
Popular Tags