Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 21ffdb56274a8d593bf46897fc19d57dea4264ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package org.eclipse.debug.internal.ui.actions;

/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved.
 */

import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.internal.ui.DebugPluginImages;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationHistoryElement;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.help.WorkbenchHelp;

/**
 * Re-launches a previous launch.
 */
public class RelaunchHistoryLaunchAction extends Action {

	protected LaunchConfigurationHistoryElement fLaunch;
	
	public RelaunchHistoryLaunchAction(LaunchConfigurationHistoryElement launch) {
		super();
		fLaunch= launch;
		setText(launch.getLabel());
		ImageDescriptor descriptor= null;
		if (launch.getLaunchConfiguration() != null) {
			descriptor = DebugUITools.getDefaultImageDescriptor(launch.getLaunchConfiguration());
		} else {
			if (launch.getMode().equals(ILaunchManager.DEBUG_MODE)) {
				descriptor= DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_DEBUG);
			} else {
				descriptor= DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_RUN);
			}
		}

		if (descriptor != null) {
			setImageDescriptor(descriptor);
		}
		WorkbenchHelp.setHelp(
			this,
			IDebugHelpContextIds.RELAUNCH_HISTORY_ACTION);
	}

	/**
	 * @see IAction
	 */
	public void run() {
		if (!DebugUITools.saveAndBuildBeforeLaunch()) {
			return;
		}
		BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
			public void run() {
				RelaunchActionDelegate.relaunch(fLaunch);
			}
		});
	}
}

Back to the top