Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: ccb56144dde341003874fe0f8e9101081e666d14 (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
/*******************************************************************************
 *  Copyright (c) 2016, 2018 SSI Schaefer and others.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *
 *  Contributors:
 *      SSI Schaefer - initial API and implementation
 *******************************************************************************/
package org.eclipse.debug.internal.ui.groups;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.IStatusHandler;
import org.eclipse.debug.internal.ui.DebugUIMessages;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.PlatformUI;

/**
 * Handles the case where a launch configuration in a group cannot be launched
 * in the requested mode.
 *
 * @since 3.12
 */
public class UnsupportedModeHandler implements IStatusHandler {

	@Override
	public Object handleStatus(IStatus status, Object source) throws CoreException {
		if (source instanceof String[]) {
			final String[] data = (String[]) source;
			PlatformUI.getWorkbench().getDisplay()
					.asyncExec(() -> MessageDialog.openError(
							PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
							DebugUIMessages.GroupLaunch_Error,
							NLS.bind(DebugUIMessages.GroupLaunch_Cannot_launch, data[0], data[1])));
		}
		return null;
	}

}

Back to the top