Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java364
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java89
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreResources.properties1
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreUtils.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsView.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/EnableDisableBreakpointAction.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/OpenBreakpointMarkerAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllBreakpointsAction.java1
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveBreakpointAction.java5
20 files changed, 358 insertions, 632 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;
+ }
+}
+
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
deleted file mode 100644
index 9d9d3eba6..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java
+++ /dev/null
@@ -1,364 +0,0 @@
-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 getMarker().equals(((IBreakpoint)item).getMarker());
- }
- return false;
- }
-
- public int hashCode() {
- return getMarker().hashCode();
- }
-
- /**
- * 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);
-
- /**
- * @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;
- }
-
- /**
- * 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/BreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
index cefc74010..ba3b7fd75 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
@@ -10,7 +10,7 @@ import java.util.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.*;
-import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.*;
/**
* The breakpoint manager manages all registered breakpoints
@@ -18,7 +18,7 @@ import org.eclipse.debug.core.model.IDebugTarget;
*
* @see IBreakpointManager
*/
-public class BreakpointManager implements IBreakpointManager, IResourceChangeListener, ILaunchListener {
+public class BreakpointManager implements IBreakpointManager, IResourceChangeListener {
private final static String PREFIX= "breakpoint_manager.";
private final static String ERROR= PREFIX + "error.";
@@ -28,6 +28,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
private final static String EXTENSION= ERROR + "extension";
private final static String ASSOCIATED_RESOURCE= ERROR + "associated_resource";
private final static String REQUIRED_ATTRIBUTES= ERROR + "required_attributes";
+ private final static String MISSING_BREAKPOINT_DEFINITION= ERROR + "missing_breakpoint_definition";
private final static String LINE_NUMBER= ERROR + "line_number";
private final static String CREATION_FAILED= ERROR + "creation_failed";
private final static String UNSUPPORTED_EXTENSION= ERROR + "unsupported_extension";
@@ -81,8 +82,8 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
/**
- * Registers this manager as a resource change listener and launch
- * listener. Loads the list of breakpoints from the breakpoint markers in the
+ * Registers this manager as a resource change listener.
+ * Loads the list of breakpoints from the breakpoint markers in the
* workspace. This method should only be called on initial startup of
* the debug plugin.
*
@@ -91,7 +92,6 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
public void startup() throws CoreException {
initBreakpointExtensions();
getWorkspace().addResourceChangeListener(this);
- getLaunchManager().addLaunchListener(this);
IMarker[] breakpoints= null;
IWorkspaceRoot root= getWorkspace().getRoot();
@@ -112,14 +112,13 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*/
public void shutdown() {
getWorkspace().removeResourceChangeListener(this);
- getLaunchManager().removeLaunchListener(this);
}
protected void initBreakpointExtensions() {
IExtensionPoint ep= DebugPlugin.getDefault().getDescriptor().getExtensionPoint(IDebugConstants.EXTENSION_POINT_BREAKPOINTS);
IConfigurationElement[] elements = ep.getConfigurationElements();
for (int i= 0; i < elements.length; i++) {
- fBreakpointExtensions.put(elements[i].getAttribute("markerType"), elements[i]);
+ fBreakpointExtensions.put(elements[i].getAttribute(IDebugConstants.MARKER_TYPE), elements[i]);
}
}
@@ -177,55 +176,18 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* @see IBreakpointManager
*/
- public IMarker[] getMarkers() {
- IMarker[] temp= (IMarker[]) fMarkers.keySet().toArray(new IMarker[0]);
- return temp;
- }
-
- /**
- * @see IBreakpointManager
- */
- 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 boolean isRegistered(IBreakpoint breakpoint) {
return fBreakpoints.contains(breakpoint);
}
- /**
- * @see IBreakpointManager
- */
- public void removeMarker(IMarker marker, boolean delete) throws CoreException {
- IBreakpoint breakpoint= (IBreakpoint)fMarkers.get(marker);
- if (breakpoint != null) {
- removeBreakpoint(breakpoint, delete);
- }
- }
/**
* Remove the given breakpoint
*/
public void removeBreakpoint(IBreakpoint breakpoint, boolean delete) throws CoreException {
if (fBreakpoints.remove(breakpoint)) {
- fireUpdate(breakpoint, null, REMOVED);
fMarkers.remove(breakpoint.getMarker());
+ fireUpdate(breakpoint, null, REMOVED);
if (delete) {
breakpoint.delete();
}
@@ -243,8 +205,8 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
try {
IConfigurationElement config = (IConfigurationElement)fBreakpointExtensions.get(marker.getType());
if (config == null) {
- // error
- return null;
+ throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getDefault().getDescriptor().getUniqueIdentifier(),
+ IDebugStatusConstants.CONFIGURATION_INVALID, DebugCoreUtils.getFormattedString(MISSING_BREAKPOINT_DEFINITION, marker.getType()), null));
}
IBreakpoint bp = (IBreakpoint)config.createExecutableExtension("class");
bp.setMarker(marker);
@@ -418,9 +380,12 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*/
protected void handleRemoveBreakpoint(IMarker marker, IMarkerDelta delta) {
IBreakpoint breakpoint= getBreakpoint(marker);
- if (isRegistered(breakpoint)) {
- fBreakpoints.remove(breakpoint);
- fireUpdate(breakpoint, delta, REMOVED);
+ if (breakpoint != null) {
+ try {
+ removeBreakpoint(breakpoint, false);
+ } catch (CoreException e) {
+ logError(e);
+ }
}
}
@@ -470,29 +435,5 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
}
- /**
- * Adds any debug targets as listeners
- *
- * @see ILaunchListener
- */
- public void launchRegistered(ILaunch launch) {
- IDebugTarget dt= launch.getDebugTarget();
- if (dt != null) {
- addBreakpointListener(dt);
- }
- }
-
- /**
- * Removes the debug target associated with
- * this launch as a breakpoint listener.
- *
- * @see ILaunchListener
- */
- public void launchDeregistered(ILaunch launch) {
- IDebugTarget dt= launch.getDebugTarget();
- if (dt != null) {
- removeBreakpointListener(dt);
- }
- }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreResources.properties b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreResources.properties
index e4a28ccf5..740e6a084 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreResources.properties
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreResources.properties
@@ -11,6 +11,7 @@ breakpoint_manager.error.label_property=Label property required to set a breakpo
breakpoint_manager.error.extension=File extension required to set a breakpoint.
breakpoint_manager.error.associated_resource=Breakpoint creator did not specify associated resource.
breakpoint_manager.error.required_attributes= Breakpoint creator did not configure required attributes.
+breakpoint_manager.error.missing_breakpoint_definition= Missing breakpoint definition for marker type {0}.
breakpoint_manager.error.line_number=Breakpoint already exists at line number {0}.
breakpoint_manager.error.creation_failed=Breakpoint creation failed.
breakpoint_manager.error.unsupported_extension=Unsupported file extension {0}.
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreUtils.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreUtils.java
index 33ec37c8b..67a66b862 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreUtils.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreUtils.java
@@ -5,10 +5,12 @@ package org.eclipse.debug.internal.core;
* All Rights Reserved.
*/
-import org.eclipse.debug.core.DebugPlugin;
+import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import org.eclipse.debug.core.DebugPlugin;
+
/**
* Utility methods for the debug core plugin.
*/
@@ -54,4 +56,20 @@ public class DebugCoreUtils {
System.out.println();
}
}
+
+ /**
+ * Plug in the single argument to the resource String for the key to get a formatted resource String
+ */
+ public static String getFormattedString(String key, String arg) {
+ String string= getResourceString(key);
+ return MessageFormat.format(string, new String[] { arg });
+ }
+
+ /**
+ * Plug in the arguments to the resource String for the key to get a formatted resource String
+ */
+ public static String getFormattedString(String key, String[] args) {
+ String string= getResourceString(key);
+ return MessageFormat.format(string, args);
+ }
}
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 dda9c26f0..d898cdb39 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
@@ -5,9 +5,9 @@ package org.eclipse.debug.internal.ui;
* All Rights Reserved.
*/
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jface.viewers.TableViewer;
/**
@@ -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).getMarkers();
+ return ((IBreakpointManager) parent).getBreakpoints();
}
/**
@@ -45,7 +45,7 @@ public class BreakpointsContentProvider extends BasicContentProvider implements
asyncExec(new Runnable() {
public void run() {
if (!isDisposed()) {
- ((TableViewer)fViewer).add(breakpoint.getMarker());
+ ((TableViewer)fViewer).add(breakpoint);
}
}
});
@@ -59,7 +59,7 @@ public class BreakpointsContentProvider extends BasicContentProvider implements
asyncExec(new Runnable() {
public void run() {
if (!isDisposed()) {
- ((TableViewer)fViewer).remove(breakpoint.getMarker());
+ ((TableViewer)fViewer).remove(breakpoint);
}
}
});
@@ -73,7 +73,7 @@ public class BreakpointsContentProvider extends BasicContentProvider implements
asyncExec(new Runnable() {
public void run() {
if (!isDisposed()) {
- refresh(breakpoint.getMarker());
+ refresh(breakpoint);
}
}
});
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 bc4056bd3..ba608edac 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
@@ -5,10 +5,11 @@ package org.eclipse.debug.internal.ui;
* All Rights Reserved.
*/
-import java.util.*;
+import java.util.Vector;
import org.eclipse.core.resources.IMarker;
import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.*;
@@ -21,7 +22,6 @@ import org.eclipse.ui.*;
import org.eclipse.ui.help.ViewContextComputer;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.model.WorkbenchViewerSorter;
-import org.eclipse.ui.texteditor.IUpdate;
/**
* This view shows the breakpoints registered with the breakpoint manager
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 12fb3ab50..b29c53ce6 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
@@ -5,22 +5,22 @@ package org.eclipse.debug.internal.ui;
* All Rights Reserved.
*/
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.*;
import org.eclipse.debug.core.model.*;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.graphics.Image;
-import java.util.HashMap;
-import java.util.Iterator;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.model.IWorkbenchAdapter;
/**
* A model presentation that delegates to the appropriate extension. This
@@ -102,7 +102,7 @@ public class DelegatingModelPresentation implements IDebugModelPresentation {
* Can return <code>null</code>
*/
public Image getImage(Object item) {
- if (item instanceof IDebugElement || item instanceof IMarker) {
+ if (item instanceof IDebugElement || item instanceof IMarker || item instanceof IBreakpoint) {
IDebugModelPresentation lp= getConfiguredPresentation(item);
if (lp != null) {
Image image= lp.getImage(item);
@@ -251,7 +251,7 @@ public class DelegatingModelPresentation implements IDebugModelPresentation {
boolean displayQualifiedNames= showQualifiedNames();
if (item instanceof InspectItem) {
return getInspectItemText((InspectItem)item);
- } else if (item instanceof IDebugElement || item instanceof IMarker) {
+ } else if (item instanceof IDebugElement || item instanceof IMarker || item instanceof IBreakpoint) {
IDebugModelPresentation lp= getConfiguredPresentation(item);
if (lp != null) {
String label= lp.getText(item);
@@ -392,17 +392,15 @@ public class DelegatingModelPresentation implements IDebugModelPresentation {
} else if (element instanceof InspectItem) {
IValue value= ((InspectItem)element).getValue();
id= value.getModelIdentifier();
- } else
- if (element instanceof IMarker) {
- IMarker m= (IMarker) element;
- try {
- if (m.exists()) {
- id= (String) m.getAttribute(IDebugConstants.MODEL_IDENTIFIER);
- }
- } catch (CoreException e) {
- DebugUIUtils.logError(e);
- }
+ } else if (element instanceof IMarker) {
+ IMarker m= (IMarker) element;
+ IBreakpoint bp = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(m);
+ if (bp != null) {
+ id= bp.getModelIdentifier();
}
+ } else if (element instanceof IBreakpoint) {
+ id = ((IBreakpoint)element).getModelIdentifier();
+ }
if (id != null) {
return getPresentation(id);
}
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 e6865c3d7..071e01bc0 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
@@ -12,6 +12,7 @@ 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.debug.core.model.IBreakpoint;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.actions.SelectionProviderAction;
@@ -49,12 +50,10 @@ public class EnableDisableBreakpointAction extends SelectionProviderAction imple
return;
}
- IBreakpointManager manager= getBreakpointManager();
MultiStatus ms= new MultiStatus(DebugUIPlugin.getDefault().getDescriptor().getUniqueIdentifier(), IDebugStatusConstants.REQUEST_FAILED, DebugUIUtils.getResourceString(STATUS), null);
while (enum.hasNext()) {
- IMarker marker= (IMarker) enum.next();
+ IBreakpoint breakpoint = (IBreakpoint) enum.next();
try {
- IBreakpoint breakpoint= getBreakpoint(marker);
breakpoint.setEnabled(!breakpoint.isEnabled());
} catch (CoreException e) {
ms.merge(e.getStatus());
@@ -75,11 +74,11 @@ public class EnableDisableBreakpointAction extends SelectionProviderAction imple
setEnabled(false);
return;
}
- IMarker marker= (IMarker)enum.next();
+ IBreakpoint bp= (IBreakpoint)enum.next();
if (!enum.hasNext()) {
//single selection
try {
- if (getBreakpoint(marker).isEnabled()) {
+ if (bp.isEnabled()) {
setText(DebugUIUtils.getResourceString(DISABLE));
} else {
setText(DebugUIUtils.getResourceString(ENABLE));
@@ -131,11 +130,5 @@ public class EnableDisableBreakpointAction extends SelectionProviderAction imple
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/OpenBreakpointMarkerAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/OpenBreakpointMarkerAction.java
index c5c0b957f..95e4f22fc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/OpenBreakpointMarkerAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/OpenBreakpointMarkerAction.java
@@ -8,6 +8,7 @@ package org.eclipse.debug.internal.ui;
import java.util.Iterator;
import org.eclipse.core.resources.IMarker;
+import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.*;
@@ -42,9 +43,9 @@ public class OpenBreakpointMarkerAction extends OpenMarkerAction {
IStructuredSelection selection= (IStructuredSelection)getStructuredSelection();
//Get the selected marker
Iterator enum= selection.iterator();
- IMarker marker= (IMarker)enum.next();
- IEditorInput input= fgPresentation.getEditorInput(marker);
- String editorId= fgPresentation.getEditorId(input, marker);
+ IBreakpoint breakpoint= (IBreakpoint)enum.next();
+ IEditorInput input= fgPresentation.getEditorInput(breakpoint);
+ String editorId= fgPresentation.getEditorId(input, breakpoint);
if (input != null) {
try {
part= page.openEditor(input, editorId);
@@ -57,7 +58,7 @@ public class OpenBreakpointMarkerAction extends OpenMarkerAction {
part.setFocus();
// Goto the bookmark.
- part.gotoMarker(marker);
+ part.gotoMarker(breakpoint.getMarker());
}
}
}
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 eb086da2a..34e5d3db0 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
@@ -8,6 +8,7 @@ package org.eclipse.debug.internal.ui;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.help.WorkbenchHelp;
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 095bfbf57..94a616f52 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
@@ -10,6 +10,7 @@ import java.util.Iterator;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -49,10 +50,10 @@ public class RemoveBreakpointAction extends SelectionProviderAction {
IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) {
- IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
while (itr.hasNext()) {
try {
- IBreakpoint breakpoint= breakpointManager.getBreakpoint((IMarker)itr.next());
+ IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
+ IBreakpoint breakpoint= (IBreakpoint)itr.next();
breakpointManager.removeBreakpoint(breakpoint, true);
} catch (CoreException ce) {
ms.merge(ce.getStatus());

Back to the top