KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > actions > TerminateAndRemoveActionDelegate


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.debug.internal.ui.actions;
12
13
14 import org.eclipse.debug.core.DebugException;
15 import org.eclipse.debug.core.model.ITerminate;
16 import org.eclipse.debug.internal.ui.views.launch.LaunchView;
17
18 public class TerminateAndRemoveActionDelegate extends AbstractDebugActionDelegate {
19
20     /**
21      * @see AbstractDebugActionDelegate#doAction(Object)
22      */

23     protected void doAction(Object JavaDoc element) throws DebugException {
24         LaunchView.terminateAndRemove(element);
25     }
26     
27     /**
28      * @see AbstractDebugActionDelegate#isRunInBackground()
29      */

30     protected boolean isRunInBackground() {
31         return true;
32     }
33
34     /**
35      * @see AbstractDebugActionDelegate#isEnabledFor(Object)
36      */

37     protected boolean isEnabledFor(Object JavaDoc element) {
38         if (element instanceof ITerminate) {
39             ITerminate terminate= (ITerminate)element;
40             //do not want to terminate an attach launch that does not
41
//have termination enabled
42
return terminate.canTerminate() || terminate.isTerminated();
43         }
44         return false;
45     }
46
47     /**
48      * @see AbstractDebugActionDelegate#getStatusMessage()
49      */

50     protected String JavaDoc getStatusMessage() {
51         return ActionMessages.TerminateAndRemoveActionDelegate_Exceptions_occurred_attempting_to_terminate_and_remove_2; //$NON-NLS-1$
52
}
53
54     /**
55      * @see AbstractDebugActionDelegate#getErrorDialogMessage()
56      */

57     protected String JavaDoc getErrorDialogMessage() {
58         return ActionMessages.TerminateAndRemoveActionDelegate_Terminate_and_remove_failed_1; //$NON-NLS-1$
59
}
60
61 }
62
Popular Tags