Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2016-09-20 03:24:41 +0000
committerSarika Sinha2016-10-27 10:32:15 +0000
commit3fa670f3c24690b6b741ae5a88b57829972ccfd7 (patch)
tree7a11818787c66135ea60ea00a26501a674d6645f /org.eclipse.debug.core
parent8936561b6fa05f69746b10e2c5ba99ba6f453bf9 (diff)
downloadeclipse.platform.debug-3fa670f3c24690b6b741ae5a88b57829972ccfd7.tar.gz
eclipse.platform.debug-3fa670f3c24690b6b741ae5a88b57829972ccfd7.tar.xz
eclipse.platform.debug-3fa670f3c24690b6b741ae5a88b57829972ccfd7.zip
Bug 501245 - Trigger points -- API deficienciesY20161103-1000I20161108-1015I20161108-0800
Diffstat (limited to 'org.eclipse.debug.core')
-rw-r--r--org.eclipse.debug.core/.settings/.api_filters26
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java40
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java23
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java27
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/ITriggerPoint.java63
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java72
6 files changed, 118 insertions, 133 deletions
diff --git a/org.eclipse.debug.core/.settings/.api_filters b/org.eclipse.debug.core/.settings/.api_filters
index b1a0ce1be..985cbd845 100644
--- a/org.eclipse.debug.core/.settings/.api_filters
+++ b/org.eclipse.debug.core/.settings/.api_filters
@@ -8,30 +8,4 @@
</message_arguments>
</filter>
</resource>
- <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 d4ea08698..bd3dc94d4 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
@@ -262,16 +262,14 @@ public interface IBreakpointManager {
public IBreakpointImportParticipant[] getImportParticipants(String markertype) throws CoreException;
/**
- * Returns the triggering breakpoint associated with the workspace or
+ * Returns the triggers for the breakpoints associated with the workspace or
* <code>null</code> if no such breakpoint exists
*
- * @return the triggering breakpoint associated with the workspace or
+ * @return the triggers breakpoint associated with the workspace or
* <code>null</code> if none exists
* @since 3.11
*/
- public default IBreakpoint[] getTriggerBreakpoints() {
- return null;
- }
+ public IBreakpoint[] getTriggerPoints();
/**
* Adds the given breakpoint as the triggering breakpoint in the workspace
@@ -289,12 +287,11 @@ public interface IBreakpointManager {
* </ul>
* @since 3.11
*/
- public default void addTriggerBreakpoint(IBreakpoint breakpoint) throws CoreException {
- }
+ public void addTriggerPoint(IBreakpoint breakpoint) throws CoreException;
/**
- * Removes the given breakpoint as the triggering breakpoint in the
- * workspace and notifies all registered listeners.
+ * Removes the given breakpoint as the trigger breakpoint in the workspace
+ * and notifies all registered listeners.
*
* @param breakpoint the breakpoint to be removed as the trigger point
*
@@ -308,8 +305,7 @@ public interface IBreakpointManager {
* </ul>
* @since 3.11
*/
- public default void removeTriggerBreakpoint(IBreakpoint breakpoint) throws CoreException {
- }
+ public void removeTriggerPoint(IBreakpoint breakpoint) throws CoreException;
/**
* Removes all the trigger points from the breakpoint manager.
@@ -318,37 +314,33 @@ public interface IBreakpointManager {
* underlying marker.
* @since 3.11
*/
- public default void removeAllTriggerpoints() throws CoreException {
- }
+ public void removeAllTriggerPoints() throws CoreException;
/**
- * Returns whether a breakpoint can suspend based on other trigger points
+ * Returns whether a workspace has active TriggerPoints
*
- * @return return <code>true</code> if a breakpoint can suspend
+ * @return return <code>true</code> if a breakpoint has active triggers and
+ * cannot suspend and return <code>false> otherwise.
* @since 3.11
*/
- public default boolean canSupendOnBreakpoint() {
- return true;
- }
+ public boolean hasActiveTriggerPoints();
/**
* Revisit all the trigger points to activate/deactivate trigger points.
*
- * @param triggerpoints list of trigger points to be deactivated or
+ * @param triggerPoints list of trigger points to be deactivated or
* <code>null<code> to deactivate all trigger points
* @param enable enable if <code>true</code> or disable if <code>false</code>
* @since 3.11
*/
- public default void enableTriggerpoints(IBreakpoint[] triggerpoints, boolean enable) {
- }
+ public void enableTriggerPoints(IBreakpoint[] triggerPoints, boolean enable);
/**
- * Refreshes the trigger point display on breakpoints.
+ * Touch and refresh the display of all breakpoints.
*
* @since 3.11
*/
- public default void refreshTriggerpointDisplay() {
- }
+ public void refreshTriggerpointDisplay();
}
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 0d2322066..62abed746 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
@@ -40,19 +40,8 @@ import org.eclipse.debug.internal.core.DebugCoreMessages;
* @since 2.0
*/
-public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
+public abstract class Breakpoint extends PlatformObject implements IBreakpoint, ITriggerPoint {
- /**
- * 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$
/**
* Creates a breakpoint.
@@ -184,22 +173,22 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
*/
@Override
public boolean isTriggerPoint() throws CoreException {
- return getMarker().getAttribute(TRIGGEREPOINT, false);
+ return getMarker().getAttribute(TRIGGERPOINT, false);
}
/**
- * @see IBreakpoint#setTriggerPoint(boolean)
+ * @see ITriggerPoint#setTriggerPoint(boolean)
* @since 3.11
*/
@Override
public void setTriggerPoint(boolean triggerPoint) throws CoreException {
if (isTriggerPoint() != triggerPoint) {
- setAttribute(TRIGGEREPOINT, triggerPoint);
+ setAttribute(TRIGGERPOINT, triggerPoint);
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
if (triggerPoint) {
- manager.addTriggerBreakpoint(this);
+ manager.addTriggerPoint(this);
} else {
- manager.removeTriggerBreakpoint(this);
+ manager.removeTriggerPoint(this);
}
}
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 cb3523eff..332680e29 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
@@ -217,33 +217,6 @@ public interface IBreakpoint extends IAdaptable {
*/
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
- */
- public default 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, then the <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
- */
- public default void setTriggerPoint(boolean trigger) throws CoreException {
- }
-
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ITriggerPoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ITriggerPoint.java
new file mode 100644
index 000000000..eb6fe0192
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ITriggerPoint.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.core.model;
+
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * TriggerPoint is a breakpoint property which defines a dependency relationship
+ * between all the breakpoints of a workspace and trigger points defined in a
+ * workspace. TriggerPoint defines the availability of breakpoints to be
+ * suspended based on the order of hits of breakpoints. If there are active
+ * TriggerPoints, breakpoints can not be suspended.
+ *
+ * @since 3.11
+ */
+public interface ITriggerPoint extends IAdaptable {
+ /**
+ * 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)
+ *
+ */
+ public static final String TRIGGERPOINT = "org.eclipse.debug.core.triggerpoint"; //$NON-NLS-1$
+
+ /**
+ * Returns whether this breakpoint is defined as a 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
+ */
+ public boolean isTriggerPoint() throws CoreException;
+
+ /**
+ * Sets whether this breakpoint is to be treated as a trigger point for the
+ * workspace. If it is a trigger point, then the
+ * {@link org.eclipse.debug.core.model.ITriggerPoint} 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.
+ */
+ public void setTriggerPoint(boolean trigger) throws CoreException;
+
+}
+
+
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 94c8fd678..365670983 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
@@ -50,6 +50,7 @@ import org.eclipse.debug.core.IBreakpointManagerListener;
import org.eclipse.debug.core.IBreakpointsListener;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IBreakpointImportParticipant;
+import org.eclipse.debug.core.model.ITriggerPoint;
import com.ibm.icu.text.MessageFormat;
@@ -284,8 +285,8 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
added.add(breakpoint);
}
- if (breakpoint.isTriggerPoint()) {
- addTriggerBreakpoint(breakpoint);
+ if (breakpoint instanceof ITriggerPoint && ((ITriggerPoint) breakpoint).isTriggerPoint()) {
+ addTriggerPoint(breakpoint);
}
} catch (DebugException e) {
DebugPlugin.log(e);
@@ -1167,23 +1168,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
public void setEnabled(final boolean enabled) {
if (isEnabled() != enabled) {
Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_BREAKPOINT_MANAGER_ENABLED_STATE, enabled, null);
- 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);
- }
+ touchAllBreakpoints();
new BreakpointManagerNotifier().notify(enabled);
}
}
@@ -1252,7 +1237,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
class BreakpointManagerTriggerPointNotifier implements ISafeRunnable {
private IBreakpointManagerListener fListener;
- private IBreakpoint fManagerTriggerpoint;
+ private IBreakpoint fManagerTriggerPoint;
/**
* @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
@@ -1268,7 +1253,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*/
@Override
public void run() throws Exception {
- fListener.breakpointManagerTriggerPointChanged(fManagerTriggerpoint);
+ fListener.breakpointManagerTriggerPointChanged(fManagerTriggerPoint);
}
/**
@@ -1277,7 +1262,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* @param triggerBreakpoint new breakpoint as trigger point
*/
public void notify(IBreakpoint triggerBreakpoint) {
- fManagerTriggerpoint = triggerBreakpoint;
+ fManagerTriggerPoint = triggerBreakpoint;
for (IBreakpointManagerListener iBreakpointManagerListener : fBreakpointManagerListeners) {
fListener = iBreakpointManagerListener;
SafeRunner.run(this);
@@ -1378,59 +1363,61 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
@Override
- public IBreakpoint[] getTriggerBreakpoints() {
+ public IBreakpoint[] getTriggerPoints() {
return fTriggerPointBreakpointList.toArray(new IBreakpoint[0]);
}
@Override
- public void addTriggerBreakpoint(IBreakpoint triggerBreakpoint) throws CoreException {
- if (triggerBreakpoint == null) {
+ public void addTriggerPoint(IBreakpoint triggerPoint) throws CoreException {
+ if (triggerPoint == null) {
return;
}
- fTriggerPointBreakpointList.add(triggerBreakpoint);
- new BreakpointManagerTriggerPointNotifier().notify(triggerBreakpoint);
+ fTriggerPointBreakpointList.add(triggerPoint);
+ new BreakpointManagerTriggerPointNotifier().notify(triggerPoint);
}
@Override
- public void removeTriggerBreakpoint(IBreakpoint breakpoint) throws CoreException {
+ public void removeTriggerPoint(IBreakpoint breakpoint) throws CoreException {
if (breakpoint != null) {
fTriggerPointBreakpointList.remove(breakpoint);
}
}
@Override
- public void removeAllTriggerpoints() throws CoreException {
+ public void removeAllTriggerPoints() throws CoreException {
IBreakpoint[] triggerPointBreakpointList = fTriggerPointBreakpointList.toArray(new IBreakpoint[0]);
for (IBreakpoint iBreakpoint : triggerPointBreakpointList) {
- iBreakpoint.setTriggerPoint(false);
+ if (iBreakpoint instanceof ITriggerPoint) {
+ ((ITriggerPoint) iBreakpoint).setTriggerPoint(false);
+ }
}
refreshTriggerpointDisplay();
}
@Override
- public boolean canSupendOnBreakpoint() {
+ public boolean hasActiveTriggerPoints() {
if (fTriggerPointBreakpointList.isEmpty()) {
- return true;
+ return false;
}
for (IBreakpoint iBreakpoint : fTriggerPointBreakpointList) {
try {
if (iBreakpoint.isEnabled()) {
- return false;
+ return true;
}
} catch (CoreException e) {
e.printStackTrace();
}
}
- return true;
+ return false;
}
@Override
- public void enableTriggerpoints(IBreakpoint[] triggerpoints, boolean enable) {
- IBreakpoint[] triggerpointList = triggerpoints;
- if (triggerpoints == null) {
- triggerpointList = fTriggerPointBreakpointList.toArray(new IBreakpoint[0]);
+ public void enableTriggerPoints(IBreakpoint[] triggerPoints, boolean enable) {
+ IBreakpoint[] triggerPointList = triggerPoints;
+ if (triggerPoints == null) {
+ triggerPointList = fTriggerPointBreakpointList.toArray(new IBreakpoint[0]);
}
- for (IBreakpoint iBreakpoint : triggerpointList) {
+ for (IBreakpoint iBreakpoint : triggerPointList) {
try {
IMarker m = iBreakpoint.getMarker();
if (m != null && m.exists()) {
@@ -1444,6 +1431,13 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
@Override
public void refreshTriggerpointDisplay() {
+ touchAllBreakpoints();
+ }
+
+ /*
+ * Touch and refresh display of all breakpoints
+ */
+ private void touchAllBreakpoints() {
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {

Back to the top