5AUENX2YJVFNKZUSPEPDNLLL7TKZS2WTFC6CABWSZK2EC4MNCRQAC ZCRW57C5MSBXYGUMGQTZNHGHO4HGHFBICW53X5I2IMGP3H2CKWRQC FRFFQV7VNYKGCA7ZAOSRPC2HHYTAIZ6AGGR7A5QEV6QPAQGFDYGAC Q7FXTHVUPVAFMNY277C3NFJO3VXLZU5G6C6UYSD5QPURHSG3A7OQC QXUEMZ3B2FUHFUC7ZZHJMH5FVWLEMEYXUMFA6JNXTJKIVZNMRIOAC FNNW5IEAXQ43WKB6QSQB7DFLG3Y3T5FYPXIUX7KQ2URR2GU3QLTAC 6CR2EFUN7JXFHCBTNX3WWOOP4WFOCFO6KSPEBN6V6J5HFZO2LHNQC 7L5LODGZ7AN4ZULDJZMLALD7PL6E57VZSNNSG67SFJARUJGCT47QC OPFG6CZ26PPTGTH7ULLRQGZGR3YEIEJOV5W2E3WN7PFRZS62CVLQC override fun reportAppendableHistory(path: FilePath,startingRevision: VcsRevisionNumber?,partner: VcsAppendableHistorySessionPartner) {reportAppendableHistory(path, partner)}override fun getLastRevision(filePath: FilePath): VcsFileRevision? {val ctx = this.project.service<PijulVcsContext>()val root = ctx.rootval revisions = pijul(project).revisions(this.project, root, ctx.resolveUnderVcs(filePath))return revisions.result?.firstOrNull()}
")"
")"val HunkWithPath.status: FileStatusget() = (this as Hunk).statusval Hunk.status: FileStatusget() = when(this) {is FileAddHunk -> FileStatus.ADDEDis FileDelHunk -> FileStatus.DELETEDis ReplacementHunk -> FileStatus.MODIFIEDis EditHunk -> FileStatus.MODIFIEDis MoveHunk -> FileStatus.SUPPRESSEDelse -> FileStatus.UNKNOWN}
package com.github.jonathanxd.dracon.dialogimport com.github.jonathanxd.dracon.i18n.DraconBundleimport com.intellij.openapi.application.ApplicationManagerimport com.intellij.openapi.fileTypes.FileTypeRegistryimport com.intellij.openapi.project.Projectimport com.intellij.openapi.ui.DialogPanelimport com.intellij.openapi.ui.DialogWrapperimport com.intellij.openapi.ui.DialogWrapper.IdeModalityTypeimport com.intellij.openapi.wm.WindowManagerimport com.intellij.ui.EditorTextFieldimport com.intellij.ui.layout.panelimport org.jetbrains.annotations.Nullableimport java.awt.Componentimport java.awt.Windowimport java.awt.event.ComponentAdapterimport java.awt.event.ComponentEventimport javax.swing.JComponentimport java.awt.BorderLayoutimport java.awt.Dimensionimport javax.swing.JLabelimport javax.swing.JPanelfun createPijulRecordDialog(project: Project, text: String): DialogPanel {val panel = panel {}val toml = FileTypeRegistry.getInstance().getFileTypeByExtension("toml")val editor = EditorTextField(text, project, toml)editor.preferredSize = Dimension(340, 460)panel.add(editor)return panel}class PijulExpertRecordDialogV2(val project: Project, val text: String) : DialogWrapper(project, true) {/*constructor(project: Project?, canBeParent: Boolean): super(project, canBeParent)constructor(project: Project?, canBeParent: Boolean, ideModalityType: IdeModalityType): super(project, canBeParent, ideModalityType)constructor(project: Project?,parentComponent: Component?,canBeParent: Boolean,ideModalityType: IdeModalityType): super (project, parentComponent, canBeParent, ideModalityType, true)constructor(project: Project?,parentComponent: Component?,canBeParent: Boolean,ideModalityType: IdeModalityType,createSouth: Boolean) : super(project, parentComponent, canBeParent, ideModalityType, createSouth)constructor(project: Project?): super(project)constructor(canBeParent: Boolean): super(canBeParent)constructor(canBeParent: Boolean, applicationModalIfPossible: Boolean): super(null, canBeParent, applicationModalIfPossible)constructor(project: Project?, canBeParent: Boolean, applicationModalIfPossible: Boolean): super(project, canBeParent, applicationModalIfPossible)constructor(parent: Component, canBeParent: Boolean): super(parent, canBeParent)*/init {init()title = DraconBundle.message("action.Pijul.ExpertRecord.text")}override fun createCenterPanel(): JComponent {val dialogPanel = JPanel(BorderLayout())val toml = FileTypeRegistry.getInstance().getFileTypeByExtension("toml")val editor = EditorTextField(this.text, this.project, toml)editor.preferredSize = Dimension(340, 460)dialogPanel.add(editor, BorderLayout.CENTER)return dialogPanel}}
package com.github.jonathanxd.dracon.dialogimport com.github.jonathanxd.dracon.completion.PijulRecordFileTextCompletionProviderimport com.github.jonathanxd.dracon.i18n.DraconBundleimport com.github.jonathanxd.dracon.pijul.NonZeroExitStatusCodeimport com.github.jonathanxd.dracon.pijul.SuccessStatusCodeimport com.github.jonathanxd.dracon.pijul.pijulimport com.intellij.CommonBundleimport com.intellij.ide.IdeBundleimport com.intellij.lang.Languageimport com.intellij.notification.Notificationimport com.intellij.notification.NotificationGroupimport com.intellij.notification.NotificationTypeimport com.intellij.notification.Notificationsimport com.intellij.openapi.application.ApplicationManagerimport com.intellij.openapi.editor.Documentimport com.intellij.openapi.editor.ex.EditorEximport com.intellij.openapi.fileTypes.FileTypeRegistryimport com.intellij.openapi.project.Projectimport com.intellij.openapi.ui.DialogEarthquakeShakerimport com.intellij.openapi.ui.DialogWrapperimport com.intellij.openapi.ui.DialogWrapper.DialogWrapperActionimport com.intellij.openapi.ui.DialogWrapper.IdeModalityTypeimport com.intellij.openapi.ui.ValidationInfoimport com.intellij.openapi.ui.popup.JBPopupFactoryimport com.intellij.openapi.wm.IdeFocusManagerimport com.intellij.openapi.wm.WindowManagerimport com.intellij.psi.PsiFileimport com.intellij.ui.EditorTextFieldimport com.intellij.ui.LanguageTextFieldimport com.intellij.ui.TextFieldWithAutoCompletionimport com.intellij.ui.TextFieldWithAutoCompletionListProviderimport com.intellij.util.containers.ContainerUtilimport com.intellij.util.textCompletion.TextCompletionUtilimport org.jetbrains.annotations.Nullableimport java.awt.*import java.awt.event.*import java.beans.PropertyChangeEventimport java.beans.PropertyChangeListenerimport java.lang.Booleanimport java.nio.file.Pathimport javax.swing.*open class PijulExpertRecordDialog(val project: Project,val vcsRoot: Path,val text: String) : DialogWrapper(project, true) {private val EXPERT_MODE_GROUP =NotificationGroup.createIdWithTitle("Expert Mode", DraconBundle.message("expert.mode.notification.group.id"))init {init()title = DraconBundle.message("action.Pijul.ExpertRecord.text")}//private lateinit var editor: EditorTextField//private lateinit var field: TextFieldWithAutoCompletion<String>private lateinit var editor: CustomEditorFieldoverride fun createCenterPanel(): JComponent {val dialogPanel = JPanel(BorderLayout())val tomlLanguage = Language.findLanguageByID("TOML")val ext = FileTypeRegistry.getInstance().getFileTypeByExtension("toml")val doc = LanguageTextField.createDocument(this.text,tomlLanguage,this.project,RecordDocumentCreator())editor = CustomEditorField(tomlLanguage, project, this.text)/*val field = TextFieldWithAutoCompletion(this.project, Provider(), true, this.text)field.setOneLineMode(false)field.isViewer = false*///editor = EditorTextField(doc, this.project, ext, false, false)editor.preferredSize = Dimension(800, 600)editor.setOneLineMode(false)editor.isViewer = falseeditor.isVisible = trueeditor.isEnabled = true//field.preferredSize = Dimension(800, 600)dialogPanel.add(editor, BorderLayout.CENTER)return dialogPanel}override fun createActions(): Array<Action> {return arrayOf(RecordAction(), this.cancelAction)}override fun doOKAction() {val record = pijul(this.project).recordFromString(this.project, this.vcsRoot, this.editor.text)if (record.statusCode is SuccessStatusCode) {val hash = record.result!!.substring("Hash:".length).trim()Notifications.Bus.notify(Notification(EXPERT_MODE_GROUP,DraconBundle.message("expert.mode.notification.title"),DraconBundle.message("expert.mode.notification.success", hash),NotificationType.ERROR,),this.project)} else {record.statusCode as NonZeroExitStatusCodeNotifications.Bus.notify(Notification(EXPERT_MODE_GROUP,DraconBundle.message("expert.mode.notification.title"),DraconBundle.message("expert.mode.notification.failure", record.statusCode.exitCode, record.statusCode.message),NotificationType.INFORMATION,),this.project)}super.doOKAction()}protected inner class RecordAction() : DialogWrapper.DialogWrapperAction(DraconBundle.message("expert.mode.button.record")) {override fun doAction(e: ActionEvent?) {val infoList: List<ValidationInfo> = doValidateAll()if (infoList.isNotEmpty()) {val info = infoList[0]if (info.component != null && info.component!!.isVisible) {IdeFocusManager.getInstance(null).requestFocus(info.component!!, true)}updateErrorInfo(infoList)startTrackingValidation()if (ContainerUtil.exists(infoList) { info1: ValidationInfo -> !info1.okEnabled }) return}doOKAction()}init {addPropertyChangeListener { evt: PropertyChangeEvent ->if (NAME == evt.propertyName) {repaint()}}}}class Provider : TextFieldWithAutoCompletionListProvider<String>(listOf("author", "[[authors]]", "authors", "name", "full_name", "email")) {override fun getLookupString(item: String): String {return item}}class RecordDocumentCreator : TextCompletionUtil.DocumentWithCompletionCreator(TextFieldWithAutoCompletion.StringsCompletionProvider(listOf("author", "[[authors]]", "authors", "name", "full_name", "email"),null),true)}class CustomEditorField(language: Language?, project: Project, s: String) : LanguageTextField(language, project, s, PijulExpertRecordDialog.RecordDocumentCreator(), false) {override fun createEditor(): EditorEx {val editor = super.createEditor()editor.setVerticalScrollbarVisible(true)editor.setHorizontalScrollbarVisible(true)editor.setCaretEnabled(true)editor.isViewer = falseeditor.isOneLineMode = falseval settings = editor.settingssettings.isLineNumbersShown = truesettings.isAutoCodeFoldingEnabled = truesettings.isFoldingOutlineShown = truesettings.isAllowSingleLogicalLineFolding = truesettings.isRightMarginShown=truereturn editor}}
package com.github.jonathanxd.dracon.contextimport com.github.jonathanxd.dracon.PijulVcsimport com.github.jonathanxd.dracon.pijulVcsimport com.intellij.openapi.components.Serviceimport com.intellij.openapi.components.serviceIfCreatedimport com.intellij.openapi.project.Projectimport com.intellij.openapi.vcs.FilePathimport com.intellij.openapi.vcs.ProjectLevelVcsManagerimport com.intellij.openapi.vfs.VirtualFileimport java.nio.file.Pathimport java.nio.file.Pathsimport kotlin.io.path.ExperimentalPathApiimport kotlin.io.path.relativeTo@Serviceclass PijulVcsContext(val project: Project) {val root by lazy {// Currently only supports a single vcs root for pijul.ProjectLevelVcsManager.getInstance(this.project).getRootsUnderVcs(pijulVcs(this.project)).first().toNioPath()}@OptIn(ExperimentalPathApi::class)fun resolveUnderVcs(path: FilePath): Path =this.resolveUnderVcs(Paths.get(path.path))@OptIn(ExperimentalPathApi::class)fun resolveUnderVcs(path: VirtualFile): Path =this.resolveUnderVcs(path.toNioPath())@OptIn(ExperimentalPathApi::class)fun resolveUnderVcs(path: Path): Path =when {this.root.toAbsolutePath().toString() == path.toAbsolutePath().toString() -> this.rootpath.startsWith(this.root) -> pathelse -> this.root.relativize(path)}@OptIn(ExperimentalPathApi::class)fun resolveRelativeToRoot(path: Path): String =if (path.toAbsolutePath().equals(this.root.toAbsolutePath().toString()))""elsepath.toAbsolutePath().relativeTo(this.root).toString()fun isRootPath(path: Path) =this.root.toAbsolutePath().toString() == path.toAbsolutePath().toString()}
package com.github.jonathanxd.dracon.completionimport com.intellij.codeInsight.completion.CompletionParametersimport com.intellij.codeInsight.completion.CompletionResultSetimport com.intellij.codeInsight.lookup.CharFilterimport com.intellij.util.textCompletion.TextCompletionProviderclass PijulRecordFileTextCompletionProvider : TextCompletionProvider {override fun getAdvertisement(): String? {return null}override fun getPrefix(text: String, offset: Int): String? {return null}override fun applyPrefixMatcher(result: CompletionResultSet, prefix: String): CompletionResultSet =result.withPrefixMatcher(prefix)override fun acceptChar(c: Char): CharFilter.Result? {return null}override fun fillCompletionVariants(parameters: CompletionParameters, prefix: String, result: CompletionResultSet) {}}
package com.github.jonathanxd.dracon.completionimport com.intellij.codeInsight.completion.*import com.intellij.codeInsight.lookup.LookupElementBuilderimport com.intellij.patterns.PlatformPatternsimport com.intellij.util.ProcessingContextclass PijulCompletionContributor : CompletionContributor() {init {extend(CompletionType.BASIC, PlatformPatterns.psiElement(), object : CompletionProvider<CompletionParameters>() {override fun addCompletions(parameters: CompletionParameters,context: ProcessingContext,result: CompletionResultSet) {result.addElement(LookupElementBuilder.create("author"))result.addElement(LookupElementBuilder.create("[[authors]]"))result.addElement(LookupElementBuilder.create("authors"))result.addElement(LookupElementBuilder.create("name"))result.addElement(LookupElementBuilder.create("full_name"))result.addElement(LookupElementBuilder.create("email"))}})}}
}override fun revisions(project: Project, root: Path, file: Path): PijulOperationResult<List<PijulVcsFileRevision>> {val historyList = mutableListOf<PijulVcsFileRevision>()val channels = this.channel(this.project, root)val currentChannel = channels.result?.channels?.firstOrNull { it.current }?.nameval result = this.fileHistory(project, root, file, {it.hunks.filterIsInstance<HunkWithPath>().groupBy {it.resolvePath(root)}.forEach { (path, hunks) ->val deleted = hunks.any { it is FileDelHunk }historyList.add(PijulVcsFileRevision(this.project,root,path,PijulRevisionNumber(it.changeHash, it.date),it.authors.map { VcsUserImpl(it.name ?: "", it.email ?: "") }.filter { it.name.isNotEmpty() },it.message,currentChannel,deleted))}}, {})return PijulOperationResult(result.operation, result.statusCode, historyList)
val logHashExecution = this.createExecPijulOperation(project, rootPath, listOf("log", "--hash-only"), delay = 10L)
return this.fileHistory(project, rootPath, filePath, consumer, errorConsumer)}@OptIn(ExperimentalPathApi::class)override fun fileHistory(project: Project,root: Path,file: Path,consumer: (PijulLogEntry) -> Unit,errorConsumer: (PijulOperationResult<Unit>) -> Unit): PijulOperationResult<Unit> {val ctx = project.service<PijulVcsContext>()val filePath = ctx.resolveUnderVcs(file)val isRootPath = ctx.isRootPath(filePath)
val change = this.doExecutionWithMapper("change-$hash", this.createPainlessExecPijulOperation(project, rootPath, listOf("change", hash))) {
val change = this.doExecutionWithMapper("change-$hash", this.createPainlessExecPijulOperation(project, root, listOf("change", hash))) {
val channelOperation = this.createPainlessExecPijulOperation(project, rootPath, listOf("channel"))
return this.channel(project, rootPath)}override fun channel(project: Project, root: Path): PijulOperationResult<ChannelInfo> {val channelOperation = this.createPainlessExecPijulOperation(project, root, listOf("channel"))
package com.github.jonathanxd.dracon.changesimport com.github.jonathanxd.dracon.PijulVcsimport com.github.jonathanxd.dracon.content.PijulContentRevisionimport com.github.jonathanxd.dracon.context.PijulVcsContextimport com.github.jonathanxd.dracon.log.*import com.github.jonathanxd.dracon.pijul.pijulimport com.github.jonathanxd.dracon.pijulVcsimport com.github.jonathanxd.dracon.revision.PijulRevisionNumberimport com.intellij.openapi.components.Serviceimport com.intellij.openapi.components.serviceimport com.intellij.openapi.project.Projectimport com.intellij.openapi.util.Pairimport com.intellij.openapi.util.io.FileUtilimport com.intellij.openapi.vcs.*import com.intellij.openapi.vcs.changes.Changeimport com.intellij.openapi.vcs.changes.ChangeListimport com.intellij.openapi.vcs.changes.ChangesUtilimport com.intellij.openapi.vcs.history.VcsFileRevisionimport com.intellij.openapi.vcs.history.VcsRevisionNumberimport com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettingsimport com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditorimport com.intellij.openapi.vcs.versionBrowser.CommittedChangeListimport com.intellij.openapi.vcs.versionBrowser.StandardVersionFilterComponentimport com.intellij.openapi.vfs.VirtualFileimport com.intellij.util.AsynchConsumerimport com.intellij.vcs.CommittedChangeListForRevisionimport com.intellij.vcs.log.VcsFullCommitDetailsimport com.intellij.vcs.log.util.VcsLogUtilimport com.intellij.vcsUtil.VcsUtilimport org.jetbrains.annotations.NotNullimport java.nio.file.Filesimport java.nio.file.Pathimport java.nio.file.Pathsimport java.util.*import javax.swing.JComponent@Serviceclass PijulCommittedChangesProvider(val project: Project) : CommittedChangesProvider<CommittedChangeList, ChangeBrowserSettings> {override fun createFilterUI(showDateFilter: Boolean): ChangesBrowserSettingsEditor<ChangeBrowserSettings> =PijulVersionFilterComponent(showDateFilter)override fun getLocationFor(root: FilePath): RepositoryLocation {val ctx = this.project.service<PijulVcsContext>()val channel = pijul(this.project).channel(this.project, ctx.root).result?.channels?.firstOrNull { it.current }?.name ?: "unknown"return PijulRepositoryLocation(ctx.root, channel)}override fun getCommittedChanges(settings: ChangeBrowserSettings,location: RepositoryLocation,maxCount: Int): MutableList<CommittedChangeList> {val changes = mutableListOf<CommittedChangeList>()this.getChanges(settings, location, maxCount) {changes.add(it)}return changes}override fun loadCommittedChanges(settings: ChangeBrowserSettings,location: RepositoryLocation,maxCount: Int,consumer: AsynchConsumer<in CommittedChangeList>) {try {getChanges(settings, location, maxCount) {consumer.consume(it)}} finally {consumer.finished()}}private fun getChanges(settings: ChangeBrowserSettings,location: RepositoryLocation,maxCount: Int,consumer: (PijulCommittedChangeList) -> Unit) {val ctx = this.project.service<PijulVcsContext>()val filters = mutableListOf<(PijulLogEntry) -> Boolean>()val beforeRev = settings.changeBeforeFilterval afterRev = settings.changeAfterFilterval beforeDate = settings.dateBeforeFilterval afterDate = settings.dateAfterFilterval author = settings.userFilterif (beforeRev != null) {filters += { entry ->entry.date.toEpochSecond() < beforeRev}}if (afterRev != null) {filters += { entry ->entry.date.toEpochSecond() > afterRev}}if (beforeDate != null) {filters += { entry ->entry.date.toInstant().isBefore(beforeDate.toInstant())}}if (afterDate != null) {filters += { entry ->entry.date.toInstant().isAfter(afterDate.toInstant())}}if (author != null) {filters += { entry ->entry.authors.any { it.name == author }}}val allRevisions = pijul(this.project).allRevisions(this.project, ctx.root).result!!pijul(this.project).log(this.project, ctx.root).result?.entries?.filter {filters.all { filter -> filter(it) }}?.map { entry ->PijulCommittedChangeList(entry.message,"",entry.authors.firstOrNull()?.name ?: "No author",Date.from(entry.date.toInstant()),entry.hunks.filterIsInstance<HunkWithPath>().map { hunk ->val beforeRevision =if (hunk is FileAddHunk) nullelse findARevisionBefore(entry.changeHash, allRevisions)?.let {PijulContentRevision(ctx.root,hunk.resolvePath(ctx.root),it,this.project)}val afterRevision =if (hunk is FileDelHunk) nullelse PijulContentRevision(ctx.root,hunk.resolvePath(ctx.root),entry.revision,this.project)Change(beforeRevision,afterRevision,hunk.status)}.toMutableList(),entry.revision,false,pijulVcs(this.project))}?.let { if (maxCount == -1) it else it.take(maxCount) }?.forEach {consumer(it)}}fun findARevisionBefore(current: String, allRevisions: List<PijulRevisionNumber>): PijulRevisionNumber? {for (i in allRevisions.indices) {if (current == allRevisions[i].hash) {return if (i == 0) {null} else {allRevisions[i - 1]}}}return null}override fun getColumns(): Array<ChangeListColumn<*>> {return arrayOf(ChangeListColumn.NUMBER,ChangeListColumn.DATE,ChangeListColumn.DESCRIPTION,ChangeListColumn.NAME)}override fun getUnlimitedCountValue(): Int = -1override fun getOneList(file: VirtualFile, number: VcsRevisionNumber): Pair<CommittedChangeList, FilePath>? {val ctx = this.project.service<PijulVcsContext>()val path = Paths.get(VcsUtil.getFilePath(file).path)val filePath = ctx.resolveUnderVcs(path)val allRevisions = pijul(this.project).allRevisions(this.project, ctx.root).result!!val rev = pijul(this.project).log(this.project, ctx.root).result?.entries?.filter {it.revision.hash == number.asString()}?.map { entry ->PijulCommittedChangeList(entry.message,"",entry.authors.firstOrNull()?.name ?: "No author",Date.from(entry.date.toInstant()),entry.hunks.filterIsInstance<HunkWithPath>().map { hunk ->val beforeRevision =if (hunk is FileAddHunk) nullelse findARevisionBefore(entry.changeHash, allRevisions)?.let {PijulContentRevision(ctx.root,hunk.resolvePath(ctx.root),it,this.project)}val afterRevision =if (hunk is FileDelHunk) nullelse PijulContentRevision(ctx.root,hunk.resolvePath(ctx.root),entry.revision,this.project)Change(beforeRevision,afterRevision,hunk.status)}.toMutableList(),entry.revision,false,pijulVcs(this.project))}?.firstOrNull() ?: return nullreturn Pair.create(rev, LocalFilePath(filePath, Files.isDirectory(filePath)))}}class PijulRepositoryLocation(val path: Path, val channel: String) : RepositoryLocation {override fun toPresentableString(): String ="${this.path}@${this.channel}"override fun getKey(): String =this.path.toString()override fun toString(): String = this.toPresentableString()}class PijulVersionFilterComponent(showDateFilter: Boolean) :StandardVersionFilterComponent<ChangeBrowserSettings>(showDateFilter) {override fun getComponent(): JComponent {return standardPanel as JComponent}init {init(ChangeBrowserSettings())}}class PijulCommittedChangeList(subject: String,comment: String,committerName: String,commitDate: Date,changes: MutableCollection<Change>,revisionNumber: VcsRevisionNumber,val modifiable: Boolean,val vcs: PijulVcs) : CommittedChangeListForRevision(subject, comment, committerName, commitDate, changes, revisionNumber) {override fun isModifiable(): Boolean = this.modifiableoverride fun getNumber(): Long =this.revisionNumber.timestamp.toInstant().epochSecondoverride fun getRevisionNumber(): PijulRevisionNumber {return super.getRevisionNumber() as PijulRevisionNumber}override fun getVcs(): AbstractVcs = this.vcs}
package com.github.jonathanxd.dracon.actionsimport com.github.jonathanxd.dracon.dialog.PijulExpertRecordDialogimport com.github.jonathanxd.dracon.dialog.createPijulRecordDialogimport com.github.jonathanxd.dracon.pijul.pijulimport com.intellij.openapi.actionSystem.AnActionEventimport com.intellij.openapi.fileEditor.FileEditorManagerimport com.intellij.openapi.fileEditor.OpenFileDescriptorimport com.intellij.openapi.fileTypes.FileTypeRegistryimport com.intellij.openapi.project.DumbAwareActionimport com.intellij.openapi.vcs.ProjectLevelVcsManagerimport com.intellij.testFramework.LightVirtualFileimport com.intellij.ui.layout.panelimport kotlin.io.path.relativeToclass PijulExpertRecord : DumbAwareAction() {override fun actionPerformed(e: AnActionEvent) {val project = e.project!!val vcsManager = ProjectLevelVcsManager.getInstance(project)val root = vcsManager.allVcsRoots.first().path.toNioPath()val recordString = pijul(project).recordToString(project, root)if (recordString.result != null) {val toml = FileTypeRegistry.getInstance().getFileTypeByExtension("toml")//val editor = EditorTextField(recordString.result, this.project, )/*val psiFile = PsiDocumentManager.getInstance(editor.getProject()).getPsiFile(editor.getDocument())val element = psiFile!!.findElementAt(editor.getCaretModel().getOffset())val code: PsiExpressionCodeFragment = JavaCodeFragmentFactory.getInstance(editor.getProject()).createExpressionCodeFragment("", element, null, true)val document: Document? = PsiDocumentManager.getInstance(editor.getProject()).getDocument(code)val myInput = EditorTextField(document, editor.getProject(), JavaFileType.INSTANCE)*/PijulExpertRecordDialog(project, root, recordString.result).showAndGet()/*FileEditorManager.getInstance(project).openTextEditor(OpenFileDescriptor(project, LightVirtualFile("record", toml, recordString.result)),true)*/}}}