How to display json in a new window?

Answered

I have added a menu item to the debugger menu. After certain manipulations, I get a json string. Now I need to display this json string in a new window with highlighting and other things (collapsing code blocks, line numbering). The window should not close by itself. How do I do this?


public class DebuggerTreeActionImpl extends DebuggerTreeAction {

    @Override
    protected void perform(XValueNodeImpl node, @NotNull String nodeName, AnActionEvent e) {
      //my code ...
      String json = "here is json";
      //Here you need to create a window and display json.
    }
}




3 comments
Comment actions Permalink

Hi,

I don't understand what you mean that the window should not close by itself.

I suggest opening dialog: https://plugins.jetbrains.com/docs/intellij/dialog-wrapper.html

and using https://plugins.jetbrains.com/docs/intellij/editor-components.html#editortextfield

in the dialog.

0
Comment actions Permalink

Karol Lewandowski The modal window blocks the parent window, am I right? I need to create a window by the event, and so that the creation of this window does not affect the operation of all the main windows and tabs.

0
Comment actions Permalink

It doesn't have to block the parent window. It depends on the "modal" flag:
https://github.com/JetBrains/intellij-community/blob/master/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java#L95

The link above is the implementation of dialog which is invoked with Evaluate Expression... action while debugging. It's not modal, so you can see and use its content and use the debugger at the same time.

0

Please sign in to leave a comment.