<commit_before>/*
 * Minecraft Dev for IntelliJ
 *
 * https://minecraftdev.org
 *
 * Copyright (c) 2017 minecraft-dev
 *
 * MIT License
 */

package com.demonwav.mcdev.nbt.editor

import com.demonwav.mcdev.nbt.Nbt
import com.demonwav.mcdev.nbt.filetype.NbtFileType
import com.demonwav.mcdev.nbt.tags.TagCompound
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.EditorFactory
import com.intellij.openapi.fileEditor.FileEditor
import com.intellij.openapi.fileEditor.FileEditorState
import com.intellij.openapi.fileEditor.FileEditorStateLevel
import com.intellij.openapi.util.UserDataHolderBase
import com.intellij.openapi.vfs.VirtualFile
import java.beans.PropertyChangeListener
import javax.swing.JComponent

class NbtFileEditor internal constructor(private val file: VirtualFile) : FileEditor, UserDataHolderBase() {

    private val rootCompound: TagCompound = Nbt().buildTagTree(file.inputStream, true)
    private var modifiedCompound: TagCompound = rootCompound.copy()

    private val editor: Editor = EditorFactory.getInstance().createEditor(EditorFactory.getInstance().createDocument(modifiedCompound.toString()))

    override fun isModified(): Boolean {
        return rootCompound != modifiedCompound
    }

    override fun addPropertyChangeListener(listener: PropertyChangeListener) {}
    override fun removePropertyChangeListener(listener: PropertyChangeListener) {}

    override fun getName(): String {
        return "NBT Editor"
    }

    override fun getState(level: FileEditorStateLevel): FileEditorState {
        return FileEditorState.INSTANCE // TODO
    }
    override fun setState(state: FileEditorState) {}

    override fun getComponent(): JComponent {
        return editor.component
    }
    override fun getPreferredFocusedComponent() = component

    override fun selectNotify() {}
    override fun deselectNotify() {}
<commit_msg>Fix NbtFileEditor<commit_after>/*
 * Minecraft Dev for IntelliJ
 *
 * https://minecraftdev.org
 *
 * Copyright (c) 2017 minecraft-dev
 *
 * MIT License
 */

package com.demonwav.mcdev.nbt.editor

import com.demonwav.mcdev.nbt.Nbt
import com.demonwav.mcdev.nbt.filetype.NbtFileType
import com.demonwav.mcdev.nbt.tags.TagCompound
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.EditorFactory
import com.intellij.openapi.fileEditor.FileEditor
import com.intellij.openapi.fileEditor.FileEditorState
import com.intellij.openapi.fileEditor.FileEditorStateLevel
import com.intellij.openapi.util.UserDataHolderBase
import com.intellij.openapi.vfs.VirtualFile
import java.beans.PropertyChangeListener
import javax.swing.JComponent

class NbtFileEditor internal constructor(private val file: VirtualFile) : FileEditor, UserDataHolderBase() {

    private val rootCompound: TagCompound = Nbt().buildTagTree(file.inputStream)
    private var modifiedCompound: TagCompound = rootCompound.copy()

    private val editor: Editor = EditorFactory.getInstance().createEditor(EditorFactory.getInstance().createDocument(modifiedCompound.toString()))

    override fun isModified(): Boolean {
        return rootCompound != modifiedCompound
    }

    override fun addPropertyChangeListener(listener: PropertyChangeListener) {}
    override fun removePropertyChangeListener(listener: PropertyChangeListener) {}

    override fun getName(): String {
        return "NBT Editor"
    }

    override fun getState(level: FileEditorStateLevel): FileEditorState {
        return FileEditorState.INSTANCE // TODO
    }
    override fun setState(state: FileEditorState) {}

    override fun getComponent(): JComponent {
        return editor.component
    }
    override fun getPreferredFocusedComponent() = component

    override fun selectNotify() {}
    override fun deselectNotify() {}

{'fraction_non_alphanumeric': 0.08694503171247357, 'fraction_numerical': 0.0021141649048625794, 'mean_word_length': 4.743550834597875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3955138', 'n_tokens_mistral': 1079, 'n_tokens_neox': 1056, 'n_words': 226}