open Webview as full screen tab intellij plugin development

81 Views Asked by At

Im trying to create a plugin with intellij, i'm able to create Tool Window with button, after that i want to open any html view. Can anyone help me im new to this, with the help of document i done below example code

enter image description here

<toolWindow  factoryClass="ui.ListPBToolWindowFactory" id="Test Tool Window"
                    anchor="left" secondary="true"/>                
package ui;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import org.jetbrains.annotations.NotNull;

public class ListPBToolWindowFactory implements ToolWindowFactory {
    @Override
    public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
        Messages.showInfoMessage("tset","info");
        ListPBToolWindow listPBToolWindow = new ListPBToolWindow();
        ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
        try {
            Content content = contentFactory.createContent(listPBToolWindow.getContent(), "", false);
            toolWindow.getContentManager().addContent(content);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
package ui; import com.intellij.openapi.actionSystem.*;import com.intellij.openapi.ui.Messages;import com.intellij.openapi.ui.SimpleToolWindowPanel;import javax.swing.*;import java.awt.*;import java.io.IOException;import java.net.URISyntaxException;import java.util.ResourceBundle;public class ListPBToolWindow {private ResourceBundle resourceBundle;private SimpleToolWindowPanel toolWindowPanel;
public ListPBToolWindow() {
    resourceBundle = ResourceBundle.getBundle("ActionBundle");
    toolWindowPanel = new SimpleToolWindowPanel(true, false);
    ActionManager actionManager = ActionManager.getInstance();
} public JPanel getContent() throws Exception {
    JPanel controlsPanel = new JPanel();
    JButton refreshDateAndTimeButton = new JButton("Test Button");
    refreshDateAndTimeButton.addActionListener(e -> {
        try {
            if (new SampleDialogWrapper().showAndGet()) {
                Messages.showInfoMessage("OK CLicked","info");
            }
            testMethod();
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        } catch (URISyntaxException ex) {
            throw new RuntimeException(ex);
        }
    });
    controlsPanel.add(refreshDateAndTimeButton);
    toolWindowPanel.removeAll(); 
    toolWindowPanel.add(controlsPanel, BorderLayout.WEST);
    return toolWindowPanel;
}

i'm expecting webview window tab view, want to render html content (javascript)

0

There are 0 best solutions below