3 * Created on 25.11.2004
5 * TODO To change the template for this generated file go to
6 * Window - Preferences - Java - Code Style - Code Templates
8 package net.sourceforge.phpeclipse.xdebug.php.model;
11 import java.util.HashMap;
14 //import net.sourceforge.phpeclipse.xdebug.php.launching.IXDebugConstants;
16 import org.eclipse.core.resources.IMarker;
17 import org.eclipse.core.resources.IResource;
18 import org.eclipse.core.resources.IWorkspaceRunnable;
19 import org.eclipse.core.runtime.CoreException;
20 import org.eclipse.core.runtime.IProgressMonitor;
21 //import org.eclipse.debug.core.DebugPlugin;
22 //import org.eclipse.debug.core.model.Breakpoint;
23 import org.eclipse.debug.core.model.IBreakpoint;
24 //import org.eclipse.debug.core.model.ILineBreakpoint;
25 //import org.eclipse.debug.core.model.LineBreakpoint;
31 * TODO To change the template for this generated type comment go to
32 * Window - Preferences - Java - Code Style - Code Templates
34 public class XDebugConditionalBreakpoint extends XDebugLineBreakpoint /*implements ILineBreakpoint*/ /*extends LineBreakpoint*/ {
37 * Default constructor is required for the breakpoint manager
38 * to re-create persisted breakpoints. After instantiating a breakpoint,
39 * the <code>setMarker(...)</code> method is called to restore
40 * this breakpoint's attributes.
42 private static final String XDEBUG_CONDITIONAL_BREAKPOINT = "net.sourceforge.phpeclipse.xdebug.core.XDebugLineBreakpoint"; //$NON-NLS-1$
45 * Breakpoint attribute storing the fully qualified name of the type
46 * this breakpoint is located in.
47 * (value <code>"net.sourceforge.phpeclipse.debug.typeName"</code>). This attribute is a <code>String</code>.
49 protected static final String TYPE_NAME = "net.sourceforge.phpeclipse.debug.typeName"; //$NON-NLS-1$
51 public static final String BREAKPOINT_ID ="XDebugConditionalBreakpointID";
53 /* public XDebugConditionalBreakpoint() {
57 * Constructs a line breakpoint on the given resource at the given
58 * line number. The line number is 1-based (i.e. the first line of a
59 * file is line number 1).
61 * @param resource file on which to set the breakpoint
62 * @param lineNumber 1-based line number of the breakpoint
63 * @throws CoreException if unable to create the breakpoint
65 public XDebugConditionalBreakpoint(final IResource resource, final int lineNumber) throws CoreException {
66 IWorkspaceRunnable wr = new IWorkspaceRunnable() {
67 public void run(IProgressMonitor monitor) throws CoreException {
70 setMarker(resource.createMarker(XDEBUG_CONDITIONAL_BREAKPOINT));
73 Map attributes = new HashMap(10);
74 addLineBreakpointAttributes(attributes, getModelIdentifier(), true, lineNumber, -1, -1);
77 ensureMarker().setAttributes(attributes);
79 // add to breakpoint manager if requested
83 run(getMarkerRule(resource), wr);
87 /*protected void register(boolean register) throws CoreException {
89 DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(this);
95 public void addLineBreakpointAttributes(Map attributes, String modelIdentifier, boolean enabled, int lineNumber, int charStart, int charEnd) {
96 attributes.put(IBreakpoint.ID, modelIdentifier);
97 attributes.put(IBreakpoint.ENABLED, new Boolean(enabled));
98 attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber));
101 attributes.put(IMarker.CHAR_START, new Integer(charStart));
102 attributes.put(IMarker.CHAR_END, new Integer(charEnd));
104 attributes.put(TYPE_NAME, "typeName");
105 attributes.put(BREAKPOINT_ID,new Integer(-1));