mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-21 19:13:38 +00:00
Reopen plugin's source code (1.10.8 → 2.0.5)
This commit is contained in:
parent
faf02a5c0a
commit
26a3e07360
231 changed files with 88014 additions and 4271 deletions
|
|
@ -0,0 +1,38 @@
|
|||
package ee.carlrobert.codegpt.actions.toolwindow;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import ee.carlrobert.codegpt.actions.editor.EditorActionsUtil;
|
||||
import ee.carlrobert.codegpt.conversations.ConversationService;
|
||||
import ee.carlrobert.codegpt.conversations.ConversationsState;
|
||||
import ee.carlrobert.codegpt.util.OverlayUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class DeleteConversationAction extends AnAction {
|
||||
|
||||
private final Runnable onRefresh;
|
||||
|
||||
public DeleteConversationAction(Runnable onRefresh) {
|
||||
super("Delete Conversation", "Delete single conversation", AllIcons.General.Remove);
|
||||
this.onRefresh = onRefresh;
|
||||
EditorActionsUtil.registerOrReplaceAction(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent event) {
|
||||
event.getPresentation().setEnabled(ConversationsState.getCurrentConversation() != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent event) {
|
||||
if (OverlayUtils.showDeleteConversationDialog() == Messages.YES) {
|
||||
var project = event.getProject();
|
||||
if (project != null) {
|
||||
ConversationService.getInstance().deleteSelectedConversation();
|
||||
onRefresh.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue