*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.core / src / net / sourceforge / phpeclipse / xdebug / core / XDebugLineBreakpoint.java
1 /*
2  * Created on 25.11.2004
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Style - Code Templates
6  */
7 package net.sourceforge.phpeclipse.xdebug.core;
8
9 import org.eclipse.core.resources.IMarker;
10 import org.eclipse.core.resources.IResource;
11 import org.eclipse.core.runtime.CoreException;
12 import org.eclipse.debug.core.model.IBreakpoint;
13 import org.eclipse.debug.core.model.LineBreakpoint;
14 import net.sourceforge.phpeclipse.xdebug.core.IXDebugConstants;
15
16 /**
17  * @author Axel
18  *
19  * TODO To change the template for this generated type comment go to
20  * Window - Preferences - Java - Code Style - Code Templates
21  */
22 public class XDebugLineBreakpoint  extends LineBreakpoint {
23         
24         /**
25          * Default constructor is required for the breakpoint manager
26          * to re-create persisted breakpoints. After instantiating a breakpoint,
27          * the <code>setMarker(...)</code> method is called to restore
28          * this breakpoint's attributes.
29          */
30         public XDebugLineBreakpoint() {
31         }
32         
33         /**
34          * Constructs a line breakpoint on the given resource at the given
35          * line number. The line number is 1-based (i.e. the first line of a
36          * file is line number 1). The PDA VM uses 0-based line numbers,
37          * so this line number translation is done at breakpoint install time.
38          * 
39          * @param resource file on which to set the breakpoint
40          * @param lineNumber 1-based line number of the breakpoint
41          * @throws CoreException if unable to create the breakpoint
42          */
43         public XDebugLineBreakpoint(IResource resource, int lineNumber) throws CoreException {
44                 IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.lineBreakpoint.marker");
45                 setMarker(marker);
46                 setEnabled(true);
47                 ensureMarker().setAttribute(IMarker.LINE_NUMBER, lineNumber);
48                 ensureMarker().setAttribute(IBreakpoint.ID, IXDebugConstants.ID_XDEBUG_DEBUG_MODEL);
49         }
50         
51         /* (non-Javadoc)
52          * @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier()
53          */
54         public String getModelIdentifier() {
55                 return IXDebugConstants.ID_XDEBUG_DEBUG_MODEL;
56         }
57 }