KickJava   Java API By Example, From Geeks To Geeks.

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


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.ui.actions;
12
13 import org.eclipse.debug.core.ILaunchConfiguration;
14 import org.eclipse.debug.ui.DebugUITools;
15 import org.eclipse.jface.action.Action;
16 import org.eclipse.jface.resource.ImageDescriptor;
17
18 import com.ibm.icu.text.MessageFormat;
19
20 /**
21  * This class provides an action wrapper for adding launch configuration actions to the context menu
22  * of the Run->... menu item
23  *
24  * @since 3.3
25  */

26 public class LaunchConfigurationAction extends Action {
27
28     private ILaunchConfiguration fConfig;
29     private String JavaDoc fMode;
30     
31     /**
32      * Constructor
33      * @param text the text for the action
34      * @param image the image for the action
35      */

36     public LaunchConfigurationAction(ILaunchConfiguration config, String JavaDoc mode, String JavaDoc text, ImageDescriptor image, int accelerator) {
37         super(MessageFormat.format(ActionMessages.LaunchConfigurationAction_0, new String JavaDoc[] {Integer.toString(accelerator), text}), image);
38         fConfig = config;
39         fMode = mode;
40     }
41     
42     /**
43      * Allows access to the launch configuration associated with the action
44      * @return the associated launch configuration
45      */

46     public ILaunchConfiguration getLaunchConfiguration() {
47         return fConfig;
48     }
49
50     /* (non-Javadoc)
51      * @see org.eclipse.jface.action.Action#run()
52      */

53     public void run() {
54         DebugUITools.launch(fConfig, fMode);
55     }
56
57 }
58
Popular Tags