package Ġrs . pe st . action . ui Ċ Ċ import Ġcom . intellij . code Insight . lookup . Lookup Manager Ċ import Ġcom . intellij . code Insight . lookup . impl . Lookup Impl Ċ import Ġcom . intellij . ide . b rowsers . Browser Launcher Ċ import Ġcom . intellij . openapi . command . Write Command Action Ċ import Ġcom . intellij . openapi . editor . Editor Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . psi . Psi Document Manager Ċ import Ġrs . pe st . PE ST _ IDE _ CR ATE _ LINK Ċ import Ġrs . pe st . PE ST _ WE BS ITE Ċ import Ġrs . pe st . live Preview . Lib Ċ import Ġrs . pe st . psi . P est Expression Ċ import Ġrs . pe st . psi . P est Grammar Rule Ċ import Ġrs . pe st . psi . start Offset Ċ import Ġjavax . swing . Button Group Ċ Ċ @ Suppress (" unused ") Ċ class ĠPest Intro duce Rule Popup Impl ( Ċ ĉ new Rule Start Offset : ĠInt , Ċ ĉ element To Rename : ĠPest Grammar Rule , Ċ ĉ editor : ĠEditor , Ċ ĉ project : ĠProject , Ċ ĉ expr : ĠPest Expression Ċ ) Ġ: ĠPest Intro duce Rule Popup ( element To Rename , Ġeditor , Ġproject , Ġexpr ) Ġ{ Ċ ĉ init Ġ{ Ċĉ ĉ main Panel . border Ġ= Ġnull Ċĉ ĉ val Ġbuttons Ġ= ĠlistOf ( atomic , Ġcompound Atomic , Ġnon Atomic , Ġnormal , Ġsilent ) Ċĉ ĉ with ( Button Group ()) Ġ{ Ġbuttons . forEach (:: add ) Ġ} Ċĉ ĉ buttons . forEach Ġ{ Ġbutton Ġ-> Ċĉĉ ĉ button . addActionListener Ġ{ Ċĉĉĉ ĉ val Ġrunnable Ġ= Ġact @{ Ċĉĉĉĉ ĉ val Ġdocument Ġ= Ġmy Editor . document Ċĉĉĉĉ ĉ val Ġgrammar Body Ġ= Ġelement To Rename . grammar Body Ġ?: Ġreturn @ act Ċĉĉĉĉ ĉ val Ġlocal Ġ= Ġelement To Rename . start Offset Ġ== Ġ 0 Ċĉĉĉĉ ĉ var Ġoffset Ġ= Ġif Ġ( local ) Ġnew Rule Start Offset Ġ+ Ġgrammar Body . start Offset Ċĉĉĉĉ ĉ else Ġgrammar Body . start Offset Ġ- Ġ 1 Ċĉĉĉĉ ĉ if Ġ( document . immutable CharSequence [ offset ] Ġin Ġ"@ ! _$ ") Ċĉĉĉĉĉ ĉ document . delete String ( offset , Ġoffset Ġ+ Ġ 1 ) Ċĉĉĉĉ ĉ else Ġoffset Ġ+= Ġ 1 Ċĉĉĉĉ ĉ when Ġ( button ) Ġ{ Ċĉĉĉĉĉ ĉ normal Ġ-> ĠUnit Ċĉĉĉĉĉ ĉ atomic Ġ-> Ġdocument . insert String ( offset , Ġ"@ ") Ċĉĉĉĉĉ ĉ non Atomic Ġ-> Ġdocument . insert String ( offset , Ġ" !") Ċĉĉĉĉĉ ĉ compound Atomic Ġ-> Ġdocument . insert String ( offset , Ġ"$ ") Ċĉĉĉĉĉ ĉ silent Ġ-> Ġdocument . insert String ( offset , Ġ"_ ") Ċĉĉĉĉ ĉ } Ċĉĉĉĉ ĉ Psi Document Manager . getInstance ( my Project ). commit Document ( document ) Ċĉĉĉ ĉ } Ċĉĉĉ ĉ Write Command Action . run Write Command Action ( project ) Ġ{ Ċĉĉĉĉ ĉ val Ġlookup Ġ= ĠLookup Manager . getActive Lookup ( my Editor ) Ġas ? ĠLookup Impl Ċĉĉĉĉ ĉ if Ġ( lookup Ġ!= Ġnull ) Ġlookup . perform Gu arded Change ( run nable ) Ċĉĉĉĉ ĉ else Ġrunnable () Ċĉĉĉ ĉ } Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ override Ġfun Ġget Component () Ġ= Ġmain Panel Ċ } Ċ Ċ class ĠPest Ide Bridge Info Impl Ġ: ĠPest Ide Bridge Info () Ġ{ Ċ ĉ val Ġcomponent Ġget () Ġ= Ġmain Panel ĊĊ ĉ comp anion Ġobject Ġ{ Ċĉ ĉ val Ġinfo Ġby Ġlazy Ġ{ ĠLib ( 1 1 4 5 1 4 Ġ* Ġ 5 0 ). crate Info () Ġ} Ċ ĉ } ĊĊ ĉ init Ġ{ Ċĉ ĉ website Link . text Ġ= ĠP EST _ WE BS ITE Ċĉ ĉ website Link . set Listener ({ Ġ_, Ġ_ Ġ-> ĠBrowser Launcher . instance . open ( PE ST _ WE BS ITE ) Ġ}, Ġnull ) Ċĉ ĉ crate Link . text Ġ= ĠP EST _ IDE _ CR ATE _ LINK Ċĉ ĉ crate Link . set Listener ({ Ġ_, Ġ_ Ġ-> ĠBrowser Launcher . instance . open ( PE ST _ IDE _ CR ATE _ LINK ) Ġ}, Ġnull ) Ċĉ ĉ version Label . text Ġ= Ġinfo . version Ċĉ ĉ author Label . text Ġ= Ġinfo . author Ċĉ ĉ description Label . text Ġ= Ġinfo . description Ċ ĉ } Ċ } Ċ