in intellij-plugin/educational-core/src/com/jetbrains/edu/learning/yaml/format/TaskChangeApplier.kt [21:63]
override fun applyChanges(existingItem: Task, deserializedItem: Task) {
@NonNls
val messageToLog = "Project not found for ${existingItem.name}"
val project = existingItem.project ?: error(messageToLog)
if (existingItem.itemType != deserializedItem.itemType) {
changeType(project, existingItem, deserializedItem)
return
}
existingItem.feedbackLink = deserializedItem.feedbackLink
@Suppress("DEPRECATION") // it's ok as we just copy value of deprecated field
existingItem.customPresentableName = deserializedItem.customPresentableName
existingItem.contentTags = deserializedItem.contentTags
existingItem.solutionHidden = deserializedItem.solutionHidden
if (deserializedItem is TheoryTask && existingItem is TheoryTask) {
existingItem.postSubmissionOnOpen = deserializedItem.postSubmissionOnOpen
}
if (deserializedItem is SortingTask && existingItem is SortingTask) {
existingItem.options = deserializedItem.options
TaskToolWindowView.getInstance(project).updateTaskDescription()
}
if (deserializedItem is MatchingTask && existingItem is MatchingTask) {
existingItem.options = deserializedItem.options
existingItem.captions = deserializedItem.captions
TaskToolWindowView.getInstance(project).updateTaskDescription()
}
if (deserializedItem is TableTask && existingItem is TableTask) {
existingItem.rows = deserializedItem.rows
existingItem.columns = deserializedItem.columns
existingItem.isMultipleChoice = deserializedItem.isMultipleChoice
TaskToolWindowView.getInstance(project).updateTaskDescription()
}
if (deserializedItem is ChoiceTask && existingItem is ChoiceTask) {
existingItem.isMultipleChoice = deserializedItem.isMultipleChoice
existingItem.choiceOptions = deserializedItem.choiceOptions
existingItem.messageCorrect = deserializedItem.messageCorrect
existingItem.messageIncorrect = deserializedItem.messageIncorrect
existingItem.quizHeader = deserializedItem.quizHeader
TaskToolWindowView.getInstance(project).updateTaskDescription()
}
hideOldPlaceholdersForOpenedFiles(project, existingItem)
existingItem.applyTaskFileChanges(deserializedItem)
paintPlaceholdersForOpenedFiles(project, existingItem)
}