// ĠCopyright Ġ 2 0 0 0 - 2 0 1 9 Ġ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 Ġtraining . learn . lesson . general . refactor ings Ċ Ċ import Ġcom . intellij . idea . Actions Bundle Ċ import Ġcom . intellij . openapi . editor . impl . Editor Component Impl Ċ import Ġcom . intellij . refactor ing . Ref actor ing Bundle Ċ import Ġcom . intellij . refactor ing . rename . inplace . In place Ref actor ing Ċ import Ġcom . intellij . ui . En gr aved Label Ċ import Ġtraining . dsl .* Ċ import Ġtraining . dsl . Lesson Util . restore If Modified Or Moved Ċ import Ġtraining . learn . Less ons Bundle Ċ import Ġtraining . learn . course . K Lesson Ċ import Ġtraining . util . adapt To Not Native Localization Ċ import Ġjavax . swing . J List Ċ Ċ abstract Ġclass ĠRefactor ing Menu Lesson Base ( lesson Id : ĠString ) Ġ: ĠK Lesson ( lesson Id , ĠLess ons Bundle . message (" refactor ing . menu . lesson . name ")) Ġ{ ĊĠ Ġfun ĠLess on Context . extract Parameter Tasks () Ġ{ ĊĠĠĠ Ġlateinit Ġvar Ġshow Popup TaskId : ĠTask Context . TaskId ĊĠĠĠ Ġtask (" Ref actor ings . Quick List Popup Action ") Ġ{ ĊĠĠĠĠĠ Ġshow Popup TaskId Ġ= ĠtaskId ĊĠĠĠĠĠ Ġtext ( Less ons Bundle . message (" refactor ing . menu . show . refactor ing . list ", Ġaction ( it ))) ĊĠĠĠĠĠ Ġval Ġrefactor This Title Ġ= ĠRefactor ing Bundle . message (" refactor . this . title ") ĊĠĠĠĠĠ Ġtrigger By Ui Component And Highlight ( false , Ġfalse ) Ġ{ Ġui : ĠEn gr aved Label Ġ-> ĊĠĠĠĠĠĠĠ Ġui . text ?. contains ( refactor This Title ) Ġ== Ġtrue ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġrestore If Modified Or Moved () ĊĠĠĠĠĠ Ġtest Ġ{ Ġactions ( it ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġif Ġ( Task TestContext . in Test Mode ) Ġ{ ĊĠĠĠĠĠ Ġtask Ġ{ ĊĠĠĠĠĠĠĠ Ġstate Check Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġfocus Owner Ġ! is ĠEditor Component Impl ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġif Ġ(! adapt To Not Native Localization ) Ġ{ ĊĠĠĠĠĠ Ġtask ( Actions Bundle . message (" action . Intro duce Parameter . text "). drop Mnemonic ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġtext ( Less ons Bundle . message (" refactor ing . menu . intro duce . parameter . eng ", Ġstrong ( it ))) ĊĠĠĠĠĠĠĠ Ġtrigger By Ui Component And Highlight ( highlight Border Ġ= Ġfalse , Ġhighlight Inside Ġ= Ġfalse ) Ġ{ Ġui : ĠJ List < *> Ġ-> ĊĠĠĠĠĠĠĠĠĠ Ġui . model . size Ġ> Ġ 0 Ġ&& Ġui . model . getElement At ( 0 ). toString (). contains ( it ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġrestore By Ui ( restore Id Ġ= Ġshow Popup TaskId , Ġdelay Millis Ġ= Ġdefault Restore Delay ) ĊĠĠĠĠĠĠĠ Ġtest Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġtype (" pa ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġtask (" Intro duce Parameter ") Ġ{ ĊĠĠĠĠĠ Ġval Ġmessage Ġ= Ġif Ġ( adapt To Not Native Localization ) Ġ{ ĊĠĠĠĠĠĠĠ ĠLess ons Bundle . message (" refactor ing . menu . intro duce . parameter ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġstrong ( Actions Bundle . message (" action . Intro duce Parameter . text "). drop Mnemonic ()), ĠLess on Util . raw Enter ()) ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġelse ĠLess ons Bundle . message (" refactor ing . menu . start . refactor ing ", Ġaction (" Editor Choose Lookup Item "), ĠLess on Util . action Name ( it )) ĊĠĠĠĠĠ Ġtext ( message ) ĊĠĠĠĠĠ Ġtrigger ( it ) ĊĠĠĠĠĠ Ġstate Check Ġ{ Ġhas In place Rename () Ġ} ĊĠĠĠĠĠ Ġrestore By Ui ( restore Id Ġ= Ġshow Popup TaskId , Ġdelay Millis Ġ= Ġdefault Restore Delay ) ĊĠĠĠĠĠ Ġtest Ġ{ ĊĠĠĠĠĠĠĠ Ġinvoke Action Via Shortcut (" ENTER ") ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġtask Ġ{ ĊĠĠĠĠĠ Ġtext ( Less ons Bundle . message (" refactor ing . menu . finish . refactor ing ", ĠLess on Util . raw Enter ())) ĊĠĠĠĠĠ Ġstate Check Ġ{ ĊĠĠĠĠĠĠĠ Ġ! has In place Rename () ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġtest ( wait Editor ToBe Ready Ġ= Ġfalse ) Ġ{ ĊĠĠĠĠĠĠĠ Ġinvoke Action Via Shortcut (" ENTER ") ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun ĠTask Runtime Context . has In place Rename () Ġ= Ġeditor . getUser Data ( In place Ref actor ing . IN PLACE _ RE NA MER ) Ġ!= Ġnull Ċ } Ċ