Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6bb79967abaf4154ad994cc70f088a58c4c43465 (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
/*****************************************************************
 * Copyright (c) 2009 Texas Instruments and others
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     Patrick Chuong (Texas Instruments) - Initial API and implementation (Bug 238956)
 *****************************************************************/
package org.eclipse.debug.internal.ui.viewers.update;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckboxModelProxy;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
import org.eclipse.jface.viewers.TreePath;

/**
 * Breakpoint container model proxy.
 *
 * @since 3.6
 */
public class BreakpointContainerProxy extends AbstractModelProxy implements	ICheckboxModelProxy {

	/**
	 * The breakpoint container
	 */
	private IBreakpointContainer fContainer;

	/**
	 * Constructor.
	 *
	 * @param container the breakpoint container.
	 */
	public BreakpointContainerProxy(IBreakpointContainer container) {
		fContainer = container;
	}

	@Override
	public boolean setChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked) {
		boolean atLeastOne = false;
		IBreakpoint[] breakpoints = fContainer.getBreakpoints();
		for (int i = 0; i < breakpoints.length; ++i) {
			try {
				breakpoints[i].setEnabled(checked);
				atLeastOne = true;
			} catch (CoreException e) {}
		}
		return atLeastOne;
	}

}

Back to the top