Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2016-06-24 06:32:51 -0400
committerSarika Sinha2016-09-09 07:48:04 -0400
commit414d0f61d474b7065cb3734772f39ad5a37d4349 (patch)
treed2b4b523dadbe146f32d4891dc23e9367030a0f2 /org.eclipse.debug.core
parentba0abc228cde4836afb6bc6fc4baf8259973e762 (diff)
downloadeclipse.platform.debug-414d0f61d474b7065cb3734772f39ad5a37d4349.tar.gz
eclipse.platform.debug-414d0f61d474b7065cb3734772f39ad5a37d4349.tar.xz
eclipse.platform.debug-414d0f61d474b7065cb3734772f39ad5a37d4349.zip
Bug 488664 - [Breakpoints] Ability to set up Breakpoint dependency
Diffstat (limited to 'org.eclipse.debug.core')
-rw-r--r--org.eclipse.debug.core/.settings/.api_filters29
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java159
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManagerListener.java18
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java86
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java118
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java147
6 files changed, 482 insertions, 75 deletions
diff --git a/org.eclipse.debug.core/.settings/.api_filters b/org.eclipse.debug.core/.settings/.api_filters
new file mode 100644
index 000000000..bfd1ab074
--- /dev/null
+++ b/org.eclipse.debug.core/.settings/.api_filters
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.debug.core" version="2">
+ <resource path="core/org/eclipse/debug/core/model/IBreakpoint.java" type="org.eclipse.debug.core.model.IBreakpoint">
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.debug.core.model.IBreakpoint"/>
+ <message_argument value="isTriggerPoint()"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.debug.core.model.IBreakpoint"/>
+ <message_argument value="isTriggerPointActive()"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.debug.core.model.IBreakpoint"/>
+ <message_argument value="setTriggerPoint(boolean)"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.debug.core.model.IBreakpoint"/>
+ <message_argument value="setTriggerPointActive(boolean)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
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 374b3e61f..eefd16e89 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -50,7 +50,7 @@ public interface IBreakpointManager {
* @since 2.0
*/
public void addBreakpoint(IBreakpoint breakpoint) throws CoreException;
-
+
/**
* Adds the given breakpoints to the collection of registered breakpoints
* in the workspace and notifies all registered listeners. Has no effect
@@ -66,19 +66,19 @@ public interface IBreakpointManager {
* </ul>
* @since 2.1
*/
- public void addBreakpoints(IBreakpoint[] breakpoints) throws CoreException;
-
+ public void addBreakpoints(IBreakpoint[] breakpoints) throws CoreException;
+
/**
* Returns the breakpoint associated with the given marker or
* <code>null</code> if no such breakpoint exists
- *
+ *
* @param marker the marker
* @return the breakpoint associated with the marker
* or <code>null</code> if none exists
* @since 2.0
*/
- public IBreakpoint getBreakpoint(IMarker marker);
-
+ public IBreakpoint getBreakpoint(IMarker marker);
+
/**
* Returns a collection of all registered breakpoints.
* Returns an empty array if no breakpoints are registered.
@@ -87,15 +87,15 @@ public interface IBreakpointManager {
* @since 2.0
*/
public IBreakpoint[] getBreakpoints();
-
+
/**
* Returns whether there are any registered breakpoints.
- *
+ *
* @return whether there are any registered breakpoints
* @since 2.0
*/
public boolean hasBreakpoints();
-
+
/**
* Returns a collection of all breakpoints registered for the
* given debug model. Answers an empty array if no breakpoints are registered
@@ -106,7 +106,7 @@ public interface IBreakpointManager {
* @since 2.0
*/
public IBreakpoint[] getBreakpoints(String modelIdentifier);
-
+
/**
* Returns whether the given breakpoint is currently
* registered with this breakpoint manager.
@@ -116,22 +116,22 @@ public interface IBreakpointManager {
* @since 2.0
*/
public boolean isRegistered(IBreakpoint breakpoint);
-
+
/**
* Notifies all registered listeners that the given
* breakpoint has changed. Has no effect if the given
* breakpoint is not currently registered.
- *
+ *
* This method is intended to be used when a breakpoint
* attribute is changed that does not alter the breakpoint's
* underlying marker, that is, when notification will not occur
* via the marker delta mechanism.
- *
+ *
* @param breakpoint the breakpoint that has changed.
* @since 2.0
*/
public void fireBreakpointChanged(IBreakpoint breakpoint);
-
+
/**
* Removes the given breakpoint from the breakpoint manager, deletes
* the marker associated with the breakpoint if the <code>delete</code> flag
@@ -147,7 +147,7 @@ public interface IBreakpointManager {
* @since 2.0
*/
public void removeBreakpoint(IBreakpoint breakpoint, boolean delete) throws CoreException;
-
+
/**
* Removes the given breakpoints from the breakpoint manager, deletes
* the markers associated with the breakpoints if the <code>delete</code> flag
@@ -162,7 +162,7 @@ public interface IBreakpointManager {
* underlying marker.
* @since 2.1
*/
- public void removeBreakpoints(IBreakpoint[] breakpoints, boolean delete) throws CoreException;
+ public void removeBreakpoints(IBreakpoint[] breakpoints, boolean delete) throws CoreException;
/**
* Adds the given listener to the collection of registered breakpoint listeners.
@@ -176,10 +176,10 @@ public interface IBreakpointManager {
* Removes the given listener from the collection of registered breakpoint listeners.
* Has no effect if an identical listener is not already registered.
*
- * @param listener the listener to remove
+ * @param listener the listener to remove
*/
public void removeBreakpointListener(IBreakpointListener listener);
-
+
/**
* Adds the given listener to the collection of registered breakpoint listeners.
* Has no effect if an identical listener is already registered.
@@ -193,45 +193,45 @@ public interface IBreakpointManager {
* Removes the given listener from the collection of registered breakpoint listeners.
* Has no effect if an identical listener is not already registered.
*
- * @param listener the listener to remove
+ * @param listener the listener to remove
* @since 2.1
*/
public void removeBreakpointListener(IBreakpointsListener listener);
-
+
/**
* Adds the given listener to the collection of registered breakpoint manager
* listeners. Has no effect if an identical listener is already registered.
- *
+ *
* @param listener the listener to add
* @since 3.0
*/
public void addBreakpointManagerListener(IBreakpointManagerListener listener);
-
+
/**
* Removes the given listener from the collection of registered breakpoint manager
* listeners. Has no effect if an identical listener is not already registered.
- *
+ *
* @param listener the listener to remove
* @since 3.0
*/
public void removeBreakpointManagerListener(IBreakpointManagerListener listener);
-
+
/**
* Returns whether or not this breakpoint manager is enabled.
* When a breakpoint manager is enabled, all breakpoints
* should be honored. When it is disabled, breakpoints should
* not be honored, regardless of each breakpoint's enabled state.
- *
+ *
* @return whether or not this breakpoint manager is enabled
* @since 3.0
*/
public boolean isEnabled();
-
+
/**
* Sets the enabled state of this breakpoint manager. When
* enabled, breakpoints should be honoured. When disabled, all
* breakpoints should be ignored.
- *
+ *
* @param enabled whether this breakpoint manager should be
* enabled
* @since 3.0
@@ -242,25 +242,114 @@ public interface IBreakpointManager {
* Returns the name (user readable String) of the given
* breakpoint's type or <code>null</code> if none has been
* specified.
- *
+ *
* @param breakpoint the breakpoint
* @return the name of the given breakpoint's type or <code>null</code>
* @since 3.1
*/
public String getTypeName(IBreakpoint breakpoint);
-
+
/**
- * Returns an array of {@link IBreakpointImportParticipant}s for the given
+ * Returns an array of {@link IBreakpointImportParticipant}s for the given
* breakpoint marker id, never <code>null</code>.
- *
+ *
* @param markertype the {@link String} identifier of the marker type
- * @return an array of {@link IBreakpointImportParticipant}s for the given marker type,
+ * @return an array of {@link IBreakpointImportParticipant}s for the given marker type,
* never <code>null</code>
* @throws CoreException if an exception occurs
* @since 3.5
*/
- public IBreakpointImportParticipant[] getImportParticipants(String markertype) throws CoreException;
-
+ public IBreakpointImportParticipant[] getImportParticipants(String markertype) throws CoreException;
+
+ /**
+ * Returns the triggering breakpoint associated with the workspace or
+ * <code>null</code> if no such breakpoint exists
+ *
+ * @return the triggering breakpoint associated with the workspace or
+ * <code>null</code> if none exists
+ * @since 3.11
+ */
+ default public IBreakpoint[] getTriggerBreakpoints() {
+ return null;
+ }
+
+ /**
+ * Adds the given breakpoint as the triggering breakpoint in the workspace
+ * and notifies all registered listeners.
+ *
+ * @param breakpoint the breakpoint to be added as the trigger point
+ *
+ * @exception CoreException if adding fails. Reasons include:
+ * <ul>
+ * <li>CONFIGURATION_INVALID - the required
+ * <code>MODEL_IDENTIFIER</code> attribute is not set on the
+ * breakpoint marker.</li>
+ * <li>A <code>CoreException</code> occurred while verifying
+ * the <code>MODEL_IDENTIFIER</code> attribute.</li>
+ * </ul>
+ * @since 3.11
+ */
+ default public void addTriggerBreakpoint(IBreakpoint breakpoint) throws CoreException {
+ }
+
+ /**
+ * Removes the given breakpoint as the triggering breakpoint in the
+ * workspace and notifies all registered listeners.
+ *
+ * @param breakpoint the breakpoint to be removed as the trigger point
+ *
+ * @exception CoreException if adding fails. Reasons include:
+ * <ul>
+ * <li>CONFIGURATION_INVALID - the required
+ * <code>MODEL_IDENTIFIER</code> attribute is not set on the
+ * breakpoint marker.</li>
+ * <li>A <code>CoreException</code> occurred while verifying
+ * the <code>MODEL_IDENTIFIER</code> attribute.</li>
+ * </ul>
+ * @since 3.11
+ */
+ default public void removeTriggerBreakpoint(IBreakpoint breakpoint) throws CoreException {
+ }
+
+ /**
+ * Removes all the trigger points from the breakpoint manager.
+ *
+ * @exception CoreException if an exception occurs while deleting an
+ * underlying marker.
+ * @since 3.11
+ */
+ default public void removeAllTriggerpoints() throws CoreException {
+ }
+
+ /**
+ * Returns whether a breakpoint can suspend based on other trigger points
+ *
+ * @return return <code>true</code> if a breakpoint can suspend
+ * @since 3.11
+ */
+ default public boolean canSupendOnBreakpoint() {
+ return true;
+ }
+
+ /**
+ * Revisit all the trigger points to activate/deactivate trigger points.
+ *
+ * @param triggerointList list of trigger points to be deactivated or
+ * <code>null<code> to deactivate all trigger points
+ * @since 3.11
+ */
+ default public void deActivateTriggerpoints(IBreakpoint[] triggerointList) {
+ }
+
+ /**
+ * Refreshes the trigger point display on breakpoints.
+ *
+ * @since 3.11
+ */
+ default public void refreshTriggerpointDisplay() {
+
+ }
+
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManagerListener.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManagerListener.java
index e8839bce2..c9deda160 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManagerListener.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManagerListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.debug.core;
+import org.eclipse.debug.core.model.IBreakpoint;
+
/**
* A breakpoint manager listener is notified when the breakpoint manager's
* enablement changes. When the breakpoint manager is disabled, no breakpoints
@@ -22,12 +24,22 @@ package org.eclipse.debug.core;
* @since 3.0
*/
public interface IBreakpointManagerListener {
-
+
/**
* Notifies the listener that the breakpoint manager's enablement
* has changed.
- *
+ *
* @param enabled whether or not the breakpoint manager is enabled
*/
public void breakpointManagerEnablementChanged(boolean enabled);
+
+ /**
+ * Notifies the listener that the breakpoint manager's trigger point has
+ * changed.
+ *
+ * @param triggerBreakpoint new trigger breakpoint or <code>null<code>
+ * @since 3.11
+ */
+ default public void breakpointManagerTriggerPointChanged(IBreakpoint triggerBreakpoint) {
+ }
}
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
index 6a6aab9f8..aee0df9e5 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -43,6 +43,29 @@ import org.eclipse.debug.internal.core.DebugCoreMessages;
public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
/**
+ * Persisted breakpoint marker attribute (value
+ * <code>"org.eclipse.debug.core.triggerpoint"</code>). The attribute is a
+ * <code>boolean</code> corresponding to whether a breakpoint is a trigger
+ * breakpoint for the workspace.
+ *
+ * @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
+ * @since 3.11
+ *
+ */
+ private static final String TRIGGEREPOINT = "org.eclipse.debug.core.triggerpoint"; //$NON-NLS-1$
+
+ /**
+ * Persisted breakpoint marker attribute (value
+ * <code>"org.eclipse.debug.core.triggerpointactive"</code>). The attribute
+ * is a <code>boolean</code> corresponding to whether the trigger breakpoint
+ * is active or not.
+ *
+ * @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
+ * @since 3.11
+ */
+ private static final String TRIGGEREPOINTACTIVE = "org.eclipse.debug.core.triggerpointactive"; //$NON-NLS-1$
+
+ /**
* Creates a breakpoint.
*
* @since 3.8
@@ -164,10 +187,56 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
}
/**
- * Convenience method to set the given boolean attribute of
- * this breakpoint's underlying marker in a workspace
- * runnable. Setting marker attributes in a workspace runnable
- * prevents deadlock.
+ * @see IBreakpoint#isPersisted()
+ * @since 3.11
+ */
+ @Override
+ public boolean isTriggerPoint() throws CoreException {
+ return getMarker().getAttribute(TRIGGEREPOINT, false);
+ }
+
+ /**
+ * @see IBreakpoint#setTriggerPoint(boolean)
+ * @since 3.11
+ */
+ @Override
+ public void setTriggerPoint(boolean triggerPoint) throws CoreException {
+ if (isTriggerPoint() != triggerPoint) {
+ setAttribute(TRIGGEREPOINT, triggerPoint);
+ IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
+ if (triggerPoint) {
+ manager.addTriggerBreakpoint(this);
+ } else {
+ manager.removeTriggerBreakpoint(this);
+ }
+ }
+
+ }
+
+ /**
+ * @see IBreakpoint#isTriggerPointActive()
+ * @since 3.11
+ */
+ @Override
+ public boolean isTriggerPointActive() throws CoreException {
+ return getMarker().getAttribute(TRIGGEREPOINTACTIVE, false);
+ }
+
+ /**
+ * @see IBreakpoint#setTriggerPointActive(boolean)
+ * @since 3.11
+ */
+ @Override
+ public void setTriggerPointActive(boolean triggerPointActive) throws CoreException {
+ if (isTriggerPointActive() != triggerPointActive) {
+ setAttribute(TRIGGEREPOINTACTIVE, triggerPointActive);
+ }
+ }
+
+ /**
+ * Convenience method to set the given boolean attribute of this
+ * breakpoint's underlying marker in a workspace runnable. Setting marker
+ * attributes in a workspace runnable prevents deadlock.
*
* @param attributeName attribute name
* @param value attribute value
@@ -360,4 +429,11 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
}
}
+ /**
+ * @since 3.11
+ */
+ protected static String getTriggerActivePropertyString() {
+ return TRIGGEREPOINTACTIVE;
+ }
+
}
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
index d25865518..ba0848ca5 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,18 +30,18 @@ import org.eclipse.debug.core.DebugPlugin;
* <p>
* For example, following is a definition of corresponding breakpoint
* and breakpoint marker definitions. Note that the <code>markerType</code>
- * attribute defined by the breakpoint extension corresponds to the
+ * 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
+ * &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
+ * &lt;marker
* id="com.example.BreakpointMarker"
* super type="org.eclipse.debug.core.breakpointMarker"
* attribute name ="exampleAttribute"&gt;
@@ -51,7 +51,7 @@ import org.eclipse.debug.core.DebugPlugin;
* <p>
* The breakpoint manager instantiates persisted breakpoints by
* traversing all markers that are a subtype of
- * <code>"org.eclipse.debug.core.breakpointMarker"</code>, and
+ * <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 associate a marker with the breakpoint.
@@ -63,24 +63,24 @@ import org.eclipse.debug.core.DebugPlugin;
* a <code>PERSISTED</code> attribute for selective persistence of breakpoints
* of the same type.
* </p>
- *
+ *
* @since 2.0
*/
public interface IBreakpoint extends IAdaptable {
-
+
/**
- * Root breakpoint marker type
+ * Root breakpoint marker type
* (value <code>"org.eclipse.debug.core.breakpointMarker"</code>).
*/
public static final String BREAKPOINT_MARKER = DebugPlugin.getUniqueIdentifier() + ".breakpointMarker"; //$NON-NLS-1$
-
+
/**
* Line breakpoint marker type
* (value <code>"org.eclipse.debug.core.lineBreakpoint"</code>).
*/
public static final String LINE_BREAKPOINT_MARKER = DebugPlugin.getUniqueIdentifier() + ".lineBreakpointMarker"; //$NON-NLS-1$
-
+
/**
* Enabled breakpoint marker attribute (value <code>"org.eclipse.debug.core.enabled"</code>).
* The attribute is a <code>boolean</code> corresponding to the
@@ -89,14 +89,14 @@ public interface IBreakpoint extends IAdaptable {
* @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
*/
public static final String ENABLED= "org.eclipse.debug.core.enabled"; //$NON-NLS-1$
-
+
/**
* Debug model identifier breakpoint marker attribute (value <code>"org.eclipse.debug.core.id"</code>).
* The attribute is a <code>String</code> corresponding to the
* identifier of the debug model a breakpoint is associated with.
*/
public static final String ID= "org.eclipse.debug.core.id"; //$NON-NLS-1$
-
+
/**
* Registered breakpoint marker attribute (value <code>"org.eclipse.debug.core.registered"</code>).
* The attribute is a <code>boolean</code> corresponding to
@@ -104,8 +104,8 @@ public interface IBreakpoint extends IAdaptable {
*
* @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
*/
- public static final String REGISTERED= "org.eclipse.debug.core.registered"; //$NON-NLS-1$
-
+ public static final String REGISTERED= "org.eclipse.debug.core.registered"; //$NON-NLS-1$
+
/**
* Persisted breakpoint marker attribute (value <code>"org.eclipse.debug.core.persisted"</code>).
* The attribute is a <code>boolean</code> corresponding to
@@ -115,7 +115,7 @@ public interface IBreakpoint extends IAdaptable {
* @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
*/
public static final String PERSISTED= "org.eclipse.debug.core.persisted"; //$NON-NLS-1$
-
+
/**
* Deletes this breakpoint's underlying marker, and removes
* this breakpoint from the breakpoint manager.
@@ -124,11 +124,11 @@ public interface IBreakpoint extends IAdaptable {
* underlying marker
*/
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.
*/
@@ -136,7 +136,7 @@ public interface IBreakpoint extends IAdaptable {
/**
* Sets the marker associated with this breakpoint. This method is
* called once at breakpoint creation.
- *
+ *
* @param marker the marker to associate with this breakpoint
* @exception CoreException if an error occurs accessing the marker
*/
@@ -144,14 +144,14 @@ public interface IBreakpoint extends IAdaptable {
/**
* Returns the identifier of the debug model this breakpoint is
* associated with.
- *
+ *
* @return the identifier of the debug model this breakpoint is
* associated with
*/
public String getModelIdentifier();
/**
* Returns whether this breakpoint is enabled
- *
+ *
* @return whether this breakpoint is enabled
* @exception CoreException if unable to access the associated
* attribute from this breakpoint's underlying marker
@@ -161,62 +161,116 @@ public interface IBreakpoint extends IAdaptable {
* 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 unable to set the associated attribute on
* this breakpoint's underlying marker.
*/
public void setEnabled(boolean enabled) throws CoreException;
-
+
/**
* Returns whether this breakpoint is currently registered with
* the breakpoint manager.
- *
+ *
* @return whether this breakpoint is currently registered with
* the breakpoint manager
- * @exception CoreException if unable to access the associated
+ * @exception CoreException if unable to access the associated
* attribute on this breakpoint's underlying marker
*/
public boolean isRegistered() throws CoreException;
-
+
/**
* Sets whether this breakpoint is currently registered with the
- * breakpoint manager.
- *
+ * breakpoint manager.
+ *
* @param registered whether this breakpoint is registered with the
* breakpoint manager
* @exception CoreException if unable to set the associated attribute
* on this breakpoint's underlying marker.
*/
public void setRegistered(boolean registered) throws CoreException;
-
+
/**
* Returns whether this breakpoint is to be persisted across
* workspace invocations, or when a project is closed and re-opened.
* Since marker definitions only allow all/none of a specific type
* of marker to be persisted (rather than selected markers of a
* specific type), breakpoints define this functionality.
- *
+ *
* @return whether this breakpoint is to be persisted
* @exception CoreException if unable to access the associated attribute
* on this breakpoint's underlying marker
*/
public boolean isPersisted() throws CoreException;
-
+
/**
* Sets whether this breakpoint is to be persisted across
* workspace invocations, or when a project is closed and re-opened.
* Has no effect if this breakpoint's marker definition is defined as not
* persisted. Sets the underlying <code>TRANSIENT</code> attribute on this
* breakpoint's marker to <code>true</code>.
- *
+ *
* @param registered whether this breakpoint is to be persisted across
* workspace invocations
* @exception CoreException if unable to set the associated attribute on
* this breakpoint's underlying marker.
*/
public void setPersisted(boolean registered) throws CoreException;
-
+
+ /**
+ * Returns whether this breakpoint is defined as the trigger point in the
+ * workspace
+ *
+ * @return whether this breakpoint is a trigger point
+ * @exception CoreException if unable to access the associated attribute on
+ * this breakpoint's underlying marker
+ * @since 3.11
+ */
+ default public boolean isTriggerPoint() throws CoreException {
+ return false;
+ }
+
+ /**
+ * Sets whether this breakpoint is to be treated as a trigger point for the
+ * workspace. If it is a trigger point <code>TRIGGERPOINT</code> attribute
+ * on this breakpoint's marker is set to <code>true</code>.
+ *
+ * @param trigger whether this breakpoint is to be treated as trigger point
+ * for the workspace
+ * @exception CoreException if unable to set the associated attribute on
+ * this breakpoint's underlying marker.
+ * @since 3.11
+ */
+ default public void setTriggerPoint(boolean trigger) throws CoreException {
+ }
+
+ /**
+ * Sets if the breakpoint is a trigger point and is active. If trigger point
+ * is active <code>TRIGGERPOINTACTIVE</code> attribute on this breakpoint's
+ * marker is set to <code>true</code>.
+ *
+ * @param trigger whether this breakpoint is to be treated as trigger point
+ * for the workspace
+ * @exception CoreException if unable to set the associated attribute on
+ * this breakpoint's underlying marker.
+ * @since 3.11
+ */
+ default public void setTriggerPointActive(boolean active) throws CoreException {
+ }
+
+ /**
+ * Returns whether this breakpoint is a trigger point and is active.
+ *
+ * @return whether this breakpoint is a trigger point and it is active
+ * @exception CoreException if unable to access the associated attribute on
+ * this breakpoint's underlying marker
+ * @since 3.11
+ */
+ default public boolean isTriggerPointActive() throws CoreException {
+ return false;
+ }
+
+
}
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 b9875728f..c7a4dae88 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
@@ -14,6 +14,7 @@ package org.eclipse.debug.internal.core;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -151,6 +152,12 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
private ListenerList<IBreakpointManagerListener> fBreakpointManagerListeners= new ListenerList<>();
/**
+ * Breakpoint which acts a the triggering point in a workspace.
+ */
+ private Set<IBreakpoint> fTriggerPointBreakpointList = new LinkedHashSet<>();
+
+
+ /**
* Listens to POST_CHANGE notifications of breakpoint markers to detect when
* a breakpoint is added & changed before the POST_BUILD add notification is
* sent.
@@ -275,6 +282,10 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
if (breakpoint.isRegistered()) {
added.add(breakpoint);
+
+ }
+ if (breakpoint.isTriggerPoint()) {
+ addTriggerBreakpoint(breakpoint);
}
} catch (DebugException e) {
DebugPlugin.log(e);
@@ -1233,6 +1244,47 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
}
+ /**
+ * Notifies breakpoint manager listeners in a safe runnable to handle
+ * exceptions.
+ */
+ class BreakpointManagerTriggerPointNotifier implements ISafeRunnable {
+
+ private IBreakpointManagerListener fListener;
+ private IBreakpoint fManagerTriggerpoint;
+
+ /**
+ * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
+ */
+ @Override
+ public void handleException(Throwable exception) {
+ IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "An exception occurred during breakpoint change notification.", exception); //$NON-NLS-1$
+ DebugPlugin.log(status);
+ }
+
+ /**
+ * @see org.eclipse.core.runtime.ISafeRunnable#run()
+ */
+ @Override
+ public void run() throws Exception {
+ fListener.breakpointManagerTriggerPointChanged(fManagerTriggerpoint);
+ }
+
+ /**
+ * Notifies the listeners of the enabled state change
+ *
+ * @param triggerBreakpoint new breakpoint as trigger point
+ */
+ public void notify(IBreakpoint triggerBreakpoint) {
+ fManagerTriggerpoint = triggerBreakpoint;
+ for (IBreakpointManagerListener iBreakpointManagerListener : fBreakpointManagerListeners) {
+ fListener = iBreakpointManagerListener;
+ SafeRunner.run(this);
+ }
+ fListener = null;
+ }
+ }
+
class BreakpointManagerJob extends Job {
private final IWorkspaceRunnable fRunnable;
@@ -1323,5 +1375,100 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
}
}
+
+ @Override
+ public IBreakpoint[] getTriggerBreakpoints() {
+ return fTriggerPointBreakpointList.toArray(new IBreakpoint[0]);
+ }
+
+ @Override
+ public void addTriggerBreakpoint(IBreakpoint triggerBreakpoint) throws CoreException {
+ if (triggerBreakpoint == null) {
+ return;
+ }
+ fTriggerPointBreakpointList.add(triggerBreakpoint);
+ new BreakpointManagerTriggerPointNotifier().notify(triggerBreakpoint);
+ }
+
+ @Override
+ public void removeTriggerBreakpoint(IBreakpoint breakpoint) throws CoreException {
+ if (breakpoint != null) {
+ fTriggerPointBreakpointList.remove(breakpoint);
+ }
+ }
+
+ @Override
+ public void removeAllTriggerpoints() throws CoreException {
+ IBreakpoint[] triggerPointBreakpointList = fTriggerPointBreakpointList.toArray(new IBreakpoint[0]);
+ for (IBreakpoint iBreakpoint : triggerPointBreakpointList) {
+ iBreakpoint.setTriggerPoint(false);
+ iBreakpoint.setTriggerPointActive(false);
+ }
+ refreshTriggerpointDisplay();
+ }
+
+ @Override
+ public boolean canSupendOnBreakpoint() {
+ if (fTriggerPointBreakpointList.isEmpty()) {
+ return true;
+ }
+ int i = 0;
+ for (IBreakpoint iBreakpoint : fTriggerPointBreakpointList) {
+ try {
+ if (iBreakpoint.isTriggerPointActive()) {
+ return false;
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ return true;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.IBreakpointManager#revisitTriggerpoints()
+ * This version of implementation deactivate all the active trigger points
+ */
+ @Override
+ public void deActivateTriggerpoints(IBreakpoint[] triggerointList) {
+ if (triggerointList == null) {
+ triggerointList = fTriggerPointBreakpointList.toArray(new IBreakpoint[0]);
+ }
+ for (IBreakpoint iBreakpoint : triggerointList) {
+ try {
+ if (iBreakpoint.isTriggerPointActive()) {
+ iBreakpoint.setTriggerPointActive(false);
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ refreshTriggerpointDisplay();
+ }
+
+ @Override
+ public void refreshTriggerpointDisplay() {
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ IBreakpoint[] breakpoints = getBreakpoints();
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint breakpoint = breakpoints[i];
+ // Touch the marker (but don't actually change anything) so
+ // that the icon in
+ // the editor ruler will be updated (editors listen to
+ // marker changes).
+ breakpoint.getMarker().setAttribute(IBreakpoint.ENABLED, breakpoint.isEnabled());
+ }
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, null);
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ }
}

Back to the top