jtulach commented on code in PR #9757:
URL: https://github.com/apache/netbeans/pull/9757#discussion_r4587086860


##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/AddLogpointAction.java:
##########
@@ -80,6 +81,18 @@ public void actionPerformed(ActionEvent ev) {
         lb.setSuspend(JPDABreakpoint.SUSPEND_NONE);
         lb.setPrintText(Bundle.MSG_LogpointAt("{className}", "{methodName}", 
"{lineNumber}", "{locals}"));
 
+        addOrReplaceBreakpoint(lb);
+    }
+
+    private static void addOrReplaceBreakpoint(LineBreakpoint lb) {
+        Comparator<Comparable<Object>> comp = Comparator.naturalOrder();
+        for (Breakpoint existing : 
DebuggerManager.getDebuggerManager().getBreakpoints()) {
+            if (lb instanceof Comparable c1 && existing instanceof Comparable 
c2) {
+                if (comp.compare(c1, c2) == 0) {
+                    
DebuggerManager.getDebuggerManager().removeBreakpoint(existing);

Review Comment:
   - 15668284efa2 unifies the two cases
   - _Add Logpoint_ action (on editor pane) is now also disabled when a line 
breakpoint is already present
   - this kind of "solution" may not make @lahodaj happy ...
      - as it basically says that Jan's [original 
inquiry](https://github.com/apache/netbeans/pull/9732#issuecomment-6445689342) 
is not a bug
   - ... and I agree it may not make for the best UX ...
   - but it consistent (across the pane and gutter actions) and it doesn't 
loose user settings (as [Toni 
reported](https://github.com/apache/netbeans/pull/9732#discussion_r4385961438))



-- 
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