package Ġcom . nas ller . code gl ance . panel Ċ Ċ import Ġcom . intellij . openapi . Disposable Ċ import Ġcom . intellij . openapi . editor . Logical Position Ċ import Ġcom . intellij . openapi . editor . Scroll Type Ċ import Ġcom . intellij . openapi . editor . Visual Position Ċ import Ġcom . intellij . openapi . vcs . ex . Local Range Ċ import Ġcom . intellij . openapi . vcs . ex . Range Ċ import Ġcom . nas ller . code gl ance . listener . My V cs Listener Ċ import Ġjava . awt . Cursor Ċ import Ġjava . awt . Dimension Ċ import Ġjava . awt . Graphics Ċ import Ġjava . awt . Graphics 2 D Ċ import Ġjava . awt . event . Mouse Adapter Ċ import Ġjava . awt . event . MouseEvent Ċ import Ġjavax . swing . JPanel Ċ Ċ class ĠMy V cs Panel ( private Ġval Ġgl ance Panel : ĠGl ance Panel ) Ġ: ĠJPanel (), ĠDis posable Ġ{ Ċ ĉ private Ġval Ġdefault Cursor Ġ= ĠCursor ( Cursor . DEFAULT _ CURSOR ) Ċ ĉ private Ġval Ġmy V cs Listener Ġ= ĠMy V cs Listener ( this ) Ċ ĉ init { Ċĉ ĉ val Ġmouse Handler Ġ= ĠMouse Handler () Ċĉ ĉ add Mouse Listener ( mouse Handler ) Ċĉ ĉ add Mouse Wheel Listener ( mouse Handler ) Ċĉ ĉ add Mouse Motion Listener ( mouse Handler ) Ċĉ ĉ add Mouse Listener ( gl ance Panel . my Pop Handler ) Ċĉ ĉ add Hierarchy Listener ( my V cs Listener ) Ċĉ ĉ add Hierarchy Bounds Listener ( my V cs Listener ) Ċĉ ĉ gl ance Panel . editor . content Component . addComponent Listener ( my V cs Listener ) Ċĉ ĉ gl ance Panel . editor . document . add Document Listener ( my V cs Listener , this ) Ċĉ ĉ gl ance Panel . editor . scroll ing Model . add Visible Area Listener ( my V cs Listener , this ) Ċĉ ĉ gl ance Panel . editor . fold ing Model . addListener ( my V cs Listener , this ) Ċĉ ĉ preferred Size Ġ= ĠDimension ( vcs Width , 0 ) Ċĉ ĉ is Opaque Ġ= Ġfalse Ċ ĉ } ĊĊ ĉ override Ġfun Ġpaint ( gfx : ĠGraphics ?) Ġ{ Ċĉ ĉ val Ġgraphics 2 D Ġ= Ġgfx Ġas ĠGraphics 2 D Ċĉ ĉ gl ance Panel . paint V cs ( graphics 2 D ) Ċ ĉ } ĊĊ ĉ inner Ġclass ĠMouse Handler Ġ: ĠMouse Adapter () Ġ{ Ċĉ ĉ private Ġvar Ġhover V cs Range : Range ? Ġ= Ġnull ĊĊĉ ĉ override Ġfun Ġmouse Clicked ( e : ĠMouseEvent ) Ġ{ Ċĉĉ ĉ hover V cs Range ?. let Ġ{ Ċĉĉĉ ĉ gl ance Panel . editor . caret Model . moveTo Logical Position ( Logical Position ( it . line 1 , 0 )) Ċĉĉĉ ĉ gl ance Panel . editor . scroll ing Model . scrollTo Caret ( Scroll Type . CENTER ) Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ override Ġfun Ġmouse Moved ( e : ĠMouseEvent ) Ġ{ Ċĉĉ ĉ val Ġlogical Position Ġ= Ġgl ance Panel . editor . visual To Logical Position ( Ċĉĉĉ ĉ Visual Position (( e . y Ġ+ Ġgl ance Panel . scroll State . visible Start ) Ġ/ Ġgl ance Panel . config . pixels Per Line , Ġ 0 )) Ċĉĉ ĉ val Ġrange Ġ= Ġgl ance Panel . tracker Manager . getLine Status Tracker ( gl ance Panel . editor . document )?. get Range For Line ( logical Position . line ) Ċĉĉ ĉ if ( range Ġ!= Ġnull Ġ&& Ġ( range Ġ! is ĠLocal Range Ġ|| Ġrange . change list Id Ġ== Ġgl ance Panel . change List Manager . default Change List . id )){ Ċĉĉĉ ĉ cursor Ġ= ĠCursor . get Pre defined Cursor ( Cursor . HAND _ CURSOR ) Ċĉĉĉ ĉ hover V cs Range Ġ= Ġrange Ċĉĉ ĉ } else { Ċĉĉĉ ĉ cursor Ġ= Ġdefault Cursor Ċĉĉĉ ĉ hover V cs Range Ġ= Ġnull Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ override Ġfun Ġmouse Exit ed ( e : ĠMouseEvent ) Ġ{ Ċĉĉ ĉ cursor Ġ= Ġdefault Cursor Ċĉĉ ĉ hover V cs Range Ġ= Ġnull Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ override Ġfun Ġdispose () Ġ{ Ċĉ ĉ remove Hierarchy Listener ( my V cs Listener ) Ċĉ ĉ remove Hierarchy Bounds Listener ( my V cs Listener ) Ċĉ ĉ gl ance Panel . editor . content Component . remove Component Listener ( my V cs Listener ) Ċ ĉ } Ċ ĉ comp anion Ġobject { Ċĉ ĉ const Ġval Ġv cs Width : Int Ġ= Ġ 8 Ċ ĉ } Ċ }