// Ġ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 Ġgit 4 idea . actions Ċ Ċ import Ġcom . intellij . Common Bundle Ċ import Ġcom . intellij . dv cs . D vcs Util Ċ import Ġcom . intellij . dv cs . repo . Repository Ċ import Ġcom . intellij . openapi . progress . Progress Indicator Ċ import Ġcom . intellij . openapi . progress . run Background able Task Ċ import Ġcom . intellij . openapi . ui . Messages Ċ import Ġcom . intellij . openapi . util . text . StringUtil Ċ import Ġcom . intellij . openapi . vcs . V cs Notifier Ċ import Ġcom . intellij . openapi . vcs . update . Refresh V Fs S ynchronously Ċ import Ġgit 4 idea . Dialog Manager Ċ import Ġgit 4 idea . Git Util Ċ import Ġgit 4 idea . changes . Git Change Utils Ċ import Ġgit 4 idea . commands . Git Ċ import Ġgit 4 idea . commands . Git Command Ċ import Ġgit 4 idea . commands . Git Line Handler Ċ import Ġgit 4 idea . i 1 8 n . Git Bundle Ċ import Ġgit 4 idea . repo . Git Repository Ċ import Ġgit 4 idea . util . Git Free zing Process Ċ import Ġorg . jetbrains . annotations . N ls Ċ Ċ internal Ġabstract Ġclass ĠGit Abort Operation Action ( repository State : ĠRepository . State , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfinal Ġoverride Ġval Ġoperation Name : Ġ@ N ls ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġgit Command : ĠGit Command ) ĊĠ Ġ: ĠGit Operation Action Base ( repository State ) Ġ{ ĊĊĠ Ġprivate Ġval Ġoperation Name Capital ised Ġ= ĠString Util . capitalize Words ( operation Name , Ġtrue ) ĊĊĠ Ġclass ĠMerge Ġ: ĠGit Abort Operation Action ( Repository . State . MER GING , ĠGit Bundle . message (" abort . operation . merge . name "), ĠGit Command . MERGE ) ĊĠ Ġclass ĠCh erry Pick Ġ: ĠGit Abort Operation Action ( Repository . State . GR AFT ING , ĠGit Bundle . message (" abort . operation . ch erry . pick . name "), ĠGit Command . CH ERR Y _ P ICK ) ĊĠ Ġclass ĠRe vert Ġ: ĠGit Abort Operation Action ( Repository . State . RE VERT ING , ĠGit Bundle . message (" abort . operation . revert . name "), ĠGit Command . RE VERT ) ĊĊĠ Ġoverride Ġfun Ġperform In Background ( repository : ĠGit Repository ) Ġ{ ĊĠĠĠ Ġif Ġ(! confirm Abort ( repository )) Ġreturn ĊĊĠĠĠ Ġrun Background able Task ( Git Bundle . message (" abort . operation . progress . title ", Ġoperation Name Capital ised ), Ġrepository . project ) Ġ{ Ġindicator Ġ-> ĊĠĠĠĠĠ Ġdo Abort ( repository , Ġindicator ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġconfirm Abort ( repository : ĠGit Repository ): ĠBoolean Ġ{ ĊĠĠĠ Ġvar Ġtitle Ġ= ĠGit Bundle . message (" abort . operation . dialog . title ", Ġoperation Name Capital ised ) ĊĠĠĠ Ġvar Ġmessage Ġ= ĠGit Bundle . message (" abort . operation . dialog . msg ", Ġoperation Name , ĠGit Util . mention ( repository )) ĊĠĠĠ Ġif Ġ( Messages . can Show Mac Sheet Panel ()) Ġ{ ĊĠĠĠĠĠ Ġtitle Ġ= Ġmessage ĊĠĠĠĠĠ Ġmessage Ġ= Ġ"" ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn ĠDialog Manager . show Ok Cancel Dialog ( repository . project , Ġmessage , Ġtitle , ĠGit Bundle . message (" abort "), ĠCommon Bundle . get Cancel ButtonText (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠMessages . get Question Icon ()) Ġ== ĠMessages . OK ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġdo Abort ( repository : ĠGit Repository , Ġindicator : ĠProgress Indicator ) Ġ{ ĊĠĠĠ Ġval Ġproject Ġ= Ġrepository . project ĊĠĠĠ ĠGit Free zing Process ( project , ĠGit Bundle . message (" git . abort . operation . title ")) Ġ{ ĊĠĠĠĠĠ ĠD vcs Util . working Tree Change Started ( project , ĠGit Bundle . message (" abort ")). use Ġ{ ĊĠĠĠĠĠĠĠ Ġindicator . text 2 Ġ= ĠGit Bundle . message (" abort . operation . indicator . text ", Ġgit Command . name (), ĠGit Util . mention ( repository )) ĊĊĠĠĠĠĠĠĠ Ġval Ġstart Hash Ġ= ĠGit Util . get Head ( repository ) ĊĠĠĠĠĠĠĠ Ġval Ġst aged Changes Ġ= ĠGit Change Utils . get St aged Changes ( project , Ġrepository . root ) ĊĊĠĠĠĠĠĠĠ Ġval Ġhandler Ġ= ĠGit Line Handler ( project , Ġrepository . root , Ġgit Command ) ĊĠĠĠĠĠĠĠ Ġhandler . add Parameters ("-- abort ") ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= ĠGit . getInstance (). run Command ( handler ) ĊĊĠĠĠĠĠĠĠ Ġif Ġ(! result . success ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠ ĠV cs Notifier . getInstance ( project ). notify Error ( Git Bundle . message (" abort . operation . failed ", Ġoperation Name Capital ised ), Ġresult . error Output As Html String , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠ ĠV cs Notifier . getInstance ( project ). notify Success ( Git Bundle . message (" abort . operation . succeeded ", Ġoperation Name Capital ised )) ĊĊĠĠĠĠĠĠĠĠĠ ĠGit Util . update And Refresh Changed V fs ( repository , Ġstart Hash ) ĊĠĠĠĠĠĠĠĠĠ ĠRefresh V Fs S ynchronously . refresh ( st aged Changes , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ}. execute () ĊĠ Ġ} Ċ } Ċ