From ae47acfaa4855a31f10d8465d239ad564b400820 Mon Sep 17 00:00:00 2001 From: Carl-Robert Linnupuu Date: Fri, 17 Mar 2023 10:47:01 +0000 Subject: [PATCH] Add browser tab --- .../codegpt/ide/toolwindow/ProjectToolWindowFactory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/ee/carlrobert/codegpt/ide/toolwindow/ProjectToolWindowFactory.java b/src/main/java/ee/carlrobert/codegpt/ide/toolwindow/ProjectToolWindowFactory.java index ce35e76f..2d322ada 100644 --- a/src/main/java/ee/carlrobert/codegpt/ide/toolwindow/ProjectToolWindowFactory.java +++ b/src/main/java/ee/carlrobert/codegpt/ide/toolwindow/ProjectToolWindowFactory.java @@ -6,10 +6,11 @@ import com.intellij.openapi.wm.ToolWindow; import com.intellij.openapi.wm.ToolWindowFactory; import com.intellij.ui.content.ContentManagerEvent; import com.intellij.ui.content.ContentManagerListener; +import com.intellij.ui.jcef.JBCefBrowser; import ee.carlrobert.codegpt.ide.conversations.ConversationsState; import ee.carlrobert.codegpt.ide.toolwindow.chat.ChatGptToolWindow; import ee.carlrobert.codegpt.ide.toolwindow.conversations.ConversationsToolWindow; -import javax.swing.JPanel; +import javax.swing.JComponent; import org.jetbrains.annotations.NotNull; public class ProjectToolWindowFactory implements ToolWindowFactory, DumbAware { @@ -23,6 +24,7 @@ public class ProjectToolWindowFactory implements ToolWindowFactory, DumbAware { var contentManagerService = project.getService(ContentManagerService.class); addContent(toolWindow, chatToolWindow.getContent(), "Chat"); addContent(toolWindow, conversationsToolWindow.getContent(), "Conversation History"); + addContent(toolWindow, new JBCefBrowser("https://chat.openai.com/chat").getComponent(), "Browser"); toolWindow.addContentManagerListener(new ContentManagerListener() { public void selectionChanged(@NotNull ContentManagerEvent event) { var content = event.getContent(); @@ -42,7 +44,7 @@ public class ProjectToolWindowFactory implements ToolWindowFactory, DumbAware { } } - public void addContent(ToolWindow toolWindow, JPanel panel, String displayName) { + public void addContent(ToolWindow toolWindow, JComponent panel, String displayName) { var contentManager = toolWindow.getContentManager(); var content = contentManager.getFactory().createContent(panel, displayName, false); contentManager.addContent(content);