View | Details | Raw Unified | Return to bug 39900 | Differences between
and this patch

Collapse All | Expand All

(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties (+3 lines)
Lines 206-208 Link Here
206
SelectLaunchersDialog_2=This dialog allows you to specify which launcher to use when multiple launchers are available for a configuration and launch mode.
206
SelectLaunchersDialog_2=This dialog allows you to specify which launcher to use when multiple launchers are available for a configuration and launch mode.
207
SelectLaunchersDialog_4=<a href="ws">Change Workspace Settings...</a>
207
SelectLaunchersDialog_4=<a href="ws">Change Workspace Settings...</a>
208
SelectLaunchersDialog_5=Description
208
SelectLaunchersDialog_5=Description
209
210
MultiLaunchAction__Launch_All_1=Launch &Sequentially
211
MultiLaunchAction__Launching_Multiple=Sequential Multi-Launch
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java (+2 lines)
Lines 225-228 Link Here
225
	public static String SelectLaunchOptionsDialog_3;
225
	public static String SelectLaunchOptionsDialog_3;
226
	public static String SelectLaunchOptionsDialog_4;
226
	public static String SelectLaunchOptionsDialog_4;
227
227
228
	public static String MultiLaunchAction__Launch_All_1;
229
	public static String MultiLaunchAction__Launching_Multiple_1;
228
}
230
}
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java (+6 lines)
Lines 102-107 Link Here
102
	 * @since 3.2
102
	 * @since 3.2
103
	 */
103
	 */
104
	private ViewerFilter[] fFilters = null;
104
	private ViewerFilter[] fFilters = null;
105
106
	private MultiLaunchAction fMultiLaunchAction;
105
	
107
	
106
	/**
108
	/**
107
	 * Constructs a launch configuration view for the given launch group
109
	 * Constructs a launch configuration view for the given launch group
Lines 193-198 Link Here
193
		fDuplicateAction = new DuplicateLaunchConfigurationAction(getViewer(), getLaunchGroup().getMode());
195
		fDuplicateAction = new DuplicateLaunchConfigurationAction(getViewer(), getLaunchGroup().getMode());
194
		setAction(DuplicateLaunchConfigurationAction.ID_DUPLICATE_ACTION, fDuplicateAction);
196
		setAction(DuplicateLaunchConfigurationAction.ID_DUPLICATE_ACTION, fDuplicateAction);
195
		
197
		
198
		fMultiLaunchAction = new MultiLaunchAction(getViewer(), getLaunchGroup().getMode());
199
		setAction(MultiLaunchAction.ID_MULTI_LAUNCH_ACTION, fMultiLaunchAction);
200
		
196
		fCollapseAllAction = new CollapseAllLaunchConfigurationAction((TreeViewer)getViewer());
201
		fCollapseAllAction = new CollapseAllLaunchConfigurationAction((TreeViewer)getViewer());
197
		setAction(CollapseAllLaunchConfigurationAction.ID_COLLAPSEALL_ACTION, fCollapseAllAction);
202
		setAction(CollapseAllLaunchConfigurationAction.ID_COLLAPSEALL_ACTION, fCollapseAllAction);
198
		
203
		
Lines 216-221 Link Here
216
		menu.add(fDuplicateAction);
221
		menu.add(fDuplicateAction);
217
		menu.add(fDeleteAction);
222
		menu.add(fDeleteAction);
218
		menu.add(new Separator());
223
		menu.add(new Separator());
224
		menu.add(fMultiLaunchAction);
219
	}
225
	}
220
226
221
	/**
227
	/**
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/MultiLaunchAction.java (+144 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 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.launchConfigurations;
12
13
14
import java.util.ArrayList;
15
import java.util.List;
16
17
import org.eclipse.core.runtime.CoreException;
18
import org.eclipse.core.runtime.IProgressMonitor;
19
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.core.runtime.Status;
21
import org.eclipse.core.runtime.SubMonitor;
22
import org.eclipse.core.runtime.jobs.Job;
23
import org.eclipse.debug.core.DebugException;
24
import org.eclipse.debug.core.ILaunch;
25
import org.eclipse.debug.core.ILaunchConfiguration;
26
import org.eclipse.debug.internal.ui.DebugUIPlugin;
27
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
28
import org.eclipse.debug.ui.DebugUITools;
29
import org.eclipse.jface.resource.ImageDescriptor;
30
import org.eclipse.jface.viewers.IStructuredSelection;
31
import org.eclipse.jface.viewers.Viewer;
32
import org.eclipse.ui.statushandlers.StatusManager;
33
34
/**
35
 * Launches all selected launch configurations.
36
 */
37
public class MultiLaunchAction extends AbstractLaunchConfigurationAction {
38
	
39
	/**
40
	 * Action identifier for IDebugView#getAction(String)
41
	 */
42
	public static final String ID_MULTI_LAUNCH_ACTION = DebugUIPlugin.getUniqueIdentifier() + ".ID_MULTI_LAUNCH_ACTION"; //$NON-NLS-1$
43
44
	/**
45
	 * Constructs an action to launch multiple configurations 
46
	 */
47
	public MultiLaunchAction(Viewer viewer, String mode) {
48
		super(LaunchConfigurationsMessages.MultiLaunchAction__Launch_All_1, viewer, mode); 
49
	}
50
51
	/**
52
	 * @see AbstractLaunchConfigurationAction#performAction()
53
	 */
54
	protected void performAction() {
55
		Object[] selection = getStructuredSelection().toArray();
56
		List launches = new ArrayList();
57
		for (int i = 0; i < selection.length; i++) {
58
			if (selection[i] instanceof ILaunchConfiguration) {
59
				launches.add(selection[i]);
60
			}
61
		}
62
		multiLaunchInBackground((ILaunchConfiguration[]) launches.toArray(new ILaunchConfiguration[launches.size()]));
63
	}
64
65
	private void multiLaunchInBackground(final ILaunchConfiguration[] launches) {
66
		new Job("Multi-Launch") {
67
			protected IStatus run(IProgressMonitor monitor) {
68
				SubMonitor sm = SubMonitor
69
						.convert(
70
								monitor,
71
								LaunchConfigurationsMessages.MultiLaunchAction__Launching_Multiple_1,
72
								launches.length);
73
				try {
74
					for (int i = 0; i < launches.length; i++) {
75
						ILaunch launch = launches[i].launch(getMode(), sm.newChild(1), true);
76
						while (!launch.isTerminated()) {
77
							try {
78
								Thread.sleep(1000);
79
							} catch (InterruptedException e) {
80
								Thread.currentThread().interrupt();
81
								return Status.CANCEL_STATUS;
82
							}
83
							if (monitor.isCanceled()) {
84
								try {
85
									launch.terminate();
86
								} catch (DebugException ex) {
87
									StatusManager.getManager().handle(new Status(IStatus.WARNING, DebugUIPlugin.getUniqueIdentifier(), ex
88
											.getLocalizedMessage(), ex), StatusManager.LOG);
89
								}
90
								return Status.CANCEL_STATUS;
91
							}
92
						}
93
					}
94
				} catch (CoreException coreException) {
95
					Status status = new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), coreException
96
							.getLocalizedMessage(), coreException);
97
					StatusManager.getManager().handle(status, StatusManager.SHOW);
98
					return Status.OK_STATUS;
99
				} finally {
100
					monitor.done();
101
				}
102
				return Status.OK_STATUS;
103
			}
104
		}.schedule();
105
	}
106
107
	/**
108
	 * @see org.eclipse.ui.actions.SelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
109
	 */
110
	protected boolean updateSelection(IStructuredSelection selection) {
111
		if (selection.size() < 2) {
112
			return false;
113
		}
114
		Object[] launches = getStructuredSelection().toArray();
115
		for (int i = 0; i < launches.length; i++) {
116
			if (!(launches[i] instanceof ILaunchConfiguration)) {
117
				return false;
118
			}
119
		}
120
		return true;
121
	}
122
	
123
	/* (non-Javadoc)
124
	 * @see org.eclipse.jface.action.Action#getDisabledImageDescriptor()
125
	 */
126
	public ImageDescriptor getDisabledImageDescriptor() {
127
		return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DUPLICATE_CONFIG);
128
	}
129
130
	/* (non-Javadoc)
131
	 * @see org.eclipse.jface.action.Action#getImageDescriptor()
132
	 */
133
	public ImageDescriptor getImageDescriptor() {
134
		return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DUPLICATE_CONFIG);
135
	}
136
137
	/* (non-Javadoc)
138
	 * @see org.eclipse.jface.action.Action#getToolTipText()
139
	 */
140
	public String getToolTipText() {
141
		return LaunchConfigurationsMessages.LaunchConfigurationsDialog_5;
142
	}
143
144
}

Return to bug 39900