KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > snippeteditor > StopAction


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.jdt.internal.debug.ui.snippeteditor;
12
13
14 import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds;
15 import org.eclipse.jdt.internal.debug.ui.JavaDebugImages;
16 import org.eclipse.ui.PlatformUI;
17
18 /**
19  * Stops the VM used to run a snippet.
20  *
21  */

22 public class StopAction extends SnippetAction {
23     
24     public StopAction(JavaSnippetEditor editor) {
25         super(editor);
26         
27         setText(SnippetMessages.getString("StopAction.label")); //$NON-NLS-1$
28
setToolTipText(SnippetMessages.getString("StopAction.tooltip")); //$NON-NLS-1$
29
setDescription(SnippetMessages.getString("StopAction.description")); //$NON-NLS-1$
30

31         setImageDescriptor(JavaDebugImages.getImageDescriptor(JavaDebugImages.IMG_TOOL_TERMSNIPPET));
32         setDisabledImageDescriptor(JavaDebugImages.getImageDescriptor(JavaDebugImages.IMG_TOOL_TERMSNIPPET_DISABLED));
33         setHoverImageDescriptor(JavaDebugImages.getImageDescriptor(JavaDebugImages.IMG_TOOL_TERMSNIPPET_HOVER));
34         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaDebugHelpContextIds.TERMINATE_SCRAPBOOK_VM_ACTION);
35     }
36     
37     /**
38      * @see IAction#run()
39      */

40     public void run() {
41         getEditor().shutDownVM();
42     }
43     
44     /**
45      * @see ISnippetStateChangedListener#snippetStateChanged(JavaSnippetEditor)
46      */

47     public void snippetStateChanged(JavaSnippetEditor editor) {
48         setEnabled(editor != null && editor.isVMLaunched());
49     }
50 }
51
Popular Tags