// ĠCopyright Ġ 2 0 0 0 - 2 0 2 0 ĠJetBrains Ġs . r . o . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ package Ġorg . jetbrains . plugins . github . pull request . data . provider Ċ Ċ import Ġcom . intellij . collabor ation . async . Comp letableFuture Util . completion On Ed t Ċ import Ġcom . intellij . collabor ation . async . Comp letableFuture Util . success On Ed t Ċ import Ġcom . intellij . openapi . Disposable Ċ import Ġcom . intellij . openapi . progress . Progress Indicator Ċ import Ġcom . intellij . util . EventDispatcher Ċ import Ġcom . intellij . util . messages . Message Bus Ċ import Ġorg . jetbrains . plugins . github . api . data . GH Label Ċ import Ġorg . jetbrains . plugins . github . api . data . GH User Ċ import Ġorg . jetbrains . plugins . github . api . data . pull request . G HP ull Request Ċ import Ġorg . jetbrains . plugins . github . api . data . pull request . G HP ull Request Requested Reviewer Ċ import Ġorg . jetbrains . plugins . github . pull request . data . GH PR Identifier Ċ import Ġorg . jetbrains . plugins . github . pull request . data . service . GH PR Comment Service Ċ import Ġorg . jetbrains . plugins . github . pull request . data . service . GH PR Details Service Ċ import Ġcom . intellij . collabor ation . ui . Simple EventListener Ċ import Ġorg . jetbrains . plugins . github . util . Collection Delta Ċ import Ġorg . jetbrains . plugins . github . util . Lazy C ancellable Background Process Value Ċ import Ġjava . util . concurrent . Comp letableFuture Ċ import Ġkotlin . properties . Deleg ates Ċ Ċ class ĠGH PR Details DataProvider Impl ( private Ġval Ġdetails Service : ĠGH PR Details Service , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġcomment Service : ĠGH PR Comment Service , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġpull RequestId : ĠGH PR Identifier , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġmessage Bus : ĠMessage Bus ) ĊĠ Ġ: ĠGH PR Details DataProvider , ĠDis posable Ġ{ ĊĊĠ Ġprivate Ġval Ġdetails Loaded EventDispatcher Ġ= ĠEvent Dispatcher . create ( Simple EventListener :: class . java ) ĊĊĠ Ġoverride Ġvar Ġloaded Details Ġby ĠDeleg ates . observable < G HP ull Request ? >( null ) Ġ{ Ġ_, Ġ_, Ġ_ Ġ-> ĊĠĠĠ Ġdetails Loaded EventDispatcher . mult ic aster . event Occurred () ĊĠ Ġ} ĊĠĠĠ Ġprivate Ġset ĊĊĠ Ġprivate Ġval Ġdetails Request Value Ġ= ĠLazy C ancellable Background Process Value . create Ġ{ Ġindicator Ġ-> ĊĠĠĠ Ġdetails Service . load Details ( indicator , Ġpull RequestId ). success On Ed t Ġ{ ĊĠĠĠĠĠ Ġloaded Details Ġ= Ġit ĊĠĠĠĠĠ Ġit ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġload Details (): ĠCompletableFuture < G HP ull Request > Ġ= Ġdetails Request Value . value ĊĊĠ Ġoverride Ġfun Ġreload Details () Ġ= Ġdetails Request Value . drop () ĊĊĠ Ġoverride Ġfun ĠgetDescription Markdown Body ( indicator : ĠProgress Indicator ) Ġ= ĊĠĠĠ Ġcomment Service . get Comment Markdown Body ( indicator , Ġpull RequestId . id ) ĊĊĠ Ġoverride Ġfun Ġupdate Details ( indicator : ĠProgress Indicator , Ġtitle : ĠString ?, Ġdescription : ĠString ?): ĠCompletableFuture < G HP ull Request > Ġ{ ĊĠĠĠ Ġval Ġfuture Ġ= Ġdetails Service . update Details ( indicator , Ġpull RequestId , Ġtitle , Ġdescription ). completion On Ed t Ġ{ ĊĠĠĠĠĠ Ġmessage Bus . sync Publisher ( GH PR Data Operations Listener . TOPIC ). on Metadata Changed () ĊĠĠĠ Ġ} ĊĠĠĠ Ġdetails Request Value . override Process ( future . success On Ed t Ġ{ ĊĠĠĠĠĠ Ġloaded Details Ġ= Ġit ĊĠĠĠĠĠ Ġit ĊĠĠĠ Ġ}) ĊĠĠĠ Ġreturn Ġfuture ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġadjust Review ers ( indicator : ĠProgress Indicator , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdelta : ĠCollection Delta < G HP ull Request Requested Reviewer >): ĠCompletableFuture < Unit > Ġ{ ĊĠĠĠ Ġreturn Ġdetails Service . adjust Review ers ( indicator , Ġpull RequestId , Ġdelta ). notify () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġadjust Assign ees ( indicator : ĠProgress Indicator , Ġdelta : ĠCollection Delta < GH User >): ĠCompletableFuture < Unit > Ġ{ ĊĠĠĠ Ġreturn Ġdetails Service . adjust Assign ees ( indicator , Ġpull RequestId , Ġdelta ). notify () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġadjust Labels ( indicator : ĠProgress Indicator , Ġdelta : ĠCollection Delta < GH Label >): ĠCompletableFuture < Unit > Ġ{ ĊĠĠĠ Ġreturn Ġdetails Service . adjust Labels ( indicator , Ġpull RequestId , Ġdelta ). notify () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġadd Details Reload Listener ( dis posable : ĠDis posable , Ġlistener : Ġ() Ġ-> ĠUnit ) Ġ= ĊĠĠĠ Ġdetails Request Value . add Drop EventListener ( dis posable , Ġlistener ) ĊĊĠ Ġoverride Ġfun Ġadd Details Loaded Listener ( dis posable : ĠDis posable , Ġlistener : Ġ() Ġ-> ĠUnit ) Ġ= ĊĠĠĠ ĠSimple EventListener . add Disposable Listener ( details Loaded EventDispatcher , Ġdis posable , Ġlistener ) ĊĊĠ Ġprivate Ġfun Ġ< T > ĠCompletableFuture < T >. notify (): ĠCompletableFuture < T > Ġ= ĊĠĠĠ Ġcompletion On Ed t Ġ{ ĊĠĠĠĠĠ Ġdetails Request Value . drop () ĊĠĠĠĠĠ Ġmessage Bus . sync Publisher ( GH PR Data Operations Listener . TOPIC ). on Metadata Changed () ĊĠĠĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġdispose () Ġ{ ĊĠĠĠ Ġdetails Request Value . drop () ĊĠ Ġ} Ċ }