Open WebView on editor from Tool Window Button
Answered
How can we create a new file with WebView (to be opened on editor) on the tool window button action.
Example:
I have a tool window with Button “Open Report”.
On “Open Report” click, I want to open a new editor window with WebView, so I can dynamically load the HTML report on it.
There is no need to persist the report. The report can be opened again using “Open Report” button (if not already opened).
Please sign in to leave a comment.
Hi,
I assume that by WebView you mean an embedded browser. IntelliJ Platform supports JCEF.
If this is the case, then implement a tool window with a button and open an HTML editor with
com.intellij.openapi.fileEditor.impl.HTMLEditorProvider.openEditor(Project, String, Request)
.Example: https://github.com/JetBrains/intellij-community/blob/master/platform/whatsNew/src/com/intellij/platform/whatsNew/WhatsNewContent.kt#L262
Thanks Karol Lewandowski . It helped me to implement the tool window with a webview.
A follow-up query (if you can suggest something). ATM I'm using links (which don't look so great) in tool window.
How can I create a tree view, with an option to refresh close / refresh the report on the right in tool window?
-----------------------------
| Report 1 refresh icon |
| Report 2 refresh icon |
| Report 3 refresh icon |
| |
-----------------------------
Thanks!!
Hi,
I'm not sure what you exactly mean, but maybe
com.intellij.ui.treeStructure.treetable.TreeTable
can help. It allows for creating a tree table with custom components (for example, button) in columns next to each node. Unfortunately, there is no documentation, so I suggest checking examples in https://github.com/JetBrains/intellij-community.If it doesn't work for you, you can browse components in the IDE (for example in settings), and if you find something that is similar to what you need, then use https://plugins.jetbrains.com/docs/intellij/internal-ui-inspector.html to find the implementation details.