[r212] bug 39474 - JavaBreakpoint.recreate() should call getAdapter(IJavaDebugTarget.class)
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaBreakpoint.java
index bea7564..e3b05ea 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaBreakpoint.java
@@ -1085,9 +1085,10 @@
for (int i = 0; i < targets.length; i++) {
IDebugTarget target = targets[i];
MultiStatus multiStatus = new MultiStatus(JDIDebugPlugin.getUniqueIdentifier(), JDIDebugPlugin.INTERNAL_ERROR, JDIDebugBreakpointMessages.getString("JavaBreakpoint.Exception"), null); //$NON-NLS-1$
- if (target instanceof JDIDebugTarget) {
+ IJavaDebugTarget jdiTarget = (IJavaDebugTarget)target.getAdapter(IJavaDebugTarget.class);
+ if (jdiTarget != null) {
try {
- recreate((JDIDebugTarget)target);
+ recreate((JDIDebugTarget)jdiTarget);
} catch (CoreException e) {
multiStatus.add(e.getStatus());
}
@@ -1099,10 +1100,13 @@
}
/**
- * Recreate this breakpoint in the given target
+ * Recreate this breakpoint in the given target, as long as the
+ * target already contains this breakpoint.
+ *
+ * @param target the target in which to re-create the breakpoint
*/
protected void recreate(JDIDebugTarget target) throws CoreException {
- if (target.isAvailable()) {
+ if (target.isAvailable() && target.getBreakpoints().contains(this)) {
removeRequests(target);
createRequests(target);
}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java
index b381bbd..dd6087a 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java
@@ -296,7 +296,7 @@
* @return list of installed breakpoints - instances of
* <code>IJavaBreakpoint</code>
*/
- protected List getBreakpoints() {
+ public List getBreakpoints() {
return fBreakpoints;
}