// Path: tmc-plugin-intellij/src/main/java/fi/helsinki/cs/tmc/intellij/holders/TmcSettingsManager.java
// public final class TmcSettingsManager {
// 
//     private static final Logger logger = LoggerFactory.getLogger(TmcSettingsManager.class);
//     private static final PersistentTmcSettings persistentSettings =
//             ServiceManager.getService(PersistentTmcSettings.class);
// 
//     private TmcSettingsManager() {}
// 
//     public static synchronized SettingsTmc get() {
//         logger.info("Get SettingsTmc. @TmcSettingsManager.");
//         if (persistentSettings.getSettingsTmc() == null) {
//             persistentSettings.setSettingsTmc(new SettingsTmc());
//         }
//         return persistentSettings.getSettingsTmc();
//     }
// 
//     public static synchronized void setup() {
//         logger.info("Setup SettingsTmc. @TmcSettingsManager.");
//         if (persistentSettings.getSettingsTmc() == null) {
//             persistentSettings.setSettingsTmc(new SettingsTmc());
//         }
//     }
// }


import fi.helsinki.cs.tmc.core.exceptions.TmcCoreException;
import fi.helsinki.cs.tmc.intellij.holders.TmcSettingsManager;
import com.intellij.notification.NotificationType;
package fi.helsinki.cs.tmc.intellij.services.errors;



class PresentableErrorMessage {
    private final String message;
    private final NotificationType messageType;

    private PresentableErrorMessage(String message, NotificationType messageType) {
        this.message = message;
        this.messageType = messageType;
    }

    String getMessage() {
        return message;
    }

    NotificationType getMessageType() {
        return messageType;
    }

    /**
     * Generates a human readable error message for a {@link TmcCoreException} and decides the
     * error's severity.
     */
    static PresentableErrorMessage forTmcException(TmcCoreException exception) {
        String causeMessage;

        causeMessage = exception.getMessage();

        String shownMessage;
        NotificationType type = NotificationType.WARNING;

        if (causeMessage.contains("Download failed")
                || causeMessage.contains("404")
                || causeMessage.contains("500")) {
            shownMessage = notifyAboutCourseServerAddressAndInternet();
// Path: tmc-plugin-intellij/src/main/java/fi/helsinki/cs/tmc/intellij/holders/TmcSettingsManager.java
// public final class TmcSettingsManager {
// 
//     private static final Logger logger = LoggerFactory.getLogger(TmcSettingsManager.class);
//     private static final PersistentTmcSettings persistentSettings =
//             ServiceManager.getService(PersistentTmcSettings.class);
// 
//     private TmcSettingsManager() {}
// 
//     public static synchronized SettingsTmc get() {
//         logger.info("Get SettingsTmc. @TmcSettingsManager.");
//         if (persistentSettings.getSettingsTmc() == null) {
//             persistentSettings.setSettingsTmc(new SettingsTmc());
//         }
//         return persistentSettings.getSettingsTmc();
//     }
// 
//     public static synchronized void setup() {
//         logger.info("Setup SettingsTmc. @TmcSettingsManager.");
//         if (persistentSettings.getSettingsTmc() == null) {
//             persistentSettings.setSettingsTmc(new SettingsTmc());
//         }
//     }
// }


// Path: tmc-plugin-intellij/src/main/java/fi/helsinki/cs/tmc/intellij/services/errors/PresentableErrorMessage.java
import fi.helsinki.cs.tmc.core.exceptions.TmcCoreException;
import fi.helsinki.cs.tmc.intellij.holders.TmcSettingsManager;
import com.intellij.notification.NotificationType;

package fi.helsinki.cs.tmc.intellij.services.errors;



class PresentableErrorMessage {
    private final String message;
    private final NotificationType messageType;

    private PresentableErrorMessage(String message, NotificationType messageType) {
        this.message = message;
        this.messageType = messageType;
    }

    String getMessage() {
        return message;
    }

    NotificationType getMessageType() {
        return messageType;
    }

    /**
     * Generates a human readable error message for a {@link TmcCoreException} and decides the
     * error's severity.
     */
    static PresentableErrorMessage forTmcException(TmcCoreException exception) {
        String causeMessage;

        causeMessage = exception.getMessage();

        String shownMessage;
        NotificationType type = NotificationType.WARNING;

        if (causeMessage.contains("Download failed")
                || causeMessage.contains("404")
                || causeMessage.contains("500")) {
            shownMessage = notifyAboutCourseServerAddressAndInternet();
        } else if (!TmcSettingsManager.get().userDataExists()) {