<commit_before>package circlet.plugins.pipelines.viewmodel

import circlet.pipelines.config.api.*
import com.intellij.openapi.project.*
import runtime.reactive.*
import javax.swing.tree.*

class ScriptWindowViewModel(private val lifetime: Lifetime, private val project: Project) {
    val scriptLifetimes = SequentialLifetimes(lifetime)
    val modelBuildIsRunning = mutableProperty(false)
    val taskIsRunning = mutableProperty(false)
    val script = mutableProperty<ScriptViewModel?>(null)
    val selectedNode = mutableProperty<CircletModelTreeNode?>(null)
    val logBuildData = mutableProperty<LogData?>(null)
    val logRunData = mutableProperty<LogData?>(null)

    init {
        selectedNode.forEach(lifetime) {
            logRunData.value = if (it != null && it.isRunnable) LogData("todo: log of task `${it.userObject}` run") else null
        }
    }
}


class ScriptViewModel internal constructor(
    private val lifetime: Lifetime,
    val config: ProjectConfig) {
}

class LogData(val dummy: String) {
    val messages = ObservableList.mutable<String>()
    fun add(message: String) {
        messages.add(message)
    }
}


fun createEmptyScriptViewModel(lifetime: Lifetime) : ScriptViewModel {
    return ScriptViewModel(lifetime, ProjectConfig(emptyList(), emptyList(), emptyList()))

}


class CircletModelTreeNode(text: String? = null, val isRunnable: Boolean = false) : DefaultMutableTreeNode(text) {

}<commit_msg>[idea plugin] [automation] make lifetime for scriptVM public<commit_after>package circlet.plugins.pipelines.viewmodel

import circlet.pipelines.config.api.*
import com.intellij.openapi.project.*
import runtime.reactive.*
import javax.swing.tree.*

class ScriptWindowViewModel(private val lifetime: Lifetime, private val project: Project) {
    val scriptLifetimes = SequentialLifetimes(lifetime)
    val modelBuildIsRunning = mutableProperty(false)
    val taskIsRunning = mutableProperty(false)
    val script = mutableProperty<ScriptViewModel?>(null)
    val selectedNode = mutableProperty<CircletModelTreeNode?>(null)
    val logBuildData = mutableProperty<LogData?>(null)
    val logRunData = mutableProperty<LogData?>(null)

    init {
        selectedNode.forEach(lifetime) {
            logRunData.value = if (it != null && it.isRunnable) LogData("todo: log of task `${it.userObject}` run") else null
        }
    }
}


class ScriptViewModel internal constructor(
    val lifetime: Lifetime,
    val config: ProjectConfig) {
}

class LogData(val dummy: String) {
    val messages = ObservableList.mutable<String>()
    fun add(message: String) {
        messages.add(message)
    }
}


fun createEmptyScriptViewModel(lifetime: Lifetime) : ScriptViewModel {
    return ScriptViewModel(lifetime, ProjectConfig(emptyList(), emptyList(), emptyList()))

}


class CircletModelTreeNode(text: String? = null, val isRunnable: Boolean = false) : DefaultMutableTreeNode(text) {

}
{'fraction_non_alphanumeric': 0.10284538909838875, 'fraction_numerical': 0.0, 'mean_word_length': 4.644100580270793, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '538574', 'n_tokens_mistral': 869, 'n_tokens_neox': 828, 'n_words': 196}