jtulach commented on code in PR #9757:
URL: https://github.com/apache/netbeans/pull/9757#discussion_r4578025666
##########
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:
- Here is a visual explanation of what Toni is describing:
<img width="1624" height="867" alt="illustrated"
src="https://github.com/user-attachments/assets/edd5558b-41e4-4252-a206-471e12aacc85"
/>
- When there is a regular breakpoint on a line and ...
- one invokes the "Add Logpoint" action
- which is enabled in the editor's (not gutter) popup menu
- then the existing breakpoint is removed and ...
- a new log point is added
<img width="383" height="160" alt="logpoint"
src="https://github.com/user-attachments/assets/d6078b1d-254b-4bcc-80f8-beb943f0f539"
/>
- The Toni's situation is [different than the
situation](https://github.com/apache/netbeans/pull/9757#issuecomment-6875508057)
described by @lahodaj
- sorry Jan for not noticing that earlier after reading [your original
description](https://github.com/apache/netbeans/pull/9732#issuecomment-6445689342)
- the 3b02b22a3a22a98413c4c784622ea9009f75adfc only "fixes" [Toni's original
report](https://github.com/apache/netbeans/pull/9732#discussion_r4385961438)
- but **the good thing** (from my point of view) is that the _"Add
Logpoint"_ can be disabled!
- as a fix (from my point of view) of both reports could be to just make
sure the **editor pane action is disabled** as well!
--
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