JaroslavTulach commented on a change in pull request #3119:
URL: https://github.com/apache/netbeans/pull/3119#discussion_r695384493
##########
File path:
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/NbProtocolServer.java
##########
@@ -349,6 +352,32 @@ public NbProtocolServer(DebugAdapterContext context) {
return future;
}
+ @Override
+ @NbBundle.Messages({"MSG_FrameRestartUnsupported=Restart of frames is not
supported.",
+ "# {0} - frame pop error message",
+ "MSG_FrameRestartFailed=Unable to restart frame: {0}"})
+ public CompletableFuture<Void> restartFrame(RestartFrameArguments args) {
+ CompletableFuture<Void> future = new CompletableFuture<>();
+ NbFrame stackFrame = (NbFrame)
context.getThreadsProvider().getThreadObjects().getObject(args.getFrameId());
+ String popError = null;
+ if (stackFrame != null) {
+ try {
+ stackFrame.getDVFrame().popOff();
+ ActionsManager am =
DebuggerManager.getDebuggerManager().getCurrentEngine().getActionsManager();
+ am.doAction("stepInto");
+ future.complete(null);
+ } catch (UnsupportedOperationException ex) {
Review comment:
If only `PopException` is thrown, this catch can be removed.
##########
File path:
ide/spi.debugger.ui/src/org/netbeans/spi/debugger/ui/DebuggingView.java
##########
@@ -508,6 +508,36 @@ default String getSourceMimeType() {
* @since 2.65
*/
int getColumn();
+
+ /**
+ * Pop all frames up to and including this frame off the stack.
+ *
+ * @throws UnsupportedOperationException thrown when popping of stack
frames is not supported.
+ * @throws PopException when the pop frame operation fails.
+ * @since 2.70
+ */
+ default void popOff() throws UnsupportedOperationException,
PopException {
+ throw new UnsupportedOperationException("The frame pop is not
supported.");
Review comment:
I would consider throwing just `PopException("Not supported")`.
##########
File path:
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/NbProtocolServer.java
##########
@@ -349,6 +352,32 @@ public NbProtocolServer(DebugAdapterContext context) {
return future;
}
+ @Override
+ @NbBundle.Messages({"MSG_FrameRestartUnsupported=Restart of frames is not
supported.",
+ "# {0} - frame pop error message",
+ "MSG_FrameRestartFailed=Unable to restart frame: {0}"})
+ public CompletableFuture<Void> restartFrame(RestartFrameArguments args) {
+ CompletableFuture<Void> future = new CompletableFuture<>();
+ NbFrame stackFrame = (NbFrame)
context.getThreadsProvider().getThreadObjects().getObject(args.getFrameId());
+ String popError = null;
+ if (stackFrame != null) {
+ try {
+ stackFrame.getDVFrame().popOff();
+ ActionsManager am =
DebuggerManager.getDebuggerManager().getCurrentEngine().getActionsManager();
+ am.doAction("stepInto");
+ future.complete(null);
+ } catch (UnsupportedOperationException ex) {
+ popError = Bundle.MSG_FrameRestartUnsupported();
+ } catch (DebuggingView.PopException ex) {
+ popError =
Bundle.MSG_FrameRestartFailed(ex.getLocalizedMessage());
Review comment:
Please note that `PopException` is final and doesn't override
`getLocalizedMessage()` - e.g. the value is always going to be same as
`getMessage()`.
--
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