KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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
14 import org.eclipse.debug.core.DebugException;
15 import org.eclipse.debug.core.model.IStackFrame;
16 import org.eclipse.jdt.debug.core.IJavaStackFrame;
17 import org.eclipse.ui.IActionFilter;
18
19 public class JavaStackFrameActionFilter implements IActionFilter {
20
21     /**
22      * @see org.eclipse.ui.IActionFilter#testAttribute(Object, String, String)
23      */

24     public boolean testAttribute(Object JavaDoc target, String JavaDoc name, String JavaDoc value) {
25         IJavaStackFrame frame = null;
26         if (target instanceof IStackFrame) {
27             frame = (IJavaStackFrame) ((IStackFrame)target).getAdapter(IJavaStackFrame.class);
28         }
29         if (frame != null) {
30             if (name.equals("DropToFrameActionFilter") //$NON-NLS-1$
31
&& value.equals("supportsDropToFrame")) { //$NON-NLS-1$
32
return frame.canDropToFrame();
33             } else if (name.equals("ReceivingStackFrameActionFilter") //$NON-NLS-1$
34
&& value.equals("isReceivingType")) { //$NON-NLS-1$
35
try {
36                         return !frame.getReceivingTypeName().equals(frame.getDeclaringTypeName());
37                     } catch (DebugException de) {
38                     }
39             }
40         }
41         return false;
42     }
43 }
44
Popular Tags