KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 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  * Pawel Piech - bug 134177
11  *******************************************************************************/

12 package org.eclipse.debug.internal.ui.actions.context;
13
14 import org.eclipse.core.runtime.IAdaptable;
15 import org.eclipse.debug.internal.ui.DebugPluginImages;
16 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
17 import org.eclipse.debug.internal.ui.actions.ActionMessages;
18 import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepAdapter;
19 import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor;
20 import org.eclipse.jface.resource.ImageDescriptor;
21
22 public class StepReturnAction extends StepIntoAction {
23     
24     public ImageDescriptor getDisabledImageDescriptor() {
25         return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEP_RETURN);
26     }
27
28     public String JavaDoc getHelpContextId() {
29         return "step_return_action_context"; //$NON-NLS-1$
30
}
31
32     public ImageDescriptor getHoverImageDescriptor() {
33         return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_RETURN);
34     }
35
36     public String JavaDoc getId() {
37         return "org.eclipse.debug.ui.debugview.toolbar.stepReturn"; //$NON-NLS-1$
38
}
39
40     public ImageDescriptor getImageDescriptor() {
41         return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_RETURN);
42     }
43
44     public String JavaDoc getToolTipText() {
45         return ActionMessages.StepReturnAction_2;
46     }
47
48     public String JavaDoc getText() {
49         return ActionMessages.StepReturnAction_3;
50     }
51
52     
53     protected void checkCapability(Object JavaDoc element, IBooleanRequestMonitor monitor) {
54         if (element instanceof IAdaptable) {
55             IAdaptable adaptable = (IAdaptable) element;
56             IAsynchronousStepAdapter steppy = (IAsynchronousStepAdapter) adaptable.getAdapter(IAsynchronousStepAdapter.class);
57             if (steppy != null) {
58                 steppy.canStepReturn(element, monitor);
59             } else {
60                 notSupported(monitor);
61             }
62         }
63     }
64
65     protected void stepAction(Object JavaDoc element) {
66         if (element instanceof IAdaptable) {
67             IAdaptable adaptable = (IAdaptable) element;
68             IAsynchronousStepAdapter steppy = (IAsynchronousStepAdapter) adaptable.getAdapter(IAsynchronousStepAdapter.class);
69             if (steppy != null)
70                 steppy.stepReturn(element, new ActionRequestMonitor());
71         }
72     }
73
74     protected String JavaDoc getStatusMessage() {
75         return ActionMessages.StepReturnActionDelegate_Exceptions_occurred_attempting_to_run_to_return_of_the_frame__2;
76     }
77
78     protected String JavaDoc getErrorDialogMessage() {
79         return ActionMessages.StepReturnActionDelegate_Run_to_return_failed__1;
80     }
81 }
82
Popular Tags