package Ġcom . m adr apps . handle bars . reference Ċ Ċ import Ġcom . d mar cot te . handle bars . parsing . Hb Token Types Ċ import Ġcom . d mar cot te . handle bars . psi . Hb Psi Element Ċ import Ġcom . intellij . openapi . util . Text Range Ċ import Ġcom . intellij . patterns . Platform Patterns Ċ import Ġcom . intellij . psi .* Ċ import Ġcom . intellij . psi . impl . source . tree . Leaf Psi Element Ċ import Ġcom . intellij . psi . search . Global Search Scope Ċ import Ġcom . intellij . util . Processing Context Ċ import Ġcom . m adr apps . handle bars . Hb Element Resolver Ċ import Ġcom . m adr apps . handle bars . persistence . Persistence Service Ċ Ċ class ĠH b Reference Contributor Ġ: ĠPsi Reference Contributor () Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġregister Reference Providers ( regist rar : ĠPsi Reference Registrar ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġparam Element In Blocks Ġ= ĠPlatform Patterns . psi Element ( Hb Psi Element :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Ancestor ( 3 , ĠPlatform Patterns . psi Element (). with ElementType ( Hb Token Types . PARAM )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. and Not ( Platform Patterns . psi Element (). with Child ( Platform Patterns . psi Element ( Hb Psi Element :: class . java ))) ĊĠĠĠĠĠĠĠ Ġval Ġsimple Elements Ġ= ĠPlatform Patterns . psi Element ( Hb Psi Element :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Ancestor ( 3 , ĠPlatform Patterns . psi Element (). with ElementType ( Hb Token Types . MUST ACHE )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. and Not ( Platform Patterns . psi Element (). with Child ( Platform Patterns . psi Element ( Hb Psi Element :: class . java ))) ĊĠĠĠĠĠĠĠ Ġregist rar . register Reference Provider ( param Element In Blocks , ĠH b Reference Provider ()) ĊĠĠĠĠĠĠĠ Ġregist rar . register Reference Provider ( simple Elements , ĠH b Reference Provider ()) ĊĠĠĠ Ġ} Ċ } Ċ Ċ class ĠH b Reference Provider Ġ: ĠPsi Reference Provider () Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġget References By Element ( element : ĠPsi Element , Ġcontext : ĠProcessing Context ): ĠArray < Psi Reference > Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( element Ġ! is ĠH b Psi Element ) Ġreturn Ġempty Array () ĊĠĠĠĠĠĠĠ Ġreturn ĠarrayOf ( H bs Element Reference ( element )) ĊĠĠĠ Ġ} Ċ } Ċ Ċ class ĠH bs Element Reference ( private Ġval Ġelement : ĠH b Psi Element ) ĊĠĠĠ Ġ: ĠPsi Reference Base < Psi Element >( element , ĠText Range . all Of ( element . text )) Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġresolve (): ĠPsi Element ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpsi Class Ġ= Ġpsi Class () Ġ?: Ġreturn Ġnull ĊĊĠĠĠĠĠĠĠ Ġval Ġresolver Ġ= ĠH b Element Resolver ( psi Class ) ĊĠĠĠĠĠĠĠ Ġreturn Ġresolver . resolve ( element ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġpsi Class (): ĠPsi Class ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġhb FilePath Ġ= Ġelement . containing File . virtual File . path ĊĠĠĠĠĠĠĠ Ġval Ġproject Ġ= Ġelement . project ĊĠĠĠĠĠĠĠ Ġval Ġqualified Name Ġ= ĠPersistence Service . getInstance ( project ). psi Map [ hb FilePath ] Ġ?: Ġreturn Ġnull ĊĠĠĠĠĠĠĠ Ġreturn ĠJava Psi Facade . getInstance ( project ). find Class ( qualified Name , ĠGlobal Search Scope . all Scope ( project )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġhandle Element Rename ( new ElementName : ĠString ): ĠPsi Element Ġ{ ĊĠĠĠĠĠĠĠ Ġwith ( element . last Child ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( this Ġis ĠLeaf Psi Element ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreplace With Text ( new ElementName ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġreturn Ġelement ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Variants (): ĠArray < Any > Ġ= Ġempty Array () Ċ }