// Path: tmc-plugin-intellij/src/main/java/fi/helsinki/cs/tmc/intellij/snapshots/ButtonInputListener.java
// public class ButtonInputListener {
// 
//     private static final Logger logger = LoggerFactory.getLogger(ButtonInputListener.class);
// 
//     public void receiveTestRun() {
//         sendProjectActionEvent(getExercise(), "tmc.test");
//     }
// 
//     public void receiveSubmit() {
//         sendProjectActionEvent(getExercise(), "tmc.submit");
//     }
// 
//     @Nullable
//     private Exercise getExercise() {
//         logger.info("Making sure current exercise should be tracked");
//         if (new CourseAndExerciseManager()
//                 .isCourseInDatabase(
//                         PathResolver.getCourseName(
//                                 new ObjectFinder().findCurrentProject().getBasePath()))) {
//             return PathResolver.getExercise(new ObjectFinder().findCurrentProject().getBasePath());
//         }
//         return null;
//     }
// 
//     public void receiveRunAction() {
//         sendProjectActionEvent(getExercise(), "COMMAND_RUN");
//     }
// 
//     public void receiveDebugRunAction() {
//         sendProjectActionEvent(getExercise(), "COMMAND_DEBUG");
//     }
// 
//     public void receivePastebin() {
//         sendProjectActionEvent(getExercise(), "tmc.paste");
//     }
// 
//     public void receiveDownloadExercise() {
//         sendProjectActionEvent(getExercise(), "tmc.download_exercise");
//     }
// 
//     public void receiveSettings() {
//         sendProjectActionEvent("tmc.settings_saved");
//     }
// 
//     private void sendProjectActionEvent(String command) {
//         logger.info("Creating a project action event JSON.");
//         Object data = Collections.singletonMap("command", command);
//         String json = new Gson().toJson(data);
//         byte[] jsonBytes = json.getBytes(Charset.forName("UTF-8"));
//         LoggableEvent event = new LoggableEvent("ide_action", jsonBytes);
//         addEvent(event);
//     }
// 
//     private void sendProjectActionEvent(Exercise ex, String command) {
//         if (ex == null) {
//             logger.warn("Exercise was invalid.");
//             return;
//         }
// 
//         logger.info("Creating a project action event JSON.");
//         Object data = Collections.singletonMap("command", command);
//         String json = new Gson().toJson(data);
// 
//         byte[] jsonBytes = json.getBytes(Charset.forName("UTF-8"));
//         LoggableEvent event = new LoggableEvent(ex, "project_action", jsonBytes);
//         addEvent(event);
//     }
// 
//     private void addEvent(LoggableEvent event) {
//         logger.info("Checking that snapshots setting is enabled.");
//         SnapshotsEventManager.add(event);
//     }
// }


import fi.helsinki.cs.tmc.intellij.holders.TmcCoreHolder;
import fi.helsinki.cs.tmc.intellij.services.PasteService;
import fi.helsinki.cs.tmc.intellij.snapshots.ButtonInputListener;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package fi.helsinki.cs.tmc.intellij.actions.buttonactions;




/**
 * Defined in plugin.xml on line &lt;action id="Submit to Pastebin"
 * class="fi.helsinki.cs.tmc.intellij.actions.buttonactions.SubmitPasteAction"&gt; in group actions
 *
 * <p>Submit code to TMC Pastebin.
 */
public class SubmitPasteAction extends AnAction {

    private static final Logger logger = LoggerFactory.getLogger(SubmitPasteAction.class);
    private PasteService pasteService;

    @Override
    public void actionPerformed(AnActionEvent anActionEvent) {
        logger.info("Performing SubmitPasteAction. @SubmitPasteAction");
        paste(anActionEvent);
    }

    private void paste(AnActionEvent anActionEvent) {
// Path: tmc-plugin-intellij/src/main/java/fi/helsinki/cs/tmc/intellij/snapshots/ButtonInputListener.java
// public class ButtonInputListener {
// 
//     private static final Logger logger = LoggerFactory.getLogger(ButtonInputListener.class);
// 
//     public void receiveTestRun() {
//         sendProjectActionEvent(getExercise(), "tmc.test");
//     }
// 
//     public void receiveSubmit() {
//         sendProjectActionEvent(getExercise(), "tmc.submit");
//     }
// 
//     @Nullable
//     private Exercise getExercise() {
//         logger.info("Making sure current exercise should be tracked");
//         if (new CourseAndExerciseManager()
//                 .isCourseInDatabase(
//                         PathResolver.getCourseName(
//                                 new ObjectFinder().findCurrentProject().getBasePath()))) {
//             return PathResolver.getExercise(new ObjectFinder().findCurrentProject().getBasePath());
//         }
//         return null;
//     }
// 
//     public void receiveRunAction() {
//         sendProjectActionEvent(getExercise(), "COMMAND_RUN");
//     }
// 
//     public void receiveDebugRunAction() {
//         sendProjectActionEvent(getExercise(), "COMMAND_DEBUG");
//     }
// 
//     public void receivePastebin() {
//         sendProjectActionEvent(getExercise(), "tmc.paste");
//     }
// 
//     public void receiveDownloadExercise() {
//         sendProjectActionEvent(getExercise(), "tmc.download_exercise");
//     }
// 
//     public void receiveSettings() {
//         sendProjectActionEvent("tmc.settings_saved");
//     }
// 
//     private void sendProjectActionEvent(String command) {
//         logger.info("Creating a project action event JSON.");
//         Object data = Collections.singletonMap("command", command);
//         String json = new Gson().toJson(data);
//         byte[] jsonBytes = json.getBytes(Charset.forName("UTF-8"));
//         LoggableEvent event = new LoggableEvent("ide_action", jsonBytes);
//         addEvent(event);
//     }
// 
//     private void sendProjectActionEvent(Exercise ex, String command) {
//         if (ex == null) {
//             logger.warn("Exercise was invalid.");
//             return;
//         }
// 
//         logger.info("Creating a project action event JSON.");
//         Object data = Collections.singletonMap("command", command);
//         String json = new Gson().toJson(data);
// 
//         byte[] jsonBytes = json.getBytes(Charset.forName("UTF-8"));
//         LoggableEvent event = new LoggableEvent(ex, "project_action", jsonBytes);
//         addEvent(event);
//     }
// 
//     private void addEvent(LoggableEvent event) {
//         logger.info("Checking that snapshots setting is enabled.");
//         SnapshotsEventManager.add(event);
//     }
// }


// Path: tmc-plugin-intellij/src/main/java/fi/helsinki/cs/tmc/intellij/actions/buttonactions/SubmitPasteAction.java
import fi.helsinki.cs.tmc.intellij.holders.TmcCoreHolder;
import fi.helsinki.cs.tmc.intellij.services.PasteService;
import fi.helsinki.cs.tmc.intellij.snapshots.ButtonInputListener;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

package fi.helsinki.cs.tmc.intellij.actions.buttonactions;




/**
 * Defined in plugin.xml on line &lt;action id="Submit to Pastebin"
 * class="fi.helsinki.cs.tmc.intellij.actions.buttonactions.SubmitPasteAction"&gt; in group actions
 *
 * <p>Submit code to TMC Pastebin.
 */
public class SubmitPasteAction extends AnAction {

    private static final Logger logger = LoggerFactory.getLogger(SubmitPasteAction.class);
    private PasteService pasteService;

    @Override
    public void actionPerformed(AnActionEvent anActionEvent) {
        logger.info("Performing SubmitPasteAction. @SubmitPasteAction");
        paste(anActionEvent);
    }

    private void paste(AnActionEvent anActionEvent) {
        new ButtonInputListener().receivePastebin();