mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-12 14:10:29 +00:00
40 lines
1.9 KiB
Java
40 lines
1.9 KiB
Java
package ee.carlrobert.codegpt.toolwindow;
|
|
|
|
import com.intellij.openapi.project.DumbAware;
|
|
import com.intellij.openapi.project.Project;
|
|
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 ee.carlrobert.codegpt.toolwindow.chat.contextual.ContextualChatToolWindowPanel;
|
|
import ee.carlrobert.codegpt.toolwindow.chat.standard.StandardChatToolWindowPanel;
|
|
import ee.carlrobert.codegpt.toolwindow.conversations.ConversationsToolWindow;
|
|
import javax.swing.JComponent;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
public class ProjectToolWindowFactory implements ToolWindowFactory, DumbAware {
|
|
|
|
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
|
|
var chatToolWindowPanel = new StandardChatToolWindowPanel(project, toolWindow.getDisposable());
|
|
// var contextualChatToolWindowPanel =
|
|
// new ContextualChatToolWindowPanel(project, toolWindow.getDisposable());
|
|
var conversationsToolWindow = new ConversationsToolWindow(project);
|
|
|
|
addContent(toolWindow, chatToolWindowPanel, "Chat");
|
|
// addContent(toolWindow, contextualChatToolWindowPanel, "Contextual Chat");
|
|
addContent(toolWindow, conversationsToolWindow.getContent(), "Chat History");
|
|
toolWindow.addContentManagerListener(new ContentManagerListener() {
|
|
public void selectionChanged(@NotNull ContentManagerEvent event) {
|
|
var content = event.getContent();
|
|
if ("Chat History".equals(content.getTabName()) && content.isSelected()) {
|
|
conversationsToolWindow.refresh();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
public void addContent(ToolWindow toolWindow, JComponent panel, String displayName) {
|
|
var contentManager = toolWindow.getContentManager();
|
|
contentManager.addContent(contentManager.getFactory().createContent(panel, displayName, false));
|
|
}
|
|
}
|