/* Ċ Ġ* Ġ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 Ġorg . jetbrains . r . debugger Ċ Ċ import Ġcom . intellij . openapi . action System . Common Data Keys Ċ import Ġcom . intellij . openapi . action System . DataContext Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . psi . Psi Document Manager Ċ import Ġcom . intellij . x debugger . X Expression Ċ import Ġcom . intellij . x debugger . evaluation . Evaluation Mode Ċ import Ġcom . intellij . x debugger . impl . breakpoints . X Expression Impl Ċ import Ġcom . intellij . x debugger . impl . evaluate . X Debugger Evaluation Dialog Ċ import Ġorg . jetbrains . r . RL anguage Ċ import Ġorg . jetbrains . r . r markdown . R Markdown Language Ċ import Ġorg . jetbrains . r . run . debug . stack . RX Debugger Evaluator Ċ Ċ internal Ġobject ĠR Debugger Evaluate Handler Ġ{ ĊĠ Ġfun Ġperform ( project : ĠProject , Ġevaluator : ĠRX Debugger Evaluator , Ġdata Context : ĠData Context ) Ġ{ ĊĠĠĠ ĠRX Debugger Evaluation Dialog ( project , Ġevaluator , Ġget Selected Expression ( project , Ġdata Context )). show () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġget Selected Expression ( project : ĠProject , Ġdata Context : ĠData Context ): ĠX Expression Ġ{ ĊĠĠĠ Ġval Ġeditor Ġ= ĠCommon Data Keys . EDITOR . getData ( data Context ) Ġ?: Ġreturn ĠX Expression Impl . EMPTY _ EXPRESSION ĊĠĠĠ Ġval Ġlanguage Ġ= ĠPsi Document Manager . getInstance ( project ). get Psi File ( editor . document )?. language ĊĠĠĠ Ġif Ġ( language Ġ!= ĠR Language . INSTANCE Ġ&& Ġlanguage Ġ!= ĠR Markdown Language ) Ġreturn ĠX Expression Impl . EMPTY _ EXPRESSION ĊĠĠĠ Ġval Ġtext Ġ= Ġeditor . selection Model . selected Text ?. trim () Ġ?: Ġreturn ĠX Expression Impl . EMPTY _ EXPRESSION ĊĠĠĠ Ġreturn ĠX Expression Impl . from Text ( text , Ġif Ġ( text . lines (). size Ġ> Ġ 1 ) ĠEvaluation Mode . CODE _ FRAGMENT Ġelse ĠEvaluation Mode . EXPRESSION ) ĊĠ Ġ} Ċ } Ċ Ċ private Ġclass ĠRX Debugger Evaluation Dialog ( project : ĠProject , Ġevaluator : ĠRX Debugger Evaluator , Ġexpression : ĠX Expression ) Ġ: ĊĠ ĠX Debugger Evaluation Dialog ( evaluator , Ġproject , ĠR Debugger Editors Provider , Ġexpression , Ġnull , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġexpression . mode Ġ== ĠEvaluation Mode . CODE _ FRAGMENT ) Ġ{ ĊĠ Ġinit Ġ{ ĊĠĠĠ Ġevaluator . register Parent Disposable ( dis posable ) ĊĠ Ġ} Ċ } Ċ