Skip to main content
summaryrefslogtreecommitdiffstats
blob: cc7b352967e4ea18c5c4615e8d35ea4cfc86b317 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package org.eclipse.debug.core.model;

import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.IDebugConstants;

/**
 * Abstract implementation of a breakpoint. This class is
 * intended to be subclassed by implementations
 * of breakpoints.
 */

public abstract class Breakpoint implements IBreakpoint {
				
	/**
	 * Underlying marker.
	 */
	protected IMarker fMarker= null;
	
	/**
	 * Constructor for Breakpoint
	 */
	public Breakpoint() {
	}
	
	public void setMarker(IMarker marker) throws CoreException {
		fMarker= marker;
	}
	
	public boolean equals(Object item) {
		if (item instanceof IBreakpoint) {
			return getMarker().equals(((IBreakpoint)item).getMarker());
		}
		return false;
	}
	
	public int hashCode() {
		return getMarker().hashCode();
	}
		
	/**
	 * @see IBreakpoint#setEnabled(boolean)
	 */
	public void setEnabled(boolean enabled) throws CoreException {
		if (enabled != isEnabled()) {
			fMarker.setAttribute(IDebugConstants.ENABLED, enabled);
		}
	}
	
	/**
	 * Returns whether the breakpoint is enabled
	 */
	public boolean isEnabled() throws CoreException {
		return fMarker.getAttribute(IDebugConstants.ENABLED, false);
	}

	/**
	 * @see IBreakpoint#delete()
	 */
	public void delete() throws CoreException {
		fMarker.delete();
	}

	/**
	 * @see IBreakpoint#getMarker()
	 */
	public IMarker getMarker() {
		return fMarker;
	}
	
	/**
	 * @see IAdaptable#getAdapter(Class adapter)
	 */
	public Object getAdapter(Class adapter) {		
		return Platform.getAdapterManager().getAdapter(this, adapter);
	}

}

Back to the top