package Ġir . m md . intellij Dev . Action able . find Ċ Ċ import Ġcom . intellij . find . Find Manager Ċ import Ġcom . intellij . find . Find Model Ċ import Ġcom . intellij . openapi . action System . An Action Ċ import Ġcom . intellij . openapi . action System . An ActionEvent Ċ import Ġir . m md . intellij Dev . Action able . find . settings . Settings State Ċ import Ġir . m md . intellij Dev . Action able . util . by Ċ import Ġir . m md . intellij Dev . Action able . util . ext .* Ċ import Ġir . m md . intellij Dev . Action able . util . with Service Ċ import Ġir . m md . intellij Dev . Action able . caret . movement . settings . Settings State Ġas ĠMovement Settings State Ċ Ċ abstract Ġclass ĠFind Action ( private Ġval Ġsearch Forward : ĠBoolean ) Ġ: ĠAn Action () Ġ{ Ċ ĉ override Ġfun ĠactionPerformed ( e : ĠAn ActionEvent ) Ġ= Ġwith Service < Movement Settings State , ĠUnit > Ġ{ Ċĉ ĉ val Ġeditor Ġ= Ġe . editor Ċĉ ĉ val Ġcaret Model Ġ= Ġeditor . caret Model Ċĉ ĉ val Ġcaret Ġ= Ġcaret Model . all Care ts . run Ġ{ Ġif Ġ( search Forward ) Ġlast () Ġelse Ġfirst () Ġ} ĊĉĉĊĉ ĉ if Ġ(! caret . has Selection ()) Ġreturn Ġby ( caret . util . get Word Bound aries ( word Separ ators , Ġhard Stop Characters )) Ġ{ Ġ( start Offset , Ġend Offset ) Ġ-> Ċĉĉ ĉ if Ġ( start Offset Ġ!= Ġend Offset ) Ġcaret . setSelection ( start Offset , Ġend Offset ) Ċĉ ĉ } ĊĉĉĊĉ ĉ val Ġ( found , Ġstart Offset , Ġend Offset ) Ġ= ĠFind Manager . getInstance ( e . project !! ). find String ( Ċĉĉ ĉ editor . document . chars Sequence , Ċĉĉ ĉ if Ġ( search Forward ) Ġcaret . selection End Ġelse Ġcaret . selection Start , Ċĉĉ ĉ Find Model (). apply Ġ{ Ċĉĉĉ ĉ is Forward Ġ= Ġsearch Forward Ċĉĉĉ ĉ is Case Sensitive Ġ= ĠSettings State . getInstance (). is Case Sensitive Ċĉĉĉ ĉ string To Find Ġ= Ġcaret . selected Text !! Ċĉĉ ĉ } Ċĉ ĉ ) ĊĉĉĊĉ ĉ if Ġ( found ) Ġcaret Model . add Caret ( Ċĉĉ ĉ editor . offset To Visual Position ( start Offset Ġ+ Ġ( caret . offset Ġ- Ġcaret . selection Start )), Ċĉĉ ĉ false Ċĉ ĉ ) !!. setSelection ( start Offset , Ġend Offset ) Ċ ĉ } ĊĉĊ ĉ override Ġfun Ġis D umb Aware () Ġ= Ġtrue Ċ ĉ override Ġfun Ġupdate ( e : ĠAn ActionEvent ) Ġ= Ġe . enable If Ġ{ Ġhas Project Ġand Ġhas Editor Ġ} Ċ } Ċ