Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.core/core/org/eclipse/debug/core')
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpoint.java45
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointListener.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java55
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugConstants.java36
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILineBreakpoint.java35
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java74
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java104
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILineBreakpoint.java36
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java49
9 files changed, 286 insertions, 150 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpoint.java
deleted file mode 100644
index 9690b734e..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpoint.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.debug.core;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-
-public interface IBreakpoint {
-
-/**
- * Deletes this marker from its associated resource. This method has no
- * effect if this marker does not exist.
- *
- * @exception CoreException if this marker could not be deleted. Reasons include:
- * <ul>
- * <li> Resource changes are disallowed during resource change event notification.</li>
- * </ul>
- */
-public void delete() throws CoreException;
-
-/**
- * Returns the marker associated with the breakpoint.
- *
- * @return the marker, or <code>null</code> if the marker does not exist.
- */
-public IMarker getMarker();
-/**
- * Sets the marker associated with this breakpoint to the given marker
- */
-public void setMarker(IMarker marker);
-/**
- * Returns the model identifier for this breakpoint.
- */
-public String getModelIdentifier();
-/**
- * Returns whether this breakpoint is enabled
- */
-public boolean isEnabled() throws CoreException;
-/**
- * Set the enabled state of this breakpoint.
- *
- * @param enabled whether this breakpoint should be enabled
- */
-public void setEnabled(boolean enabled) throws CoreException;
-
-}
-
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointListener.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointListener.java
index 0d805f840..0b4ef04dd 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointListener.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointListener.java
@@ -6,8 +6,8 @@ package org.eclipse.debug.core;
*/
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.debug.core.model.IBreakpoint;
/**
* A breakpoint listener is notified of breakpoint additions,
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java
index be82c0776..24c979918 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java
@@ -7,6 +7,7 @@ package org.eclipse.debug.core;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IBreakpoint;
/**
* The breakpoint manager manages the collection of breakpoints
@@ -14,20 +15,14 @@ import org.eclipse.core.runtime.CoreException;
* program being debugged. The kinds of breakpoint supported by each
* debug architecture and the information required to create those
* breakpoints is dictated by each debug architecture.
- *
* <p>
* Breakpoint creation is a client responsibility. Breakpoints
* are only considered active when registered with the breakpoint manager.
* </p>
* <p>
- * As launches are registered and deregistered, the breakpoint
- * manager automatically adds and removes debug targets associated with those
- * lauches, as breakpoint listeners.
- * Debug targets (implementors of <code>IBreakpointSupport</code>) are
- * informed of breakpoint additions, removals, and changes if they
- * respond <code>true</code> to <code>supportsBreakpoints()</code>.
- * A debug target is responsible for installing all existing
- * (applicable) breakpoints when created.
+ * Clients interested in breakpoint change notification may
+ * register with the breakpoint manager - see
+ * <code>IBreakpointListener</code>.
* </p>
* <p>
* This interface is not intended to be implemented by clients.
@@ -38,7 +33,6 @@ import org.eclipse.core.runtime.CoreException;
* from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
* (repeatedly) as the API evolves.
* </p>
- * @see org.eclipse.debug.core.model.IBreakpointSupport
*/
public interface IBreakpointManager {
/**
@@ -83,23 +77,6 @@ public interface IBreakpointManager {
* @return an array of breakpoints
*/
IBreakpoint[] getBreakpoints(String modelIdentifier);
-
- /**
- * Returns a collection of all existing markers.
- * Returns an empty array if no markers exist.
- *
- * @return an array of breakpoint markers
- */
- IMarker[] getMarkers();
- /**
- * Returns a collection of all markers registered for the
- * given debug model. Answers an empty array if no markers are registered
- * for the given debug model.
- *
- * @param modelIdentifier identifier of a debug model plug-in
- * @return an array of breakpoint markers
- */
- IMarker[] getMarkers(String modelIdentifier);
/**
* Returns whether the given breakpoint is currently
@@ -110,28 +87,20 @@ public interface IBreakpointManager {
boolean isRegistered(IBreakpoint breakpoint);
/**
- * Removes the given breakpoint from the breakpoint manager, and notifies all
- * registered listeners. The breakpoint is deleted if the <code>delete</code> flag is
- * true. Has no effect if the given breakpoint is not currently registered.
+ * Removes the given breakpoint from the breakpoint manager, invokes
+ * <code>delete()</code> on the breakpoint if the <code>delete</code> flag
+ * is <code>true</code>, and notifies all registered
+ * listeners. Has no effect if the given breakpoint is not currently
+ * registered.
*
* @param breakpoint the breakpoint to remove
- * @param delete whether the breakpoint should be deleted
- * @exception CoreException if an exception occurs while deleting the breakpoint.
+ * @param delete whether to delete the given breakpoint
+ * @exception CoreException if an exception occurs while deleting the
+ * underlying marker.
*/
void removeBreakpoint(IBreakpoint breakpoint, boolean delete) throws CoreException;
/**
- * Removes the breakpoint associated with the given marker from the breakpoint manager, and notifies all
- * registered listeners. The marker is deleted if the <code>delete</code> flag is
- * true. Has no effect if the given breakpoint is not currently registered.
- *
- * @param marker the marker to remove
- * @param delete whether the breakpoint marker should be deleted
- * @exception CoreException if an exception occurs while deleting the marker.
- */
- void removeMarker(IMarker marker, boolean delete) throws CoreException;
-
- /**
* Adds the given listener to the collection of registered breakpoint listeners.
* Has no effect if an identical listener is already registered.
*
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugConstants.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugConstants.java
index a5be1a2ac..21a68175f 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugConstants.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugConstants.java
@@ -36,41 +36,19 @@ public interface IDebugConstants {
* (value <code>"breakpoints"</code>).
*/
public static final String EXTENSION_POINT_BREAKPOINTS= "breakpoints";
-
- /**
- * Root breakpoint marker type
- * (value <code>"org.eclipse.debug.core.breakpoint"</code>).
- */
- public static final String BREAKPOINT = "breakpointMarker";
-
- /**
- * Line breakpoint type.
- * (value <code>"org.eclipse.debug.core.lineBreakpoint"</code>).
- */
- public static final String LINE_BREAKPOINT = "lineBreakpointMarker";
-
+
/**
* Root breakpoint marker type
* (value <code>"org.eclipse.debug.core.breakpoint"</code>).
*/
- public static final String BREAKPOINT_MARKER = PLUGIN_ID + "." + BREAKPOINT;
+ public static final String BREAKPOINT_MARKER = PLUGIN_ID + ".breakpointMarker";
/**
* Line breakpoint marker type.
* (value <code>"org.eclipse.debug.core.lineBreakpoint"</code>).
*/
- public static final String LINE_BREAKPOINT_MARKER = PLUGIN_ID + "." + LINE_BREAKPOINT;
-
- /**
- * Debug model identifier breakpoint marker attribute
- * (value <code>"modelIdentifier"</code>).
- * This attribute is a <code>String<code> corresponding to the identifier
- * of a debug model plugin a breakpoint is associated with.
- *
- * @see org.eclipse.core.resources.IMarker#getAttribute(String, String)
- */
- public static final String MODEL_IDENTIFIER = "modelIdentifier";
-
+ public static final String LINE_BREAKPOINT_MARKER = PLUGIN_ID + ".lineBreakpointMarker";
+
/**
* Enabled breakpoint marker attribute (value <code>"enabled"</code>).
* The attribute is a <code>boolean</code> corresponding to the
@@ -87,4 +65,10 @@ public interface IDebugConstants {
*/
public final static String ID= "id";
+ /**
+ * Attribute name for the <code>"markerType"</code> attribute of
+ * a breakpoint extension.
+ */
+ public final static String MARKER_TYPE= "markerType";
+
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILineBreakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILineBreakpoint.java
deleted file mode 100644
index ad4a32cd8..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILineBreakpoint.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.debug.core;
-public interface ILineBreakpoint extends IBreakpoint {
-
-/**
- * Returns the value of the <code>LINE_NUMBER</code> attribute of the
- * given breakpoint or -1 if the attribute is not present or
- * an exception occurs while accessing the attribute. This is a
- * convenience method for <code>IMarker.getAttribute(String, int)</code>.
- *
- * @param breakpoint the breakpoint
- * @return the breakpoint's line number, or -1 if unknown
- */
-public int getLineNumber();
-/**
- * Returns the value of the <code>CHAR_START</code> attribute of the
- * given breakpoint or -1 if the attribute is not present, or
- * an exception occurs while accessing the attribute. This is a
- * convenience method for <code>IMarker.getAttribute(String, int)</code>
- *
- * @param breakpoint the breakpoint
- * @return the breakpoint's char start value, or -1 if unknown
- */
-public int getCharStart();
-/**
- * Returns the value of the <code>CHAR_END</code> attribute of the
- * given breakpoint or -1 if the attribute is not present or
- * an exception occurs while accessing the attribute.
- * This is a convenience method for <code>IMarker.getAttribute(String, int)</code>.
- *
- * @param breakpoint the breakpoint
- * @return the breakpoint's char end value, or -1 if unknown
- */
-public int getCharEnd();
-}
-
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
new file mode 100644
index 000000000..19bfe199b
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
@@ -0,0 +1,74 @@
+package org.eclipse.debug.core.model;
+
+import java.util.Map;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+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;
+ }
+
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java
new file mode 100644
index 000000000..110a58364
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java
@@ -0,0 +1,104 @@
+package org.eclipse.debug.core.model;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * A breakpoint is capable of suspending the execution of a
+ * program at a specific location when a program is running
+ * in debug mode. Each breakpoint has an associated marker which
+ * stores and persists all attributes associated with each breakpoint.
+ * <p>
+ * A breakpoint is defined in two parts:
+ * <ol>
+ * <li>By an extension of kind <code>"org.eclipse.debug.core.breakpoints"</li>
+ * <li>By a marker definition that corresnponds to the above breakpoint extension</li>
+ * </ol>
+ * <p>
+ * For example, following is a definition of corresponding breakpoint
+ * and breakpoint marker defintions. Note that the <ocde>markerType</code>
+ * attribute defined by the breakpoint extension corresponds to the
+ * type of the marker definition.
+ * <pre>
+ * &lt;extension point="org.eclipse.debug.core.breakpoints"&gt;
+ * &lt;breakpoint
+ * id="com.example.Breakpoint"
+ * class="com.example.Breakpoint"
+ * markerType="com.example.BreakpointMarker"&gt;
+ * &lt;/breakpoint&gt;
+ * &lt;/extension&gt;
+ * &lt;extension point="org.eclipse.core.resources.markers"&gt;
+ * &lt;marker
+ * id="com.example.BreakpointMarker"
+ * super type="org.eclipse.debug.core.breakpointMarker"
+ * attribute name ="exampleAttribute"&gt;
+ * &lt;/marker&gt;
+ * &lt;/extension&gt;
+ * </pre>
+ * <p>
+ * The breakpoint manager instantiates persisted breakpoints by
+ * traversing all markers that are a subtype of
+ * <code>"org.eclipse.debug.core.breakpointMarker"</code>, and
+ * instantiating the class defined by the <code>class</code> attribute
+ * on the associated breakpoint extension. The method <code>setMarker</code>
+ * is then called to associated a marker with the breakpoint.
+ */
+
+public interface IBreakpoint {
+
+/**
+ * Deletes this breakpoint's underlying marker, and removes
+ * this breakpoint from the breakpoint manager.
+ *
+ * @exception CoreException if deleting the underlying marker throws
+ * a <code>CoreException<code>.
+ */
+public void delete() throws CoreException;
+
+/**
+ * Returns the marker associated with this breakpoint, or
+ * <code>null</code> if no marker is associated with this breakpoint.
+ *
+ * @return associated marker, or <code>null</code> if there is
+ * no associated marker.
+ */
+public IMarker getMarker();
+/**
+ * Sets the marker associated with this breakpoint. This method is
+ * only called at breakpoint creation, when restoring a persisted
+ * marker.
+ *
+ * @param marker the marker to associate with this breakpoint
+ * @exception CoreException if an error occurrs accessing the marker
+ */
+public void setMarker(IMarker marker) throws CoreException;
+/**
+ * Returns the identifier of the debug model this breakpoint is
+ * asscoiated with.
+ *
+ * @return the identifier of the debug model this breakpoint is
+ * associated with
+ */
+public String getModelIdentifier();
+/**
+ * Returns whether this breakpoint is enabled
+ *
+ * @exception CoreException if a <code>CoreException</code> is
+ * thrown when retrieving the enabled attribute from the underlying marker
+ * @return whether this breakpoint is enabled
+ */
+public boolean isEnabled() throws CoreException;
+/**
+ * Sets the enabled state of this breakpoint. This has no effect
+ * if the current enabled state is the same as specified by the
+ * enabled parameter.
+ *
+ * @param enabled whether this breakpoint should be enabled
+ * @exception CoreException if a <code>CoreException</code> is thrown
+ * when setting the attribute on the underlying marker.
+ */
+public void setEnabled(boolean enabled) throws CoreException;
+
+}
+
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILineBreakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILineBreakpoint.java
new file mode 100644
index 000000000..67626b680
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILineBreakpoint.java
@@ -0,0 +1,36 @@
+package org.eclipse.debug.core.model;
+
+import org.eclipse.core.runtime.CoreException;
+
+public interface ILineBreakpoint extends IBreakpoint {
+
+/**
+ * Returns the line number in the original source that corresponds
+ * to the location of this breakpoint, or -1 if the attribute is not
+ * present.
+ *
+ * @return this breakpoint's line number, or -1 if unknown
+ * @exception CoreException if a <code>CoreException</code> is thrown
+ * while accessing the underlying <code>LINE_NUMBER</code> marker attribute
+ */
+public int getLineNumber() throws CoreException;
+/**
+ * Returns starting source index in the original source that corresponds
+ * to the location of this breakpoint, or -1 if the attribute is not present.
+ *
+ * @return this breakpoint's char start value, or -1 if unknown
+ * @exception CoreException if a <code>CoreException</code> is thrown
+ * while accessing the underlying <code>CHAR_START</code> marker attribute
+ */
+public int getCharStart() throws CoreException;
+/**
+ * Returns ending source index in the original source that corresponds
+ * to the location of this breakpoint, or -1 if the attribute is not present.
+ *
+ * @return this breakpoint's char end value, or -1 if unknown
+ * @exception CoreException if a <code>CoreException</code> is thrown
+ * while accessing the underlying <code>CHAR_END</code> marker attribute
+ */
+public int getCharEnd() throws CoreException;
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java
new file mode 100644
index 000000000..bd2536da3
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java
@@ -0,0 +1,49 @@
+package org.eclipse.debug.core.model;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+
+/**
+ * Abstract implementation of a line breakpoint. This class is
+ * intended to be subclassed by debug model specific implementations
+ * of line breakpoints.
+ */
+
+public abstract class LineBreakpoint extends Breakpoint implements ILineBreakpoint {
+
+
+ /**
+ * @see ILineBreakpoint#getLineNumber()
+ */
+ public int getLineNumber() throws CoreException {
+ IMarker m = getMarker();
+ if (m != null) {
+ return m.getAttribute(IMarker.LINE_NUMBER, -1);
+ }
+ return -1;
+ }
+
+ /**
+ * @see ILineBreakpoint#getCharStart()
+ */
+ public int getCharStart() throws CoreException {
+ IMarker m = getMarker();
+ if (m != null) {
+ return m.getAttribute(IMarker.CHAR_START, -1);
+ }
+ return -1;
+ }
+
+ /**
+ * @see ILineBreakpoint#getCharEnd()
+ */
+ public int getCharEnd() throws CoreException {
+ IMarker m = getMarker();
+ if (m != null) {
+ return m.getAttribute(IMarker.CHAR_END, -1);
+ }
+ return -1;
+ }
+}
+

Back to the top