// Path: tmc-plugin-intellij/src/main/java/fi/helsinki/cs/tmc/intellij/ui/testresults/TestResultPanelFactory.java
// public class TestResultPanelFactory implements ToolWindowFactory {
// 
//     private static final Logger logger = LoggerFactory.getLogger(TestResultPanelFactory.class);
//     private static List<TestResultsPanel> panels;
// 
//     public TestResultPanelFactory() {
//         panels = new ArrayList<>();
//     }
// 
//     @Override
//     public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
//         logger.info("Creating tool window content for test results. " + "@TestResultPanelFactory");
// 
//         TestResultsPanel panel = new TestResultsPanel();
//         ContentFactory cf = ContentFactory.SERVICE.getInstance();
//         Content content = cf.createContent(panel, "", true);
//         toolWindow.getContentManager().addContent(content);
// 
//         panels.add(panel);
//     }
// 
//     public static void updateMostRecentResult(List<TestResult> tests, ValidationResult validation) {
//         logger.info("Updating the most recent test result. @TestResultPanelFactory.");
//         for (TestResultsPanel panel : panels) {
//             panel.showResults(tests, validation);
//             panel.repaint();
//         }
//     }
// }


import fi.helsinki.cs.tmc.core.domain.submission.SubmissionResult;
import fi.helsinki.cs.tmc.intellij.ui.testresults.TestResultPanelFactory;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package fi.helsinki.cs.tmc.intellij.ui.submissionresult;




public class FailedSubmissionDialog {

    private static final Logger logger = LoggerFactory.getLogger(FailedSubmissionDialog.class);

    public FailedSubmissionDialog(SubmissionResult result, Project project) {
        logger.info("Showing error message for failed submission. @FailedSubmissionDialog");
        String points = parsePoints(result);

        String failMessage =
                "All tests didn't pass on server!\nSee Test results for more details\n"
                        + "Permanent points awarded: "
                        + points;
        ApplicationManager.getApplication()
                .invokeLater(
                        () -> Messages.showErrorDialog(failMessage, "Some Tests Failed!"));
// Path: tmc-plugin-intellij/src/main/java/fi/helsinki/cs/tmc/intellij/ui/testresults/TestResultPanelFactory.java
// public class TestResultPanelFactory implements ToolWindowFactory {
// 
//     private static final Logger logger = LoggerFactory.getLogger(TestResultPanelFactory.class);
//     private static List<TestResultsPanel> panels;
// 
//     public TestResultPanelFactory() {
//         panels = new ArrayList<>();
//     }
// 
//     @Override
//     public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
//         logger.info("Creating tool window content for test results. " + "@TestResultPanelFactory");
// 
//         TestResultsPanel panel = new TestResultsPanel();
//         ContentFactory cf = ContentFactory.SERVICE.getInstance();
//         Content content = cf.createContent(panel, "", true);
//         toolWindow.getContentManager().addContent(content);
// 
//         panels.add(panel);
//     }
// 
//     public static void updateMostRecentResult(List<TestResult> tests, ValidationResult validation) {
//         logger.info("Updating the most recent test result. @TestResultPanelFactory.");
//         for (TestResultsPanel panel : panels) {
//             panel.showResults(tests, validation);
//             panel.repaint();
//         }
//     }
// }


// Path: tmc-plugin-intellij/src/main/java/fi/helsinki/cs/tmc/intellij/ui/submissionresult/FailedSubmissionDialog.java
import fi.helsinki.cs.tmc.core.domain.submission.SubmissionResult;
import fi.helsinki.cs.tmc.intellij.ui.testresults.TestResultPanelFactory;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

package fi.helsinki.cs.tmc.intellij.ui.submissionresult;




public class FailedSubmissionDialog {

    private static final Logger logger = LoggerFactory.getLogger(FailedSubmissionDialog.class);

    public FailedSubmissionDialog(SubmissionResult result, Project project) {
        logger.info("Showing error message for failed submission. @FailedSubmissionDialog");
        String points = parsePoints(result);

        String failMessage =
                "All tests didn't pass on server!\nSee Test results for more details\n"
                        + "Permanent points awarded: "
                        + points;
        ApplicationManager.getApplication()
                .invokeLater(
                        () -> Messages.showErrorDialog(failMessage, "Some Tests Failed!"));
        TestResultPanelFactory.updateMostRecentResult(