KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mountainminds > eclemma > internal > ui > coverageview > RelaunchSessionAction


1 /*******************************************************************************
2  * Copyright (c) 2006 Mountainminds GmbH & Co. KG
3  * This software is provided under the terms of the Eclipse Public License v1.0
4  * See http://www.eclipse.org/legal/epl-v10.html.
5  *
6  * $Id: RelaunchSessionAction.java 338 2007-06-19 14:57:16Z mtnminds $
7  ******************************************************************************/

8 package com.mountainminds.eclemma.internal.ui.coverageview;
9
10 import org.eclipse.debug.core.ILaunchConfiguration;
11 import org.eclipse.debug.ui.DebugUITools;
12 import org.eclipse.jface.action.Action;
13
14 import com.mountainminds.eclemma.core.CoverageTools;
15 import com.mountainminds.eclemma.core.ICoverageSession;
16 import com.mountainminds.eclemma.core.ISessionManager;
17 import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin;
18 import com.mountainminds.eclemma.internal.ui.UIMessages;
19
20 /**
21  * This action removes the active coverage session. Internally used by the
22  * coverage view.
23  *
24  * @author Marc R. Hoffmann
25  * @version $Revision: 338 $
26  */

27 class RelaunchSessionAction extends Action {
28   
29   RelaunchSessionAction() {
30     setText(UIMessages.CoverageViewRelaunchAction_label);
31     setToolTipText(UIMessages.CoverageViewRelaunchAction_tooltip);
32     setImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.ELCL_RELAUNCH));
33     setDisabledImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.DLCL_RELAUNCH));
34     setEnabled(false);
35   }
36   
37   public void run() {
38     ISessionManager manager = CoverageTools.getSessionManager();
39     ICoverageSession session = manager.getActiveSession();
40     if (session != null) {
41       ILaunchConfiguration config = session.getLaunchConfiguration();
42       if (config != null) {
43         DebugUITools.launch(config, CoverageTools.LAUNCH_MODE);
44       }
45     }
46   }
47
48 }
49
Popular Tags