From ee5960f91385c877a65d4491cea29f8b3b5b0a50 Mon Sep 17 00:00:00 2001 From: Jaakko Nakaza Date: Fri, 23 Aug 2024 16:12:17 +0300 Subject: [PATCH] Code review fixes --- .../exercise/OpenExerciseItemAction.kt | 13 ------ .../actions/exercise/ShowFeedbackAction.kt | 9 +++- .../activities/InitializationActivity.kt | 10 ++++- .../aalto/cs/apluscourses/api/CourseConfig.kt | 10 +++-- .../generator/APlusModuleBuilder.kt | 19 ++++---- .../ApiTokenNotSetNotification.kt | 17 ------- .../CourseConfigListErrorNotification.kt | 18 -------- .../notifications/CourseConfigurationError.kt | 6 +-- .../notifications/CourseFileError.kt | 19 -------- .../CourseVersionOutdatedError.kt | 5 +-- .../CourseVersionOutdatedWarning.kt | 5 +-- .../notifications/CourseVersionTooNewError.kt | 5 +-- .../ExerciseNotSelectedNotification.kt | 18 -------- .../FeedbackAvailableNotification.kt | 16 +++---- .../notifications/IoErrorNotification.kt | 22 ---------- .../MissingDependencyNotification.kt | 8 ++-- .../notifications/MissingFileNotification.kt | 9 +--- .../MissingModuleNotification.kt | 9 ++-- .../notifications/NetworkErrorNotification.kt | 6 +-- .../NewModulesVersionsNotification.kt | 2 +- .../NotSubmittableNotification.kt | 5 +-- .../SubmissionSentNotification.kt | 17 ------- .../notifications/TaskCompleteNotification.kt | 44 ------------------- .../UrlRenderingErrorNotification.kt | 20 --------- .../OpenDocumentationActionProvider.kt | 20 ++------- .../aalto/cs/apluscourses/services/Opener.kt | 25 +---------- .../cs/apluscourses/services/TokenStorage.kt | 4 +- .../services/course/CoursesFetcher.kt | 3 +- .../services/exercise/ShowFeedback.kt | 26 ++++------- .../services/exercise/SubmitExercise.kt | 36 ++++++++++----- .../apluscourses/ui/exercise/ExercisesView.kt | 23 ---------- .../ui/exercise/SubmitExerciseDialog.kt | 2 +- .../CourseProjectActionDialogs.kt | 16 ------- .../resources/messages/resources.properties | 4 +- 34 files changed, 110 insertions(+), 361 deletions(-) delete mode 100644 src/main/kotlin/fi/aalto/cs/apluscourses/notifications/ApiTokenNotSetNotification.kt delete mode 100644 src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseConfigListErrorNotification.kt delete mode 100644 src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseFileError.kt delete mode 100644 src/main/kotlin/fi/aalto/cs/apluscourses/notifications/ExerciseNotSelectedNotification.kt delete mode 100644 src/main/kotlin/fi/aalto/cs/apluscourses/notifications/IoErrorNotification.kt delete mode 100644 src/main/kotlin/fi/aalto/cs/apluscourses/notifications/SubmissionSentNotification.kt delete mode 100644 src/main/kotlin/fi/aalto/cs/apluscourses/notifications/TaskCompleteNotification.kt delete mode 100644 src/main/kotlin/fi/aalto/cs/apluscourses/notifications/UrlRenderingErrorNotification.kt delete mode 100644 src/main/kotlin/fi/aalto/cs/apluscourses/ui/temp/courseproject/CourseProjectActionDialogs.kt diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/actions/exercise/OpenExerciseItemAction.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/actions/exercise/OpenExerciseItemAction.kt index 6a6ef222c..951f6ac2a 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/actions/exercise/OpenExerciseItemAction.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/actions/exercise/OpenExerciseItemAction.kt @@ -35,19 +35,6 @@ class OpenExerciseItemAction : AnAction() { } private fun browse(url: String, project: Project) { - /* Embedded browser for the future - val fileEditorManager = FileEditorManager.getInstance(project) - fileEditorManager.allEditors.forEach { editor: FileEditor -> - if (editor.file != null && editor.file.extension == "aplus") { - (editor as BrowserEditor).loadURL(url) - return - } - } - val file = LightVirtualFile("browse.aplus", "url:$url") - application.invokeLater { - fileEditorManager.openFile(file, true) - } - */ BrowserUtil.browse(url, project) } diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/actions/exercise/ShowFeedbackAction.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/actions/exercise/ShowFeedbackAction.kt index 47c0dc71e..ac28f13a8 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/actions/exercise/ShowFeedbackAction.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/actions/exercise/ShowFeedbackAction.kt @@ -4,6 +4,7 @@ import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.components.service +import fi.aalto.cs.apluscourses.services.course.CourseManager import fi.aalto.cs.apluscourses.services.exercise.SelectedExercise import fi.aalto.cs.apluscourses.services.exercise.ShowFeedback import fi.aalto.cs.apluscourses.ui.exercise.ExercisesView.SubmissionResultItem @@ -18,8 +19,14 @@ class ShowFeedbackAction : AnAction() { } override fun update(e: AnActionEvent) { + val feedbackCss = e.project?.service()?.state?.feedbackCss + if (feedbackCss == null || feedbackCss.isEmpty()) { + e.presentation.isVisible = false + return + } val selected = e.project?.service()?.selectedExerciseTreeItem - e.presentation.isEnabled = selected != null && selected is SubmissionResultItem + e.presentation.isEnabled = + selected != null && selected is SubmissionResultItem && selected.exercise.isSubmittable } override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/activities/InitializationActivity.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/activities/InitializationActivity.kt index d596e8d36..834f496d6 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/activities/InitializationActivity.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/activities/InitializationActivity.kt @@ -18,6 +18,7 @@ import fi.aalto.cs.apluscourses.MyBundle import fi.aalto.cs.apluscourses.api.CourseConfig import fi.aalto.cs.apluscourses.api.CourseConfig.resourceUrls import fi.aalto.cs.apluscourses.notifications.CourseVersionOutdatedError +import fi.aalto.cs.apluscourses.notifications.CourseVersionOutdatedWarning import fi.aalto.cs.apluscourses.notifications.CourseVersionTooNewError import fi.aalto.cs.apluscourses.services.CoursesClient import fi.aalto.cs.apluscourses.services.Notifier @@ -77,15 +78,22 @@ internal class InitializationActivity() : val requiredVersion = courseConfig.version logger.info("Starting initialization for course ${courseConfig.name} with required plugin version $requiredVersion and installed version $pluginVersion") - val versionComparison = requiredVersion.comparisonStatus(pluginVersion) + val versionComparison = pluginVersion.comparisonStatus(requiredVersion) when (versionComparison) { ComparisonStatus.MAJOR_TOO_OLD -> { logger.warn("A+ Courses version outdated: installed $pluginVersion, required $requiredVersion") Notifier.notify(CourseVersionOutdatedError(), project) + InitializationStatus.setIsIoError(project) + CourseManager.getInstance(project).fireNetworkError() return } + ComparisonStatus.MINOR_TOO_OLD -> { + logger.warn("A+ Courses version outdated: installed $pluginVersion, required $requiredVersion") + Notifier.notify(CourseVersionOutdatedWarning(), project) + } + ComparisonStatus.MAJOR_TOO_NEW -> { logger.warn("A+ Courses version too new: installed $pluginVersion, required $requiredVersion") Notifier.notify(CourseVersionTooNewError(), project) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/api/CourseConfig.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/api/CourseConfig.kt index 624c2503d..fa74e76ba 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/api/CourseConfig.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/api/CourseConfig.kt @@ -1,7 +1,9 @@ package fi.aalto.cs.apluscourses.api import com.intellij.openapi.project.Project +import fi.aalto.cs.apluscourses.notifications.CourseConfigurationError import fi.aalto.cs.apluscourses.services.CoursesClient +import fi.aalto.cs.apluscourses.services.Notifier import fi.aalto.cs.apluscourses.services.course.CourseFileManager import fi.aalto.cs.apluscourses.utils.Version import io.ktor.client.statement.bodyAsText @@ -138,7 +140,7 @@ object CourseConfig { val name: String, val aPlusUrl: String, val languages: List, - val version: Version, + val version: Version = Version.DEFAULT, val resources: Resources? = null, val requiredPlugins: List = emptyList(), val vmOptions: Map = emptyMap(), @@ -245,10 +247,12 @@ object CourseConfig { val courseConfig = CoursesClient.getInstance(project).get(url).bodyAsText() return deserialize(courseConfig) } catch (e: Exception) { - println(e) when (e) { is IOException, is UnresolvedAddressException -> throw e - else -> return null + else -> { + Notifier.notify(CourseConfigurationError(e), project) + return null + } } } } diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/generator/APlusModuleBuilder.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/generator/APlusModuleBuilder.kt index 4b0010a5c..c507fe25b 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/generator/APlusModuleBuilder.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/generator/APlusModuleBuilder.kt @@ -226,14 +226,16 @@ internal class APlusModuleBuilder : ModuleBuilder() { checkBox("Leave IntelliJ settings unchanged").bindSelected(dontImportSettings) } } - group("Required plugins") { - row { - text("The following plugins required by the course will be installed.") - } - row { - placeholder().apply { - placeholder = this - }.resizableColumn().align(AlignX.FILL) + if (courseConfig.requiredPlugins.isNotEmpty()) { + group("Required plugins") { + row { + text("The following plugins required by the course will be installed.") + } + row { + placeholder().apply { + placeholder = this + }.resizableColumn().align(AlignX.FILL) + } } } if (this@APlusModuleBuilder.programmingLanguage == "scala") { @@ -254,6 +256,7 @@ internal class APlusModuleBuilder : ModuleBuilder() { component.revalidate() component.repaint() + if (courseConfig.requiredPlugins.isEmpty()) return application.service().runInBackground(courseConfig.requiredPlugins) { components -> placeholder?.component = panel { components.map { diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/ApiTokenNotSetNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/ApiTokenNotSetNotification.kt deleted file mode 100644 index 91cadeceb..000000000 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/ApiTokenNotSetNotification.kt +++ /dev/null @@ -1,17 +0,0 @@ -package fi.aalto.cs.apluscourses.notifications - -import com.intellij.notification.Notification -import com.intellij.notification.NotificationType -import fi.aalto.cs.apluscourses.MyBundle -import fi.aalto.cs.apluscourses.services.PluginSettings - -class ApiTokenNotSetNotification -/** - * Constructs a notification that tells authentication is not set. - */ - : Notification( - PluginSettings.A_PLUS, - MyBundle.message("notification.ApiTokenNotSet.title"), - MyBundle.message("notification.ApiTokenNotSet.content"), - NotificationType.INFORMATION -) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseConfigListErrorNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseConfigListErrorNotification.kt deleted file mode 100644 index a4e3ae42c..000000000 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseConfigListErrorNotification.kt +++ /dev/null @@ -1,18 +0,0 @@ -package fi.aalto.cs.apluscourses.notifications - -import com.intellij.notification.Notification -import com.intellij.notification.NotificationType -import fi.aalto.cs.apluscourses.MyBundle -import fi.aalto.cs.apluscourses.services.PluginSettings - -class CourseConfigListErrorNotification -/** - * Constructs a notification that notifies the user of an error about course configs. - */ - : Notification( - PluginSettings.A_PLUS, - MyBundle.message("notification.CourseConfigListErrorNotification.title"), - MyBundle.message("notification.CourseConfigListErrorNotification.content"), - NotificationType.ERROR -) - diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseConfigurationError.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseConfigurationError.kt index 331452efe..5be6ec657 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseConfigurationError.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseConfigurationError.kt @@ -5,13 +5,13 @@ import com.intellij.notification.NotificationType import fi.aalto.cs.apluscourses.MyBundle import fi.aalto.cs.apluscourses.services.PluginSettings -class CourseConfigurationError /** - * Constructs a notification that notifies the user of an error that occurred while attempting to + * A notification that notifies the user of an error that occurred while attempting to * parse a course configuration file. * * @param exception An exception that caused this notification. - */(val exception: Exception) : Notification( + */ +class CourseConfigurationError(val exception: Exception) : Notification( PluginSettings.A_PLUS, MyBundle.message("notification.CourseConfigurationError.title"), MyBundle.message( diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseFileError.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseFileError.kt deleted file mode 100644 index 4a193cd6f..000000000 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseFileError.kt +++ /dev/null @@ -1,19 +0,0 @@ -package fi.aalto.cs.apluscourses.notifications - -import com.intellij.notification.Notification -import com.intellij.notification.NotificationType -import fi.aalto.cs.apluscourses.MyBundle -import fi.aalto.cs.apluscourses.services.PluginSettings - -class CourseFileError -/** - * Error to be shown when course settings file cannot be accessed. - * - * @param e Exception. - */ - (e: Exception) : Notification( - PluginSettings.A_PLUS, - MyBundle.message("notification.CourseFileError.title"), - MyBundle.message("notification.CourseFileError.content", e.message!!), - NotificationType.ERROR -) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseVersionOutdatedError.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseVersionOutdatedError.kt index ff118ea27..804aaa00d 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseVersionOutdatedError.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseVersionOutdatedError.kt @@ -5,12 +5,11 @@ import com.intellij.notification.NotificationType import fi.aalto.cs.apluscourses.MyBundle import fi.aalto.cs.apluscourses.services.PluginSettings -class CourseVersionOutdatedError /** - * Notification to be shown when the plugin is outdated with respect to the current course. + * A notification to be shown when the plugin is outdated with respect to the current course. * This represents a mismatch in the major version and is an error. */ - : Notification( +class CourseVersionOutdatedError : Notification( PluginSettings.A_PLUS, MyBundle.message("notification.CourseVersionError.title"), MyBundle.message("notification.CourseVersionOutdatedError.content"), NotificationType.ERROR ) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseVersionOutdatedWarning.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseVersionOutdatedWarning.kt index 376b62401..d5993448f 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseVersionOutdatedWarning.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseVersionOutdatedWarning.kt @@ -5,12 +5,11 @@ import com.intellij.notification.NotificationType import fi.aalto.cs.apluscourses.MyBundle import fi.aalto.cs.apluscourses.services.PluginSettings -class CourseVersionOutdatedWarning /** - * Notification to be shown when the plugin is outdated with respect to the current course. + * A notification to be shown when the plugin is outdated with respect to the current course. * This represents a mismatch in the minor version and is a warning. */ - : Notification( +class CourseVersionOutdatedWarning : Notification( PluginSettings.A_PLUS, MyBundle.message("notification.CourseVersionError.title"), MyBundle.message("notification.CourseVersionOutdatedWarning.content"), NotificationType.WARNING ) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseVersionTooNewError.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseVersionTooNewError.kt index be0d9d881..ceb350dcd 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseVersionTooNewError.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/CourseVersionTooNewError.kt @@ -5,11 +5,10 @@ import com.intellij.notification.NotificationType import fi.aalto.cs.apluscourses.MyBundle import fi.aalto.cs.apluscourses.services.PluginSettings -class CourseVersionTooNewError /** - * Notification to be shown when the plugin is too new to support the current course. + * A notification to be shown when the plugin is too new to support the current course. */ - : Notification( +class CourseVersionTooNewError : Notification( PluginSettings.A_PLUS, MyBundle.message("notification.CourseVersionError.title"), MyBundle.message("notification.CourseVersionTooNewError.content"), NotificationType.ERROR ) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/ExerciseNotSelectedNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/ExerciseNotSelectedNotification.kt deleted file mode 100644 index 7533d345a..000000000 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/ExerciseNotSelectedNotification.kt +++ /dev/null @@ -1,18 +0,0 @@ -package fi.aalto.cs.apluscourses.notifications - -import com.intellij.notification.Notification -import com.intellij.notification.NotificationType -import fi.aalto.cs.apluscourses.MyBundle -import fi.aalto.cs.apluscourses.services.PluginSettings - -class ExerciseNotSelectedNotification -/** - * Constructs a notification that notifies the user that no exercise is selected. This should be - * shown when the user uses the exercise submission button, but no exercise is selected. - */ - : Notification( - PluginSettings.A_PLUS, - MyBundle.message("notification.ExerciseNotSelectedNotification.title"), - MyBundle.message("notification.ExerciseNotSelectedNotification.content"), - NotificationType.INFORMATION -) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/FeedbackAvailableNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/FeedbackAvailableNotification.kt index 7d6a56bd6..2b22e5944 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/FeedbackAvailableNotification.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/FeedbackAvailableNotification.kt @@ -12,8 +12,11 @@ import fi.aalto.cs.apluscourses.services.PluginSettings import fi.aalto.cs.apluscourses.services.course.CourseManager import fi.aalto.cs.apluscourses.utils.SubmissionResultUtil -//import fi.aalto.cs.apluscourses.services.PluginSettings.Companion.getInstance - +/** + * A notification that notifies the user that feedback is available for a submission. + * The notification contains a link that can be used to open the feedback and the amount of + * points the submission got. + */ class FeedbackAvailableNotification( submissionResult: SubmissionResult, exercise: Exercise, @@ -27,15 +30,10 @@ class FeedbackAvailableNotification( ), NotificationType.INFORMATION ) { - /** - * Construct a notification that notifies the user that feedback is available for a submission. - * The notification contains a link that can be used to open the feedback and the amount of - * points the submission got. - */ init { if (CourseManager.getInstance(project).state.feedbackCss != null) { - super.addAction(ShowFeedbackNotificationAction(submissionResult, exercise)) + addAction(ShowFeedbackNotificationAction(submissionResult, exercise)) } - super.addAction(OpenSubmissionNotificationAction(submissionResult)) + addAction(OpenSubmissionNotificationAction(submissionResult)) } } diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/IoErrorNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/IoErrorNotification.kt deleted file mode 100644 index bf547527f..000000000 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/IoErrorNotification.kt +++ /dev/null @@ -1,22 +0,0 @@ -package fi.aalto.cs.apluscourses.notifications - -import com.intellij.notification.Notification -import com.intellij.notification.NotificationType -import fi.aalto.cs.apluscourses.MyBundle -import fi.aalto.cs.apluscourses.services.PluginSettings -import java.io.IOException - -class IoErrorNotification -/** - * Construct an error notification that tells the user of an IO error. - * - * @param exception The exception corresponding to the IO error. - */(val exception: IOException) : Notification( - PluginSettings.A_PLUS, - MyBundle.message("notification.IoErrorNotification.title"), - MyBundle.message( - "notification.IoErrorNotification.content", - exception.message!! - ), - NotificationType.ERROR -) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/MissingDependencyNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/MissingDependencyNotification.kt index c493417bc..53e2d06b4 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/MissingDependencyNotification.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/MissingDependencyNotification.kt @@ -5,16 +5,16 @@ import com.intellij.notification.NotificationType import fi.aalto.cs.apluscourses.MyBundle import fi.aalto.cs.apluscourses.services.PluginSettings -class MissingDependencyNotification /** - * Construct a missing module notification which explains that modules with the given names couldn't be found. + * A missing module notification which explains that modules with the given names couldn't be found. */ - (moduleNames: Set) : Notification( +class MissingDependencyNotification(moduleNames: Set) : Notification( PluginSettings.A_PLUS, MyBundle.message("notification.MissingDependencyNotification.title"), MyBundle.message( "notification.MissingDependencyNotification.content", - java.lang.String.join(", ", moduleNames) + moduleNames.joinToString(", ") ), NotificationType.ERROR ) +// TODO show \ No newline at end of file diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/MissingFileNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/MissingFileNotification.kt index 0aed82621..3bf6dbd08 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/MissingFileNotification.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/MissingFileNotification.kt @@ -4,17 +4,12 @@ import com.intellij.notification.Notification import com.intellij.notification.NotificationType import fi.aalto.cs.apluscourses.MyBundle import fi.aalto.cs.apluscourses.services.PluginSettings -import java.nio.file.Path /** - * Construct a missing file notification that explains that a file with the given name couldn't be + * A missing file notification that explains that a file with the given name couldn't be * found in the given module. */ -class MissingFileNotification -/** - * Construct a missing file notification that explains that a file with the given name couldn't be - * found in the given module. - */ @JvmOverloads constructor(val path: Path, val filename: String, download: Boolean = false) : Notification( +class MissingFileNotification(path: String, filename: String, download: Boolean = false) : Notification( PluginSettings.A_PLUS, MyBundle.message("notification.MissingFileNotification.title"), MyBundle.message( diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/MissingModuleNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/MissingModuleNotification.kt index 5931d40d1..74e9c5c4b 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/MissingModuleNotification.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/MissingModuleNotification.kt @@ -5,13 +5,12 @@ import com.intellij.notification.NotificationType import fi.aalto.cs.apluscourses.MyBundle import fi.aalto.cs.apluscourses.services.PluginSettings -class MissingModuleNotification /** - * Construct a missing module notification that explains that a module with the given name - * couldn't be found. - */(val moduleName: String) : Notification( + * Construct a missing module notification that explains that a module couldn't be found. + */ +class MissingModuleNotification : Notification( PluginSettings.A_PLUS, MyBundle.message("notification.MissingModuleNotification.title"), - MyBundle.message("notification.MissingModuleNotification.content", moduleName), + MyBundle.message("notification.MissingModuleNotification.content"), NotificationType.ERROR ) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/NetworkErrorNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/NetworkErrorNotification.kt index 3b0e80c8c..22b7dbf57 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/NetworkErrorNotification.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/NetworkErrorNotification.kt @@ -5,12 +5,12 @@ import com.intellij.notification.NotificationType import fi.aalto.cs.apluscourses.MyBundle import fi.aalto.cs.apluscourses.services.PluginSettings -class NetworkErrorNotification /** - * Constructs a notification that notifies the user of an IO error arising from the HTTP client. + * A notification that notifies the user of an IO error arising from the HTTP client. * * @param exception An exception that caused this notification. - */(val exception: Exception) : Notification( + */ +class NetworkErrorNotification(val exception: Exception) : Notification( PluginSettings.A_PLUS, MyBundle.message("notification.NetworkErrorNotification.title"), MyBundle.message( diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/NewModulesVersionsNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/NewModulesVersionsNotification.kt index 1603907d1..1ca59c769 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/NewModulesVersionsNotification.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/NewModulesVersionsNotification.kt @@ -23,7 +23,7 @@ class NewModulesVersionsNotification(modules: List) : Notification( "notification.NewModulesVersionsNotification.contentSingle" else "notification.NewModulesVersionsNotification.content", - modules.map { it.name }.joinToString(", ") // TODO check strings + modules.map { it.name }.joinToString(", ") ), NotificationType.INFORMATION ) \ No newline at end of file diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/NotSubmittableNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/NotSubmittableNotification.kt index 2e4bc9112..19a74707a 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/NotSubmittableNotification.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/NotSubmittableNotification.kt @@ -5,11 +5,10 @@ import com.intellij.notification.NotificationType import fi.aalto.cs.apluscourses.MyBundle import fi.aalto.cs.apluscourses.services.PluginSettings -class NotSubmittableNotification /** - * Construct a notification that explains that the exercise cannot be submitted from the plugin. + * A notification that explains that the exercise cannot be submitted from the plugin. */ - : Notification( +class NotSubmittableNotification : Notification( PluginSettings.A_PLUS, MyBundle.message("notification.NotSubmittableNotification.title"), MyBundle.message("notification.NotSubmittableNotification.content"), diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/SubmissionSentNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/SubmissionSentNotification.kt deleted file mode 100644 index fcd14d3cc..000000000 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/SubmissionSentNotification.kt +++ /dev/null @@ -1,17 +0,0 @@ -package fi.aalto.cs.apluscourses.notifications - -import com.intellij.notification.Notification -import com.intellij.notification.NotificationType -import fi.aalto.cs.apluscourses.MyBundle -import fi.aalto.cs.apluscourses.services.PluginSettings - -class SubmissionSentNotification -/** - * Construct a notification which informs the user that an exercise was submitted successfully. - */ - : Notification( - PluginSettings.A_PLUS, - MyBundle.message("notification.SuccessfulSubmissionNotification.title"), - MyBundle.message("notification.SuccessfulSubmissionNotification.content"), - NotificationType.INFORMATION -) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/TaskCompleteNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/TaskCompleteNotification.kt deleted file mode 100644 index 7c4ccc1ef..000000000 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/TaskCompleteNotification.kt +++ /dev/null @@ -1,44 +0,0 @@ -package fi.aalto.cs.apluscourses.notifications - -import com.intellij.notification.Notification -import com.intellij.notification.NotificationType -import fi.aalto.cs.apluscourses.MyBundle -import fi.aalto.cs.apluscourses.services.PluginSettings - -class TaskCompleteNotification : Notification { - /** - * Constructor. - */ - private constructor(contentKey: String, index: Int) : super( - PluginSettings.A_PLUS, - MyBundle.message("notification.TaskCompleteNotification.title"), - MyBundle.message(contentKey, index), - NotificationType.INFORMATION - ) - - /** - * Constructor. - */ - private constructor(contentKey: String, index: Int, instructions: String) : super( - PluginSettings.A_PLUS, - MyBundle.message("notification.TaskCompleteNotification.title"), - """ - ${MyBundle.message(contentKey, index)} - ($instructions) - """.trimIndent(), - NotificationType.INFORMATION - ) - - companion object { - fun createTaskCompleteNotification(index: Int): TaskCompleteNotification { - return TaskCompleteNotification("notification.TaskCompleteNotification.content", index + 1) - } - - fun createTaskAlreadyCompleteNotification(index: Int, instructions: String): TaskCompleteNotification { - return TaskCompleteNotification( - "notification.TaskCompleteNotification.contentAlready", - index + 1, instructions - ) - } - } -} diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/UrlRenderingErrorNotification.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/UrlRenderingErrorNotification.kt deleted file mode 100644 index 9655300fc..000000000 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/notifications/UrlRenderingErrorNotification.kt +++ /dev/null @@ -1,20 +0,0 @@ -package fi.aalto.cs.apluscourses.notifications - -import com.intellij.notification.Notification -import com.intellij.notification.NotificationType -import fi.aalto.cs.apluscourses.MyBundle -import fi.aalto.cs.apluscourses.services.PluginSettings - -class UrlRenderingErrorNotification -/** - * Construct a notification informing the user that an error occurred while attempting to render - * a submission. - */(val exception: Exception) : Notification( - PluginSettings.A_PLUS, - MyBundle.message("notification.UrlRenderingErrorNotification.title"), - MyBundle.message( - "notification.UrlRenderingErrorNotification.content", - exception.message!! - ), - NotificationType.ERROR -) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/services/OpenDocumentationActionProvider.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/services/OpenDocumentationActionProvider.kt index 6df29ee45..164dedc26 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/services/OpenDocumentationActionProvider.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/services/OpenDocumentationActionProvider.kt @@ -18,22 +18,18 @@ import fi.aalto.cs.apluscourses.utils.FileUtil internal class OpenDocumentationActionProvider : InspectionWidgetActionProvider { override fun createAction(editor: Editor): AnAction? { val project = editor.project ?: return null - CourseManager.course(project) ?: return null + val course = CourseManager.course(project) ?: return null + if (!course.name.contains("O1")) return null val virtualFile = editor.virtualFile ?: return null if (virtualFile.extension != "scala") return null val fileName = virtualFile.nameWithoutExtension val path = virtualFile.path - println(path) - println(path.replace("/o1/", "/doc/o1/").substringBeforeLast("/")) -// val module = -// ProjectRootManager.getInstance(project).fileIndex.getModuleForFile(virtualFile) ?: return null val file = FileUtil.findFileInDirectoryStartingWith( + // TODO: O1 specific path.replace("/o1/", "/doc/o1/").substringBeforeLast("/"), fileName ) ?: return null - println( - file - ) + val action = object : DumbAwareAction("Show Documentation") { override fun actionPerformed(e: AnActionEvent) { val virtualFile = VirtualFileManager.getInstance().findFileByNioPath(file) ?: return @@ -43,14 +39,6 @@ internal class OpenDocumentationActionProvider : InspectionWidgetActionProvider OpenInBrowserEditorContextBarGroupAction().getChildren(e)[0].actionPerformed( e.withDataContext(newDataContext) ) -// AnActionEvent( -// e.inputEvent, -// newDataContext, -// e.place, -// e.presentation, -// e.actionManager, -// e.modifiers -// ) } override fun update(e: AnActionEvent) { diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/services/Opener.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/services/Opener.kt index e039c3e4d..ba03eac95 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/services/Opener.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/services/Opener.kt @@ -1,6 +1,5 @@ package fi.aalto.cs.apluscourses.services -import com.intellij.icons.AllIcons import com.intellij.ide.BrowserUtil import com.intellij.ide.browsers.actions.OpenInBrowserBaseGroupAction.OpenInBrowserEditorContextBarGroupAction import com.intellij.ide.projectView.ProjectView @@ -72,33 +71,11 @@ class Opener( } } - fun showModuleInProjectTreeAction(module: Module): AnAction { - return object : DumbAwareAction("Show in Project Tree") { - override fun actionPerformed(e: AnActionEvent) { - showModuleInProjectTree(module) - } - - override fun update(e: AnActionEvent) { - e.presentation.text = "Show in Project Tree" - e.presentation.icon = AllIcons.General.Locate - } - - override fun getActionUpdateThread(): ActionUpdateThread { - return ActionUpdateThread.EDT - } - } - } - fun openDocumentationAction(module: Module, fileName: String): AnAction { return object : DumbAwareAction("Show Documentation") { override fun actionPerformed(e: AnActionEvent) { val dir = module.platformObject?.guessModuleDir() ?: return - println(dir) -// val file = FileUtil.findFileInDirectoryStartingWith( -// path.replace("/o1/", "/doc/o1/").substringBeforeLast("/"), fileName -// val virtualFile = VirtualFileManager.getInstance().findFileByNioPath(file) ?: return val virtualFile = dir.findFile(fileName) ?: return - println(virtualFile) val psiFile = PsiManager.getInstance(project).findFile(virtualFile) ?: return val newDataContext = SimpleDataContext.builder().add(CommonDataKeys.PROJECT, project) .add(CommonDataKeys.PSI_FILE, psiFile).build() @@ -113,7 +90,7 @@ class Opener( } override fun getActionUpdateThread(): ActionUpdateThread { - return ActionUpdateThread.EDT + return ActionUpdateThread.BGT } } diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/services/TokenStorage.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/services/TokenStorage.kt index 341ac48a2..2a45f322f 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/services/TokenStorage.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/services/TokenStorage.kt @@ -20,10 +20,10 @@ import org.jetbrains.annotations.NonNls @Service(Service.Level.APP) class TokenStorage(private val cs: CoroutineScope) { @NonNls - private val serviceName: String = "A+ Courses Plugin" + private val serviceName: String = "A+ Courses Plugin Token" @NonNls - private val serviceKey: String = "A+ Token" + private val serviceKey: String = "plus.cs.aalto.fi" // TODO change to the correct url private val credentialAttributes: CredentialAttributes = CredentialAttributes( generateServiceName(serviceName, serviceKey) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/services/course/CoursesFetcher.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/services/course/CoursesFetcher.kt index 844ee696d..d1937a89b 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/services/course/CoursesFetcher.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/services/course/CoursesFetcher.kt @@ -37,8 +37,7 @@ class CoursesFetcher(private val cs: CoroutineScope) { fun fetchCourses(setCourses: (List) -> Unit) { cs.launch { val client = HttpClient(CIO) -// val url = "https://version.aalto.fi/gitlab/aplus-courses/course-config-urls/-/raw/main/courses.yaml" - val url = "https://raw.githubusercontent.com/jaakkonakaza/temp/main/courses.yaml" // TODO + val url = "https://version.aalto.fi/gitlab/aplus-courses/course-config-urls/-/raw/main/courses.yaml" val res = client.get(url) val courses = Yaml() diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/services/exercise/ShowFeedback.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/services/exercise/ShowFeedback.kt index 2532b3ba8..fe01021d4 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/services/exercise/ShowFeedback.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/services/exercise/ShowFeedback.kt @@ -2,19 +2,20 @@ package fi.aalto.cs.apluscourses.services.exercise import com.intellij.openapi.application.EDT import com.intellij.openapi.components.Service +import com.intellij.openapi.components.service import com.intellij.openapi.fileEditor.FileEditor import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.fileEditor.impl.HTMLEditorProvider.Companion.openEditor import com.intellij.openapi.project.Project -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.openapi.vfs.writeText import com.intellij.ui.JBColor -import com.intellij.util.application import com.intellij.util.ui.JBFont import fi.aalto.cs.apluscourses.MyBundle.message import fi.aalto.cs.apluscourses.api.APlusApi import fi.aalto.cs.apluscourses.model.exercise.Exercise import fi.aalto.cs.apluscourses.model.exercise.SubmissionResult +import fi.aalto.cs.apluscourses.notifications.NetworkErrorNotification +import fi.aalto.cs.apluscourses.services.Notifier +import fi.aalto.cs.apluscourses.services.Opener import fi.aalto.cs.apluscourses.services.course.CourseManager import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -33,9 +34,9 @@ class ShowFeedback( fun showFeedback(submission: SubmissionResult, exercise: Exercise) { cs.launch { try { - println(CourseManager.getInstance(project).state.feedbackCss) - val feedbackCss = CourseManager.getInstance(project).state.feedbackCss ?: return@launch - if (feedbackCss.isEmpty()) { + val feedbackCss = CourseManager.getInstance(project).state.feedbackCss ?: "" + if (feedbackCss.isEmpty() || !exercise.isSubmittable) { + project.service().openSubmission(submission) return@launch } val feedbackString = withContext(Dispatchers.IO) { @@ -55,8 +56,6 @@ class ShowFeedback( val fontName: String = JBFont.regular().fontName - println(feedbackCss) - document.head().append( """""" ) @@ -104,17 +103,8 @@ class ShowFeedback( ) } } catch (ex: IOException) { -// notifier.notify(NetworkErrorNotification(ex), project) + Notifier.notify(NetworkErrorNotification(ex), project) } } } - - fun updateBrowserTitle(file: VirtualFile, newTitle: String) { -// cs.launch { -// writeCommandAction(project, "Change Page Title") { - application.runWriteAction { - file.writeText(newTitle) - FileEditorManager.getInstance(project).updateFilePresentation(file) - } - } } \ No newline at end of file diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/services/exercise/SubmitExercise.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/services/exercise/SubmitExercise.kt index 7ecf738eb..9a1249f3c 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/services/exercise/SubmitExercise.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/services/exercise/SubmitExercise.kt @@ -6,13 +6,14 @@ import com.intellij.openapi.components.Service import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.module.ModuleUtilCore import com.intellij.openapi.project.Project +import com.intellij.serialization.PropertyMapping import fi.aalto.cs.apluscourses.api.APlusApi import fi.aalto.cs.apluscourses.icons.CoursesIcons -import fi.aalto.cs.apluscourses.model.component.Module import fi.aalto.cs.apluscourses.model.exercise.Exercise import fi.aalto.cs.apluscourses.model.exercise.Submission import fi.aalto.cs.apluscourses.model.exercise.SubmissionInfo import fi.aalto.cs.apluscourses.model.people.Group +import fi.aalto.cs.apluscourses.notifications.MissingFileNotification import fi.aalto.cs.apluscourses.notifications.MissingModuleNotification import fi.aalto.cs.apluscourses.notifications.NetworkErrorNotification import fi.aalto.cs.apluscourses.notifications.NotSubmittableNotification @@ -57,7 +58,6 @@ class SubmitExercise( if (!submittable) { logger.warn("$exercise not submittable") - // TODO more info notifier.notify(NotSubmittableNotification(), project) return@launch } @@ -68,16 +68,16 @@ class SubmitExercise( return@launch } - val exerciseModules: Map = course.exerciseModules[exercise.id]!! - println(course.exerciseModules) +// val exerciseModules: Map = course.exerciseModules[exercise.id]!! +// println(course.exerciseModules) - val module = exerciseModules[language] + val module = exercise.module// exerciseModules[language] val platformModule = module?.platformObject logger.info("Selected $module") if (module == null || platformModule == null) { - return@launch + throw ModuleMissingException() } withContext(Dispatchers.EDT) { @@ -90,7 +90,10 @@ class SubmitExercise( println(modulePath) println(submissionInfo.getFiles(language)) for ((key, name) in submissionInfo.getFiles(language)) { - files[key] = FileUtil.findFileInDirectory(modulePath, name)!! + files[key] = FileUtil.findFileInDirectory(modulePath, name) ?: throw FileDoesNotExistException( + modulePath, + name + ) } logger.info("Submission files: $files") @@ -146,10 +149,10 @@ class SubmitExercise( // addLocalHistoryTag(project, tag) } catch (ex: IOException) { notifyNetworkError(ex, project) -// } catch (ex: FileDoesNotExistException) { -// notifier.notify(MissingFileNotification(ex.path, ex.name), project) - } catch (ex: ModuleMissingException) { - notifier.notify(MissingModuleNotification(ex.moduleName), project) + } catch (ex: FileDoesNotExistException) { + notifier.notify(MissingFileNotification(ex.path, ex.name), project) + } catch (_: ModuleMissingException) { + notifier.notify(MissingModuleNotification(), project) } logger.debug("Finished submitting exercise") } @@ -167,7 +170,16 @@ class SubmitExercise( } companion object { - class ModuleMissingException(val moduleName: String) : Exception() + class ModuleMissingException @PropertyMapping() constructor() : Exception() { + private val serialVersionUID: Long = 1L + } + + class FileDoesNotExistException @PropertyMapping("path", "name") constructor( + val path: String, + val name: String + ) : Exception() { + private val serialVersionUID: Long = 1L + } private val logger = APlusLogger.logger private val notifier = Notifier diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/ui/exercise/ExercisesView.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/ui/exercise/ExercisesView.kt index f30223e55..75c28ee38 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/ui/exercise/ExercisesView.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/ui/exercise/ExercisesView.kt @@ -330,8 +330,6 @@ class ExercisesView(project: Project) : SimpleToolWindowPanel(true, true) { override fun getChildren(item: ExercisesTreeItem): List { return item.children() } -// override fun getChildren(item: ExercisesTreeItem): List = -// item.children() override fun getText(item: ExercisesTreeItem?): String = when (item) { is ExerciseItem -> item.exercise.name @@ -364,26 +362,5 @@ class ExercisesView(project: Project) : SimpleToolWindowPanel(true, true) { } } } - } - } - - -/** // TODO - * Sets the nodeAppliedListener as OpenExerciseItemAction if the course isn't supported in ShowFeedbackAction, - * else ShowFeedbackAction. - */ -// fun setSubmissionAction(feedbackEnabled: Boolean) { -// if (!feedbackEnabled) { -// exerciseGroupsTree.addNodeAppliedListener( -// SubmissionResultViewModel::class.java, -// ActionUtil.createOnEventLauncher(OpenExerciseItemAction.ACTION_ID, exerciseGroupsTree) -// ) -// } else { -// exerciseGroupsTree.addNodeAppliedListener( -// SubmissionResultViewModel::class.java, -// ActionUtil.createOnEventLauncher(ShowFeedbackAction.ACTION_ID, exerciseGroupsTree) -// ) -// } -// } \ No newline at end of file diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/ui/exercise/SubmitExerciseDialog.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/ui/exercise/SubmitExerciseDialog.kt index 8e9de8204..2e71419d4 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/ui/exercise/SubmitExerciseDialog.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/ui/exercise/SubmitExerciseDialog.kt @@ -83,7 +83,7 @@ class SubmitExerciseDialog( text("You are about to make submission $submissionNumber out of ${exercise.maxSubmissions}.") } row { - if (exercise.maxSubmissions <= (submissionNumber)) { + if (submissionNumber >= exercise.maxSubmissions) { text( if (submissionNumber == exercise.maxSubmissions) { MyBundle.message("presentation.submissionViewModel.warning.lastSubmission") diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/ui/temp/courseproject/CourseProjectActionDialogs.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/ui/temp/courseproject/CourseProjectActionDialogs.kt deleted file mode 100644 index 1dd24fd65..000000000 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/ui/temp/courseproject/CourseProjectActionDialogs.kt +++ /dev/null @@ -1,16 +0,0 @@ -package fi.aalto.cs.apluscourses.ui.temp.courseproject - -import com.intellij.openapi.ui.Messages -import fi.aalto.cs.apluscourses.MyBundle.message - -class CourseProjectActionDialogs { - fun showRestartDialog(): Boolean { - return Messages.showOkCancelDialog( - message("ui.courseProject.dialogs.showRestartDialog.message"), - message("ui.courseProject.dialogs.showRestartDialog.title"), - message("ui.courseProject.dialogs.showRestartDialog.okText"), - message("ui.courseProject.dialogs.showRestartDialog.cancelText"), - Messages.getQuestionIcon() - ) == Messages.OK - } -} diff --git a/src/main/resources/messages/resources.properties b/src/main/resources/messages/resources.properties index 0e362b40e..d12978edf 100755 --- a/src/main/resources/messages/resources.properties +++ b/src/main/resources/messages/resources.properties @@ -2,14 +2,14 @@ notification.ApiTokenNotSet.title=Failed to store A+ token notification.ApiTokenNotSet.content=The A+ token was stored for this session but could not be stored persistently on your computer.\nYou will be asked for the token again the next time you open the project.\nTo allow secure persistent storage on your machine, check your computer's keyring settings. notification.CourseConfigurationError.title=Failed to parse the course configuration file -notification.CourseConfigurationError.content=The A+ Courses plugin for IntelliJ could not set up the target course, perhaps due to a mistake by the course staff.\nAs a result, many features of the plugin won''t work as expected. If the problem persists, please contact the course staff.\nError message: {0}. +notification.CourseConfigurationError.content=The A+ Courses plugin for IntelliJ could not set up the target course, perhaps due to a mistake by the course staff.\nAs a result, many features of the plugin will not work as expected. If the problem persists, please contact the course staff.\nError message: {0}. notification.ExerciseNotSelectedNotification.title=No assignment is selected notification.ExerciseNotSelectedNotification.content=To submit an assignment, please select the assignment in the list before clicking the submit button. notification.MissingFileNotification.title=File not found notification.MissingFileNotification.content=The A+ Courses plugin could not find the file {0} in the directory {1}. Please double-check which module you intend to submit and that the appropriate file(s) exist there. notification.MissingFileNotification.contentDownload=The A+ Courses plugin could not find the file {0} in the directory {1}. Please double-check which module you intend to download and that the appropriate file(s) exist there. notification.MissingModuleNotification.title=Could not find module -notification.MissingModuleNotification.content=The A+ Courses plugin could not find the module {0} on your computer. +notification.MissingModuleNotification.content=The A+ Courses plugin could not find the correct module. notification.MissingDependencyNotification.title=Missing dependencies notification.MissingDependencyNotification.content=The A+ Courses plugin could not find the following modules: {0}. notification.NetworkErrorNotification.title=The A+ Courses plugin encountered a network error