Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2001-08-24 15:14:19 +0000
committerDarin Wright2001-08-24 15:14:19 +0000
commit9c0aec215837308f91b7d88792927779676ee91a (patch)
treee86773c2ca337b9895538e24859fc4312ba8162c
parent8b274fcc46d6c5cdaf15ec79cc1b26eb62c276c5 (diff)
downloadeclipse.platform.debug-9c0aec215837308f91b7d88792927779676ee91a.tar.gz
eclipse.platform.debug-9c0aec215837308f91b7d88792927779676ee91a.tar.xz
eclipse.platform.debug-9c0aec215837308f91b7d88792927779676ee91a.zip
1GI3JYO: ITPDUI:ALL - The case for IBreakpoints
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java34
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpoint.java119
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointFactory.java23
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointListener.java10
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java190
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugConstants.java25
-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/IBreakpointFactoryDelegate.java29
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointSupport.java86
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java412
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointFactory.java78
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java242
-rw-r--r--org.eclipse.debug.core/plugin.xml1
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsView.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/EnableDisableBreakpointAction.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllBreakpointsAction.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveBreakpointAction.java3
20 files changed, 1007 insertions, 432 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
index afc3fe65c..20e5f9e4a 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
@@ -5,9 +5,9 @@ package org.eclipse.debug.core;
* All Rights Reserved.
*/
+import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.internal.core.*;
-import org.eclipse.core.runtime.*;
/**
* There is one instance of the debug plugin available from
@@ -42,6 +42,11 @@ public class DebugPlugin extends Plugin {
private Launcher[] fLaunchers= new Launcher[0];
/**
+ * The collection of breakpoint factory extensions.
+ */
+ private IBreakpointFactory[] fBreakpointFactories= new IBreakpointFactory[0];
+
+ /**
* The singleton breakpoint manager.
*/
private BreakpointManager fBreakpointManager;
@@ -157,6 +162,32 @@ public class DebugPlugin extends Plugin {
fLaunchers[i]= new Launcher(infos[i]);
}
}
+
+ /**
+ * Returns a collection of breakpoint factory extensions. Breakpoint factory represent
+ * and provide access to breakpoint factory extensions.
+ *
+ * @return an array of breakpoint factory
+ * @see org.eclipse.debug.core.IBreakpointFactory
+ */
+ public IBreakpointFactory[] getBreakpointFactories() {
+ return fBreakpointFactories;
+ }
+
+ /**
+ * Loads all breakpoint factory extensions.
+ *
+ * @exception CoreException if creation of a breakpoint factory extension fails
+ */
+ protected void loadBreakpointFactories() throws CoreException {
+ IPluginDescriptor descriptor= getDescriptor();
+ IExtensionPoint extensionPoint= descriptor.getExtensionPoint(IDebugConstants.EXTENSION_POINT_BREAKPOINT_FACTORY);
+ IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
+ fBreakpointFactories= new IBreakpointFactory[infos.length];
+ for (int i= 0; i < infos.length; i++) {
+ fBreakpointFactories[i]= new BreakpointFactory(infos[i]);
+ }
+ }
/**
* Removes the given listener from the collection of registered debug
@@ -204,6 +235,7 @@ public class DebugPlugin extends Plugin {
fLaunchManager= new LaunchManager();
fBreakpointManager= new BreakpointManager();
loadLaunchers();
+ loadBreakpointFactories();
fBreakpointManager.startup();
}
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
new file mode 100644
index 000000000..e0bddef8d
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpoint.java
@@ -0,0 +1,119 @@
+package org.eclipse.debug.core;
+
+import java.util.Map;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IDebugTarget;
+
+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;
+/**
+ * Tests this breakpoint for equality with the given object.
+ * Two breakpoints are equal if their markers have the same id.
+ * Markers are assigned an id when created on a resource.
+ *
+ * @param object the other object
+ * @return an indication of whether the objects are equal
+ */
+public boolean equals(Object object);
+/**
+ * Returns whether this marker exists in the workspace. A marker
+ * exists if its resource exists and has a marker with the marker's id.
+ *
+ * @return <code>true</code> if this marker exists, otherwise
+ * <code>false</code>
+ */
+public boolean exists();
+/**
+ * Enable this breakpoint
+ */
+public void enable() throws CoreException;
+/**
+ * Disable this breakpoint
+ */
+public void disable() 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 the id of the marker. The id of a marker is unique
+ * relative to the resource with which the marker is associated.
+ * Marker ids are not globally unique.
+ *
+ * @return the id of the marker
+ * @see IResource#findMarker
+ */
+public long getId();
+/**
+ * Returns the resource with which this marker is associated.
+ *
+ * @return the resource with which this marker is associated
+ */
+public IResource getResource();
+/**
+ * Returns the type of this breakpoint.
+ *
+ * @return the type of this marker
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li> This marker does not exist.</li>
+ * </ul>
+ */
+public String getType() throws CoreException;
+/**
+ * Returns whether this breakpoint is enabled
+ */
+public boolean isEnabled() throws CoreException;
+/**
+ * Returns whether this breakpoint is disabled
+ */
+public boolean isDisabled() throws CoreException;
+/**
+ * Sets the enabled state of this breakpoint to the opposite of its
+ * current state.
+ */
+public void toggleEnabled() throws CoreException;
+
+/**
+ * Install a breakpoint request for this breakpoint in the given target.
+ *
+ * @param target the debug target into which the request should be added.
+ */
+public abstract void addToTarget(IDebugTarget target);
+/**
+ * Update the breakpoint request for this breakpoint in the given target.
+ *
+ * @param target the debug target for which the request should be updated.
+ */
+public abstract void changeForTarget(IDebugTarget target);
+/**
+ * Remove the breakpoint request for this breakpoint from the given target.
+ *
+ * @param target the debug target from which the request should be removed.
+ */
+public abstract void removeFromTarget(IDebugTarget target);
+
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointFactory.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointFactory.java
new file mode 100644
index 000000000..311711536
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointFactory.java
@@ -0,0 +1,23 @@
+package org.eclipse.debug.core;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Creates breakpoints from markers
+ */
+public interface IBreakpointFactory {
+
+ /**
+ * Create a breakpoint for the given marker based on the marker type
+ */
+ IBreakpoint createBreakpointFor(IMarker marker) throws DebugException;
+
+ /**
+ * Returns whether this breakpoint factory knows how to create
+ * breakpoints for the given marker.
+ */
+ boolean canCreateBreakpointsFor(IMarker marker) 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 49629fe40..0d805f840 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
@@ -32,12 +32,12 @@ public interface IBreakpointListener {
*
* @param breakpoint the added breakpoint
*/
- public void breakpointAdded(IMarker breakpoint);
+ public void breakpointAdded(IBreakpoint breakpoint);
/**
* Notifies this listener that the given breakpoint has been removed.
- * If the given marker has been removed because it has been deleted,
+ * If the given breakpoint has been removed because it has been deleted,
* the associated marker delta is also provided such that any attributes
- * of the marker can still be accessed.
+ * of the breakpoint can still be accessed.
*
* @param breakpoint the removed breakpoint
* @param delta the associated marker delta, or <code>null</code> when
@@ -46,7 +46,7 @@ public interface IBreakpointListener {
*
* @see org.eclipse.core.resources.IMarkerDelta
*/
- public void breakpointRemoved(IMarker breakpoint, IMarkerDelta delta);
+ public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta);
/**
* Notifies this listener that an attribute of the given breakpoint has
@@ -57,6 +57,6 @@ public interface IBreakpointListener {
*
* @see org.eclipse.core.resources.IMarkerDelta
*/
- public void breakpointChanged(IMarker breakpoint, IMarkerDelta delta);
+ public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta);
} \ No newline at end of file
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 e71f39119..80394504b 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
@@ -5,7 +5,6 @@ package org.eclipse.debug.core;
* All Rights Reserved.
*/
-
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
@@ -15,26 +14,9 @@ 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>
- * Breakpoints are implemented by markers. The debug plug-in defines a root
- * breakpoint marker of which all breakpoints should be subtypes. The
- * debug plug-in also defines a common line breakpoint. Convenience methods
- * are defined to configure the attributes of breakpoints defined by
- * the debug plug-in. See <code>configureBreakpoint(IMarker, String, boolean)</code>
- * and <code>configureLineBreakpoint(IMarker, String, boolean, int, int, int)</code>.
- * </p>
- * <p>All breakpoints have:<ul>
- * <li> a model identifier, specifying the identifier of the debug model the breakpoint
- * is intended for</li>
- * <li> a enabled attribute, specifying if the breakpoint is enabled or disabled</li>.
- * </ul>
- * Additionally, all line breakpoints have a line number and/or a character start and
- * end range.
- * </p>
- * <p>
- * Breakpoint creation is a client responsibility. Creation of a breakpoint requires
- * the creation of a marker. It is a client responsibility to determine which
- * resource a breakpoint marker should be associated/persisted with. Breakpoints
+ * Breakpoint creation is a client responsibility. Breakpoints
* are only considered active when registered with the breakpoint manager.
* </p>
* <p>
@@ -56,60 +38,9 @@ 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 IMarker
* @see org.eclipse.debug.core.model.IBreakpointSupport
*/
public interface IBreakpointManager {
-
- /**
- * Configures the given breakpoint's <code>MODEL_IDENTIFIER</code>
- * and <code>ENABLED</code> attributes to the given values.
- * This is a convenience method for
- * <code>IMarker.setAttribute(String, Object)</code> and
- * <code>IMarker.setAttribute(String, boolean)</code>.
- * <code>IMarker.setAttribute(String, int)</code>.
- *
- * @param breakpoint the breakpoint marker to configure
- * @param modelIdentifier the identifier of the debug model plug-in
- * the breakpoint is associated with
- * @param enabled the initial value of the enabled attribute of the
- * breakpoint marker
- *
- * @exception CoreException if setting an attribute fails
- * @see IMarker#setAttribute(String, Object)
- * @see IMarker#setAttribute(String, boolean)
- * @see IMarker#setAttribute(String, int)
- */
- void configureBreakpoint(IMarker breakpoint, String modelIdentifier, boolean enabled) throws CoreException;
-
- /**
- * Configures the given breakpoint's <code>MODEL_IDENTIFIER</code>,
- * <code>ENABLED</code>, <code>LINE_NUMBER</code>, <code>CHAR_START</code>,
- * and <code>CHAR_END</code> attributes to the given values.
- * This is a convenience method for
- * <code>IMarker.setAttribute(String, Object)</code>,
- * <code>IMarker.setAttribute(String, boolean)</code>, and
- * <code>IMarker.setAttribute(String, int)</code>.
- *
- * @param breakpoint the line breakpoint marker to configure
- * @param modelIdentifier the identifier of the debug model plug-in
- * the breakpoint is associated with
- * @param enabled the initial value of the enabled attribute of the
- * breakpoint marker
- * @param lineNumber the line number the breakpoint is associated with, or -1
- * if unknown
- * @param charStart the index in an associated source element, of the first
- * character associated with the breakpoint, or -1 if unknown
- * @param charEnd the index in an associated source element, of the last
- * character associated with the breakpoint, or -1 if unknown
- *
- * @exception CoreException if setting an attribute fails
- * @see IMarker#setAttribute(String, Object)
- * @see IMarker#setAttribute(String, boolean)
- * @see IMarker#setAttribute(String, int)
- */
- void configureLineBreakpoint(IMarker breakpoint, String modelIdentifier, boolean enabled, int lineNumber, int charStart, int charEnd) throws CoreException;
-
/**
* Adds the given breakpoint to the collection of active breakpoints
* in the workspace and notifies all registered listeners. This has no effect
@@ -124,15 +55,31 @@ public interface IBreakpointManager {
* attribute.</li>
* </ul>
*/
- void addBreakpoint(IMarker breakpoint) throws DebugException;
+ void addBreakpoint(IBreakpoint breakpoint) throws DebugException;
+
+ /**
+ * Create a breakpoint for the given marker and add it.
+ *
+ * @return the breakpoint that is created
+ */
+ IBreakpoint loadMarker(IMarker marker) throws DebugException;
+
+ /**
+ * Returns the breakpoint that is associated with marker or
+ * <code>null</code> if no such breakpoint exists
+ *
+ * @param marker the marker
+ * @return the breakpoint associated with the marker or null if none exists
+ */
+ IBreakpoint getBreakpoint(IMarker marker);
/**
* Returns a collection of all existing breakpoints.
* Returns an empty array if no breakpoints exist.
*
- * @return an array of breakpoint markers
+ * @return an array of breakpoints
*/
- IMarker[] getBreakpoints();
+ IBreakpoint[] getBreakpoints();
/**
* Returns a collection of all breakpoints registered for the
@@ -140,99 +87,56 @@ public interface IBreakpointManager {
* for the given debug model.
*
* @param modelIdentifier identifier of a debug model plug-in
- * @return an array of breakpoint markers
+ * @return an array of breakpoints
*/
- IMarker[] getBreakpoints(String modelIdentifier);
-
+ IBreakpoint[] getBreakpoints(String modelIdentifier);
+
/**
- * Returns the value of the <code>ENABLED</code> attribute of the
- * given breakpoint - <code>true</code> if the breakpoint is enabled,
- * otherwise <code>false</code>. By default, if the attribute has not
- * been set, a breakpoint is considered enabled.
- * Note, this method returns <code>false</code>
- * if an exception occurs while accessing the attribute. This is
- * a convenience method for
- * <code>IMarker.getAttribute(String, boolean)</code>.
+ * Returns a collection of all existing markers.
+ * Returns an empty array if no markers exist.
*
- * @param breakpoint the breakpoint
- * @return whether the breakpoint is enabled
- * @see IMarker#getAttribute(String, boolean)
+ * @return an array of breakpoint markers
*/
- boolean isEnabled(IMarker breakpoint);
-
+ IMarker[] getMarkers();
/**
- * Sets the value of the <code>ENABLED</code> attribute of the
- * given breakpoint. This is a convenience method for
- * <code>IMarker.setAttribute(String, boolean)</code>.
+ * 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.
*
- * @exception CoreException if setting the attribute fails
- * @see IMarker#setAttribute(String, boolean)
+ * @param modelIdentifier identifier of a debug model plug-in
+ * @return an array of breakpoint markers
*/
- void setEnabled(IMarker breakpoint, boolean value) throws CoreException;
-
+ IMarker[] getMarkers(String modelIdentifier);
+
/**
* Returns whether the given breakpoint is currently
* registered with this breakpoint manager.
*
* @return whether the breakpoint is registered
*/
- boolean isRegistered(IMarker marker);
-
- /**
- * 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
- */
- int getLineNumber(IMarker breakpoint);
-
- /**
- * 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
- */
- int getCharStart(IMarker breakpoint);
-
- /**
- * 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
- */
- int getCharEnd(IMarker breakpoint);
-
+ boolean isRegistered(IBreakpoint breakpoint);
+
/**
- * Returns the value of the <code>MODEL_IDENTIFIER</code> attribute of the
- * given breakpoint or <code>null</code> if the attribute is not present or
- * an exception occurs while accessing the attribute. This is a convenience method
- * for <code>IMarker.getAttribute(String, String)</code>.
+ * 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.
*
- * @param breakpoint the breakpoint
- * @return the breakpoint's debug model plug-in identifier, or <code>null</code>
- * if an exception occurs retrieving the attribute
+ * @param breakpoint the breakpoint to remove
+ * @param delete whether the breakpoint should be deleted
+ * @exception CoreException if an exception occurs while deleting the breakpoint.
*/
- String getModelIdentifier(IMarker breakpoint);
+ void removeBreakpoint(IBreakpoint breakpoint, boolean delete) throws CoreException;
/**
- * Removes the given breakpoint from the breakpoint manager, and notifies all
+ * 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 breakpoint the breakpoint to remove
+ * @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 removeBreakpoint(IMarker breakpoint, boolean delete) throws CoreException;
+ void removeMarker(IMarker marker, boolean delete) throws CoreException;
/**
* Adds the given listener to the collection of registered breakpoint listeners.
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 2c1055c6f..ffc09ab5d 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
@@ -32,6 +32,12 @@ public interface IDebugConstants {
public static final String EXTENSION_POINT_LAUNCHER= "launchers";
/**
+ * Breakpoint factory extension point identifier
+ * (value <code>"breakpoint_factories"</code>).
+ */
+ public static final String EXTENSION_POINT_BREAKPOINT_FACTORY= "breakpoint_factories";
+
+ /**
* Root breakpoint marker type
* (value <code>"org.eclipse.debug.core.breakpoint"</code>).
*/
@@ -44,6 +50,18 @@ public interface IDebugConstants {
public static final String LINE_BREAKPOINT_MARKER = PLUGIN_ID + ".lineBreakpoint";
/**
+ * Root breakpoint type
+ * (value <code>"org.eclipse.debug.core.breakpoint"</code>).
+ */
+ public static final String BREAKPOINT = "breakpoint";
+
+ /**
+ * Line breakpoint type.
+ * (value <code>"org.eclipse.debug.core.lineBreakpoint"</code>).
+ */
+ public static final String LINE_BREAKPOINT = "lineBreakpoint";
+
+ /**
* Debug model identifier breakpoint marker attribute
* (value <code>"modelIdentifier"</code>).
* This attribute is a <code>String<code> corresponding to the identifier
@@ -62,4 +80,11 @@ public interface IDebugConstants {
*/
public final static String ENABLED= "enabled";
+ /**
+ * Breakpoint marker attribute (value <code>"id"</code>).
+ * The attribute is a <code>String</code> corresponding to the
+ * id of a breakpoint type
+ */
+ public final static String ID= "id";
+
}
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
new file mode 100644
index 000000000..ad4a32cd8
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILineBreakpoint.java
@@ -0,0 +1,35 @@
+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/IBreakpointFactoryDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointFactoryDelegate.java
new file mode 100644
index 000000000..4569499e0
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointFactoryDelegate.java
@@ -0,0 +1,29 @@
+package org.eclipse.debug.core.model;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.IBreakpoint;
+
+public interface IBreakpointFactoryDelegate {
+ /**
+ * Notifies this breakpoint factory delegate to create a breakpoint
+ * based on the type of the marker.
+ * Returns the breakpoint if successful, otherwise <code>null</code>.
+ *
+ * @param elements an array of objects providing a context for the launch
+ * @param mode run or debug (as defined by <code>ILaunchManager.RUN_MODE</code>,
+ * <code>ILaunchManager.DEBUG_MODE</code>)
+ * @param launcher the proxy to this lazily instantiated extension which needs
+ * to be supplied in the resulting launch object
+ * @return whether the launch succeeded
+ *
+ * @see org.eclipse.debug.core.ILaunch
+ * @see org.eclipse.debug.core.Launch
+ * @see IDebugTarget
+ * @see IProcess
+ * @see org.eclipse.debug.core.ILaunchManager#registerLaunch
+ */
+ IBreakpoint createBreakpointFor(IMarker marker) throws DebugException;
+
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointSupport.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointSupport.java
deleted file mode 100644
index c685491a0..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointSupport.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.IBreakpointListener;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IMarkerDelta;
-
-/**
- * Breakpoint support defines functionality for
- * debug targets supporting breakpoints. The breakpoint manager
- * automatically adds debug targets as breakpoint listeners,
- * as launches are registered. The breakpoint
- * manager only informs a debug target of breakpoint changes
- * (that is, add/remove/change) if the target returns <code>true</code>
- * from <code>supportsBreakpoint(IMarker)</code>. The breakpoint manager
- * removes debug targets from its listener list as launches
- * are deregistered.
- * <p>
- * Clients may implement this interface.
- * </p>
- * <p>
- * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- */
-public interface IBreakpointSupport extends IBreakpointListener {
-
- /**
- * Returns whether this target currently supports the given breakpoint.
- * The breakpoint manager calls this method before calling an
- * added/removed/changed method to verify this listener is interested
- * in the given breakpoint.
- * <p>
- * Generally, a debug target is only interested in breakpoints that
- * originated from its debug model, and only if the debug target has
- * not been terminated.
- * </p>
- *
- * @param breakpoint the breakpoint being added/removed/changed
- * @return whether this target is currently interested in the breakpoint
- */
- boolean supportsBreakpoint(IMarker breakpoint);
-
- /**
- * Installs the given breakpoint in this target. The breakpoint should
- * be deferred if it cannot be installed immediately. This method is only
- * called if this listener supports the given breakpoint.
- *
- * @param breakpoint the added breakpoint
- * @see IBreakpointListener
- * @see #supportsBreakpoint(IMarker)
- */
- public void breakpointAdded(IMarker breakpoint);
-
- /**
- * Uninstalls the given breakpoint from this target if currently installed.
- * This method is only called if this listener supports the given breakpoint.
- *
- * @param breakpoint the removed breakpoint
- * @see IBreakpointListener
- * @see #supportsBreakpoint(IMarker)
- */
- public void breakpointRemoved(IMarker breakpoint, IMarkerDelta delta);
-
- /**
- * An attribute of the given breakpoint has changed, as described
- * by the delta. If the breakpoint is applicable to this target
- * the attribute change should be reflected. For example, the enabled
- * state may have changed, and should be updated in the target. This
- * method is only called if this listener supports the given breakpoint.
- *
- * @param breakpoint the changed breakpoint
- * @see IBreakpointListener
- * @see #supportsBreakpoint(IMarker)
- */
- public void breakpointChanged(IMarker breakpoint, IMarkerDelta delta);
-
-}
-
-
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java
index ad76d44a0..f2545624b 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java
@@ -5,7 +5,7 @@ package org.eclipse.debug.core.model;
* All Rights Reserved.
*/
-import java.util.List;
+import org.eclipse.debug.core.IBreakpointListener;
/**
* A debug target is a debuggable execution context. For example, a debug target
@@ -38,7 +38,7 @@ import java.util.List;
* @see IDisconnect
* @see org.eclipse.debug.core.ILaunch
*/
-public interface IDebugTarget extends IDebugElement, ITerminate, ISuspendResume, IBreakpointSupport, IDisconnect {
+public interface IDebugTarget extends IDebugElement, ITerminate, ISuspendResume, IBreakpointListener, IDisconnect {
/**
* Returns the system process associated with this debug target
* or <code>null</code> if no system process is associated with
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java
new file mode 100644
index 000000000..0a89b0739
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java
@@ -0,0 +1,412 @@
+package org.eclipse.debug.internal.core;
+
+import java.util.Map;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.IBreakpoint;
+import org.eclipse.debug.core.IDebugConstants;
+import org.eclipse.debug.core.model.IDebugTarget;
+
+public abstract class Breakpoint implements IBreakpoint {
+
+ private static String fMarkerType= IDebugConstants.BREAKPOINT_MARKER;
+
+ /**
+ * The set of attributes used to configure a breakpoint
+ */
+ protected static final String[] fgBreakpointAttributes= new String[]{IDebugConstants.MODEL_IDENTIFIER, IDebugConstants.ENABLED};
+
+ protected IMarker fMarker= null;
+ protected boolean installed= false;
+
+ /**
+ * Returns the marker type that this breakpoint creates.
+ * Subclasses should override this method.
+ */
+ public static String getMarkerType() {
+ return fMarkerType;
+ }
+
+ /**
+ * Constructor for Breakpoint
+ */
+ public Breakpoint() {
+ }
+
+ /**
+ * Create a breakpoint for the given marker
+ */
+ public Breakpoint(IMarker marker) {
+ try {
+ if (marker.isSubtypeOf(IDebugConstants.BREAKPOINT_MARKER)) {
+ fMarker= marker;
+ }
+ } catch (CoreException ce) {
+ }
+ }
+
+ public void setMarker(IMarker marker) {
+ fMarker= marker;
+ }
+
+ /**
+ * Returns whether the given object is equal to this object.
+ *
+ * Two breakpoints are equal if their markers have the same id.
+ * A breakpoint is not equal to any other kind of object.
+ */
+ public boolean equals(Object item) {
+ if (item instanceof IBreakpoint) {
+ return getId() == ((IBreakpoint)item).getId();
+ }
+ return false;
+ }
+
+ /**
+ * Configures the given breakpoint's <code>MODEL_IDENTIFIER</code>
+ * and <code>ENABLED</code> attributes to the given values.
+ * This is a convenience method for
+ * <code>IBreakpoint.setAttribute(String, Object)</code> and
+ * <code>IBreakpoint.setAttribute(String, boolean)</code>.
+ * <code>IBreakpoint.setAttribute(String, int)</code>.
+ *
+ * @param modelIdentifier the identifier of the debug model plug-in
+ * the breakpoint is associated with
+ * @param enabled the initial value of the enabled attribute of the
+ * breakpoint marker
+ *
+ * @exception CoreException if setting an attribute fails
+ * @see IBreakpoint#setAttribute(String, Object)
+ * @see IBreakpoint#setAttribute(String, boolean)
+ * @see IBreakpoint#setAttribute(String, int)
+ */
+ public void configure(String modelIdentifier, boolean enabled) throws CoreException {
+ setAttributes(fgBreakpointAttributes, new Object[]{modelIdentifier, new Boolean(enabled)});
+ }
+
+ /**
+ * @see IBreakpoint#addToTarget(IDebugTarget)
+ */
+ public abstract void addToTarget(IDebugTarget target);
+
+ /**
+ * @see IBreakpoint#changeForTarget(IDebugTarget)
+ */
+ public abstract void changeForTarget(IDebugTarget target);
+
+ /**
+ * @see IBreakpoint#removeFromTarget(IDebugTarget)
+ */
+ public abstract void removeFromTarget(IDebugTarget target);
+
+ /**
+ * Enable the breakpoint
+ */
+ public void enable() throws CoreException {
+ fMarker.setAttribute(IDebugConstants.ENABLED, true);
+ }
+
+ /**
+ * Returns whether the breakpoint is enabled
+ */
+ public boolean isEnabled() throws CoreException {
+ return fMarker.getAttribute(IDebugConstants.ENABLED, false);
+ }
+
+ /**
+ * @see IBreakpoint#toggleEnabled()
+ */
+ public void toggleEnabled() throws CoreException {
+ if (isEnabled()) {
+ disable();
+ } else {
+ enable();
+ }
+ }
+
+ /**
+ * Disable the breakpoint
+ */
+ public void disable() throws CoreException {
+ fMarker.setAttribute(IDebugConstants.ENABLED, false);
+ }
+
+ /**
+ * Returns whether the breakpoint is disabled
+ */
+ public boolean isDisabled() throws CoreException {
+ return !isEnabled();
+ }
+
+ /**
+ * @see IBreakpoint#delete()
+ */
+ public void delete() throws CoreException {
+ fMarker.delete();
+ }
+
+ /**
+ * @see IBreakpoint#exists()
+ */
+ public boolean exists() {
+ return fMarker.exists();
+ }
+
+
+ /**
+ * @see IBreakpoint#getMarker()
+ */
+ public IMarker getMarker() {
+ return fMarker;
+ }
+
+ /**
+ * @see IBreakpoint#getId()
+ */
+ public long getId() {
+ return fMarker.getId();
+ }
+
+ /**
+ * @see IBreakpoint#getResource()
+ */
+ public IResource getResource() {
+ return fMarker.getResource();
+ }
+
+ /**
+ * @see IBreakpoint#getType()
+ */
+ public String getType() throws CoreException {
+ return fMarker.getType();
+ }
+
+ /**
+ * Returns the model identifier for the given breakpoint.
+ */
+ public String getModelIdentifier() {
+ return (String)getAttribute(IDebugConstants.MODEL_IDENTIFIER, null);
+ }
+
+ /**
+ * Returns the attribute with the given name. The result is an instance of one
+ * of the following classes: <code>String</code>, <code>Integer</code>,
+ * or <code>Boolean</code>.
+ * Returns <code>null</code> if the attribute is undefined.
+ *
+ * @param attributeName the name of the attribute
+ * @return the value, or <code>null</code> if the attribute is undefined.
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li> This breakpoint does not exist.</li>
+ * </ul>
+ */
+ protected Object getAttribute(String attributeName) throws CoreException {
+ return fMarker.getAttribute(attributeName);
+ }
+
+ /**
+ * Returns the integer-valued attribute with the given name.
+ * Returns the given default value if the attribute is undefined.
+ * or the marker does not exist or is not an integer value.
+ *
+ * @param attributeName the name of the attribute
+ * @param defaultValue the value to use if no value is found
+ * @return the value or the default value if no value was found.
+ */
+ protected int getAttribute(String attributeName, int defaultValue) {
+ return fMarker.getAttribute(attributeName, defaultValue);
+ }
+
+ /**
+ * Returns the string-valued attribute with the given name.
+ * Returns the given default value if the attribute is undefined
+ * or the marker does not exist or is not a string value.
+ *
+ * @param attributeName the name of the attribute
+ * @param defaultValue the value to use if no value is found
+ * @return the value or the default value if no value was found.
+ */
+ protected String getAttribute(String attributeName, String defaultValue) {
+ return fMarker.getAttribute(attributeName, defaultValue);
+ }
+
+ /**
+ * Returns the boolean-valued attribute with the given name.
+ * Returns the given default value if the attribute is undefined
+ * or the marker does not exist or is not a boolean value.
+ * @param attributeName the name of the attribute
+ * @param defaultValue the value to use if no value is found
+ * @return the value or the default value if no value was found.
+ */
+ protected boolean getAttribute(String attributeName, boolean defaultValue) {
+ return fMarker.getAttribute(attributeName, defaultValue);
+ }
+
+ /**
+ * Returns a map with all the attributes for the marker.
+ * If the marker has no attributes then <code>null</code> is returned.
+ *
+ * @return a map of attribute keys and values (key type : <code>String</code>
+ * value type : <code>String</code>, <code>Integer</code>, or
+ * <code>Boolean</code>) or <code>null</code>.
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li> The marker does not exist.</li>
+ * </ul>
+ */
+ protected Map getAttributes() throws CoreException {
+ return fMarker.getAttributes();
+ }
+
+ /**
+ * Returns the attributes with the given names. The result is an an array
+ * whose elements correspond to the elements of the given attribute name
+ * array. Each element is <code>null</code> or an instance of one
+ * of the following classes: <code>String</code>, <code>Integer</code>,
+ * or <code>Boolean</code>.
+ *
+ * @param attributeNames the names of the attributes
+ * @return the values of the given attributes.
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li> The marker does not exist.</li>
+ * </ul>
+ */
+ protected Object[] getAttributes(String[] attributeNames) throws CoreException {
+ return fMarker.getAttributes(attributeNames);
+ }
+
+
+ /**
+ * Returns the <code>boolean</code> attribute of the given breakpoint
+ * or <code>false</code> if the attribute is not set.
+ */
+ protected boolean getBooleanAttribute(String attribute) {
+ return getAttribute(attribute, false);
+ }
+
+ /**
+ * Sets the <code>boolean</code> attribute of the given breakpoint.
+ */
+ protected void setBooleanAttribute(String attribute, boolean value) throws CoreException {
+ setAttribute(attribute, value);
+ }
+
+ /**
+ * Sets the integer-valued attribute with the given name.
+ * <p>
+ * This method changes resources; these changes will be reported
+ * in a subsequent resource change event, including an indication
+ * that this marker has been modified.
+ * </p>
+ *
+ * @param attributeName the name of the attribute
+ * @param value the value
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li> This marker does not exist.</li>
+ * </ul>
+ */
+ protected void setAttribute(String attributeName, int value)
+ throws CoreException {
+ fMarker.setAttribute(attributeName, value);
+ }
+
+ /**
+ * Sets the attribute with the given name. The value must be <code>null</code> or
+ * an instance of one of the following classes:
+ * <code>String</code>, <code>Integer</code>, or <code>Boolean</code>.
+ * If the value is <code>null</code>, the attribute is considered to be undefined.
+ * <p>
+ * This method changes resources; these changes will be reported
+ * in a subsequent resource change event, including an indication
+ * that this marker has been modified.
+ * </p>
+ *
+ * @param attributeName the name of the attribute
+ * @param value the value, or <code>null</code> if the attribute is to be undefined
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li> The marker does not exist.</li>
+ * </ul>
+ */
+ protected void setAttribute(String attributeName, Object value)
+ throws CoreException {
+ fMarker.setAttribute(attributeName, value);
+ }
+
+ /**
+ * Sets the boolean-valued attribute with the given name.
+ * <p>
+ * This method changes resources; these changes will be reported
+ * in a subsequent resource change event, including an indication
+ * that this marker has been modified.
+ * </p>
+ *
+ * @param attributeName the name of the attribute
+ * @param value the value
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li> The marker does not exist.</li>
+ * </ul>
+ */
+ protected void setAttribute(String attributeName, boolean value)
+ throws CoreException {
+ fMarker.setAttribute(attributeName, value);
+ }
+
+ /**
+ * Sets the given attribute key-value pairs on this marker.
+ * The values must be <code>null</code> or an instance of
+ * one of the following classes: <code>String</code>,
+ * <code>Integer</code>, or <code>Boolean</code>.
+ * If a value is <code>null</code>, the new value of the
+ * attribute is considered to be undefined.
+ * <p>
+ * This method changes resources; these changes will be reported
+ * in a subsequent resource change event, including an indication
+ * that this marker has been modified.
+ * </p>
+ *
+ * @param attributeNames an array of attribute names
+ * @param values an array of attribute values
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li> This marker does not exist.</li>
+ * </ul>
+ */
+ protected void setAttributes(String[] attributeNames, Object[] values)
+ throws CoreException {
+ fMarker.setAttributes(attributeNames, values);
+ }
+
+ /**
+ * Sets the attributes for this marker to be the ones contained in the
+ * given table. The values must be an instance of one of the following classes:
+ * <code>String</code>, <code>Integer</code>, or <code>Boolean</code>.
+ * Attributes previously set on the marker but not included in the given map
+ * are considered to be removals. Setting the given map to be <code>null</code>
+ * is equivalent to removing all marker attributes.
+ * <p>
+ * This method changes resources; these changes will be reported
+ * in a subsequent resource change event, including an indication
+ * that this marker has been modified.
+ * </p>
+ *
+ * @param attributes a map of attribute names to attribute values
+ * (key type : <code>String</code> value type : <code>String</code>,
+ * <code>Integer</code>, or <code>Boolean</code>) or <code>null</code>
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li> The marker does not exist.</li>
+ * </ul>
+ */
+ protected void setAttributes(Map attributes) throws CoreException {
+ fMarker.setAttributes(attributes);
+ }
+
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointFactory.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointFactory.java
new file mode 100644
index 000000000..b6de8b2c4
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointFactory.java
@@ -0,0 +1,78 @@
+package org.eclipse.debug.internal.core;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IBreakpointFactoryDelegate;
+
+public class BreakpointFactory implements IBreakpointFactory {
+
+ /**
+ * The configuration element that defines this breakpoint factory handle
+ */
+ protected IConfigurationElement fConfigElement = null;
+
+ /**
+ * The type of markers that this breakpoint factory creates
+ * breakpoints for
+ */
+ private String fType= null;
+
+ /**
+ * The underlying breakpoint factory, which is <code>null</code> until the
+ * it needs to be instantiated.
+ */
+ protected IBreakpointFactoryDelegate fDelegate = null;
+
+ /**
+ * Constructs a handle for a breakpoint factory extension.
+ */
+ public BreakpointFactory(IConfigurationElement element) {
+ fConfigElement = element;
+ }
+
+ /**
+ * Returns the marker type specified in the configuration data.
+ */
+ public String getMarkerType() {
+ if (fType == null) {
+ fType= fConfigElement.getAttribute("type");
+ }
+ return fType;
+ }
+
+ /**
+ * Returns the breakpoint factory for this handle, instantiating it if required.
+ */
+ public IBreakpointFactoryDelegate getDelegate() {
+ if (fDelegate == null) {
+ try {
+ fDelegate = (IBreakpointFactoryDelegate)fConfigElement.createExecutableExtension("class");
+ } catch (CoreException e) {
+ //status logged in the #createExecutableExtension code
+ }
+ }
+ return fDelegate;
+ }
+
+ public boolean canCreateBreakpointsFor(IMarker marker) throws CoreException {
+ return (marker.isSubtypeOf(getMarkerType()));
+ }
+
+ /**
+ * @see IBreakpointFactory#createBreakpointFor(IMarker)
+ */
+ public IBreakpoint createBreakpointFor(IMarker marker) throws DebugException {
+ try {
+ if (canCreateBreakpointsFor(marker)) {
+ return getDelegate().createBreakpointFor(marker);
+ }
+ } catch (CoreException ce) {
+ throw new DebugException(ce.getStatus());
+ }
+ return null;
+ }
+
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
index 7f848dae2..f769d354e 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
@@ -5,14 +5,12 @@ package org.eclipse.debug.internal.core;
* All Rights Reserved.
*/
+import java.util.*;
+
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.*;
-import org.eclipse.debug.core.model.IBreakpointSupport;
import org.eclipse.debug.core.model.IDebugTarget;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.Vector;
/**
* The breakpoint manager manages all registered breakpoints
@@ -51,6 +49,11 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*
*/
protected Vector fBreakpoints;
+
+ /**
+ * Collection of markers that associates markers to breakpoints
+ */
+ protected HashMap fMarkers;
/**
* Collection of breakpoint listeners.
@@ -61,22 +64,13 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* Singleton resource delta visitor
*/
protected static BreakpointManagerVisitor fgVisitor;
-
- /**
- * The set of attributes used to configure a breakpoint
- */
- protected static final String[] fgBreakpointAttributes= new String[]{IDebugConstants.MODEL_IDENTIFIER, IDebugConstants.ENABLED};
-
- /**
- * The set of attributes used to configure a line breakpoint
- */
- protected static final String[] fgLineBreakpointAttributes= new String[]{IDebugConstants.MODEL_IDENTIFIER, IDebugConstants.ENABLED, IMarker.LINE_NUMBER, IMarker.CHAR_START, IMarker.CHAR_END};
/**
* Constructs a new breakpoint manager.
*/
public BreakpointManager() {
fBreakpoints= new Vector(15);
+ fMarkers= new HashMap(15);
}
/**
@@ -90,6 +84,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
public void startup() throws CoreException {
getWorkspace().addResourceChangeListener(this);
getLaunchManager().addLaunchListener(this);
+
IMarker[] breakpoints= null;
IWorkspaceRoot root= getWorkspace().getRoot();
breakpoints= root.findMarkers(IDebugConstants.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
@@ -97,11 +92,11 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
for (int i = 0; i < breakpoints.length; i++) {
IMarker marker= breakpoints[i];
try {
- addBreakpoint(marker);
+ loadMarker(marker);
} catch (DebugException e) {
logError(e);
}
- }
+ }
}
/**
@@ -130,111 +125,146 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* @see IBreakpointManager
*/
- public IMarker[] getBreakpoints() {
- IMarker[] temp= new IMarker[fBreakpoints.size()];
+ public IBreakpoint getBreakpoint(IMarker marker) {
+ return (IBreakpoint)fMarkers.get(marker);
+ }
+
+ /**
+ * @see IBreakpointManager
+ */
+ public IBreakpoint[] getBreakpoints() {
+ Breakpoint[] temp= new Breakpoint[fBreakpoints.size()];
fBreakpoints.copyInto(temp);
return temp;
}
-
+
/**
* @see IBreakpointManager
*/
- public IMarker[] getBreakpoints(String modelIdentifier) {
+ public IBreakpoint[] getBreakpoints(String modelIdentifier) {
Vector temp= new Vector(fBreakpoints.size());
if (!fBreakpoints.isEmpty()) {
- Iterator bps= fBreakpoints.iterator();
- while (bps.hasNext()) {
- IMarker bp= (IMarker) bps.next();
- String id= getModelIdentifier(bp);
+ Iterator breakpoints= fBreakpoints.iterator();
+ while (breakpoints.hasNext()) {
+ IBreakpoint breakpoint= (IBreakpoint) breakpoints.next();
+ String id= breakpoint.getModelIdentifier();
if (id != null && id.equals(modelIdentifier)) {
- temp.add(bp);
+ temp.add(breakpoint);
}
}
}
- IMarker[] m= new IMarker[temp.size()];
+ Breakpoint[] m= new Breakpoint[temp.size()];
temp.copyInto(m);
return m;
- }
+ }
/**
* @see IBreakpointManager
*/
- public int getLineNumber(IMarker breakpoint) {
- return breakpoint.getAttribute(IMarker.LINE_NUMBER, -1);
- }
-
+ public IMarker[] getMarkers() {
+ IMarker[] temp= (IMarker[]) fMarkers.keySet().toArray(new IMarker[0]);
+ return temp;
+ }
+
/**
* @see IBreakpointManager
*/
- public int getCharStart(IMarker breakpoint) {
- return breakpoint.getAttribute(IMarker.CHAR_START, -1);
+ public IMarker[] getMarkers(String modelIdentifier) {
+ Vector temp= new Vector(fBreakpoints.size());
+ if (!fBreakpoints.isEmpty()) {
+ Iterator breakpoints= fBreakpoints.iterator();
+ while (breakpoints.hasNext()) {
+ IBreakpoint breakpoint= (IBreakpoint) breakpoints.next();
+ String id= breakpoint.getModelIdentifier();
+ if (id != null && id.equals(modelIdentifier)) {
+ temp.add(breakpoint.getMarker());
+ }
+ }
+ }
+ IMarker[] m= new IMarker[temp.size()];
+ temp.copyInto(m);
+ return m;
}
/**
* @see IBreakpointManager
*/
- public int getCharEnd(IMarker breakpoint) {
- return breakpoint.getAttribute(IMarker.CHAR_END, -1);
- }
-
- /**
- * Returns the model identifier for the given breakpoint.
- */
- public String getModelIdentifier(IMarker breakpoint) {
- return (String) breakpoint.getAttribute(IDebugConstants.MODEL_IDENTIFIER, (String)null);
+ public boolean isRegistered(IBreakpoint breakpoint) {
+ return fBreakpoints.contains(breakpoint);
}
/**
* @see IBreakpointManager
*/
- public boolean isEnabled(IMarker marker) {
- return marker.getAttribute(IDebugConstants.ENABLED, true);
+ public void removeMarker(IMarker marker, boolean delete) throws CoreException {
+ IBreakpoint breakpoint= (IBreakpoint)fMarkers.get(marker);
+ if (breakpoint != null) {
+ removeBreakpoint(breakpoint, delete);
+ }
}
/**
- * @see IBreakpointManager
+ * Remove the given breakpoint
*/
- public boolean isRegistered(IMarker marker) {
- return fBreakpoints.contains(marker);
- }
-
- /**
- * @see IBreakpointManager
- */
- public void removeBreakpoint(IMarker breakpoint, boolean delete) throws CoreException {
+ public void removeBreakpoint(IBreakpoint breakpoint, boolean delete) throws CoreException {
if (fBreakpoints.remove(breakpoint)) {
fireUpdate(breakpoint, null, REMOVED);
+ fMarkers.remove(breakpoint.getMarker());
if (delete) {
breakpoint.delete();
}
}
}
+
+ /**
+ * @see IBreakpointManager
+ */
+ public IBreakpoint loadMarker(IMarker marker) throws DebugException {
+ if (fMarkers.containsKey(marker)) {
+ return (IBreakpoint) fMarkers.get(marker);
+ }
+ IBreakpoint breakpoint= null;
+ IBreakpointFactory[] factories= DebugPlugin.getDefault().getBreakpointFactories();
+ for (int i=0; i<factories.length; i++) {
+ try {
+ if (factories[i].canCreateBreakpointsFor(marker)) {
+ breakpoint= factories[i].createBreakpointFor(marker);
+ addBreakpoint(breakpoint);
+ break;
+ }
+ } catch (CoreException ce) {
+ throw new DebugException(ce.getStatus());
+ }
+ }
+ return breakpoint;
+ }
/**
* @see IBreakpointManager
*/
- public void addBreakpoint(IMarker breakpoint) throws DebugException {
+ public void addBreakpoint(IBreakpoint breakpoint) throws DebugException {
if (!fBreakpoints.contains(breakpoint)) {
verifyBreakpoint(breakpoint);
fBreakpoints.add(breakpoint);
+ fMarkers.put(breakpoint.getMarker(), breakpoint);
fireUpdate(breakpoint, null, ADDED);
- }
+ }
}
/**
* Verifies that the breakpoint marker has the minimal required attributes,
* and throws a debug exception if not.
*/
- protected void verifyBreakpoint(IMarker breakpoint) throws DebugException {
+ protected void verifyBreakpoint(IBreakpoint breakpoint) throws DebugException {
try {
- String id= (String) breakpoint.getAttribute(IDebugConstants.MODEL_IDENTIFIER);
+ String id= breakpoint.getModelIdentifier();
if (id == null) {
throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getDefault().getDescriptor().getUniqueIdentifier(),
IDebugStatusConstants.CONFIGURATION_INVALID, DebugCoreUtils.getResourceString(REQUIRED_ATTRIBUTES), null));
}
} catch (CoreException e) {
throw new DebugException(e.getStatus());
- }
+ }
}
/**
@@ -263,9 +293,9 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
//closed
Enumeration breakpoints= fBreakpoints.elements();
while (breakpoints.hasMoreElements()) {
- IMarker breakpoint= (IMarker) breakpoints.nextElement();
- IResource breakpointResource= breakpoint.getResource();
- if (project.getFullPath().isPrefixOf(breakpointResource.getFullPath())) {
+ IBreakpoint breakpoint= (IBreakpoint) breakpoints.nextElement();
+ IResource markerResource= breakpoint.getResource();
+ if (project.getFullPath().isPrefixOf(markerResource.getFullPath())) {
try {
removeBreakpoint(breakpoint, false);
} catch (CoreException e) {
@@ -275,17 +305,18 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
return;
} else {
- IMarker[] breakpoints= null;
+ IMarker[] markers= null;
try {
- breakpoints= project.findMarkers(IDebugConstants.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
+ markers= project.findMarkers(IDebugConstants.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
} catch (CoreException e) {
logError(e);
return;
}
- if (breakpoints != null) {
- for (int i= 0; i < breakpoints.length; i++) {
+
+ if (markers != null) {
+ for (int i= 0; i < markers.length; i++) {
try {
- addBreakpoint(breakpoints[i]);
+ loadMarker(markers[i]);
} catch (DebugException e) {
logError(e);
}
@@ -295,13 +326,6 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
/**
- * @see IBreakpointManager.
- */
- public void setEnabled(IMarker marker, boolean enabled) throws CoreException {
- marker.setAttribute(IDebugConstants.ENABLED, enabled);
- }
-
- /**
* Logs errors
*/
protected void logError(Exception e) {
@@ -339,7 +363,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
return true;
- }
+ }
/**
* Wrapper for handling adds
@@ -351,7 +375,8 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
final IWorkspaceRunnable wRunnable= new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) {
try {
- marker.delete();
+ IBreakpoint breakpoint= getBreakpoint(marker);
+ breakpoint.delete();
} catch (CoreException ce) {
logError(ce);
}
@@ -376,9 +401,10 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* Wrapper for handling removes
*/
protected void handleRemoveBreakpoint(IMarker marker, IMarkerDelta delta) {
- if (isRegistered(marker)) {
- fBreakpoints.remove(marker);
- fireUpdate(marker, delta, REMOVED);
+ IBreakpoint breakpoint= getBreakpoint(marker);
+ if (isRegistered(breakpoint)) {
+ fBreakpoints.remove(breakpoint);
+ fireUpdate(breakpoint, delta, REMOVED);
}
}
@@ -386,8 +412,9 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* Wrapper for handling changes
*/
protected void handleChangeBreakpoint(IMarker marker, IMarkerDelta delta) {
- if (isRegistered(marker)) {
- fireUpdate(marker, delta, CHANGED);
+ IBreakpoint breakpoint= getBreakpoint(marker);
+ if (isRegistered(breakpoint)) {
+ fireUpdate(breakpoint, delta, CHANGED);
}
}
}
@@ -405,58 +432,27 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
public void removeBreakpointListener(IBreakpointListener listener) {
fBreakpointListeners.remove(listener);
}
-
+
/**
* Notifies listeners of the add/remove/change
*/
- protected void fireUpdate(IMarker marker, IMarkerDelta delta, int update) {
+ protected void fireUpdate(IBreakpoint breakpoint, IMarkerDelta delta, int update) {
Object[] copiedListeners= fBreakpointListeners.getListeners();
for (int i= 0; i < copiedListeners.length; i++) {
IBreakpointListener listener = (IBreakpointListener)copiedListeners[i];
- if (supportsBreakpoint(listener, marker)) {
- switch (update) {
- case ADDED:
- listener.breakpointAdded(marker);
- break;
- case REMOVED:
- listener.breakpointRemoved(marker, delta);
- break;
- case CHANGED:
- listener.breakpointChanged(marker, delta);
- break;
- }
-
+ switch (update) {
+ case ADDED:
+ listener.breakpointAdded(breakpoint);
+ break;
+ case REMOVED:
+ listener.breakpointRemoved(breakpoint, delta);
+ break;
+ case CHANGED:
+ listener.breakpointChanged(breakpoint, delta);
+ break;
}
}
}
-
- /**
- * Returns whether the given listener supports breakpoints. If
- * the listener is a debug target, we check if the specific
- * breakpoint is supported by the target.
- */
- protected boolean supportsBreakpoint(IBreakpointListener listener, IMarker breakpoint) {
- if (listener instanceof IBreakpointSupport) {
- return ((IBreakpointSupport)listener).supportsBreakpoint(breakpoint);
- } else {
- return true;
- }
- }
-
- /**
- * @see IBreakpointManager
- */
- public void configureBreakpoint(IMarker breakpoint, String modelIdentifier, boolean enabled) throws CoreException {
- breakpoint.setAttributes(fgBreakpointAttributes, new Object[]{modelIdentifier, new Boolean(enabled)});
- }
-
- /**
- * @see IBreakpointManager
- */
- public void configureLineBreakpoint(IMarker breakpoint, String modelIdentifier, boolean enabled, int lineNumber, int charStart, int charEnd) throws CoreException {
- Object[] values= new Object[]{modelIdentifier, new Boolean(enabled), new Integer(lineNumber), new Integer(charStart), new Integer(charEnd)};
- breakpoint.setAttributes(fgLineBreakpointAttributes, values);
- }
/**
* Adds any debug targets as listeners
diff --git a/org.eclipse.debug.core/plugin.xml b/org.eclipse.debug.core/plugin.xml
index 612cf2ff0..1a534f44d 100644
--- a/org.eclipse.debug.core/plugin.xml
+++ b/org.eclipse.debug.core/plugin.xml
@@ -21,6 +21,7 @@
<!-- Extension points -->
<extension-point id="launchers" name="Launcher"/>
+<extension-point id="breakpoint_factories" name="BreakpointFactory"/>
<!-- Extensions -->
<extension
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java
index fde370bb2..fc24db299 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java
@@ -26,7 +26,7 @@ public class BreakpointsContentProvider extends BasicContentProvider implements
* Returns all the breakpoint markers in the current open workspace
*/
public Object[] getElements(Object parent) {
- return ((IBreakpointManager) parent).getBreakpoints();
+ return ((IBreakpointManager) parent).getMarkers();
}
/**
@@ -40,12 +40,12 @@ public class BreakpointsContentProvider extends BasicContentProvider implements
/**
* @see IBreakpointListener
*/
- public void breakpointAdded(final IMarker breakpoint) {
+ public void breakpointAdded(final IBreakpoint breakpoint) {
if (breakpoint.exists()) {
asyncExec(new Runnable() {
public void run() {
if (!isDisposed()) {
- ((TableViewer)fViewer).add(breakpoint);
+ ((TableViewer)fViewer).add(breakpoint.getMarker());
}
}
});
@@ -55,11 +55,11 @@ public class BreakpointsContentProvider extends BasicContentProvider implements
/**
* @see IBreakpointListener
*/
- public void breakpointRemoved(final IMarker breakpoint, IMarkerDelta delta) {
+ public void breakpointRemoved(final IBreakpoint breakpoint, IMarkerDelta delta) {
asyncExec(new Runnable() {
public void run() {
if (!isDisposed()) {
- ((TableViewer)fViewer).remove(breakpoint);
+ ((TableViewer)fViewer).remove(breakpoint.getMarker());
}
}
});
@@ -68,12 +68,12 @@ public class BreakpointsContentProvider extends BasicContentProvider implements
/**
* @see IBreakpointListener
*/
- public void breakpointChanged(final IMarker breakpoint, IMarkerDelta delta) {
+ public void breakpointChanged(final IBreakpoint breakpoint, IMarkerDelta delta) {
if (breakpoint.exists()) {
asyncExec(new Runnable() {
public void run() {
if (!isDisposed()) {
- refresh(breakpoint);
+ refresh(breakpoint.getMarker());
}
}
});
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsView.java
index a84d043f4..bc4056bd3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsView.java
@@ -8,8 +8,7 @@ package org.eclipse.debug.internal.ui;
import java.util.*;
import org.eclipse.core.resources.IMarker;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.core.*;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.*;
@@ -39,7 +38,7 @@ public class BreakpointsView extends AbstractDebugView implements IDoubleClickLi
private RemoveAllBreakpointsAction fRemoveAllBreakpointsAction;
private EnableDisableBreakpointAction fEnableDisableBreakpointAction;
private ShowQualifiedAction fShowQualifiedNamesAction;
- private List fContributedActions = new ArrayList(0);
+ private Vector fBreakpointListenerActions;
/**
* @see IWorkbenchPart
@@ -83,6 +82,7 @@ public class BreakpointsView extends AbstractDebugView implements IDoubleClickLi
* Initializes the actions of this view
*/
protected void initializeActions() {
+ fBreakpointListenerActions = new Vector(2);
fRemoveBreakpointAction= new RemoveBreakpointAction(fViewer);
fRemoveAllBreakpointsAction= new RemoveAllBreakpointsAction();
@@ -95,20 +95,17 @@ public class BreakpointsView extends AbstractDebugView implements IDoubleClickLi
fOpenMarkerAction= new OpenBreakpointMarkerAction(fViewer);
fEnableDisableBreakpointAction= new EnableDisableBreakpointAction(fViewer);
- DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(fEnableDisableBreakpointAction);
- DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(fRemoveAllBreakpointsAction);
+ addBreakpointListenerAction(fEnableDisableBreakpointAction);
+ addBreakpointListenerAction(fRemoveAllBreakpointsAction);
}
/**
* Cleans up the actions when this part is disposed
*/
protected void cleanupActions() {
- if (fEnableDisableBreakpointAction != null) {
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(fEnableDisableBreakpointAction);
+ for (int i=0; i < fBreakpointListenerActions.size(); i++) {
+ DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener((IBreakpointListener)fBreakpointListenerActions.get(i));
}
- if (fRemoveAllBreakpointsAction != null) {
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(fRemoveAllBreakpointsAction);
- }
}
/**
@@ -138,16 +135,17 @@ public class BreakpointsView extends AbstractDebugView implements IDoubleClickLi
/**
* Open an editor for the breakpoint.
*/
- protected void openEditorForBreakpoint(IMarker breakpoint, IWorkbenchPage page) {
- String id= getBreakpointManager().getModelIdentifier(breakpoint);
+ protected void openEditorForBreakpoint(IMarker marker, IWorkbenchPage page) {
+ IBreakpoint breakpoint= getBreakpointManager().getBreakpoint(marker);
+ String id= breakpoint.getModelIdentifier();
IDebugModelPresentation presentation= getPresentation(id);
- IEditorInput input= presentation.getEditorInput(breakpoint);
- String editorId= presentation.getEditorId(input, breakpoint);
+ IEditorInput input= presentation.getEditorInput(marker);
+ String editorId= presentation.getEditorId(input, marker);
if (input != null) {
try {
IEditorPart editor;
editor= page.openEditor(input, editorId);
- editor.gotoMarker(breakpoint);
+ editor.gotoMarker(marker);
} catch (PartInitException e) {
DebugUIUtils.logError(e);
}
@@ -158,7 +156,6 @@ public class BreakpointsView extends AbstractDebugView implements IDoubleClickLi
* Adds items to the context menu
*/
protected void fillContextMenu(IMenuManager menu) {
- updateContributedActions();
menu.add(new Separator(IDebugUIConstants.EMPTY_NAVIGATION_GROUP));
menu.add(new Separator(IDebugUIConstants.NAVIGATION_GROUP));
menu.add(fOpenMarkerAction);
@@ -172,25 +169,14 @@ public class BreakpointsView extends AbstractDebugView implements IDoubleClickLi
menu.add(fShowQualifiedNamesAction);
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
-
+
/**
* Add an action to the contributed actions collection
*/
- public void addContributedAction(IUpdate update) {
- fContributedActions.add(update);
- }
-
- /**
- * Update the contributed actions that the BreakpointsView knows about.
- * This gives contributed actions a chance to refresh their state.
- */
- protected void updateContributedActions() {
- Iterator actions= fContributedActions.iterator();
- while (actions.hasNext()) {
- IUpdate update= (IUpdate)actions.next();
- update.update();
- }
- }
+ public void addBreakpointListenerAction(IBreakpointListener action) {
+ fBreakpointListenerActions.add(action);
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(action);
+ }
/**
* @see IDoubleClickListener
@@ -203,11 +189,12 @@ public class BreakpointsView extends AbstractDebugView implements IDoubleClickLi
* Returns whether an editor is open on this breakpoint's
* resource
*/
- protected IEditorPart getOpenEditor(IMarker breakpoint, IWorkbenchPage page) {
+ protected IEditorPart getOpenEditor(IMarker marker, IWorkbenchPage page) {
//attempt to find the editor for the input
- String id= getBreakpointManager().getModelIdentifier(breakpoint);
+ IBreakpoint breakpoint= getBreakpointManager().getBreakpoint(marker);
+ String id= breakpoint.getModelIdentifier();
IDebugModelPresentation presentation= getPresentation(id);
- IEditorInput editorElement = presentation.getEditorInput(breakpoint);
+ IEditorInput editorElement = presentation.getEditorInput(marker);
IEditorPart[] editors= page.getEditors();
for (int i= 0; i < editors.length; i++) {
IEditorPart part= editors[i];
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
index 62f6d769b..b8a31faf5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
@@ -227,14 +227,14 @@ public class DelegatingModelPresentation implements IDebugModelPresentation {
} else
if (element instanceof IMarker) {
try {
- IMarker m= (IMarker) element;
- if (m.exists() && m.isSubtypeOf(IDebugConstants.BREAKPOINT_MARKER)) {
- if (DebugPlugin.getDefault().getBreakpointManager().isEnabled(m)) {
+ IMarker marker= (IMarker) element;
+ IBreakpoint breakpoint= DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
+ if (breakpoint.exists()) {
+ if (breakpoint.isEnabled()) {
return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
} else {
return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT_DISABLED);
}
-
}
} catch (CoreException e) {
DebugUIUtils.logError(e);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/EnableDisableBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/EnableDisableBreakpointAction.java
index 51f7e5517..eb324c6ce 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/EnableDisableBreakpointAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/EnableDisableBreakpointAction.java
@@ -5,7 +5,17 @@ package org.eclipse.debug.internal.ui;
* All Rights Reserved.
*/
-import java.util.Iterator; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarkerDelta; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.MultiStatus; import org.eclipse.debug.core.*; import org.eclipse.jface.viewers.*; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.actions.SelectionProviderAction; import org.eclipse.ui.help.WorkbenchHelp;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.debug.core.*;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.actions.SelectionProviderAction;
+import org.eclipse.ui.help.WorkbenchHelp;
/**
* Enables or disables a breakpoint
@@ -29,13 +39,6 @@ public class EnableDisableBreakpointAction extends SelectionProviderAction imple
}
/**
- * Returns the breakpoint manager
- */
- protected IBreakpointManager getBreakpointManager() {
- return DebugPlugin.getDefault().getBreakpointManager();
- }
-
- /**
* @see Action
*/
public void run() {
@@ -49,10 +52,9 @@ public class EnableDisableBreakpointAction extends SelectionProviderAction imple
IBreakpointManager manager= getBreakpointManager();
MultiStatus ms= new MultiStatus(DebugUIPlugin.getDefault().getDescriptor().getUniqueIdentifier(), IDebugStatusConstants.REQUEST_FAILED, DebugUIUtils.getResourceString(STATUS), null);
while (enum.hasNext()) {
- IMarker breakpoint= (IMarker) enum.next();
- boolean enabled= manager.isEnabled(breakpoint);
+ IMarker marker= (IMarker) enum.next();
try {
- manager.setEnabled(breakpoint, !enabled);
+ getBreakpoint(marker).toggleEnabled();
} catch (CoreException e) {
ms.merge(e.getStatus());
}
@@ -75,11 +77,14 @@ public class EnableDisableBreakpointAction extends SelectionProviderAction imple
IMarker marker= (IMarker)enum.next();
if (!enum.hasNext()) {
//single selection
- boolean enabled= getBreakpointManager().isEnabled(marker);
- if (enabled) {
- setText(DebugUIUtils.getResourceString(DISABLE));
- } else {
- setText(DebugUIUtils.getResourceString(ENABLE));
+ try {
+ if (getBreakpoint(marker).isEnabled()) {
+ setText(DebugUIUtils.getResourceString(DISABLE));
+ } else {
+ setText(DebugUIUtils.getResourceString(ENABLE));
+ }
+ } catch (CoreException ce) {
+ DebugUIUtils.errorDialog(DebugUIPlugin.getActiveWorkbenchWindow().getShell(), ERROR, ce.getStatus());
}
} else {
// multi- selection
@@ -91,19 +96,19 @@ public class EnableDisableBreakpointAction extends SelectionProviderAction imple
/**
* @see IBreakpointListener
*/
- public void breakpointAdded(IMarker breakpoint) {
+ public void breakpointAdded(IBreakpoint breakpoint) {
}
/**
* @see IBreakpointListener
*/
- public void breakpointRemoved(IMarker breakpoint, IMarkerDelta delta) {
+ public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
}
/**
* @see IBreakpointListener
*/
- public void breakpointChanged(IMarker breakpoint, IMarkerDelta delta) {
+ public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
Display display= Display.getDefault();
if (display.isDisposed()) {
return;
@@ -117,5 +122,19 @@ public class EnableDisableBreakpointAction extends SelectionProviderAction imple
}
});
}
+
+ /**
+ * Returns the breakpoint manager
+ */
+ private IBreakpointManager getBreakpointManager() {
+ return DebugPlugin.getDefault().getBreakpointManager();
+ }
+
+ /**
+ * Returns the breakpoint associated with marker
+ */
+ private IBreakpoint getBreakpoint(IMarker marker) {
+ return getBreakpointManager().getBreakpoint(marker);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllBreakpointsAction.java
index b5eaebaae..eb086da2a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllBreakpointsAction.java
@@ -38,13 +38,13 @@ public class RemoveAllBreakpointsAction extends Action implements IBreakpointLis
*/
public void run() {
final IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
- final IMarker[] markers= breakpointManager.getBreakpoints();
+ final IBreakpoint[] breakpoints= breakpointManager.getBreakpoints();
final MultiStatus ms= new MultiStatus(DebugPlugin.getDefault().getDescriptor().getUniqueIdentifier(), IDebugStatusConstants.REQUEST_FAILED, DebugUIUtils.getResourceString(STATUS), null);
IWorkspaceRunnable r = new IWorkspaceRunnable() {
public void run(IProgressMonitor pm) {
- for (int i= 0; i < markers.length; i++) {
+ for (int i= 0; i < breakpoints.length; i++) {
try {
- breakpointManager.removeBreakpoint(markers[i], true);
+ breakpointManager.removeBreakpoint(breakpoints[i], true);
} catch (CoreException e) {
ms.merge(e.getStatus());
}
@@ -63,18 +63,18 @@ public class RemoveAllBreakpointsAction extends Action implements IBreakpointLis
/**
* @see IBreakpointListener
*/
- public void breakpointAdded(IMarker breakpoint) {
+ public void breakpointAdded(IBreakpoint breakpoint) {
breakpointAltered();
}
/**
* @see IBreakpointListener
*/
- public void breakpointChanged(IMarker breakpoint, IMarkerDelta delta) {
+ public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
}
/**
* @see IBreakpointListener
*/
- public void breakpointRemoved(IMarker breakpoint, IMarkerDelta delta) {
+ public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
breakpointAltered();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveBreakpointAction.java
index 409cc8c73..095bfbf57 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveBreakpointAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveBreakpointAction.java
@@ -52,7 +52,8 @@ public class RemoveBreakpointAction extends SelectionProviderAction {
IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
while (itr.hasNext()) {
try {
- breakpointManager.removeBreakpoint((IMarker)itr.next(), true);
+ IBreakpoint breakpoint= breakpointManager.getBreakpoint((IMarker)itr.next());
+ breakpointManager.removeBreakpoint(breakpoint, true);
} catch (CoreException ce) {
ms.merge(ce.getStatus());
}

Back to the top