chore: Improve code (#442)

* chore: Improve code

* Convert classes to records
This commit is contained in:
Rene Leonhardt 2024-04-10 13:47:38 +02:00 committed by GitHub
parent c29d3928db
commit 7d89650062
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
86 changed files with 528 additions and 976 deletions

View file

@ -18,6 +18,7 @@ import ee.carlrobert.codegpt.conversations.ConversationsState;
import ee.carlrobert.codegpt.conversations.message.Message;
import ee.carlrobert.codegpt.settings.configuration.ConfigurationSettings;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;
@ -110,16 +111,13 @@ public final class ChatToolWindowContentManager {
public @NotNull ToolWindow getToolWindow() {
var toolWindowManager = ToolWindowManager.getInstance(project);
var toolWindow = toolWindowManager.getToolWindow("CodeGPT");
if (toolWindow == null) {
// https://intellij-support.jetbrains.com/hc/en-us/community/posts/11533368171026/comments/11538403084562
return toolWindowManager
.registerToolWindow(RegisterToolWindowTask.closable(
"CodeGPT",
() -> "CodeGPT",
Icons.DefaultSmall,
ToolWindowAnchor.RIGHT));
}
return toolWindow;
// https://intellij-support.jetbrains.com/hc/en-us/community/posts/11533368171026/comments/11538403084562
return Objects.requireNonNullElseGet(toolWindow, () -> toolWindowManager
.registerToolWindow(RegisterToolWindowTask.closable(
"CodeGPT",
() -> "CodeGPT",
Icons.DefaultSmall,
ToolWindowAnchor.RIGHT)));
}
private Optional<Content> tryFindFirstChatTabContent() {