Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: fdef5de75460bcad5e480931c4d9a2ddc1e3b519 (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
/*******************************************************************************
 * Copyright (c) Aug 19, 2013 IBM Corporation 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.debug.internal.examples.mixedmode;

import java.util.Iterator;
import java.util.Set;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchManager;

/**
 * Handler for the Clear Preferred Delegates command
 */
public class ClearPreferredDelegatesHandler extends AbstractHandler {

	/* (non-Javadoc)
	 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
	 */
	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
		ILaunchConfigurationType[] types = lm.getLaunchConfigurationTypes();
		Set<Set<String>> modes = null;
		Set<String> mode = null;
		for (int i = 0; i < types.length; i++) {
			modes = types[i].getSupportedModeCombinations();
			for (Iterator<Set<String>> iter = modes.iterator(); iter.hasNext();) {
				mode = iter.next();
				try {
					types[i].setPreferredDelegate(mode, null);
				} catch (CoreException ce) {
					// /do nothing
				}
			}
		}
		return null;
	}
}

Back to the top