Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: ceb712bf110982b75f48495ea20a820b8a127ff8 (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
59
60
61
62
63
64
65
66
/*******************************************************************************
 * Copyright (c) 2008, 2018 QNX Software Systems 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:
 * QNX Software Systems - Initial API and implementation
 * QNX Software Systems - catchpoints - bug 226689
 *******************************************************************************/
package org.eclipse.cdt.debug.internal.core.breakpoints;

import java.util.Map;

import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;

public class CEventBreakpoint extends CBreakpoint implements ICEventBreakpoint {

	public CEventBreakpoint() {
	}

	public CEventBreakpoint(IResource resource, Map<String, Object> attributes, boolean add) throws CoreException {
		this();
		// event breakpoint must set non null EVENT_TYPE_ID property to be valid
		if (attributes.get(EVENT_TYPE_ID) == null)
			throw new IllegalArgumentException();
		CDIDebugModel.createBreakpointMarker(this, resource, attributes, add);
	}

	@Override
	public String getMarkerType() {
	    return C_EVENT_BREAKPOINT_MARKER;
	}
	
	@Override
	protected String getMarkerMessage() throws CoreException {
		// default message, overridden by label provider, which would take care of translation
		return "Event Breakpoint: " + getEventType(); //$NON-NLS-1$ 
	}

	/**
	 * @see ICEventBreakpoint#getEventType()
	 */
	@Override
	public String getEventType() throws DebugException {
		return ensureMarker().getAttribute(EVENT_TYPE_ID, ""); //$NON-NLS-1$
	}

	/**
	 * @see ICEventBreakpoint#getEventArgument()
	 */
	@Override
	public String  getEventArgument() throws CoreException {
		return ensureMarker().getAttribute(EVENT_ARG, ""); //$NON-NLS-1$
	}

}

Back to the top