public class AddCustomAction extends AnAction {

    private final Runnable runnable;

    public AddCustomAction(Runnable runnable) {
        super(() -> MessageBundle.message("action.code.custom.action.add.title"), AllIcons.Actions.AddList);
        this.runnable = runnable;
    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
        Editor editor = e.getData(CommonDataKeys.EDITOR);
        VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
        Objects.requireNonNull(e.getProject()).putUserData(EditorCustomAction.ACTIVE_FILE_TYPE, virtualFile.getFileType());
        NAME_1 selectedText = editor.getSelectionModel().getSelectedText();
        e.getProject().putUserData(EditorCustomAction.ACTIVE_PROMPT, selectedText);

        new CustomActionDialog(e.getProject(), runnable).show();
    }


}
优化这段代码