KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > core > commands > DropToFrameCommand


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.core.commands;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IAdaptable;
15 import org.eclipse.debug.core.commands.IDropToFrameHandler;
16 import org.eclipse.debug.core.model.IDropToFrame;
17
18 /**
19  * Default drop to frame command for the standard debug model.
20  *
21  * @since 3.3
22  */

23 public class DropToFrameCommand extends StepCommand implements IDropToFrameHandler {
24
25     protected Object JavaDoc getTarget(Object JavaDoc element) {
26         if (element instanceof IDropToFrame) {
27             return element;
28         } else if (element instanceof IAdaptable) {
29             return ((IAdaptable) element).getAdapter(IDropToFrame.class);
30         }
31         return null;
32     }
33
34     /* (non-Javadoc)
35      * @see org.eclipse.debug.internal.core.commands.StepCommand#isSteppable(java.lang.Object)
36      */

37     protected boolean isSteppable(Object JavaDoc target) throws CoreException {
38         return ((IDropToFrame)target).canDropToFrame();
39     }
40
41     /* (non-Javadoc)
42      * @see org.eclipse.debug.internal.core.commands.StepCommand#step(java.lang.Object)
43      */

44     protected void step(Object JavaDoc target) throws CoreException {
45         ((IDropToFrame)target).dropToFrame();
46     }
47 }
48
Popular Tags