Displaying Big JSON content in DialogWrapper


Hi JB team,

I have a table with JSON data in some columns. Since JSON data is big(at least 2KB), I would like to display it in DialogWrapper when a user double clicks a particular cell.

In createCenterPanel() of method  DialogWrapper I'm creating a LanguageTextField with Language as JSON as shown below.

protected JComponent createCenterPanel() {
return new LanguageTextField(JsonLanguage.findInstance(JsonLanguage.class),project,textToDisplay,false);

But this is displaying JSON data in single line only.
How can I display in mutliple line with proper code formatting similar to code->Reformat code and proper dimension of Dialog and scroll bar?

Also, how can I make content of LanguageTextField read-only?

Thanks in advance.
1 comment

Use com.intellij.ui.LanguageTextField#createDocument to create Document, format via com.intellij.ui.LanguageTextField.SimpleDocumentCreator#customizePsiFile  and pass it in com.intellij.ui.EditorTextField#EditorTextField(com.intellij.openapi.editor.Document, com.intellij.openapi.project.Project, com.intellij.openapi.fileTypes.FileType, boolean, boolean) constructor which has additional parameter isViewer.


Please sign in to leave a comment.