1
/*******************************************************************************
2
* Copyright (c) 2008, 2010 Wind River Systems 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
9
* Wind River Systems - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints;
13
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMProvider;
14
import org.eclipse.cdt.dsf.ui.viewmodel.DefaultVMModelProxyStrategy;
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.debug.core.DebugPlugin;
17
import org.eclipse.debug.core.model.IBreakpoint;
18
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
19
import org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckboxModelProxy;
20
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
21
import org.eclipse.jface.viewers.TreePath;
24
* Breakpoints VM model proxy that includes an ICheckboxModelProxy implementation.
28
public class BreakpointVMModelProxyStrategy extends DefaultVMModelProxyStrategy implements ICheckboxModelProxy {
30
public BreakpointVMModelProxyStrategy(AbstractVMProvider provider, Object rootElement) {
31
super(provider, rootElement);
34
public boolean setChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked) {
35
Object lastSegment = path.getLastSegment();
36
if (lastSegment instanceof IBreakpointContainer) {
37
IBreakpoint[] breakpoints = ((IBreakpointContainer) lastSegment).getBreakpoints();
38
for (int i = 0; i < breakpoints.length; ++i) {
40
breakpoints[i].setEnabled(checked);
41
} catch (CoreException e) {
48
IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(lastSegment, IBreakpoint.class);
49
if (breakpoint != null) {
51
breakpoint.setEnabled(checked);
52
} catch (CoreException e) {