// ĠCopyright Ġ 2 0 0 0 - 2 0 2 1 ĠJetBrains Ġs . r . o . Ġand Ġcontributors . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ Ċ package Ġorg . jetbrains . kotlin . idea . intent ions Ċ Ċ import Ġcom . intellij . openapi . editor . Editor Ċ import Ġorg . jetbrains . kotlin . idea . Kotlin Bundle Ċ import Ġorg . jetbrains . kotlin . idea . intent ions . Add Br aces To All Branches Int ention . Companion . all Branch Expressions Ċ import Ġorg . jetbrains . kotlin . idea . intent ions . Add Br aces To All Branches Int ention . Companion . target If Or When Expression Ċ import Ġorg . jetbrains . kotlin . psi .* Ċ Ċ class ĠRemove Br aces From All Branches Int ention Ġ: ĠSelf Target ing Int ention < Kt Expression >( ĊĠĠĠ ĠK t Expression :: class . java , ĊĠĠĠ ĠKotlin Bundle . lazy Message (" remove . br aces . from . all . branches ") Ċ ) Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġis Applicable To ( element : ĠK t Expression , Ġcaret Offset : ĠInt ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtarget If Or When Expression Ġ= Ġtarget If Or When Expression ( element ) Ġ?: Ġreturn Ġfalse ĊĠĠĠĠĠĠĠ Ġval Ġtarget Branch Expressions Ġ= Ġtarget If Or When Expression . target Branch Expressions () ĊĠĠĠĠĠĠĠ Ġif Ġ( target Branch Expressions . isEmpty () Ġ|| Ġtarget Branch Expressions . any Ġ{ Ġ! Remove Br aces Int ention . is Applicable To ( it ) Ġ}) Ġreturn Ġfalse ĊĠĠĠĠĠĠĠ Ġwhen Ġ( target If Or When Expression ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠK t If Expression Ġ-> Ġset Text Getter ( Kotlin Bundle . lazy Message (" remove . br aces . from . if . all . statements ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠK t When Expression Ġ-> Ġset Text Getter ( Kotlin Bundle . lazy Message (" remove . br aces . from . when . all . entries ")) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġreturn Ġtrue ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġapply To ( element : ĠK t Expression , Ġeditor : ĠEditor ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtarget If Or When Expression Ġ= Ġtarget If Or When Expression ( element ) Ġ?: Ġreturn ĊĠĠĠĠĠĠĠ Ġtarget If Or When Expression . target Branch Expressions (). forEach Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠRemove Br aces Int ention . remove Br aces ( target If Or When Expression , Ġit ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun ĠK t Expression . target Branch Expressions (): ĠList < Kt Block Expression > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbranch Expressions Ġ= Ġall Branch Expressions () ĊĠĠĠĠĠĠĠ Ġif Ġ( branch Expressions . size Ġ<= Ġ 1 ) Ġreturn Ġempty List () ĊĠĠĠĠĠĠĠ Ġreturn Ġbranch Expressions . filter Is Instance < Kt Block Expression >() ĊĠĠĠ Ġ} Ċ }