eppleton commented on code in PR #9732:
URL: https://github.com/apache/netbeans/pull/9732#discussion_r4385784461


##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/AddLogpointAction.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.debugger.jpda.ui.actions;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import org.netbeans.api.debugger.DebuggerManager;
+import org.netbeans.api.debugger.jpda.JPDABreakpoint;
+import org.netbeans.api.debugger.jpda.LineBreakpoint;
+import org.netbeans.modules.debugger.jpda.ui.EditorContextBridge;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.awt.ActionRegistration;
+import org.openide.awt.ActionState;
+import org.openide.loaders.DataObject;
+import org.openide.util.NbBundle.Messages;
+
+@ActionID(
+        category = "Debug",
+        id = "org.netbeans.modules.debugger.jpda.ui.actions.AddLogpointAction"
+)
+@ActionRegistration(
+        displayName = "#CTL_AddLogpointAction",
+        enabledOn = @ActionState( property = "hasJavaSource", type = 
Action.class )
+)
+@ActionReferences({
+    @ActionReference(path = "Editors/text/x-java/Popup", position = 1900),
+    @ActionReference(path = 
"Editors/AnnotationTypes/BreakpointActionsWithToggleNew", position = 400)

Review Comment:
   You're right to doubt it. I was wrong about where the entry shows up. 
`Annotations.initMenu` also adds the enabled actions of every visible 
annotation type that isn't on the line, so "Add Logpoint" is offered in the 
gutter on every Java line, not only on lines that already have a breakpoint. 
Sorry for the noise.
   
   What remains is what you confirmed: on a line that already has a breakpoint, 
a second, non-suspending one is added. To reproduce: toggle a line breakpoint, 
then choose Add Logpoint on the same line, and the Breakpoints view lists two 
entries for that line. I don't think that should block the integration. Turning 
an existing line breakpoint into a logpoint could be a follow-up.
   



##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/BreakpointOutput.java:
##########
@@ -462,12 +456,53 @@ final void printExpressions(
             printText = printText + "\n***\n"+ 
thr.getLocalizedMessage()+"\n***\n";
         }
         // remaining of the text with a new line
-        println.accept(printText);
+        io.print(printText, null, true);
         for (var errors : dumpErrors) {
             errors.run();
         }
     }
 
+    final void printLocals(JPDABreakpointEvent event, BreakpointOutputWriter 
io) {
+        CallStackFrame csf = findTopFrame(event);
+        if (csf != null) {
+            try {
+                for (var refValue : csf.getLocalVariables()) {
+                    io.print("  ", null, false);
+                    io.print(refValue.getName(), null, false);
+                    io.print(" = ", null, false);
+                    if (refValue instanceof ObjectVariable ov && !isNull(ov) 
&& ov.toFixed() instanceof ObjectVariable obj) {

Review Comment:
   Agreed, this predates the PR with `{=expr}`, so it's fine to leave it for 
later. To clarify: I meant the IDE-side variable copies and their listeners, 
not the debuggee objects. I agree those can still be collected, which I also 
mentioned on the `Variable.java` comment.
   



##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/BreakpointOutput.java:
##########
@@ -375,13 +375,18 @@ private void printOutEvent(DebuggerConsoleIO io, String 
format, JPDABreakpointEv
                 printText = selectCondition(printText, threadStartedCondition, 
false);
             }
         }
+
+        int printLocals = printText.indexOf(localsPattern);

Review Comment:
   Printing the locals after the message makes sense to me. Yes, I'd remove 
every occurrence and print the locals once.
   
   For documentation, the print text field in `ActionsPanel` (`tfPrintText`) 
has no tooltip. A tooltip listing the placeholders (`{className}`, 
`{methodName}`, `{lineNumber}`, `{threadName}`, `{=expression}`, `{locals}`) 
would be a small, natural place to put it, and it would cover the undocumented 
ones you mentioned too. It doesn't need to be part of this PR.
   



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