troizet commented on code in PR #6891:
URL: https://github.com/apache/netbeans/pull/6891#discussion_r1438466321


##########
php/php.dbgp/src/org/netbeans/modules/php/dbgp/breakpoints/BreakpointModel.java:
##########
@@ -179,21 +180,55 @@ private boolean foundBreakpoint(DebugSession session, 
Acceptor acceptor) {
                 continue;
             }
             if (acceptor.accept(breakpoint)) {
-                AbstractBreakpoint abpnt = (AbstractBreakpoint) breakpoint;
-                synchronized (myCurrentBreakpoints) {
-                    AbstractBreakpoint bpnt = 
myCurrentBreakpoints.get(session);
-                    myCurrentBreakpoints.put(session, abpnt);
-                    fireChangeEvents(new ModelEvent[]{
-                        new ModelEvent.NodeChanged(this, bpnt),
-                        new ModelEvent.NodeChanged(this, abpnt)
-                    });
-                }
+                updateCurrentBreakpoint(session, breakpoint);
                 return true;
             }
         }
         return false;
     }
 
+    public void setCurrentBreakpoint(DebugSession session, String id) {
+        Breakpoint[] breakpoints = 
DebuggerManager.getDebuggerManager().getBreakpoints();
+        for (Breakpoint breakpoint : breakpoints) {
+            if (canSetCurrentBreakPoint(session, breakpoint, id)) {
+                updateCurrentBreakpoint(session, breakpoint);
+                break;
+            }
+        }
+    }
+
+    private boolean canSetCurrentBreakPoint(DebugSession session, Breakpoint 
breakpoint, String id) {
+        if (Utils.isValid(breakpoint) && breakpoint instanceof 
AbstractBreakpoint) {
+            AbstractBreakpoint abstractBreakpoint = (AbstractBreakpoint) 
breakpoint;
+            if (abstractBreakpoint.isSessionRelated(session)
+                    && abstractBreakpoint.isEnabled()
+                    && abstractBreakpoint.getBreakpointId().equals(id)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private void updateCurrentBreakpoint(DebugSession session, Breakpoint 
breakpoint) {
+        AbstractBreakpoint abpnt = (AbstractBreakpoint) breakpoint;
+        synchronized (myCurrentBreakpoints) {
+            AbstractBreakpoint bpnt = myCurrentBreakpoints.get(session);
+            myCurrentBreakpoints.put(session, abpnt);
+            fireChangeEvents(new ModelEvent[]{
+                new ModelEvent.NodeChanged(this, bpnt),
+                new ModelEvent.NodeChanged(this, abpnt)
+            });
+        }
+    }
+
+    public void setSearchCurrentBreakpointById(Boolean flag) {

Review Comment:
   Oops. Fixed it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to