KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > actions > context > DropToFrameAction


1 /*******************************************************************************
2  * Copyright (c) 2005, 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.debug.internal.ui.actions.context;
12
13 import org.eclipse.core.runtime.IAdaptable;
14 import org.eclipse.debug.internal.ui.DebugPluginImages;
15 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
16 import org.eclipse.debug.internal.ui.actions.ActionMessages;
17 import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousDropToFrameAdapter;
18 import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor;
19 import org.eclipse.jface.resource.ImageDescriptor;
20
21 /**
22  * Action delegate which performs a drop to frame.
23  */

24 public class DropToFrameAction extends AbstractDebugContextAction {
25     /*
26      * (non-Javadoc)
27      * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#doAction(java.lang.Object)
28      */

29     protected void doAction(Object JavaDoc element) {
30         if (element instanceof IAdaptable) {
31             IAdaptable adaptable = (IAdaptable) element;
32             IAsynchronousDropToFrameAdapter dropper = (IAsynchronousDropToFrameAdapter) adaptable.getAdapter(IAsynchronousDropToFrameAdapter.class);
33             if (dropper != null)
34                 dropper.dropToFrame(element, new ActionRequestMonitor());
35         }
36     }
37
38     /*
39      * (non-Javadoc)
40      * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#isEnabledFor(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor)
41      */

42     protected void isEnabledFor(Object JavaDoc element, IBooleanRequestMonitor monitor) {
43         if (element instanceof IAdaptable) {
44             IAdaptable adaptable = (IAdaptable) element;
45             IAsynchronousDropToFrameAdapter dropper = (IAsynchronousDropToFrameAdapter) adaptable.getAdapter(IAsynchronousDropToFrameAdapter.class);
46             if (dropper != null) {
47                 dropper.canDropToFrame(element, monitor);
48             } else {
49                 notSupported(monitor);
50             }
51         }
52     }
53
54     /*
55      * (non-Javadoc)
56      *
57      * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getText()
58      */

59     public String JavaDoc getText() {
60         return ActionMessages.DropToFrameAction_0;
61     }
62
63     /*
64      * (non-Javadoc)
65      *
66      * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHelpContextId()
67      */

68     public String JavaDoc getHelpContextId() {
69         return "drop_to_frame_action_context"; //$NON-NLS-1$
70
}
71
72     /*
73      * (non-Javadoc)
74      *
75      * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getId()
76      */

77     public String JavaDoc getId() {
78         return "org.eclipse.debug.ui.debugview.toolbar.dropToFrame"; //$NON-NLS-1$
79
}
80
81     /*
82      * (non-Javadoc)
83      *
84      * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getToolTipText()
85      */

86     public String JavaDoc getToolTipText() {
87         return ActionMessages.DropToFrameAction_3;
88     }
89
90     /*
91      * (non-Javadoc)
92      *
93      * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHoverImageDescriptor()
94      */

95     public ImageDescriptor getHoverImageDescriptor() {
96         return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DROP_TO_FRAME);
97     }
98
99     /*
100      * (non-Javadoc)
101      *
102      * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getImageDescriptor()
103      */

104     public ImageDescriptor getImageDescriptor() {
105         return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DROP_TO_FRAME);
106     }
107
108     /* (non-Javadoc)
109      * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getDisabledImageDescriptor()
110      */

111     public ImageDescriptor getDisabledImageDescriptor() {
112         return null;
113     }
114 }
115
Popular Tags