package Ġcom . code stream . review Ċ Ċ import Ġcom . code stream . extensions . file Ċ import Ġcom . intellij . code Insight . daemon . Out sid ers Psi File Support Ċ import Ġcom . intellij . diff . contents . Document Content Ċ import Ġcom . intellij . diff . contents . Document Content Impl Ċ import Ġcom . intellij . diff . util . Diff UserData Keys Ex Ċ import Ġcom . intellij . openapi . application . Read Action Ċ import Ġcom . intellij . openapi . editor . Document Ċ import Ġcom . intellij . openapi . editor . Editor Factory Ċ import Ġcom . intellij . openapi . file Editor . File Document Manager Ċ import Ġcom . intellij . openapi . file Types . File Types Ċ import Ġcom . intellij . openapi . file Types . Plain Text FileType Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . openapi . util . text . StringUtil Ċ import Ġcom . intellij . openapi . vcs . Remote FilePath Ċ import Ġcom . intellij . psi . Psi Document Manager Ċ import Ġjava . io . File Ċ Ċ fun Ġcreate Review Diff Content ( ĊĠĠĠ Ġproject : ĠProject , ĊĠĠĠ Ġrepo Root : ĠString ?, ĊĠĠĠ Ġreview Id : ĠString , ĊĠĠĠ Ġcheckpoint : ĠInt ?, ĊĠĠĠ Ġrepo Id : ĠString , ĊĠĠĠ Ġside : ĠReview Diff Side , ĊĠĠĠ Ġpath : ĠString , ĊĠĠĠ Ġtext : ĠString Ċ ): ĠDocument Content Ġ{ ĊĠĠĠ Ġval Ġcheckpoint Str Ġ= Ġcheckpoint ?. toString () Ġ?: Ġ" undefined " ĊĠĠĠ Ġval Ġfull Path Ġ= Ġ"$ review Id /$ checkpoint Str /$ repo Id /${ side . path }/ $ path " ĊĊĠĠĠ Ġreturn Ġcreate Diff Content ( project , Ġrepo Root , Ġfull Path , Ġside , Ġpath , Ġtext , Ġreview Id Ġ!= Ġ" local ") Ċ } Ċ Ċ fun Ġcreate Revision Diff Content ( ĊĠĠĠ Ġproject : ĠProject , ĊĠĠĠ Ġrepo Root : ĠString , ĊĠĠĠ Ġdata : ĠCode Stream Diff Uri Data , ĊĠĠĠ Ġside : ĠReview Diff Side , ĊĠĠĠ Ġtext : ĠString Ċ ): ĠDocument Content Ġ{ ĊĠĠĠ Ġreturn Ġcreate Diff Content ( project , Ġrepo Root , Ġdata . to Encoded Path (), Ġside , Ġdata . path , Ġtext , Ġtrue ) Ċ } Ċ Ċ fun Ġcreate Diff Content ( ĊĠĠĠ Ġproject : ĠProject , ĊĠĠĠ Ġrepo Root : ĠString ?, ĊĠĠĠ Ġfull Path : ĠString , ĊĠĠĠ Ġside : ĠReview Diff Side , ĊĠĠĠ Ġpath : ĠString , ĊĠĠĠ Ġtext : ĠString , ĊĠĠĠ Ġcan Create Marker : ĠBoolean Ċ ): ĠDocument Content Ġ{ ĊĠĠĠ Ġval ĠfilePath Ġ= ĠRemote FilePath ( fullPath , Ġfalse ) ĊĊĠĠĠ Ġval ĠfileType Ġ= Ġwhen Ġ( filePath . fileType ) Ġ{ ĊĠĠĠĠĠĠĠ ĠFile Types . UNKNOWN Ġ-> ĠPlain Text FileType . INSTANCE ĊĠĠĠĠĠĠĠ Ġelse Ġ-> ĠfilePath . fileType ĊĠĠĠ Ġ} ĊĠĠĠ Ġval Ġseparator Ġ= ĠString Util . detect Separ ators ( text ) ĊĠĠĠ Ġval Ġcorrected Text Ġ= ĠString Util . convert Line Separ ators ( text ) ĊĊĠĠĠ Ġ// ĠB orrow ed Ġfrom Ġcom . intellij . diff . Diff Content Factory Impl ĊĠĠĠ Ġval Ġdocument Ġ= ĠRead Action . compute < Document , ĠRuntimeException > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġfile Ġ= ĠReview Diff Virtual File . create ( fullPath , Ġside , Ġpath , Ġcorrected Text , ĠfileType , Ġcan Create Marker ) ĊĠĠĠĠĠĠĠ Ġfile . is Writable Ġ= Ġfalse ĊĠĠĠĠĠĠĠ ĠOut sid ers Psi File Support . mark File ( file , Ġrepo Root ?. let { ĠFile ( it ). resolve ( path ). path Ġ}) ĊĠĠĠĠĠĠĠ Ġval Ġdocument Ġ= ĠFile Document Manager . getInstance (). getDocument ( file ) Ġ?: Ġreturn @ compute Ġnull ĊĠĠĠĠĠĠĠ ĠPsi Document Manager . getInstance ( project ). get Psi File ( document ) ĊĠĠĠĠĠĠĠ Ġdocument ĊĠĠĠ Ġ} Ġ?: ĠEditor Factory . getInstance (). create Document ( corrected Text ). also Ġ{ Ġit . set ReadOnly ( true ) Ġ} ĊĊĠĠĠ Ġval Ġcontent : ĠDocument Content Ġ= ĊĠĠĠĠĠĠĠ ĠDocument Content Impl ( project , Ġdocument , ĠfileType , Ġdocument . file , Ġseparator , Ġnull , Ġnull ) ĊĠĠĠ Ġcontent . put UserData ( Diff UserData Keys Ex . FILE _ NAME , ĠfilePath . name ) ĊĊĠĠĠ Ġreturn Ġcontent Ċ } Ċ