mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-16 11:15:34 +00:00
parent
4c8b8d4e4f
commit
7dfe62b96d
51 changed files with 244 additions and 247 deletions
|
|
@ -0,0 +1,47 @@
|
|||
package ee.carlrobert.codegpt.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import ee.carlrobert.codegpt.actions.ActionType;
|
||||
import ee.carlrobert.codegpt.telemetry.TelemetryAction;
|
||||
import javax.swing.Icon;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class TrackableAction extends AnAction {
|
||||
|
||||
private final ActionType actionType;
|
||||
protected final Editor editor;
|
||||
|
||||
public TrackableAction(
|
||||
@NotNull Editor editor,
|
||||
String text,
|
||||
String description,
|
||||
Icon icon,
|
||||
ActionType actionType) {
|
||||
super(text, description, icon);
|
||||
this.editor = editor;
|
||||
this.actionType = actionType;
|
||||
}
|
||||
|
||||
public abstract void handleAction(@NotNull AnActionEvent e);
|
||||
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
try {
|
||||
handleAction(e);
|
||||
} catch (Exception ex) {
|
||||
TelemetryAction.IDE_ACTION_ERROR
|
||||
.createActionMessage()
|
||||
.error(ex)
|
||||
.send();
|
||||
throw ex;
|
||||
} finally {
|
||||
TelemetryAction.IDE_ACTION
|
||||
.createActionMessage()
|
||||
.property("group", null)
|
||||
.property("action", actionType.name())
|
||||
.send();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue