Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Swanson2001-08-01 11:24:26 +0000
committerDarin Swanson2001-08-01 11:24:26 +0000
commitb54845d121aad0e578138ebc2a98b2753aaa5ecd (patch)
treea4248437a9d1ee1bf3503f3736b0f19d86249318
parent172b0ea764f0a5e279f16142312b13a5b57fbc5b (diff)
downloadeclipse.platform.debug-bp_exp_002.tar.gz
eclipse.platform.debug-bp_exp_002.tar.xz
eclipse.platform.debug-bp_exp_002.zip
*** empty log message ***bp_exp_002
-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.java473
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointFactory.java16
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointListener.java8
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java121
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugConstants.java18
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IExceptionBreakpoint.java20
-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.java21
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java283
-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.java219
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreResources.properties5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java14
-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.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleDocument.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java23
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/EnableDisableBreakpointAction.java64
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllBreakpointsAction.java12
21 files changed, 1245 insertions, 250 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..512268ff1 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;
@@ -134,6 +139,17 @@ public class DebugPlugin extends Plugin {
}
/**
+ * 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;
+ }
+
+ /**
* Returns the launch manager.
*
* @return the launch manager
@@ -157,6 +173,21 @@ public class DebugPlugin extends Plugin {
fLaunchers[i]= new Launcher(infos[i]);
}
}
+
+ /**
+ * 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..340ebbf3e
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpoint.java
@@ -0,0 +1,473 @@
+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 {
+ /*====================================================================
+ * Marker types:
+ *====================================================================*/
+
+ /**
+ * Base marker type
+ *
+ * @see #getType
+ */
+ public static final String MARKER = ResourcesPlugin.PI_RESOURCES + ".marker";
+
+ /**
+ * Task marker type
+ *
+ * @see #getType
+ */
+ public static final String TASK = ResourcesPlugin.PI_RESOURCES + ".taskmarker";
+
+ /**
+ * Problem marker type
+ *
+ * @see #getType
+ */
+ public static final String PROBLEM = ResourcesPlugin.PI_RESOURCES + ".problemmarker";
+
+ /**
+ * Text marker type
+ *
+ * @see #getType
+ */
+ public static final String TEXT = ResourcesPlugin.PI_RESOURCES + ".textmarker";
+
+ /**
+ * Bookmark marker type
+ *
+ * @see #getType
+ */
+ public static final String BOOKMARK = ResourcesPlugin.PI_RESOURCES + ".bookmark";
+
+ /*====================================================================
+ * Marker attributes:
+ *====================================================================*/
+
+ /**
+ * Severity marker attribute. A number from the set of error, warning and info
+ * severities defined by the plaform.
+ *
+ * @see #SEVERITY_ERROR
+ * @see #SEVERITY_WARNING
+ * @see #SEVERITY_INFO
+ * @see #getAttribute
+ */
+ public static final String SEVERITY = "severity";
+
+ /**
+ * Message marker attribute. A localized string describing the nature
+ * of the marker (e.g., a name for a bookmark or task). The content
+ * and form of this attribute is not specified or interpreted by the platform.
+ *
+ * @see #getAttribute
+ */
+ public static final String MESSAGE = "message";
+
+ /**
+ * Location marker attribute. The location is a human-readable (localized) string which
+ * can be used to distinguish between markers on a resource. As such it
+ * should be concise and aimed at users. The content and
+ * form of this attribute is not specified or interpreted by the platform.
+ *
+ * @see #getAttribute
+ */
+ public static final String LOCATION = "location";
+
+ /**
+ * Priority marker attribute. A number from the set of high, normal and low
+ * priorities defined by the plaform.
+ *
+ * @see #PRIORITY_HIGH
+ * @see #PRIORITY_NORMAL
+ * @see #PRIORITY_LOW
+ * @see #getAttribute
+ */
+ public static final String PRIORITY = "priority";
+
+ /**
+ * Done marker attribute. A boolean value indicating whether
+ * the marker (e.g., a task) is considered done.
+ *
+ * @see #getAttribute
+ */
+ public static final String DONE = "done";
+
+ /**
+ * Character start marker attribute. An integer value indicating where a text
+ * marker starts. This attribute is zero-relative and inclusive.
+ *
+ * @see #getAttribute
+ */
+ public static final String CHAR_START = "charStart";
+
+ /**
+ * Character end marker attribute. An integer value indicating where a text
+ * marker ends. This attribute is zero-relative and exclusive.
+ *
+ * @see #getAttribute
+ */
+ public static final String CHAR_END = "charEnd";
+
+ /**
+ * Line number marker attribute. An integer value indicating the line number
+ * for a text marker. This attribute is 1-relative.
+ *
+ * @see #getAttribute
+ */
+ public static final String LINE_NUMBER = "lineNumber";
+
+ /*====================================================================
+ * Marker attributes values:
+ *====================================================================*/
+
+ /**
+ * High priority constant (value 2).
+ *
+ * @see #getAttribute
+ */
+ public static final int PRIORITY_HIGH = 2;
+
+ /**
+ * Normal priority constant (value 1).
+ *
+ * @see #getAttribute
+ */
+ public static final int PRIORITY_NORMAL = 1;
+
+ /**
+ * Low priority constant (value 0).
+ *
+ * @see #getAttribute
+ */
+ public static final int PRIORITY_LOW = 0;
+
+ /**
+ * Error severity constant (value 2) indicating an error state.
+ *
+ * @see #getAttribute
+ */
+ public static final int SEVERITY_ERROR= 2;
+
+ /**
+ * Warning severity constant (value 1) indicating a warning.
+ *
+ * @see #getAttribute
+ */
+ public static final int SEVERITY_WARNING = 1;
+
+ /**
+ * Info severity constant (value 0) indicating information only.
+ *
+ * @see #getAttribute
+ */
+ public static final int SEVERITY_INFO = 0;
+
+/**
+ * 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)
+ */
+public void configure(String modelIdentifier, boolean enabled) throws CoreException;
+/**
+ * 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 marker for equality with the given object.
+ * Two markers are equal iff they 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();
+/**
+ * Returns the model identifier for this breakpoint.
+ */
+public String getModelIdentifier();
+/**
+ * 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 marker does not exist.</li>
+ * </ul>
+ */
+public Object getAttribute(String attributeName) throws CoreException;
+/**
+ * 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.
+ */
+public int getAttribute(String attributeName, int 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.
+ */
+public String getAttribute(String attributeName, String 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.
+ */
+public boolean getAttribute(String attributeName, boolean 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> This marker does not exist.</li>
+ * </ul>
+ */
+public Map getAttributes() throws CoreException;
+/**
+ * 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> This marker does not exist.</li>
+ * </ul>
+ */
+public Object[] getAttributes(String[] attributeNames) throws CoreException;
+/**
+ * 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 marker.
+ *
+ * @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;
+/**
+ * Returns whether the type of this marker is considered to be a subtype of
+ * the given marker type.
+ *
+ * @return boolean <code>true</code>if the marker's type
+ * is the same as (or a subtype of) the given type.
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li> This marker does not exist.</li>
+ * </ul>
+ */
+public boolean isSubtypeOf(String superType) throws CoreException;
+/**
+ * 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>
+ */
+public void setAttribute(String attributeName, int value) throws CoreException;
+/**
+ * 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> This marker does not exist.</li>
+ * </ul>
+ */
+public void setAttribute(String attributeName, Object value) throws CoreException;
+/**
+ * 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> This marker does not exist.</li>
+ * </ul>
+ */
+public void setAttribute(String attributeName, boolean value) throws CoreException;
+/**
+ * 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>
+ */
+public void setAttributes(String[] attributeNames, Object[] values) throws CoreException;
+/**
+ * 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> This marker does not exist.</li>
+ * </ul>
+ */
+public void setAttributes(Map attributes) 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..1ab33a664
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointFactory.java
@@ -0,0 +1,16 @@
+package org.eclipse.debug.core;
+
+import org.eclipse.core.resources.IMarker;
+
+/**
+ * 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;
+
+}
+
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..c6f2c595d 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,10 +32,10 @@ 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.
*
@@ -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 e9105a316..ce12ae509 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
@@ -8,6 +8,7 @@ package org.eclipse.debug.core;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.internal.core.Breakpoint;
/**
* The breakpoint manager manages the collection of breakpoints
@@ -62,55 +63,6 @@ import org.eclipse.core.runtime.CoreException;
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 breakoint, or -1 if unknown
- * @param charEnd the index in an associated source element, of the last
- * character associated with the breakoint, 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
* if the given breakpoint is already registered.
@@ -124,7 +76,14 @@ 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 a collection of all existing breakpoints.
@@ -132,7 +91,15 @@ public interface IBreakpointManager {
*
* @return an array of breakpoint markers
*/
- IMarker[] getBreakpoints();
+ IBreakpoint[] getBreakpoints();
+
+ /**
+ * 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 breakpoints registered for the
@@ -142,23 +109,26 @@ public interface IBreakpointManager {
* @param modelIdentifier identifier of a debug model plug-in
* @return an array of breakpoint markers
*/
- 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 markers registered for the
+ * given debug model. Answers an empty array if no markers are registered
+ * for the given debug model.
*
- * @param breakpoint the breakpoint
- * @return whether the breakpoint is enabled
- * @see IMarker#getAttribute(String, boolean)
+ * @param modelIdentifier identifier of a debug model plug-in
+ * @return an array of breakpoint markers
*/
- boolean isEnabled(IMarker breakpoint);
+ IMarker[] getMarkers(String modelIdentifier);
+
+ /**
+ * 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);
/**
* Sets the value of the <code>ENABLED</code> attribute of the
@@ -176,7 +146,15 @@ public interface IBreakpointManager {
*
* @return whether the breakpoint is registered
*/
- boolean isRegistered(IMarker marker);
+ boolean isRegistered(IBreakpoint breakpoint);
+
+ /**
+ * Returns whether the given marker is currently
+ * registered with this breakpoint manager.
+ *
+ * @return whether the marker is registered
+ */
+ boolean isRegistered(IMarker marker);
/**
* Returns the value of the <code>LINE_NUMBER</code> attribute of the
@@ -232,7 +210,18 @@ public interface IBreakpointManager {
* @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 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 removeBreakpoint(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..01753d1cd 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 marker type
+ * (value <code>"org.eclipse.debug.core.breakpoint"</code>).
+ */
+ public static final String BREAKPOINT = "breakpoint";
+
+ /**
+ * Line breakpoint marker 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
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IExceptionBreakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IExceptionBreakpoint.java
new file mode 100644
index 000000000..790c87ac5
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IExceptionBreakpoint.java
@@ -0,0 +1,20 @@
+package org.eclipse.debug.core;
+
+import org.eclipse.core.runtime.CoreException;
+
+public interface IExceptionBreakpoint extends IBreakpoint {
+
+ boolean isChecked();
+
+ boolean isCaught();
+
+ boolean isUncaught();
+
+ void setChecked(boolean checked) throws CoreException;
+
+ void setCaught(boolean caught) throws CoreException;
+
+ void setUncaught(boolean uncaught) throws CoreException;
+
+}
+
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
index c685491a0..04139b892 100644
--- 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
@@ -5,9 +5,10 @@ package org.eclipse.debug.core.model;
* All Rights Reserved.
*/
-import org.eclipse.debug.core.IBreakpointListener;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.debug.core.IBreakpoint;
+import org.eclipse.debug.core.IBreakpointListener;
/**
* Breakpoint support defines functionality for
@@ -45,7 +46,7 @@ public interface IBreakpointSupport extends IBreakpointListener {
* @param breakpoint the breakpoint being added/removed/changed
* @return whether this target is currently interested in the breakpoint
*/
- boolean supportsBreakpoint(IMarker breakpoint);
+ boolean supportsBreakpoint(IBreakpoint breakpoint);
/**
* Installs the given breakpoint in this target. The breakpoint should
@@ -54,20 +55,20 @@ public interface IBreakpointSupport extends IBreakpointListener {
*
* @param breakpoint the added breakpoint
* @see IBreakpointListener
- * @see #supportsBreakpoint(IMarker)
+ * @see #supportsBreakpoint(IBreakpoint)
*/
- public void breakpointAdded(IMarker breakpoint);
-
+ public void breakpointAdded(IBreakpoint 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)
+ * @see #supportsBreakpoint(IBreakpoint)
*/
- public void breakpointRemoved(IMarker breakpoint, IMarkerDelta delta);
-
+ public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta);
+
/**
* An attribute of the given breakpoint has changed, as described
* by the delta. If the breakpoint is applicable to this target
@@ -77,9 +78,9 @@ public interface IBreakpointSupport extends IBreakpointListener {
*
* @param breakpoint the changed breakpoint
* @see IBreakpointListener
- * @see #supportsBreakpoint(IMarker)
+ * @see #supportsBreakpoint(IBreakpoint)
*/
- public void breakpointChanged(IMarker breakpoint, IMarkerDelta delta);
+ public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta);
}
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..c801c7e98
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java
@@ -0,0 +1,283 @@
+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 {
+
+ /**
+ * 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;
+
+ /**
+ * Constructor for Breakpoint
+ */
+ public Breakpoint() {
+ }
+
+ /**
+ * Create a breakpoint for the given marker
+ */
+ public Breakpoint(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;
+ }
+
+ /**
+ * @see IBreakpoint
+ */
+ 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#getAttribute(String)
+ */
+ public Object getAttribute(String attributeName) throws CoreException {
+ return fMarker.getAttribute(attributeName);
+ }
+
+ /**
+ * @see IBreakpoint#getAttribute(String, int)
+ */
+ public int getAttribute(String attributeName, int defaultValue) {
+ return fMarker.getAttribute(attributeName, defaultValue);
+ }
+
+ /**
+ * @see IBreakpoint#getAttribute(String, String)
+ */
+ public String getAttribute(String attributeName, String defaultValue) {
+ return fMarker.getAttribute(attributeName, defaultValue);
+ }
+
+ /**
+ * @see IBreakpoint#getAttribute(String, boolean)
+ */
+ public boolean getAttribute(String attributeName, boolean defaultValue) {
+ return fMarker.getAttribute(attributeName, defaultValue);
+ }
+
+ /**
+ * @see IBreakpoint#getAttributes()
+ */
+ public Map getAttributes() throws CoreException {
+ return fMarker.getAttributes();
+ }
+
+ /**
+ * @see IBreakpoint#getAttributes(String[])
+ */
+ public Object[] getAttributes(String[] attributeNames) throws CoreException {
+ return fMarker.getAttributes(attributeNames);
+ }
+
+ /**
+ * Sets the <code>boolean</code> attribute of the given breakpoint.
+ */
+ protected void setBooleanAttribute(String attribute, boolean value) throws CoreException {
+ setAttribute(attribute, value);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * @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();
+ }
+
+ /**
+ * @see IBreakpointManager
+ */
+ public int getLineNumber() {
+ return getAttribute(IMarker.LINE_NUMBER, -1);
+ }
+
+ /**
+ * @see IBreakpointManager
+ */
+ public int getCharStart() {
+ return getAttribute(IMarker.CHAR_START, -1);
+ }
+
+ /**
+ * @see IBreakpointManager
+ */
+ public int getCharEnd() {
+ return getAttribute(IMarker.CHAR_END, -1);
+ }
+
+ /**
+ * Returns the model identifier for the given breakpoint.
+ */
+ public String getModelIdentifier() {
+ return (String)getAttribute(IDebugConstants.MODEL_IDENTIFIER, null);
+ }
+
+ /**
+ * @see IBreakpoint#isSubtypeOf(String)
+ */
+ public boolean isSubtypeOf(String superType) throws CoreException {
+ return fMarker.isSubtypeOf(superType);
+ }
+
+ /**
+ * @see IBreakpoint#setAttribute(String, int)
+ */
+ public void setAttribute(String attributeName, int value)
+ throws CoreException {
+ fMarker.setAttribute(attributeName, value);
+ }
+
+ /**
+ * @see IBreakpoint#setAttribute(String, Object)
+ */
+ public void setAttribute(String attributeName, Object value)
+ throws CoreException {
+ fMarker.setAttribute(attributeName, value);
+ }
+
+ /**
+ * @see IBreakpoint#setAttribute(String, boolean)
+ */
+ public void setAttribute(String attributeName, boolean value)
+ throws CoreException {
+ fMarker.setAttribute(attributeName, value);
+ }
+
+ /**
+ * @see IBreakpoint#setAttributes(String[], Object[])
+ */
+ public void setAttributes(String[] attributeNames, Object[] values)
+ throws CoreException {
+ fMarker.setAttributes(attributeNames, values);
+ }
+
+ /**
+ * @see IBreakpoint#setAttributes(Map)
+ */
+ public 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..2d2bcf708 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,13 @@ 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
@@ -53,6 +52,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.
*/
protected ListenerList fBreakpointListeners= new ListenerList(6);
@@ -63,11 +67,6 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
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};
@@ -77,6 +76,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*/
public BreakpointManager() {
fBreakpoints= new Vector(15);
+ fMarkers= new HashMap();
}
/**
@@ -90,18 +90,6 @@ 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);
-
- for (int i = 0; i < breakpoints.length; i++) {
- IMarker marker= breakpoints[i];
- try {
- addBreakpoint(marker);
- } catch (DebugException e) {
- logError(e);
- }
- }
}
/**
@@ -130,8 +118,15 @@ 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;
}
@@ -139,93 +134,159 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* @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();
+ Breakpoint bp= (Breakpoint) bps.next();
String id= getModelIdentifier(bp);
if (id != null && id.equals(modelIdentifier)) {
temp.add(bp);
}
}
}
- IMarker[] m= new IMarker[temp.size()];
+ Breakpoint[] m= new Breakpoint[temp.size()];
temp.copyInto(m);
return m;
}
+
+ /**
+ * @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 int getLineNumber(IMarker breakpoint) {
- return breakpoint.getAttribute(IMarker.LINE_NUMBER, -1);
+ public int getLineNumber(IMarker marker) {
+ return getBreakpoint(marker).getAttribute(IMarker.LINE_NUMBER, -1);
}
/**
* @see IBreakpointManager
*/
- public int getCharStart(IMarker breakpoint) {
- return breakpoint.getAttribute(IMarker.CHAR_START, -1);
+ public int getCharStart(IMarker marker) {
+ return getBreakpoint(marker).getAttribute(IMarker.CHAR_START, -1);
}
/**
* @see IBreakpointManager
*/
- public int getCharEnd(IMarker breakpoint) {
- return breakpoint.getAttribute(IMarker.CHAR_END, -1);
+ public int getCharEnd(IMarker marker) {
+ return getBreakpoint(marker).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 String getModelIdentifier(IMarker marker) {
+ return getModelIdentifier(getBreakpoint(marker));
}
+
+ /**
+ * Returns the model identifier for the given breakpoint.
+ */
+ public String getModelIdentifier(IBreakpoint breakpoint) {
+ return breakpoint.getModelIdentifier();
+ }
/**
* @see IBreakpointManager
*/
- public boolean isEnabled(IMarker marker) {
- return marker.getAttribute(IDebugConstants.ENABLED, true);
+ public boolean isRegistered(IBreakpoint breakpoint) {
+ return fBreakpoints.contains(breakpoint);
}
/**
* @see IBreakpointManager
*/
public boolean isRegistered(IMarker marker) {
- return fBreakpoints.contains(marker);
- }
+ return (fMarkers.get(marker) != null);
+ }
/**
* @see IBreakpointManager
*/
- public void removeBreakpoint(IMarker breakpoint, boolean delete) throws CoreException {
+ public void removeBreakpoint(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());
if (delete) {
breakpoint.delete();
}
}
+ }
+
+ /**
+ * @see IBreakpointManager
+ */
+ public IBreakpoint loadMarker(IMarker marker) throws DebugException {
+ if (isRegistered(marker)) {
+ return (IBreakpoint) fMarkers.get(marker);
+ }
+ IBreakpointFactory[] factories= DebugPlugin.getDefault().getBreakpointFactories();
+ for (int i=0; i<factories.length; i++) {
+ IBreakpoint breakpoint= factories[i].createBreakpointFor(marker);
+ if (breakpoint == null) {
+ continue;
+ }
+ addBreakpoint(breakpoint);
+ return breakpoint;
+ }
+ return null;
}
/**
* @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);
if (id == null) {
@@ -234,7 +295,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
} catch (CoreException e) {
throw new DebugException(e.getStatus());
- }
+ }
}
/**
@@ -263,9 +324,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 +336,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);
}
@@ -298,7 +360,15 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* @see IBreakpointManager.
*/
public void setEnabled(IMarker marker, boolean enabled) throws CoreException {
- marker.setAttribute(IDebugConstants.ENABLED, enabled);
+ IBreakpoint breakpoint= getBreakpoint(marker);
+ if (breakpoint != null) {
+ if (enabled) {
+ breakpoint.enable();
+ } else {
+ breakpoint.disable();
+ }
+
+ }
}
/**
@@ -351,7 +421,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);
}
@@ -373,21 +444,23 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
/**
- * Wrapper for handling removes
+ * Wrapper for handling marker 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);
}
- }
+ }
/**
* 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);
}
}
}
@@ -409,23 +482,22 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* 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)) {
+ if (supportsBreakpoint(listener, breakpoint)) {
switch (update) {
case ADDED:
- listener.breakpointAdded(marker);
+ listener.breakpointAdded(breakpoint);
break;
case REMOVED:
- listener.breakpointRemoved(marker, delta);
+ listener.breakpointRemoved(breakpoint, delta);
break;
case CHANGED:
- listener.breakpointChanged(marker, delta);
+ listener.breakpointChanged(breakpoint, delta);
break;
}
-
}
}
}
@@ -435,7 +507,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* the listener is a debug target, we check if the specific
* breakpoint is supported by the target.
*/
- protected boolean supportsBreakpoint(IBreakpointListener listener, IMarker breakpoint) {
+ protected boolean supportsBreakpoint(IBreakpointListener listener, IBreakpoint breakpoint) {
if (listener instanceof IBreakpointSupport) {
return ((IBreakpointSupport)listener).supportsBreakpoint(breakpoint);
} else {
@@ -444,21 +516,6 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
/**
- * @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
*
* @see ILaunchListener
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..81d42bf2f 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
@@ -34,11 +34,6 @@ exception_manager.error.restoring=Error restoring exceptions.
input_stream_monitor.label=Input Stream Monitor
##############################################################
-# OutputStreamMonitor
-##############################################################
-output_stream_monitor.label=Output Stream Monitor
-
-##############################################################
# Launch
##############################################################
launch.terminate_failed=Terminate failed
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
index 81f827f0e..904bee8c7 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
@@ -8,6 +8,7 @@ package org.eclipse.debug.internal.core;
import org.eclipse.debug.core.model.IStreamMonitor;
import org.eclipse.debug.core.model.IStreamsProxy;
import java.io.IOException;
+import java.io.OutputStream;
/**
* @see IStreamsProxy
@@ -22,9 +23,9 @@ public class StreamsProxy implements IStreamsProxy {
*/
protected InputStreamMonitor fErrorMonitor;
/**
- * The monitor for the output stream (connected to standard in of the process).
+ * The <code>OutputStream</code> of the <code>IProcess</code>.
*/
- protected OutputStreamMonitor fOutputMonitor;
+ protected OutputStream fOutputStream;
/**
* Records the open/closed state of communications with
* the underlying streams.
@@ -38,10 +39,9 @@ public class StreamsProxy implements IStreamsProxy {
if (process != null) {
fInputMonitor= new InputStreamMonitor(process.getInputStream());
fErrorMonitor= new InputStreamMonitor(process.getErrorStream());
- fOutputMonitor= new OutputStreamMonitor(process.getOutputStream());
+ fOutputStream= process.getOutputStream();
fInputMonitor.startMonitoring();
fErrorMonitor.startMonitoring();
- fOutputMonitor.startMonitoring();
}
}
@@ -54,7 +54,6 @@ public class StreamsProxy implements IStreamsProxy {
fClosed= true;
fInputMonitor.close();
fErrorMonitor.close();
- fOutputMonitor.close();
}
/**
@@ -75,8 +74,9 @@ public class StreamsProxy implements IStreamsProxy {
* @see IStreamsProxy
*/
public void write(String input) throws IOException {
- if (!fClosed) {
- fOutputMonitor.write(input);
+ if (!fClosed && fOutputStream != null) {
+ fOutputStream.write(input.getBytes());
+ fOutputStream.flush();
} else {
throw new IOException();
}
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 b1c64a9dd..1c333bd63 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.*;
@@ -19,6 +18,7 @@ import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.*;
+import org.eclipse.ui.actions.SelectionProviderAction;
import org.eclipse.ui.help.ViewContextComputer;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.model.WorkbenchViewerSorter;
@@ -38,8 +38,8 @@ public class BreakpointsView extends AbstractDebugView implements IDoubleClickLi
private RemoveBreakpointAction fRemoveBreakpointAction;
private RemoveAllBreakpointsAction fRemoveAllBreakpointsAction;
private EnableDisableBreakpointAction fEnableDisableBreakpointAction;
+ private Vector fBreakpointListenerActions;
private ShowQualifiedAction fShowQualifiedNamesAction;
- private List fContributedActions = new ArrayList(0);
/**
* @see IWorkbenchPart
@@ -54,7 +54,7 @@ public class BreakpointsView extends AbstractDebugView implements IDoubleClickLi
createContextMenu(((TableViewer)fViewer).getTable());
- fViewer.setInput(DebugPlugin.getDefault().getBreakpointManager());
+ fViewer.setInput(getBreakpointManager());
fViewer.addDoubleClickListener(this);
fViewer.getControl().addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
@@ -83,6 +83,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);
fRemoveBreakpointAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_REMOVE));
fRemoveBreakpointAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE));
@@ -106,20 +107,17 @@ public class BreakpointsView extends AbstractDebugView implements IDoubleClickLi
fOpenMarkerAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_OPEN_MARKER));
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);
- }
}
/**
@@ -169,7 +167,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);
@@ -187,23 +184,12 @@ public class BreakpointsView extends AbstractDebugView implements IDoubleClickLi
/**
* Add an action to the contributed actions collection
*/
- public void addContributedAction(IUpdate update) {
- fContributedActions.add(update);
+ public void addBreakpointListenerAction(IBreakpointListener action) {
+ fBreakpointListenerActions.add(action);
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(action);
}
/**
- * 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();
- }
- }
-
- /**
* @see IDoubleClickListener
*/
public void doubleClick(DoubleClickEvent event) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleDocument.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleDocument.java
index e1a0a6989..e9ff360d2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleDocument.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleDocument.java
@@ -25,7 +25,6 @@ public class ConsoleDocument extends AbstractDocument implements IDebugEventList
protected IProcess fProcess;
private IStreamsProxy fProxy;
private int fLastStreamWriteEnd= 0;
- private int fLastWritePosition= 0;
private int fNewStreamWriteEnd= 0;
protected boolean fNeedsToStartReading= true;
@@ -87,8 +86,7 @@ public class ConsoleDocument extends AbstractDocument implements IDebugEventList
if (lineDelimiters[i].equals(eventText)) {
try {
String inText= event.getDocument().get();
- fLastWritePosition = fLastStreamWriteEnd;
- inText= inText.substring(fLastWritePosition, inText.length());
+ inText= inText.substring(fNewStreamWriteEnd, inText.length());
if (inText.length() == 0) {
return;
}
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..5f89fbfb0 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
@@ -181,9 +181,10 @@ public class DelegatingModelPresentation implements IDebugModelPresentation {
}
} else
if (element instanceof IMarker) {
- IMarker m= (IMarker) element;
+ IMarker marker= (IMarker) element;
+ IBreakpoint breakpoint= DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
try {
- if (m.exists() && m.isSubtypeOf(IDebugConstants.BREAKPOINT_MARKER)) {
+ if (breakpoint.exists() && breakpoint.isSubtypeOf(IDebugConstants.BREAKPOINT_MARKER)) {
return DebugUIUtils.getResourceString(BREAKPOINT_LABEL);
}
} catch (CoreException e) {
@@ -227,9 +228,10 @@ 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() && breakpoint.isSubtypeOf(IDebugConstants.BREAKPOINT_MARKER)) {
+ if (breakpoint.isEnabled()) {
return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
} else {
return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT_DISABLED);
@@ -394,13 +396,10 @@ public class DelegatingModelPresentation implements IDebugModelPresentation {
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);
+ IMarker marker= (IMarker) element;
+ IBreakpoint breakpoint= DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
+ if (breakpoint.exists()) {
+ id= breakpoint.getModelIdentifier();
}
}
if (id != null) {
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..5afc66b5d 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() {
@@ -45,14 +48,12 @@ public class EnableDisableBreakpointAction extends SelectionProviderAction imple
if (!enum.hasNext()) {
return;
}
-
- 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();
+ IBreakpoint breakpoint= getBreakpoint(marker);
try {
- manager.setEnabled(breakpoint, !enabled);
+ breakpoint.toggleEnabled();
} catch (CoreException e) {
ms.merge(e.getStatus());
}
@@ -75,11 +76,15 @@ 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 {
+ IBreakpoint breakpoint= getBreakpoint(marker);
+ if (breakpoint.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,20 +96,20 @@ 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) {
- Display display= Display.getDefault();
+ public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
+ final Display display= Display.getDefault();
if (display.isDisposed()) {
return;
}
@@ -117,5 +122,20 @@ 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 ac32eef29..28b334eb2 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
@@ -30,13 +30,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());
}
@@ -55,18 +55,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();
}

Back to the top