constructor public delegate if j edit get boolean property macos plugin use screen menu bar j edit get boolean property macos plugin default use screen menu bar system set property apple laf use screen menu bar true else system set property apple laf use screen menu bar false jedit getbooleanproperty macosplugin usescreenmenubar jedit getbooleanproperty macosplugin usescreenmenubar setproperty usescreenmenubar setproperty usescreenmenubar handle about method public void handle about application event event event set handled true new about dialog j edit get active view handleabout handleabout applicationevent sethandled aboutdialog jedit getactiveview handle file codes method public void handle file codes buffer update msg buffer buffer msg get buffer set type creator on save if buffer is dirty msg get what buffer update dirty changed try file manager set file type and creator buffer get path buffer get integer property macos plugin type j edit get integer property macos plugin default type 0 buffer get integer property macos plugin creator j edit get integer property macos plugin default creator 0 catch exception e fail silently since we may be using ufs add type creator to local buffer property list on open else if msg get what buffer update created if true equals j edit get property macos plugin preserve codes try int type file manager get file type buffer get path int creator file manager get file creator buffer get path if type 0 buffer set integer property macos plugin type type if creator 0 buffer set integer property macos plugin creator creator catch exception e this will happen when a new file is created handlefilecodes handlefilecodes bufferupdate getbuffer isdirty getwhat bufferupdate dirty_changed filemanager setfiletypeandcreator getpath getintegerproperty macosplugin jedit getintegerproperty macosplugin getintegerproperty macosplugin jedit getintegerproperty macosplugin getwhat bufferupdate jedit getproperty macosplugin preservecodes filemanager getfiletype getpath filemanager getfilecreator getpath setintegerproperty macosplugin setintegerproperty macosplugin handle open file method public void handle open file application event event filenames add event get filename event set handled true handleopenfile handleopenfile applicationevent getfilename sethandled handle open file method public void handle open file view update msg if msg get what view update created iterator i filenames iterator while i has next j edit open file msg get view string i next macos plugin started true ns application app ns application shared application app set services provider new delegate handleopenfile handleopenfile viewupdate getwhat viewupdate hasnext jedit openfile getview macosplugin nsapplication nsapplication sharedapplication setservicesprovider handle preferences method public void handle preferences application event event event set handled true new global options j edit get active view handlepreferences handlepreferences applicationevent sethandled globaloptions jedit getactiveview handle quit method this never seems to be called when used with a delegate public void handle quit application event event event set handled false j edit exit j edit get active view true delegate methods application dock menu method public ns menu application dock menu ns application sender ns menu dock menu buffer menu buf menu macros menu mac menu recent menu rec menu recent dir menu dir menu ns menu item show curr item ns menu item show curr dir item ns menu item new view item buffers ns menu item mi buff new ns menu item j edit get property macos plugin menu buffers label null mi buff set submenu buf menu new buffer menu recent buffers ns menu item mi rec new ns menu item j edit get property macos plugin menu recent label null mi rec set submenu rec menu new recent menu recent directories ns menu item mi dir new ns menu item j edit get property macos plugin menu recent dir label null mi dir set submenu dir menu new recent dir menu macros ns menu item mi mac new ns menu item j edit get property macos plugin menu macros label null mi mac set submenu mac menu new macros menu dock menu new ns menu new view item new ns menu item j edit get property macos plugin menu new view action sel new view item set target new new view action dock menu add item new view item dock menu add item new ns menu item separator item show curr item new ns menu item j edit get property macos plugin menu show current action sel dock menu add item show curr item show curr dir item new ns menu item j edit get property macos plugin menu show current dir action sel dock menu add item show curr dir item dock menu add item new ns menu item separator item dock menu add item mi buff dock menu add item mi rec dock menu add item mi dir dock menu add item new ns menu item separator item dock menu add item mi mac if j edit get view count 0 mi mac set enabled false buf menu update menu rec menu update menu dir menu update menu mac menu update menu view view j edit get active view if view null file buff new file view get buffer get path if buff exists show curr item set target new show file action buff get path show curr dir item set target new show file action buff get parent else show curr item set enabled false show curr dir item set enabled false return dock menu handlequit handlequit applicationevent sethandled jedit jedit getactiveview applicationdockmenu nsmenu applicationdockmenu nsapplication nsmenu dockmenu buffermenu bufmenu macrosmenu macmenu recentmenu recmenu recentdirmenu dirmenu nsmenuitem showcurritem nsmenuitem showcurrdiritem nsmenuitem newviewitem nsmenuitem mibuff nsmenuitem jedit getproperty macosplugin mibuff setsubmenu bufmenu buffermenu nsmenuitem mirec nsmenuitem jedit getproperty macosplugin mirec setsubmenu recmenu recentmenu nsmenuitem midir nsmenuitem jedit getproperty macosplugin recentdir midir setsubmenu dirmenu recentdirmenu nsmenuitem mimac nsmenuitem jedit getproperty macosplugin mimac setsubmenu macmenu macrosmenu dockmenu nsmenu newviewitem nsmenuitem jedit getproperty macosplugin newview actionsel newviewitem settarget newviewaction dockmenu additem newviewitem dockmenu additem nsmenuitem separatoritem showcurritem nsmenuitem jedit getproperty macosplugin showcurrent actionsel dockmenu additem showcurritem showcurrdiritem nsmenuitem jedit getproperty macosplugin showcurrentdir actionsel dockmenu additem showcurrdiritem dockmenu additem nsmenuitem separatoritem dockmenu additem mibuff dockmenu additem mirec dockmenu additem midir dockmenu additem nsmenuitem separatoritem dockmenu additem mimac jedit getviewcount mimac setenabled bufmenu updatemenu recmenu updatemenu dirmenu updatemenu macmenu updatemenu jedit getactiveview getbuffer getpath showcurritem settarget showfileaction getpath showcurrdiritem settarget showfileaction getparent showcurritem setenabled showcurrdiritem setenabled dockmenu application open files method public void application open files ns application sender ns array filenames int count filenames count for int i 0 i count i file file new file string filenames object at index i buffer buffer view view j edit get active view if view null view perspective manager load perspective true if file is directory vfs browser browse directory j edit get active view file get path return if j edit open file view file get path null log log log error this error opening file applicationopenfiles applicationopenfiles nsapplication nsarray objectatindex jedit getactiveview perspectivemanager loadperspective isdirectory vfsbrowser browsedirectory jedit getactiveview getpath jedit openfile getpath application should handle reopen method public boolean application should handle reopen ns application the application boolean flag swing utilities invoke later new runnable public void run if j edit get view count 0 new new view action do action return false applicationshouldhandlereopen applicationshouldhandlereopen nsapplication theapplication swingutilities invokelater jedit getviewcount newviewaction doaction public void run if j edit get view count 0 new new view action do action jedit getviewcount newviewaction doaction application should terminate method public boolean application should terminate ns application sender swing utilities invoke later new runnable public void run j edit exit j edit get active view true return false applicationshouldterminate applicationshouldterminate nsapplication swingutilities invokelater jedit jedit getactiveview swing utilities invoke later new runnable public void run j edit exit j edit get active view true swingutilities invokelater jedit jedit getactiveview open file method public string open file ns pasteboard pboard string user data if j edit get view count 0 return null ns data data pboard data for type ns filenames pboard type string error new string 1 int format new int 1 ns array filenames ns array ns property list serialization property list from data data ns property list serialization property list immutable format error int count filenames count for int i 0 i count i file file new file string filenames object at index i if file is directory vfs browser browse directory j edit get active view file get path else j edit open file j edit get active view file get path return null openfile openfile nspasteboard userdata jedit getviewcount nsdata datafortype nsfilenamespboardtype nsarray nsarray nspropertylistserialization propertylistfromdata nspropertylistserialization propertylistimmutable objectatindex isdirectory vfsbrowser browsedirectory jedit getactiveview getpath jedit openfile jedit getactiveview getpath insert selection method public string insert selection ns pasteboard pboard string user data string string pboard string for type ns string pboard type if j edit get view count 0 view view j edit get active view view get buffer insert view get text area get caret position string return null insertselection insertselection nspasteboard userdata stringfortype nsstringpboardtype jedit getviewcount jedit getactiveview getbuffer gettextarea getcaretposition open selection method public string open selection ns pasteboard pboard string user data string string pboard string for type ns string pboard type if j edit get view count 0 new new view action do action j edit new file j edit get active view insert 0 pboard string for type ns string pboard type return null openselection openselection nspasteboard userdata stringfortype nsstringpboardtype jedit getviewcount newviewaction doaction jedit newfile jedit getactiveview stringfortype nsstringpboardtype class buffer menu extends ns menu public buffer menu super buffermenu nsmenu buffermenu public void update menu ns menu item item for int i 0 i number of items i remove item at index 0 buffer buffs j edit get buffers for int i 0 i buffs length i if buffs i is untitled item new ns menu item buffs i get name action sel item set target new show file action buffs i get path item set image ns workspace shared workspace icon for file buffs i get path if new file buffs i get path exists item set enabled false add item item if number of items 0 item new ns menu item j edit get property macos plugin menu buffers none null item set enabled false add item item updatemenu nsmenuitem numberofitems removeitematindex jedit getbuffers isuntitled nsmenuitem getname actionsel settarget showfileaction getpath setimage nsworkspace sharedworkspace iconforfile getpath getpath setenabled additem numberofitems nsmenuitem jedit getproperty macosplugin setenabled additem class macros menu extends ns menu public macros menu super macrosmenu nsmenu macrosmenu public void update menu vector macro vector macros get macro hierarchy ns menu item item file file int max macro vector size int length number of items for int i 0 i length i remove item at index 0 if max 0 item new ns menu item j edit get property macos plugin menu macros none null item set enabled false add item item return create menu this macro vector updatemenu macrovector getmacrohierarchy nsmenuitem macrovector numberofitems removeitematindex nsmenuitem jedit getproperty macosplugin setenabled additem createmenu macrovector public void create menu ns menu menu vector vector for int i 0 i vector size i object obj vector element at i if obj instanceof macros macro macros macro macro macros macro obj ns menu item item new ns menu item macro get label action sel item set target new macro action macro menu add item item else if obj instanceof vector vector subvector vector obj string name string subvector element at 0 ns menu submenu new ns menu create menu submenu subvector if submenu number of items 0 ns menu item submenuitem new ns menu item name null submenuitem set submenu submenu menu add item submenuitem createmenu nsmenu elementat nsmenuitem nsmenuitem getlabel actionsel settarget macroaction additem elementat nsmenu nsmenu createmenu numberofitems nsmenuitem nsmenuitem setsubmenu additem class recent menu extends ns menu public recent menu super recentmenu nsmenu recentmenu public void update menu list recent buffer history get history ns menu item item file file int max recent size int min max 20 int length number of items for int i 0 i length i remove item at index 0 if max 0 item new ns menu item j edit get property macos plugin menu recent none null item set enabled false add item item return if min 0 min 0 for int i max 1 i min i file new file buffer history entry recent get i path item new ns menu item file get name action sel item set target new show file action file get path if file exists item set enabled false add item item updatemenu bufferhistory gethistory nsmenuitem numberofitems removeitematindex nsmenuitem jedit getproperty macosplugin setenabled additem bufferhistory nsmenuitem getname actionsel settarget showfileaction getpath setenabled additem class recent dir menu extends ns menu public recent dir menu super recentdirmenu nsmenu recentdirmenu public void update menu history model model history model get model vfs browser path ns menu item item file file int max model get size int length number of items for int i 0 i length i remove item at index 0 if max 0 item new ns menu item j edit get property macos plugin menu recent dir none null item set enabled false add item item return for int i 0 i max i file new file model get item i item new ns menu item file get name action sel item set target new show file action file get path if file exists item set enabled false add item item updatemenu historymodel historymodel getmodel nsmenuitem getsize numberofitems removeitematindex nsmenuitem jedit getproperty macosplugin recentdir setenabled additem getitem nsmenuitem getname actionsel settarget showfileaction getpath setenabled additem private macros macro macro public macro action macros macro macro this macro macro macroaction public void do action macro invoke j edit get active view doaction jedit getactiveview public void do action swing utilities invoke later new runnable public void run if j edit get view count 0 perspective manager load perspective true else j edit new view j edit get active view doaction swingutilities invokelater jedit getviewcount perspectivemanager loadperspective jedit newview jedit getactiveview public void run if j edit get view count 0 perspective manager load perspective true else j edit new view j edit get active view jedit getviewcount perspectivemanager loadperspective jedit newview jedit getactiveview private string path public show file action string path this path path showfileaction public void do action macos actions show in finder path doaction macosactions showinfinder status bar constructor public status bar view view super new border layout set border new compound border new empty border 4 0 0 operating system is macos 18 0 ui manager get border text field border this view view panel new j panel new border layout box new box box layout x axis panel add border layout east box add border layout center panel mouse handler mouse handler new mouse handler caret status new tool tip label caret status set tool tip text j edit get property view status caret tooltip caret status add mouse listener mouse handler message new j label set message component message mode new tool tip label mode set tool tip text j edit get property view status mode tooltip mode add mouse listener mouse handler wrap new tool tip label wrap set horizontal alignment swing constants center wrap set tool tip text j edit get property view status wrap tooltip wrap add mouse listener mouse handler multi select new tool tip label multi select set horizontal alignment swing constants center multi select set tool tip text j edit get property view status multi tooltip multi select add mouse listener mouse handler rect select new tool tip label rect select set horizontal alignment swing constants center rect select set tool tip text j edit get property view status rect tooltip rect select add mouse listener mouse handler overwrite new tool tip label overwrite set horizontal alignment swing constants center overwrite set tool tip text j edit get property view status overwrite tooltip overwrite add mouse listener mouse handler line sep new tool tip label line sep set horizontal alignment swing constants center line sep set tool tip text j edit get property view status linesep tooltip line sep add mouse listener mouse handler statusbar statusbar borderlayout setborder compoundborder emptyborder operatingsystem ismacos uimanager getborder textfield jpanel borderlayout boxlayout x_axis borderlayout borderlayout mousehandler mousehandler mousehandler caretstatus tooltiplabel caretstatus settooltiptext jedit getproperty caretstatus addmouselistener mousehandler jlabel setmessagecomponent tooltiplabel settooltiptext jedit getproperty addmouselistener mousehandler tooltiplabel sethorizontalalignment swingconstants settooltiptext jedit getproperty addmouselistener mousehandler multiselect tooltiplabel multiselect sethorizontalalignment swingconstants multiselect settooltiptext jedit getproperty multiselect addmouselistener mousehandler rectselect tooltiplabel rectselect sethorizontalalignment swingconstants rectselect settooltiptext jedit getproperty rectselect addmouselistener mousehandler tooltiplabel sethorizontalalignment swingconstants settooltiptext jedit getproperty addmouselistener mousehandler linesep tooltiplabel linesep sethorizontalalignment swingconstants linesep settooltiptext jedit getproperty linesep addmouselistener mousehandler properties changed method public void properties changed color fg j edit get color property view status foreground color bg j edit get color property view status background show caret status j edit get boolean property view status show caret status show edit mode j edit get boolean property view status show edit mode show fold mode j edit get boolean property view status show fold mode show encoding j edit get boolean property view status show encoding show wrap j edit get boolean property view status show wrap show multi select j edit get boolean property view status show multi select show rect select j edit get boolean property view status show rect select show overwrite j edit get boolean property view status show overwrite show line seperator j edit get boolean property view status show line seperator boolean show memory j edit get boolean property view status show memory boolean show clock j edit get boolean property view status show clock panel set background bg panel set foreground fg caret status set background bg caret status set foreground fg message set background bg message set foreground fg mode set background bg mode set foreground fg wrap set background bg wrap set foreground fg multi select set background bg multi select set foreground fg rect select set background bg rect select set foreground fg overwrite set background bg overwrite set foreground fg line sep set background bg line sep set foreground fg retarded gtk look and feel font font new j label get font ui manager get font label font font metrics fm get font metrics font dimension dim null if show caret status panel add border layout west caret status caret status set font font dim new dimension fm string width caret test str fm get height caret status set preferred size dim else panel remove caret status box remove all if show encoding show edit mode show fold mode box add mode if show wrap dim new dimension math max math max fm char width fm char width h fm char width s 1 fm get height wrap set preferred size dim wrap set maximum size dim box add wrap if show multi select dim new dimension math max fm char width fm char width m 1 fm get height multi select set preferred size dim multi select set maximum size dim box add multi select if show rect select dim new dimension math max fm char width fm char width r 1 fm get height rect select set preferred size dim rect select set maximum size dim box add rect select if show overwrite dim new dimension math max fm char width fm char width o 1 fm get height overwrite set preferred size dim overwrite set maximum size dim box add overwrite if show line seperator dim new dimension math max math max fm char width u fm char width w fm char width m 1 fm get height line sep set preferred size dim line sep set maximum size dim box add line sep if show memory box add new memory status if show clock box add new clock update buffer status update misc status propertieschanged propertieschanged jedit getcolorproperty jedit getcolorproperty showcaretstatus jedit getbooleanproperty showeditmode jedit getbooleanproperty showfoldmode jedit getbooleanproperty showencoding jedit getbooleanproperty showwrap jedit getbooleanproperty showmultiselect jedit getbooleanproperty showrectselect jedit getbooleanproperty showoverwrite jedit getbooleanproperty showlineseperator jedit getbooleanproperty showmemory jedit getbooleanproperty showclock jedit getbooleanproperty setbackground setforeground caretstatus setbackground caretstatus setforeground setbackground setforeground setbackground setforeground setbackground setforeground multiselect setbackground multiselect setforeground rectselect setbackground rectselect setforeground setbackground setforeground linesep setbackground linesep setforeground jlabel getfont uimanager getfont fontmetrics getfontmetrics showcaretstatus borderlayout caretstatus caretstatus setfont stringwidth caretteststr getheight caretstatus setpreferredsize caretstatus removeall showencoding showeditmode showfoldmode showwrap charwidth charwidth charwidth getheight setpreferredsize setmaximumsize showmultiselect charwidth charwidth getheight multiselect setpreferredsize multiselect setmaximumsize multiselect showrectselect charwidth charwidth getheight rectselect setpreferredsize rectselect setmaximumsize rectselect showoverwrite charwidth charwidth getheight setpreferredsize setmaximumsize showlineseperator charwidth charwidth charwidth getheight linesep setpreferredsize linesep setmaximumsize linesep showmemory memorystatus showclock updatebufferstatus updatemiscstatus add notify method public void add notify super add notify vfs manager getio thread pool add progress listener this addnotify addnotify addnotify vfsmanager getiothreadpool addprogresslistener remove notify method public void remove notify super remove notify vfs manager getio thread pool remove progress listener this removenotify removenotify removenotify vfsmanager getiothreadpool removeprogresslistener status update method public void status update final work thread pool thread pool int thread index swing utilities invoke later new runnable public void run don t obscure existing message if message null equals message get text trim current message isio return int request count thread pool get request count if request count 0 set message and clear j edit get property view status io done current message isio true else if request count 1 set message j edit get property view status io 1 current message isio true else object args new integer request count set message j edit get property view status io args current message isio true statusupdate statusupdate workthreadpool threadpool threadindex swingutilities invokelater gettext currentmessageisio requestcount threadpool getrequestcount requestcount setmessageandclear jedit getproperty currentmessageisio requestcount setmessage jedit getproperty currentmessageisio requestcount setmessage jedit getproperty currentmessageisio public void run don t obscure existing message if message null equals message get text trim current message isio return int request count thread pool get request count if request count 0 set message and clear j edit get property view status io done current message isio true else if request count 1 set message j edit get property view status io 1 current message isio true else object args new integer request count set message j edit get property view status io args current message isio true gettext currentmessageisio requestcount threadpool getrequestcount requestcount setmessageandclear jedit getproperty currentmessageisio requestcount setmessage jedit getproperty currentmessageisio requestcount setmessage jedit getproperty currentmessageisio progress update method public void progress update work thread pool thread pool int thread index progressupdate progressupdate workthreadpool threadpool threadindex set message and clear method show a message for a short period of time param message the message since j edit 3 2pre5 public void set message and clear string message set message message temp timer new timer 0 new action listener public void action performed action event evt so if view is closed in the meantime if is showing set message null temp timer set initial delay 10000 temp timer set repeats false temp timer start setmessageandclear jedit setmessageandclear setmessage temptimer actionlistener actionperformed actionevent isshowing setmessage temptimer setinitialdelay temptimer setrepeats temptimer public void action performed action event evt so if view is closed in the meantime if is showing set message null actionperformed actionevent isshowing setmessage set message method displays a status message public void set message string message if temp timer null temp timer stop temp timer null set message component this message if message null if view get macro recorder null this message set text j edit get property view status recording else this message set text else this message set text message setmessage setmessage temptimer temptimer temptimer setmessagecomponent getmacrorecorder settext jedit getproperty settext settext set message component method public void set message component component comp current message isio false if comp null message comp comp return message comp comp panel add border layout center message comp setmessagecomponent setmessagecomponent currentmessageisio messagecomp messagecomp borderlayout messagecomp update caret status method public void update caret status if is showing return if show caret status buffer buffer view get buffer if buffer is loaded can happen when switching buffers sometimes buffer view get text area get buffer caret status set text return j edit text area text area view get text area int curr line text area get caret line there must be a better way of fixing this the problem is that this method can sometimes be called as a result of a text area scroll event in which case the caret position has not been updated yet if curr line buffer get line count return hopefully another caret update will come int start text area get line start offset curr line int dot text area get caret position start see above if dot 0 return buffer get text start dot seg int virtual position misc utilities get virtual width seg buffer get tab size buf set length 0 buf append integer to string curr line 1 buf append buf append integer to string dot 1 if virtual position dot buf append buf append integer to string virtual position 1 buf append int first line text area get first line int visible text area get visible lines int line count text area get display manager get scroll line count if visible line count buf append all else if first line 0 buf append top else if first line visible line count buf append bot else float percent float first line float line count 100 0f buf append integer to string int percent buf append caret status set text buf to string updatecaretstatus updatecaretstatus isshowing showcaretstatus getbuffer isloaded gettextarea getbuffer caretstatus settext jedittextarea textarea gettextarea currline textarea getcaretline currline getlinecount textarea getlinestartoffset currline textarea getcaretposition gettext virtualposition miscutilities getvirtualwidth gettabsize setlength tostring currline tostring virtualposition tostring virtualposition firstline textarea getfirstline textarea getvisiblelines linecount textarea getdisplaymanager getscrolllinecount linecount firstline firstline linecount firstline linecount tostring caretstatus settext tostring update buffer status method public void update buffer status if is showing return buffer buffer view get buffer if show wrap string wrap buffer get string property wrap if wrap equals none this wrap set text else if wrap equals hard this wrap set text h else if wrap equals soft this wrap set text s if show line seperator string line sep buffer get string property line separator if n equals line sep this line sep set text u else if r n equals line sep this line sep set text w else if r equals line sep this line sep set text m if show edit mode show fold mode show encoding this doesn t look pretty and mode line should probably be split up into seperate components strings buf set length 0 if buffer is loaded if show edit mode buf append buffer get mode get name if show fold mode if show edit mode buf append buf append string view get buffer get property folding if show encoding if show edit mode show fold mode buf append buf append buffer get string property encoding mode set text buf to string updatebufferstatus updatebufferstatus isshowing getbuffer showwrap getstringproperty settext settext settext showlineseperator linesep getstringproperty lineseparator linesep linesep settext linesep linesep settext linesep linesep settext showeditmode showfoldmode showencoding setlength isloaded showeditmode getmode getname showfoldmode showeditmode getbuffer getproperty showencoding showeditmode showfoldmode getstringproperty settext tostring update misc status method public void update misc status if is showing return j edit text area text area view get text area if show multi select multi select set text text area is multiple selection enabled m if show rect select rect select set text text area is rectangular selection enabled r if show overwrite overwrite set text text area is overwrite enabled o updatemiscstatus updatemiscstatus isshowing jedittextarea textarea gettextarea showmultiselect multiselect settext textarea ismultipleselectionenabled showrectselect rectselect settext textarea isrectangularselectionenabled showoverwrite settext textarea isoverwriteenabled public void mouse clicked mouse event evt buffer buffer view get buffer object source evt get source if source caret status if evt get click count 2 view get text area show go to line dialog else if source mode if evt get click count 2 new buffer options view view get buffer else if source wrap buffer toggle word wrap view else if source multi select view get text area toggle multiple selection enabled else if source rect select view get text area toggle rectangular selection enabled else if source overwrite view get text area toggle overwrite enabled else if source line sep buffer toggle line separator view mouseclicked mouseevent getbuffer getsource caretstatus getclickcount gettextarea showgotolinedialog getclickcount bufferoptions getbuffer togglewordwrap multiselect gettextarea togglemultipleselectionenabled rectselect gettextarea togglerectangularselectionenabled gettextarea toggleoverwriteenabled linesep togglelineseparator get tool tip location method public point get tool tip location mouse event event return new point event getx 20 gettooltiplocation gettooltiplocation mouseevent memory status constructor public memory status fucking gtk look and feel font font new j label get font font font ui manager get font label font memory status this set font font font render context frc new font render context null false false rectangle2d bounds font get string bounds memory test str frc dimension dim new dimension int bounds get width int bounds get height set preferred size dim set maximum size dim lm font get line metrics memory test str frc set foreground j edit get color property view status foreground set background j edit get color property view status background progress foreground j edit get color property view status memory foreground progress background j edit get color property view status memory background add mouse listener new mouse handler memorystatus memorystatus jlabel getfont uimanager getfont memorystatus setfont fontrendercontext fontrendercontext getstringbounds memoryteststr getwidth getheight setpreferredsize setmaximumsize getlinemetrics memoryteststr setforeground jedit getcolorproperty setbackground jedit getcolorproperty progressforeground jedit getcolorproperty progressbackground jedit getcolorproperty addmouselistener mousehandler add notify method public void add notify super add notify timer new timer 2000 this timer start tool tip manager shared instance register component this addnotify addnotify addnotify tooltipmanager sharedinstance registercomponent remove notify method public void remove notify timer stop tool tip manager shared instance unregister component this super remove notify removenotify removenotify tooltipmanager sharedinstance unregistercomponent removenotify get tool tip text method public string get tool tip text runtime runtime runtime get runtime int free memory int runtime free memory 1024 int total memory int runtime total memory 1024 int used memory total memory free memory integer args new integer used memory new integer total memory return j edit get property view status memory tooltip args gettooltiptext gettooltiptext getruntime freememory freememory totalmemory totalmemory usedmemory totalmemory freememory usedmemory totalmemory jedit getproperty get tool tip location method public point get tool tip location mouse event event return new point event getx 20 gettooltiplocation gettooltiplocation mouseevent action performed method public void action performed action event evt memory status this repaint actionperformed actionperformed actionevent memorystatus paint component method public void paint component graphics g insets insets new insets 0 0 0 0 memory status this get border get border insets this runtime runtime runtime get runtime int free memory int runtime free memory 1024 int total memory int runtime total memory 1024 int used memory total memory free memory int width memory status this get width insets left insets right int height memory status this get height insets top insets bottom 1 float fraction float used memory total memory g set color progress background g fill rect insets left insets top int width fraction height string str used memory 1024 total memory 1024 mb font render context frc new font render context null false false rectangle2d bounds g get font get string bounds str frc graphics g2 g create g2 set clip insets left insets top int width fraction height g2 set color progress foreground g2 draw string str insets left int width bounds get width 2 int insets top lm get ascent g2 dispose g2 g create g2 set clip insets left int width fraction insets top memory status this get width insets left int width fraction height g2 set color memory status this get foreground g2 draw string str insets left int width bounds get width 2 int insets top lm get ascent g2 dispose paintcomponent paintcomponent memorystatus getborder getborderinsets getruntime freememory freememory totalmemory totalmemory usedmemory totalmemory freememory memorystatus getwidth memorystatus getheight usedmemory totalmemory setcolor progressbackground fillrect usedmemory totalmemory fontrendercontext fontrendercontext getfont getstringbounds setclip setcolor progressforeground drawstring getwidth getascent setclip memorystatus getwidth setcolor memorystatus getforeground drawstring getwidth getascent public void mouse pressed mouse event evt if evt get click count 2 j edit show memory dialog view repaint mousepressed mouseevent getclickcount jedit showmemorydialog clock constructor public clock font render context frc new font render context null false false rectangle2d bounds get font get string bounds get time frc dimension dim new dimension int bounds get width int bounds get height set preferred size dim set maximum size dim set foreground j edit get color property view status foreground set background j edit get color property view status background fontrendercontext fontrendercontext getfont getstringbounds gettime getwidth getheight setpreferredsize setmaximumsize setforeground jedit getcolorproperty setbackground jedit getcolorproperty add notify method public void add notify super add notify update int milliseconds per minute 1000 60 timer new timer milliseconds per minute this timer set initial delay int milliseconds per minute system current time millis milliseconds per minute 500 timer start tool tip manager shared instance register component this addnotify addnotify addnotify millisecondsperminute millisecondsperminute setinitialdelay millisecondsperminute currenttimemillis millisecondsperminute tooltipmanager sharedinstance registercomponent remove notify method public void remove notify timer stop tool tip manager shared instance unregister component this super remove notify removenotify removenotify tooltipmanager sharedinstance unregistercomponent removenotify get tool tip text method public string get tool tip text return new date to string gettooltiptext gettooltiptext tostring get tool tip location method public point get tool tip location mouse event event return new point event getx 20 gettooltiplocation gettooltiplocation mouseevent action performed method public void action performed action event evt update actionperformed actionperformed actionevent get time method private string get time return date format get time instance date format short format new date gettime gettime dateformat gettimeinstance dateformat update method private void update set text get time settext gettime vfs file name field constructor vfs file name field vfs browser browser string model super model set enter adds to history false this browser browser dimension dim get preferred size dim width integer max value set maximum size dim action map map get action map action backspace map get delete previous map put delete previous new backspace action backspace vfsfilenamefield vfsfilenamefield vfsbrowser setenteraddstohistory getpreferredsize max_value setmaximumsize actionmap getactionmap backspaceaction is managing focus method public boolean is managing focus return false ismanagingfocus ismanagingfocus get focus traversal keys enabled method public boolean get focus traversal keys enabled return false getfocustraversalkeysenabled getfocustraversalkeysenabled process key event method public void process key event key event evt if evt getid key event key pressed string path get text switch evt get key code case key event vk tab do complete path break case key event vk left if get caret position 0 browser get browser view get table process key event evt else super process key event evt break case key event vk right if get caret position get document get length browser get browser view get table process key event evt else super process key event evt break case key event vk up case key event vk down case key event vk page up case key event vk page down browser get browser view get table process key event evt break case key event vk enter browser files activated evt is shift down vfs browser m open new view vfs browser m open false set text null evt consume break default super process key event evt break else if evt getid key event key typed char ch evt get key char if ch ch file separator char get caret position get document get length super process key event evt string path get text if path length 2 path char at 0 path browser get view get buffer get directory else if path length 3 path starts with path misc utilities get parent of path browser get directory vfs vfs vfs manager getvfs for path path if vfs get capabilities vfs low latency cap 0 browser set directory path vfs manager wait for requests set text null else if misc utilities is absolute path path vfs directory entry files browser get browser view get selected files if files length 1 files 0 type vfs directory entry file return path files 0 path else if operating system isdos derived path length 3 path char at 1 browser set directory path vfs manager wait for requests set text null vfs vfs vfs manager getvfs for path path if vfs get capabilities vfs low latency cap 0 set text null browser set directory path vfs manager wait for requests else if path ends with path ends with file separator set text path else set text path vfs get file separator else if ch 0x20 ch 0x7f ch 0xff super process key event evt string path get text browser view view browser get browser view view select none int mode browser get mode fix for bug 765507 we don t type complete in save dialog boxes press tab to do an explicit complete view get table do type select path mode vfs browser choose directory dialog mode vfs browser save dialog else super process key event evt processkeyevent processkeyevent keyevent keyevent key_pressed gettext getkeycode keyevent vk_tab docomplete keyevent vk_left getcaretposition getbrowserview gettable processkeyevent processkeyevent keyevent vk_right getcaretposition getdocument getlength getbrowserview gettable processkeyevent processkeyevent keyevent vk_up keyevent vk_down keyevent vk_page_up keyevent vk_page_down getbrowserview gettable processkeyevent keyevent vk_enter filesactivated isshiftdown vfsbrowser m_open_new_view vfsbrowser m_open settext processkeyevent keyevent key_typed getkeychar separatorchar getcaretposition getdocument getlength processkeyevent gettext charat getview getbuffer getdirectory startswith miscutilities getparentofpath getdirectory vfsmanager getvfsforpath getcapabilities low_latency_cap setdirectory vfsmanager waitforrequests settext miscutilities isabsolutepath directoryentry getbrowserview getselectedfiles directoryentry operatingsystem isdosderived charat setdirectory vfsmanager waitforrequests settext vfsmanager getvfsforpath getcapabilities low_latency_cap settext setdirectory vfsmanager waitforrequests endswith endswith settext settext getfileseparator processkeyevent gettext browserview getbrowserview selectnone getmode gettable dotypeselect vfsbrowser choose_directory_dialog vfsbrowser save_dialog processkeyevent do complete method private void do complete string current text browser view view browser get browser view view select none view get table do type select current text browser get mode vfs browser choose directory dialog vfs directory entry files view get selected files if files length 0 return string path files 0 path string name files 0 name string parent misc utilities get parent of path path string new text if misc utilities is absolute path current text current text starts with browser get directory new text path else if vfs browser paths equal parent browser get directory new text name else new text path set text new text docomplete docomplete currenttext browserview getbrowserview selectnone gettable dotypeselect currenttext getmode vfsbrowser choose_directory_dialog directoryentry getselectedfiles miscutilities getparentofpath newtext miscutilities isabsolutepath currenttext currenttext startswith getdirectory newtext vfsbrowser pathsequal getdirectory newtext newtext settext newtext go to parent method private void go to parent string name misc utilities get file name browser get directory string parent misc utilities get parent of path browser get directory browser set directory parent vfs vfs vfs manager getvfs for path parent if vfs get capabilities vfs low latency cap 0 vfs manager wait for requests set text name browser get browser view get table do type select name browser get mode vfs browser choose directory dialog gotoparent gotoparent miscutilities getfilename getdirectory miscutilities getparentofpath getdirectory setdirectory vfsmanager getvfsforpath getcapabilities low_latency_cap vfsmanager waitforrequests settext getbrowserview gettable dotypeselect getmode vfsbrowser choose_directory_dialog private action delegate backspace action action delegate this delegate delegate backspaceaction public void action performed action event evt if get selection start 0 get selection end 0 go to parent else delegate action performed evt string path get text browser view view browser get browser view view select none int mode browser get mode fix for bug 765507 we don t type complete in save dialog boxes press tab to do an explicit complete view get table do type select path mode vfs browser choose directory dialog mode vfs browser save dialog actionperformed actionevent getselectionstart getselectionend gotoparent actionperformed gettext browserview getbrowserview selectnone getmode gettable dotypeselect vfsbrowser choose_directory_dialog vfsbrowser save_dialog jar class loader constructor this constructor creates a class loader for loading classes from all plugins for example bean shell uses one of these so that scripts can use plugin classes public jar class loader for debugging id index live jarclassloader beanshell jarclassloader load class method exception class not found exception if the class could not be found public class load class string clazz boolean resolve it throws class not found exception see what jar class loader this class is in object obj class hash get clazz if obj no class we remember which classes we don t exist because bean shell tries loading all possible imported prefix class name combinations throw new class not found exception clazz else if obj instanceof jar class loader jar class loader class loader jar class loader obj return class loader loadclass clazz resolve it if it s not in the class hash and not marked as non existent try loading it from the classpath try class cls defer to whoever loaded us such as j shell echidna etc class loader parent loader get class get class loader if parent loader null cls parent loader load class clazz else cls find system class clazz return cls catch class not found exception cnf remember that this class doesn t exist for future reference class hash put clazz no class throw cnf loadclass classnotfoundexception loadclass resolveit classnotfoundexception jarclassloader classhash no_class beanshell classnotfoundexception jarclassloader jarclassloader classloader jarclassloader classloader _loadclass resolveit jshell classloader parentloader getclass getclassloader parentloader parentloader loadclass findsystemclass classnotfoundexception classhash no_class get resource as stream method public input stream get resource as stream string name if jar null return null try zip file zip file jar get zip file zip entry entry zip file get entry name if entry null return get system resource as stream name else return zip file get input stream entry catch io exception io log log log error this io return null getresourceasstream inputstream getresourceasstream zipfile zipfile getzipfile zipentry zipfile getentry getsystemresourceasstream zipfile getinputstream ioexception get resource method public url get resource string name if jar null return null try zip file zip file jar get zip file zip entry entry zip file get entry name if entry null return get system resource name else return new url get resource as path name catch io exception io log log log error this io return null getresource getresource zipfile zipfile getzipfile zipentry zipfile getentry getsystemresource getresourceaspath ioexception get resource as path method public string get resource as path string name if jar null return null if name starts with name name return jeditresource misc utilities get file name jar get path name getresourceaspath getresourceaspath startswith miscutilities getfilename getpath get zip file method deprecated call code pluginjar get zip file code instead public zip file get zip file try return jar get zip file catch io exception io log log log error this io return null getzipfile getzipfile zipfile getzipfile getzipfile ioexception dump method for debugging public static void dump log log log debug jar class loader class total instances created index log log log debug jar class loader class live instances live synchronized class hash iterator entries class hash entry set iterator while entries has next map entry entry map entry entries next if entry get value no class log log log debug jar class loader class entry get key entry get value jarclassloader jarclassloader classhash classhash entryset hasnext getvalue no_class jarclassloader getkey getvalue to string method public string to string if jar null return anonymous id else return jar get path id tostring tostring getpath finalize method protected void finalize live jar class loader constructor since j edit 4 2pre1 jar class loader pluginjar jar this this jar jar jarclassloader jedit jarclassloader activate method void activate string classes jar get classes if classes null for int i 0 i classes length i class hash put classes i this getclasses classhash deactivate method void deactivate string classes jar get classes if classes null return for int i 0 i classes length i object loader class hash get classes i if loader this class hash remove classes i else two plugins provide same class getclasses classhash classhash loadclass method load class from this jar only private synchronized class loadclass string clazz boolean resolve it throws class not found exception jar activate plugin synchronized this class cls find loaded class clazz if cls null if resolve it resolve class cls return cls string name misc utilities class to file clazz try zip file zip file jar get zip file zip entry entry zip file get entry name if entry null throw new class not found exception clazz input stream in zip file get input stream entry int len int entry get size byte data new byte len int success 0 int offset 0 while success len len success offset success success in read data offset len if success 1 log log log error this failed to load class clazz from zip file get name throw new class not found exception clazz cls define class clazz data 0 data length if resolve it resolve class cls return cls catch io exception io log log log error this io throw new class not found exception clazz _loadclass _loadclass resolveit classnotfoundexception activateplugin findloadedclass resolveit resolveclass miscutilities classtofile zipfile zipfile getzipfile zipentry zipfile getentry classnotfoundexception inputstream zipfile getinputstream getsize zipfile getname classnotfoundexception defineclass resolveit resolveclass ioexception classnotfoundexception int num throws 0 bsh method declaration int id super id numthrows bshmethoddeclaration set the return type node params node and block node based on child node structure no evaluation is done here synchronized void insure nodes parsed if params node null there is always a params node return object first node jjt get child 0 first throws clause 1 if first node instanceof bsh return type return type node bsh return type first node params node bsh formal parameters jjt get child 1 if jjt get num children 2 num throws block node bsh block jjt get child 2 num throws skip throws first throws clause else params node bsh formal parameters jjt get child 0 block node bsh block jjt get child 1 num throws skip throws returntypenode paramsnode blocknode insurenodesparsed paramsnode paramsnode firstnode jjtgetchild firstthrowsclause firstnode bshreturntype returntypenode bshreturntype firstnode paramsnode bshformalparameters jjtgetchild jjtgetnumchildren numthrows blocknode bshblock jjtgetchild numthrows firstthrowsclause paramsnode bshformalparameters jjtgetchild blocknode bshblock jjtgetchild numthrows evaluate the return type node return the type or null indicating loosely typed return class eval return type call stack callstack interpreter interpreter throws eval error insure nodes parsed if return type node null return return type node eval return type callstack interpreter else return null evalreturntype callstack evalerror insurenodesparsed returntypenode returntypenode evalreturntype string get return type descriptor call stack callstack interpreter interpreter string default package insure nodes parsed if return type node null return null else return return type node get type descriptor callstack interpreter default package getreturntypedescriptor callstack defaultpackage insurenodesparsed returntypenode returntypenode gettypedescriptor defaultpackage bsh return type get return type node insure nodes parsed return return type node bshreturntype getreturntypenode insurenodesparsed returntypenode evaluate the declaration of the method that is determine the structure of the method and install it into the caller s namespace public object eval call stack callstack interpreter interpreter throws eval error return type eval return type callstack interpreter eval nodes callstack interpreter install an instance of this method in the namespace see notes in bsh method this is not good need a way to update eval without re installing so that we can re eval params etc when classloader changes look into this name space namespace callstack top bsh method bsh method new bsh method this namespace modifiers try namespace set method name bsh method catch util eval error e throw e to eval error this callstack return primitive void callstack evalerror returntype evalreturntype evalnodes bshmethod namespace bshmethod bshmethod bshmethod setmethod bshmethod utilevalerror toevalerror private void eval nodes call stack callstack interpreter interpreter throws eval error insure nodes parsed validate that the throws names are class names for int i first throws clause i num throws first throws clause i bsh ambiguous name jjt get child i to class callstack interpreter params node eval callstack interpreter if strict java mode check for loose parameters and return type if interpreter get strict java for int i 0 i params node param types length i if params node param types i null warning null callstack here don t think we need a stack trace to indicate how we sourced the method throw new eval error strict java mode undeclared argument type parameter params node get param names i in method name this null if return type null warning null callstack here don t think we need a stack trace to indicate how we sourced the method throw new eval error strict java mode undeclared return type for method name this null evalnodes callstack evalerror insurenodesparsed firstthrowsclause numthrows firstthrowsclause bshambiguousname jjtgetchild toclass paramsnode strictjava getstrictjava paramsnode paramtypes paramsnode paramtypes evalerror paramsnode getparamnames returntype evalerror public string to string return method declaration name tostring methoddeclaration public string name bsh variable declarator int id super id bshvariabledeclarator evaluate the optional initializer value the name was set at parse time a variable declarator can be evaluated with or without preceding type information currently the type info is only used by array initializers in the case where there is no explicitly declared type param type node is the bsh type node its info is passed through to any variable intializer children for the case where the array initializer does not declare the type explicitly e g int a 1 2 type node may be null to indicate no type information available public object eval bsh type type node call stack callstack interpreter interpreter throws eval error null value means no value object value null if jjt get num children 0 simple node initializer simple node jjt get child 0 if we have type info and the child is an array initializer pass it along else use the default eval style this allows array initializer to handle the problem allowing for future enhancements in loosening types there if type node null initializer instanceof bsh array initializer value bsh array initializer initializer eval type node get base type type node get array dims callstack interpreter else value initializer eval callstack interpreter if value primitive void throw new eval error void initializer this callstack return value typenode bshtype typenode bshtype typenode callstack evalerror jjtgetnumchildren simplenode simplenode jjtgetchild typenode bsharrayinitializer bsharrayinitializer typenode getbasetype typenode getarraydims evalerror public string to string return bsh variable declarator name tostring bshvariabledeclarator properties changed method public static void properties changed int new size j edit get integer property history 25 if ring null ring new undo manager remove new size else if new size ring length undo manager remove new ring new undo manager remove new size list model model new ring list model int new count math min model get size new size for int i 0 i new count i new ring i undo manager remove model get element at i ring new ring count new count wrap false else if count ring length count 0 wrap true propertieschanged propertieschanged newsize jedit getintegerproperty undomanager newsize newsize undomanager newring undomanager newsize listmodel ringlistmodel newcount getsize newsize newcount newring undomanager getelementat newring newcount get list model method public static list model get list model return new ring list model getlistmodel listmodel getlistmodel ringlistmodel load method public static void load string settings directory j edit get settings directory if settings directory null return file kill ring new file misc utilities construct path settings directory killring xml if kill ring exists return kill ring mod time kill ring last modified log log log message kill ring class loading killring xml kill ring handler handler new kill ring handler xml parser parser new xml parser reader in null parser set handler handler try in new buffered reader new file reader kill ring parser parse null null in catch xml exception xe int line xe get line string message xe get message log log log error kill ring class kill ring line message catch file not found exception fnf log log log debug buffer history class fnf catch exception e log log log error kill ring class e finally try if in null in close catch io exception io log log log error kill ring class io ring undo manager remove handler list to array new undo manager remove handler list size count ring length settingsdirectory jedit getsettingsdirectory settingsdirectory killring miscutilities constructpath settingsdirectory killring killringmodtime killring lastmodified killring killringhandler killringhandler xmlparser xmlparser sethandler bufferedreader filereader killring xmlexception getline getmessage killring killring filenotfoundexception bufferhistory killring ioexception killring undomanager toarray undomanager save method public static void save string settings directory j edit get settings directory if settings directory null return file file1 new file misc utilities construct path settings directory killring xml save file file2 new file misc utilities construct path settings directory killring xml if file2 exists file2 last modified kill ring mod time log log log warning kill ring class file2 changed on disk will not save recent files return j edit backup settings file file2 log log log message kill ring class saving killring xml string line sep system get property line separator buffered writer out null try out new buffered writer new file writer file1 out write xml version 1 0 out write line sep out write doctype killring system killring dtd out write line sep out write killring out write line sep list model model get list model int size model get size for int i size 1 i 0 i out write entry out write misc utilities chars to entities model get element at i to string out write entry out write line sep out write killring out write line sep out close to avoid data loss only do this if the above completed successfully file2 delete file1 rename to file2 catch exception e log log log error kill ring class e finally try if out null out close catch io exception e kill ring mod time file2 last modified settingsdirectory jedit getsettingsdirectory settingsdirectory miscutilities constructpath settingsdirectory miscutilities constructpath settingsdirectory lastmodified killringmodtime killring jedit backupsettingsfile killring linesep getproperty bufferedwriter bufferedwriter filewriter linesep linesep linesep listmodel getlistmodel getsize miscutilities charstoentities getelementat tostring linesep linesep renameto killring ioexception killringmodtime lastmodified changed method static void changed undo manager remove rem if rem in kill ring compare existing entries hashcode with this int length wrap ring length count int kill 1 for int i 0 i length i if ring i rem ring i hashcode rem hashcode ring i str equals rem str we don t want duplicate entries in the kill ring kill i break if kill 1 remove kill else add rem undomanager inkillring add method static void add undo manager remove rem compare existing entries hashcode with this int length wrap ring length count for int i 0 i length i if ring i hashcode rem hashcode strings might be equal if ring i str equals rem str we don t want duplicate entries in the kill ring return no duplicates check for all whitespace string boolean all whitespace true for int i 0 i rem str length i if character is whitespace rem str char at i all whitespace false break if all whitespace return rem in kill ring true if ring count null ring count in kill ring false ring count rem if count ring length wrap true count 0 undomanager allwhitespace iswhitespace charat allwhitespace allwhitespace inkillring inkillring remove method static void remove int i if wrap undo manager remove new ring new undo manager remove ring length int new count 0 for int j 0 j ring length j int index if j count index count j 1 else index count ring length j 1 if i index ring index in kill ring false continue new ring new count ring index ring new ring count new count wrap false else system arraycopy ring i 1 ring i count i 1 count undomanager newring undomanager newcount inkillring newring newcount newring newcount private static long kill ring mod time private kill ring killringmodtime killring static class ring list model implements list model public void add list data listener list data listener listener ringlistmodel listmodel addlistdatalistener listdatalistener public void remove list data listener list data listener listener removelistdatalistener listdatalistener public object get element at int index undo manager remove rem if wrap if index count rem ring count index 1 else rem ring count ring length index 1 else rem ring count index 1 return rem getelementat undomanager public int get size if wrap return ring length else return count getsize public object resolve entity string public id string system id if killring dtd equals system id this will result in a slight speed up since we don t need to read the dtd anyway as a elfred is non validating return new string reader return null resolveentity publicid systemid systemid aelfred stringreader public void doctype decl string name string public id string system id throws exception if killring equals name return log log log error this killring xml doctype must be killring doctypedecl publicid systemid public void end element string name if name equals entry list add new undo manager remove null 0 0 char data endelement undomanager chardata public void char data char ch int start int length char data new string ch start length chardata chardata public tar buffer input stream in stream this in stream tar buffer default blksize tarbuffer inputstream instream instream tarbuffer default_blksize public tar buffer input stream in stream int block size this in stream block size tar buffer default rcdsize tarbuffer inputstream instream blocksize instream blocksize tarbuffer default_rcdsize public tar buffer input stream in stream int block size int record size this in stream in stream this out stream null this initialize block size record size tarbuffer inputstream instream blocksize recordsize instream instream outstream blocksize recordsize public tar buffer output stream out stream this out stream tar buffer default blksize tarbuffer outputstream outstream outstream tarbuffer default_blksize public tar buffer output stream out stream int block size this out stream block size tar buffer default rcdsize tarbuffer outputstream outstream blocksize outstream blocksize tarbuffer default_rcdsize public tar buffer output stream out stream int block size int record size this in stream null this out stream out stream this initialize block size record size tarbuffer outputstream outstream blocksize recordsize instream outstream outstream blocksize recordsize initialization common to all constructors private void initialize int block size int record size this debug false this block size block size this record size record size this recs per block this block size this record size this block buffer new byte this block size if this in stream null this curr blk idx 1 this curr rec idx this recs per block else this curr blk idx 0 this curr rec idx 0 blocksize recordsize blocksize blocksize recordsize recordsize recsperblock blocksize recordsize blockbuffer blocksize instream currblkidx currrecidx recsperblock currblkidx currrecidx get the tar buffer s block size blocks consist of multiple records public int get block size return this block size getblocksize blocksize get the tar buffer s record size public int get record size return this record size getrecordsize recordsize set the debugging flag for the buffer param debug if true print debugging output public void set debug boolean debug this debug debug setdebug determine if an archive record indicate end of archive end of archive is indicated by a record that consists entirely of null bytes param record the record data to check public boolean iseof record byte record for int i 0 sz this get record size i sz i if record i 0 return false return true iseofrecord getrecordsize skip over a record on the input stream public void skip record throws io exception if this debug system err println skip record rec idx this curr rec idx blk idx this curr blk idx if this in stream null throw new io exception reading via skip from an output buffer if this curr rec idx this recs per block if this read block return undone this curr rec idx skiprecord ioexception skiprecord recidx currrecidx blkidx currblkidx instream ioexception currrecidx recsperblock readblock currrecidx read a record from the input stream and return the data return the record data public byte read record throws io exception if this debug system err println read record rec idx this curr rec idx blk idx this curr blk idx if this in stream null throw new io exception reading from an output buffer if this curr rec idx this recs per block if this read block return null byte result new byte this record size system arraycopy this block buffer this curr rec idx this record size result 0 this record size this curr rec idx return result readrecord ioexception readrecord recidx currrecidx blkidx currblkidx instream ioexception currrecidx recsperblock readblock recordsize blockbuffer currrecidx recordsize recordsize currrecidx return false if end of file else true private boolean read block throws io exception if this debug system err println read block blk idx this curr blk idx if this in stream null throw new io exception reading from an output buffer this curr rec idx 0 int offset 0 int bytes needed this block size for bytes needed 0 long num bytes this in stream read this block buffer offset bytes needed note we have fit eof and the block is not full this is a broken archive it does not follow the standard blocking algorithm however because we are generous and it requires little effort we will simply ignore the error and continue as if the entire block were read this does not appear to break anything upstream we used to return false in this case thanks to yohann roussel alcatel fr for this fix if num bytes 1 break offset num bytes bytes needed num bytes if num bytes this block size if this debug system err println read block incomplete read num bytes of this block size bytes read this curr blk idx return true readblock ioexception readblock blkidx currblkidx instream ioexception currrecidx bytesneeded blocksize bytesneeded numbytes instream blockbuffer bytesneeded numbytes numbytes bytesneeded numbytes numbytes blocksize readblock numbytes blocksize currblkidx get the current block number zero based return the current zero based block number public int get current block num return this curr blk idx getcurrentblocknum currblkidx get the current record number within the current block zero based thus current offset current block num recs per blk current rec num return the current zero based record number public int get current record num return this curr rec idx 1 currentblocknum recsperblk currentrecnum getcurrentrecordnum currrecidx write an archive record to the archive param record the record data to write to the archive public void write record byte record throws io exception if this debug system err println write record rec idx this curr rec idx blk idx this curr blk idx if this out stream null throw new io exception writing to an input buffer if record length this record size throw new io exception record to write has length record length which is not the record size of this record size if this curr rec idx this recs per block this write block system arraycopy record 0 this block buffer this curr rec idx this record size this record size this curr rec idx writerecord ioexception writerecord recidx currrecidx blkidx currblkidx outstream ioexception recordsize ioexception recordsize currrecidx recsperblock writeblock blockbuffer currrecidx recordsize recordsize currrecidx write an archive record to the archive where the record may be inside of a larger array buffer the buffer must be offset plus record size long param buf the buffer containing the record data to write param offset the offset of the record data within buf public void write record byte buf int offset throws io exception if this debug system err println write record rec idx this curr rec idx blk idx this curr blk idx if this out stream null throw new io exception writing to an input buffer if offset this record size buf length throw new io exception record has length buf length with offset offset which is less than the record size of this record size if this curr rec idx this recs per block this write block system arraycopy buf offset this block buffer this curr rec idx this record size this record size this curr rec idx writerecord ioexception writerecord recidx currrecidx blkidx currblkidx outstream ioexception recordsize ioexception recordsize currrecidx recsperblock writeblock blockbuffer currrecidx recordsize recordsize currrecidx write a tar buffer block to the archive private void write block throws io exception if this debug system err println write block blk idx this curr blk idx if this out stream null throw new io exception writing to an input buffer this out stream write this block buffer 0 this block size this out stream flush this curr rec idx 0 this curr blk idx tarbuffer writeblock ioexception writeblock blkidx currblkidx outstream ioexception outstream blockbuffer blocksize outstream currrecidx currblkidx flush the current data block if it has any data in it private void flush block throws io exception if this debug system err println tar buffer flush block called if this out stream null throw new io exception writing to an input buffer if this curr rec idx 0 this write block flushblock ioexception tarbuffer flushblock outstream ioexception currrecidx writeblock close the tar buffer if this is an output buffer also flush the current block before closing public void close throws io exception if this debug system err println tar buffer close buffer if this out stream null this flush block if this out stream system out this out stream system err this out stream close this out stream null else if this in stream null if this in stream system in this in stream close this in stream null tarbuffer ioexception tarbuffer closebuffer outstream flushblock outstream outstream outstream outstream instream instream instream instream private int m globalcrc protected crc initialisecrc m_globalcrc int get finalcrc return m globalcrc getfinalcrc m_globalcrc void initialisecrc m globalcrc 0xffffffff m_globalcrc void updatecrc final int in ch int temp m globalcrc 24 in ch if temp 0 temp 256 temp m globalcrc m globalcrc 8 crc32 table temp inch m_globalcrc inch m_globalcrc m_globalcrc crc32_table boolean is default public bsh switch label int id super id isdefault bshswitchlabel public object eval call stack callstack interpreter interpreter throws eval error if is default return null should probably error simple node label simple node jjt get child 0 return label eval callstack interpreter callstack evalerror isdefault simplenode simplenode jjtgetchild public work thread work thread pool pool thread group group string name super group name so that j edit doesn t exit with no views open automatically set daemon true set priority thread min priority this pool pool workthread workthreadpool threadgroup jedit setdaemon setpriority min_priority sets if the current request can be aborted since j edit 2 6pre1 public void set abortable boolean abortable synchronized abort lock this abortable abortable if aborted stop new abort jedit setabortable abortlock returns if the work thread is currently running a request public boolean is request running return request running isrequestrunning requestrunning returns the status text public string get status return status getstatus sets the status text since j edit 2 6pre1 public void set status string status this status status pool fire progress changed this jedit setstatus fireprogresschanged returns the progress value public int get progress value return progress value getprogressvalue progressvalue sets the progress value since j edit 2 6pre1 public void set progress value int progress value this progress value progress value pool fire progress changed this jedit setprogressvalue progressvalue progressvalue progressvalue fireprogresschanged returns the progress maximum public int get progress maximum return progress maximum getprogressmaximum progressmaximum sets the maximum progress value since j edit 2 6pre1 public void set progress maximum int progress maximum this progress maximum progress maximum pool fire progress changed this jedit setprogressmaximum progressmaximum progressmaximum progressmaximum fireprogresschanged aborts the currently running request if allowed since j edit 2 6pre1 public void abort current request synchronized abort lock if abortable aborted stop new abort aborted true jedit abortcurrentrequest abortlock public void run log log log debug this work request thread starting get name for do requests getname dorequests private void do requests work thread pool request request for request pool get next request if request null break else request running true pool fire status changed this do request request request running false pool fire status changed this synchronized pool wait for all lock notify a running wait for requests method pool wait for all lock notify all synchronized pool lock wait for more requests try pool lock wait catch interrupted exception ie log log log error this ie dorequests workthreadpool getnextrequest requestrunning firestatuschanged dorequest requestrunning firestatuschanged waitforalllock waitforrequests waitforalllock notifyall interruptedexception private void do request work thread pool request request log log log debug work thread class running in work thread request try request run run catch abort a log log log error work thread class unhandled abort catch throwable t log log log error work thread class exception in work thread log log log error work thread class t finally synchronized abort lock aborted abortable false status null progress value progress maximum 0 pool request done pool fire status changed this dorequest workthreadpool workthread workthread workthread workthread abortlock progressvalue progressmaximum requestdone firestatuschanged public static class abort extends error public abort super work request aborted get start method returns the start offset of this selection public int get start return start getstart getstart get end method returns the end offset of this selection public int get end return end getend getend get start method returns the beginning of the portion of the selection falling on the specified line used to manipulate selection text on a line by line basis param buffer the buffer param line the line number since j edit 4 1pre1 getstart jedit get end method returns the end of the portion of the selection falling on the specified line used to manipulate selection text on a line by line basis param buffer the buffer param line the line number since j edit 4 1pre1 getend jedit get start line method returns the starting line number of this selection public int get start line return start line getstartline getstartline startline get end line method returns the ending line number of this selection public int get end line return end line getendline getendline endline overlaps method returns if this selection and the specified selection overlap param s the other selection since j edit 4 1pre1 public boolean overlaps selection s if start s start start s end end s start end s end return true else return false jedit to string method public string to string return get class get name start start end end start line start line end line end line tostring tostring getclass getname startline startline endline endline clone method public object clone try return super clone catch clone not supported exception e throw new internal error i just drank a whole bottle of cough syrup and i feel funny clonenotsupportedexception internalerror selection constructor selection selection constructor selection selection sel this start sel start this end sel end selection constructor selection int start int end this start start this end end should the next two be public maybe abstract void get text buffer buffer string buffer buf gettext stringbuffer should the next two be public maybe abstract void get text buffer buffer string buffer buf abstract int set text buffer buffer string text gettext stringbuffer settext abstract int set text buffer buffer string text abstract boolean content inserted buffer buffer int start line int start int num lines int length settext contentinserted startline numlines abstract boolean content inserted buffer buffer int start line int start int num lines int length abstract boolean content removed buffer buffer int start line int start int num lines int length contentinserted startline numlines contentremoved startline numlines range constructor public range range constructor public range selection sel super sel range constructor public range int start int end super start end get start method public int get start buffer buffer int line if line start line return start else return buffer get line start offset line getstart getstart startline getlinestartoffset get end method public int get end buffer buffer int line if line end line return end else return buffer get line end offset line 1 getend getend endline getlineendoffset get text method void get text buffer buffer string buffer buf buf append buffer get text start end start gettext gettext stringbuffer gettext set text method int set text buffer buffer string text buffer remove start end start if text null text length 0 buffer insert start text return start text length else return start settext settext content inserted method boolean content inserted buffer buffer int start line int start int num lines int length boolean changed false if this start start this start length if num lines 0 this start line buffer get line of offset this start changed true if this end start this end length if num lines 0 this end line buffer get line of offset this end changed true return changed contentinserted contentinserted startline numlines numlines startline getlineofoffset numlines endline getlineofoffset content removed method boolean content removed buffer buffer int start line int start int num lines int length int end start length boolean changed false if this start start this start end this start start changed true else if this start end this start length changed true if this end start this end end this end start changed true else if this end end this end length changed true if changed num lines 0 this start line buffer get line of offset this start this end line buffer get line of offset this end return changed contentremoved contentremoved startline numlines numlines startline getlineofoffset endline getlineofoffset rect constructor public rect super rect constructor public rect selection sel super sel rect constructor public rect int start int end super start end rect constructor public rect int start line int start int end line int end this start line start line this start start this end line end line this end end startline endline startline startline endline endline rect constructor public rect buffer buffer int start line int start column int end line int end column this start line start line this end line end line int width new int 1 int start offset buffer get offset of virtual column start line start column width if start offset 1 extra start virt start column width 0 start offset buffer get line end offset start line 1 else start offset buffer get line start offset start line int end offset buffer get offset of virtual column end line end column width if end offset 1 extra end virt end column width 0 end offset buffer get line end offset end line 1 else end offset buffer get line start offset end line startline startcolumn endline endcolumn startline startline endline endline startoffset getoffsetofvirtualcolumn startline startcolumn startoffset extrastartvirt startcolumn startoffset getlineendoffset startline startoffset getlinestartoffset startline endoffset getoffsetofvirtualcolumn endline endcolumn endoffset extraendvirt endcolumn endoffset getlineendoffset endline endoffset getlinestartoffset endline get start column method public int get start column buffer buffer int virt col start buffer get virtual width start line start buffer get line start offset start line extra start virt int virt col end buffer get virtual width end line end buffer get line start offset end line extra end virt return math min virt col start virt col end getstartcolumn getstartcolumn virtcolstart getvirtualwidth startline getlinestartoffset startline extrastartvirt virtcolend getvirtualwidth endline getlinestartoffset endline extraendvirt virtcolstart virtcolend get end column method public int get end column buffer buffer int virt col start buffer get virtual width start line start buffer get line start offset start line extra start virt int virt col end buffer get virtual width end line end buffer get line start offset end line extra end virt return math max virt col start virt col end getendcolumn getendcolumn virtcolstart getvirtualwidth startline getlinestartoffset startline extrastartvirt virtcolend getvirtualwidth endline getlinestartoffset endline extraendvirt virtcolstart virtcolend get start method public int get start buffer buffer int line return get column on other line buffer line get start column buffer getstart getstart getcolumnonotherline getstartcolumn get end method public int get end buffer buffer int line return get column on other line buffer line get end column buffer getend getend getcolumnonotherline getendcolumn get text method void get text buffer buffer string buffer buf int start get start column buffer int end get end column buffer for int i start line i end line i int line start buffer get line start offset i int line len buffer get line length i int rect start buffer get offset of virtual column i start null if rect start 1 rect start line len int rect end buffer get offset of virtual column i end null if rect end 1 rect end line len if rect end rect start system err println i start end rect start rect end buf append buffer get text line start rect start rect end rect start if i end line buf append n gettext gettext stringbuffer getstartcolumn getendcolumn startline endline linestart getlinestartoffset linelen getlinelength rectstart getoffsetofvirtualcolumn rectstart rectstart linelen rectend getoffsetofvirtualcolumn rectend rectend linelen rectend rectstart rectstart rectend gettext linestart rectstart rectend rectstart endline set text method int set text buffer buffer string text int start column get start column buffer int end column get end column buffer int total new int 1 int tab size buffer get tab size int max width 0 int total lines 0 array list lines new array list split the text into lines if text null int last newline 0 int current width start column for int i 0 i text length i char ch text char at i if ch n total lines lines add text substring last newline i last newline i 1 max width math max max width current width lines add new integer current width current width start column else if ch t current width tab size current width tab size else current width if last newline text length total lines lines add text substring last newline lines add new integer current width max width math max max width current width insert the lines into the buffer int end offset 0 int last line math max start line total lines 1 end line for int i start line i last line i if i buffer get line count buffer insert buffer get length n int line start buffer get line start offset i int line len buffer get line length i int rect start buffer get offset of virtual column i start column total int start whitespace if rect start 1 start whitespace start column total 0 rect start line len else start whitespace 0 int rect end buffer get offset of virtual column i end column null if rect end 1 rect end line len buffer remove rect start line start rect end rect start if start whitespace 0 buffer insert rect start line start misc utilities create white space start whitespace 0 int end whitespace if total lines 0 if rect end line len end whitespace 0 else end whitespace max width start column else int index 2 i start line total lines string str string lines get index buffer insert rect start line start start whitespace str if rect end line len end whitespace 0 else end whitespace max width integer lines get index 1 int value start whitespace str length if end whitespace 0 buffer insert rect start line start start whitespace misc utilities create white space end whitespace 0 end offset rect start line start start whitespace end whitespace move the caret down a line if text null text length 0 return end else return end offset settext settext startcolumn getstartcolumn endcolumn getendcolumn tabsize gettabsize maxwidth totallines arraylist arraylist lastnewline currentwidth startcolumn charat totallines lastnewline lastnewline maxwidth maxwidth currentwidth currentwidth currentwidth startcolumn currentwidth tabsize currentwidth tabsize currentwidth lastnewline totallines lastnewline currentwidth maxwidth maxwidth currentwidth endoffset lastline startline totallines endline startline lastline getlinecount getlength linestart getlinestartoffset linelen getlinelength rectstart getoffsetofvirtualcolumn startcolumn startwhitespace rectstart startwhitespace startcolumn rectstart linelen startwhitespace rectend getoffsetofvirtualcolumn endcolumn rectend rectend linelen rectstart linestart rectend rectstart startwhitespace rectstart linestart miscutilities createwhitespace startwhitespace endwhitespace totallines rectend linelen endwhitespace endwhitespace maxwidth startcolumn startline totallines rectstart linestart startwhitespace rectend linelen endwhitespace endwhitespace maxwidth intvalue startwhitespace endwhitespace rectstart linestart startwhitespace miscutilities createwhitespace endwhitespace endoffset rectstart linestart startwhitespace endwhitespace endoffset content inserted method boolean content inserted buffer buffer int start line int start int num lines int length if this end start return false this end length if this start line start line this start length if num lines 0 this start line buffer get line of offset this start this end line buffer get line of offset this end return true int end virtual column buffer get virtual width this end line end buffer get line start offset this end line if this start start int start virtual column buffer get virtual width this start line start buffer get line start offset this start line this start length int new start virtual column buffer get virtual width start line start buffer get line start offset this start line int total virtual width new int 1 int new end buffer get offset of virtual column this end line end virtual column new start virtual column start virtual column total virtual width if new end 1 end buffer get line start offset this end line new end else end buffer get line end offset this end line 1 extra end virt total virtual width 0 end virtual column else if this start start this start length if num lines 0 this start line buffer get line of offset this start if num lines 0 this end line buffer get line of offset this end int new end virtual column buffer get virtual width end line end buffer get line start offset this end line if start line this end line extra end virt 0 extra end virt end virtual column new end virtual column else if start line this start line extra start virt 0 extra start virt end virtual column new end virtual column return true contentinserted contentinserted startline numlines startline startline numlines startline getlineofoffset endline getlineofoffset endvirtualcolumn getvirtualwidth endline getlinestartoffset endline startvirtualcolumn getvirtualwidth startline getlinestartoffset startline newstartvirtualcolumn getvirtualwidth startline getlinestartoffset startline totalvirtualwidth newend getoffsetofvirtualcolumn endline endvirtualcolumn newstartvirtualcolumn startvirtualcolumn totalvirtualwidth newend getlinestartoffset endline newend getlineendoffset endline extraendvirt totalvirtualwidth endvirtualcolumn numlines startline getlineofoffset numlines endline getlineofoffset newendvirtualcolumn getvirtualwidth endline getlinestartoffset endline startline endline extraendvirt extraendvirt endvirtualcolumn newendvirtualcolumn startline startline extrastartvirt extrastartvirt endvirtualcolumn newendvirtualcolumn content removed method boolean content removed buffer buffer int start line int start int num lines int length int end start length boolean changed false if this start start this start end this start start changed true else if this start end this start length changed true if this end start this end end this end start changed true else if this end end this end length changed true if changed num lines 0 this start line buffer get line of offset this start this end line buffer get line of offset this end return changed contentremoved contentremoved startline numlines numlines startline getlineofoffset endline getlineofoffset get column on other line method private int get column on other line buffer buffer int line int col int return value buffer get offset of virtual column line col null if return value 1 return buffer get line end offset line 1 else return buffer get line start offset line return value getcolumnonotherline getcolumnonotherline returnvalue getoffsetofvirtualcolumn returnvalue getlineendoffset getlinestartoffset returnvalue buffer options constructor public buffer options view view buffer buffer super view j edit get property buffer options title true this view view this buffer buffer j panel content new j panel new border layout content set border new empty border 12 12 12 12 set content pane content action handler action listener new action handler abstract option pane panel new abstract option pane null panel add component gui utilities create multiline label j edit get property buffer options caption panel add separator buffer options loading saving line separator string line seps j edit get property line sep unix j edit get property line sep windows j edit get property line sep mac line separator new j combo box line seps string line sep buffer get string property buffer linesep if line sep null line sep system get property line separator if n equals line sep line separator set selected index 0 else if r n equals line sep line separator set selected index 1 else if r equals line sep line separator set selected index 2 panel add component j edit get property buffer options line separator line separator encoding string encodings misc utilities get encodings arrays sort encodings new misc utilities stringi case compare encoding new j combo box encodings encoding set editable true encoding set selected item buffer get string property buffer encoding panel add component j edit get property buffer options encoding encoding g zipped setting gzipped new j check box j edit get property buffer options gzipped gzipped set selected buffer get boolean property buffer gzipped panel add component gzipped panel add separator buffer options editing edit mode modes j edit get modes misc utilities quicksort modes new misc utilities stringi case compare mode new j combo box modes mode set selected item buffer get mode mode add action listener action listener panel add component j edit get property buffer options mode mode fold mode string fold modes fold handler get fold modes folding new j combo box fold modes folding set selected item buffer get string property folding panel add component j edit get property options editing folding folding wrap mode string wrap modes none soft hard wrap new j combo box wrap modes wrap set selected item buffer get string property wrap panel add component j edit get property options editing wrap wrap wrap add action listener new action handler max line length string line lengths 0 72 76 80 max line len new j combo box line lengths max line len set editable true max line len set selected item buffer get string property max line len max line len add action listener new action handler panel add component j edit get property options editing max line len max line len tab size string tab sizes 2 4 8 tab size new j combo box tab sizes tab size set editable true tab size set selected item buffer get string property tab size panel add component j edit get property options editing tab size tab size indent size indent size new j combo box tab sizes indent size set editable true indent size set selected item buffer get string property indent size panel add component j edit get property options editing indent size indent size soft tabs no tabs new j check box j edit get property options editing no tabs no tabs set selected buffer get boolean property no tabs panel add component no tabs content add border layout north panel buttons j panel buttons new j panel buttons set layout new box layout buttons box layout x axis buttons set border new empty border 12 0 0 0 buttons add box create glue ok new j button j edit get property common ok ok add action listener action listener get root pane set default button ok buttons add ok buttons add box create horizontal strut 6 cancel new j button j edit get property common cancel cancel add action listener action listener buttons add cancel buttons add box create glue content add border layout south buttons pack set location relative to view set visible true bufferoptions bufferoptions jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane actionhandler actionlistener actionhandler abstractoptionpane abstractoptionpane addcomponent guiutilities createmultilinelabel jedit getproperty addseparator lineseps jedit getproperty linesep jedit getproperty linesep jedit getproperty linesep lineseparator jcombobox lineseps linesep getstringproperty linesep linesep getproperty linesep lineseparator setselectedindex linesep lineseparator setselectedindex linesep lineseparator setselectedindex addcomponent jedit getproperty lineseparator lineseparator miscutilities getencodings miscutilities stringicasecompare jcombobox seteditable setselecteditem getstringproperty addcomponent jedit getproperty gzipped jcheckbox jedit getproperty setselected getbooleanproperty addcomponent addseparator jedit getmodes miscutilities miscutilities stringicasecompare jcombobox setselecteditem getmode addactionlistener actionlistener addcomponent jedit getproperty foldmodes foldhandler getfoldmodes jcombobox foldmodes setselecteditem getstringproperty addcomponent jedit getproperty wrapmodes jcombobox wrapmodes setselecteditem getstringproperty addcomponent jedit getproperty addactionlistener actionhandler linelengths maxlinelen jcombobox linelengths maxlinelen seteditable maxlinelen setselecteditem getstringproperty maxlinelen maxlinelen addactionlistener actionhandler addcomponent jedit getproperty maxlinelen maxlinelen tabsizes tabsize jcombobox tabsizes tabsize seteditable tabsize setselecteditem getstringproperty tabsize addcomponent jedit getproperty tabsize tabsize indentsize jcombobox tabsizes indentsize seteditable indentsize setselecteditem getstringproperty indentsize addcomponent jedit getproperty indentsize indentsize notabs jcheckbox jedit getproperty notabs notabs setselected getbooleanproperty notabs addcomponent notabs borderlayout jpanel jpanel setlayout boxlayout boxlayout x_axis setborder emptyborder createglue jbutton jedit getproperty addactionlistener actionlistener getrootpane setdefaultbutton createhorizontalstrut jbutton jedit getproperty addactionlistener actionlistener createglue borderlayout setlocationrelativeto setvisible ok method public void ok int index line separator get selected index string line sep if index 0 line sep n else if index 1 line sep r n else if index 2 line sep r else throw new internal error string old line sep buffer get string property buffer linesep if old line sep null old line sep system get property line separator if old line sep equals line sep buffer set string property line separator line sep buffer set dirty true string encoding string this encoding get selected item string old encoding buffer get string property buffer encoding if old encoding equals encoding buffer set string property buffer encoding encoding buffer set dirty true boolean gzipped value gzipped is selected boolean old gzipped buffer get boolean property buffer gzipped if gzipped value old gzipped buffer set boolean property buffer gzipped gzipped value buffer set dirty true buffer set string property folding string folding get selected item buffer set string property wrap string wrap get selected item try buffer set property max line len new integer max line len get selected item to string catch number format exception nf try buffer set property tab size new integer tab size get selected item to string catch number format exception nf try buffer set property indent size new integer indent size get selected item to string catch number format exception nf buffer set boolean property no tabs no tabs is selected index mode get selected index buffer set mode modes index dispose lineseparator getselectedindex linesep linesep linesep linesep internalerror oldlinesep getstringproperty oldlinesep oldlinesep getproperty oldlinesep linesep setstringproperty lineseparator linesep setdirty getselecteditem oldencoding getstringproperty oldencoding setstringproperty setdirty gzippedvalue isselected oldgzipped getbooleanproperty gzippedvalue oldgzipped setbooleanproperty gzippedvalue setdirty setstringproperty getselecteditem setstringproperty getselecteditem setproperty maxlinelen maxlinelen getselecteditem tostring numberformatexception setproperty tabsize tabsize getselecteditem tostring numberformatexception setproperty indentsize indentsize getselecteditem tostring numberformatexception setbooleanproperty notabs notabs isselected getselectedindex setmode cancel method public void cancel dispose action performed method public void action performed action event evt object source evt get source if source ok ok else if source cancel cancel else if source mode mode mode mode mode get selected item folding set selected item mode get property folding wrap set selected item mode get property wrap max line len set selected item mode get property max line len tab size set selected item mode get property tab size indent size set selected item mode get property indent size no tabs set selected mode get boolean property no tabs else if source wrap if wrap get selected item equals none if max line len get selected item equals 0 max line len set selected item 80 else if source max line len if wrap get selected item equals none if max line len get selected item equals 0 wrap set selected item none actionperformed actionperformed actionevent getsource _mode getselecteditem setselecteditem _mode getproperty setselecteditem _mode getproperty maxlinelen setselecteditem _mode getproperty maxlinelen tabsize setselecteditem _mode getproperty tabsize indentsize setselecteditem _mode getproperty indentsize notabs setselected _mode getbooleanproperty notabs getselecteditem maxlinelen getselecteditem maxlinelen setselecteditem maxlinelen getselecteditem maxlinelen getselecteditem setselecteditem style option pane constructor public syntax hilite option pane super syntax styleoptionpane syntaxhiliteoptionpane init method protected void init set layout new border layout 6 6 add border layout center create style table scroller _init _init setlayout borderlayout borderlayout createstyletablescroller save method protected void save style model save _save _save stylemodel create style table scroller method private j scroll pane create style table scroller style model create style table model style table new j table style model style table set row selection allowed false style table set column selection allowed false style table set cell selection enabled false style table get table header set reordering allowed false style table add mouse listener new mouse handler table column model tcm style table get column model table column style column tcm get column 1 style column set cell renderer new style table model style renderer dimension d style table get preferred size d height math min d height 100 j scroll pane scroller new j scroll pane style table scroller set preferred size d return scroller createstyletablescroller jscrollpane createstyletablescroller stylemodel createstyletablemodel styletable jtable stylemodel styletable setrowselectionallowed styletable setcolumnselectionallowed styletable setcellselectionenabled styletable gettableheader setreorderingallowed styletable addmouselistener mousehandler tablecolumnmodel styletable getcolumnmodel tablecolumn stylecolumn getcolumn stylecolumn setcellrenderer styletablemodel stylerenderer styletable getpreferredsize jscrollpane jscrollpane styletable setpreferredsize create style table model method private style table model create style table model return new style table model createstyletablemodel styletablemodel createstyletablemodel styletablemodel public void mouse clicked mouse event evt int row style table row at point evt get point if row 1 return syntax style style new style editor syntax hilite option pane this syntax style style model get value at row 1 get style if style null style model set value at style row 1 mouseclicked mouseevent styletable rowatpoint getpoint syntaxstyle styleeditor syntaxhiliteoptionpane syntaxstyle stylemodel getvalueat getstyle stylemodel setvalueat style table model constructor style table model style choices new vector token id count 4 start at 1 not 0 to skip token null for int i 1 i token id count i string token name token token to string byte i add style choice token name view style token name to lower case add style choice j edit get property options syntax fold line 1 view style fold line 1 add style choice j edit get property options syntax fold line 2 view style fold line 2 add style choice j edit get property options syntax fold line 3 view style fold line 3 add style choice j edit get property options syntax fold line 0 view style fold line 0 misc utilities quicksort style choices new misc utilities stringi case compare styletablemodel styletablemodel stylechoices id_count id_count tokenname tokentostring addstylechoice tokenname tokenname tolowercase addstylechoice jedit getproperty foldline foldline addstylechoice jedit getproperty foldline foldline addstylechoice jedit getproperty foldline foldline addstylechoice jedit getproperty foldline foldline miscutilities stylechoices miscutilities stringicasecompare get column count method public int get column count return 2 getcolumncount getcolumncount get row count method public int get row count return style choices size getrowcount getrowcount stylechoices get value at method public object get value at int row int col style choice ch style choice style choices element at row switch col case 0 return ch label case 1 return ch style default return null getvalueat getvalueat stylechoice stylechoice stylechoices elementat set value at method public void set value at object value int row int col style choice ch style choice style choices element at row if col 1 ch style syntax style value fire table rows updated row row setvalueat setvalueat stylechoice stylechoice stylechoices elementat syntaxstyle firetablerowsupdated get column name method public string get column name int index switch index case 0 return j edit get property options syntax object case 1 return j edit get property options syntax style default return null getcolumnname getcolumnname jedit getproperty jedit getproperty save method public void save for int i 0 i style choices size i style choice ch style choice style choices element at i j edit set property ch property gui utilities get style string ch style stylechoices stylechoice stylechoice stylechoices elementat jedit setproperty guiutilities getstylestring add style choice method private void add style choice string label string property style choices add element new style choice label property gui utilities parse style j edit get property property dialog 12 addstylechoice addstylechoice stylechoices addelement stylechoice guiutilities parsestyle jedit getproperty style choice string label string property syntax style style this label label this property property this style style stylechoice syntaxstyle for sorting public string to string return label tostring style renderer constructor public style renderer set opaque true set border syntax hilite option pane no focus border set text hello world stylerenderer stylerenderer setopaque setborder syntaxhiliteoptionpane nofocusborder settext get table cell renderer component method public component get table cell renderer component j table table object value boolean is selected boolean cell has focus int row int col if value null syntax style style syntax style value set foreground style get foreground color if style get background color null set background style get background color else this part sucks set background j edit get color property view bg color set font style get font set border cell has focus ui manager get border table focus cell highlight border syntax hilite option pane no focus border return this gettablecellrenderercomponent gettablecellrenderercomponent jtable isselected cellhasfocus syntaxstyle syntaxstyle setforeground getforegroundcolor getbackgroundcolor setbackground getbackgroundcolor setbackground jedit getcolorproperty bgcolor setfont getfont setborder cellhasfocus uimanager getborder focuscellhighlightborder syntaxhiliteoptionpane nofocusborder style editor constructor style editor component comp syntax style style super gui utilities get parent dialog comp j edit get property style editor title true j panel content new j panel new border layout 12 12 content set border new empty border 12 12 12 12 set content pane content j panel panel new j panel new grid layout 4 2 12 12 italics new j check box j edit get property style editor italics italics set selected style get font is italic panel add italics panel add new j label bold new j check box j edit get property style editor bold bold set selected style get font is bold panel add bold panel add new j label color fg style get foreground color fg color check box new j check box j edit get property style editor fg color fg color check box set selected fg null fg color check box add action listener this panel add fg color check box fg color new color well button fg fg color set enabled fg null panel add fg color color bg style get background color bg color check box new j check box j edit get property style editor bg color bg color check box set selected bg null bg color check box add action listener this panel add bg color check box bg color new color well button bg bg color set enabled bg null panel add bg color content add border layout center panel box box new box box layout x axis box add box create glue box add ok new j button j edit get property common ok get root pane set default button ok ok add action listener this box add box create horizontal strut 6 box add cancel new j button j edit get property common cancel cancel add action listener this box add box create glue content add border layout south box pack set location relative to gui utilities get parent dialog comp set resizable false set visible true styleeditor styleeditor syntaxstyle guiutilities getparentdialog jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane jpanel jpanel gridlayout jcheckbox jedit getproperty setselected getfont isitalic jlabel jcheckbox jedit getproperty setselected getfont isbold jlabel getforegroundcolor fgcolorcheckbox jcheckbox jedit getproperty fgcolor fgcolorcheckbox setselected fgcolorcheckbox addactionlistener fgcolorcheckbox fgcolor colorwellbutton fgcolor setenabled fgcolor getbackgroundcolor bgcolorcheckbox jcheckbox jedit getproperty bgcolor bgcolorcheckbox setselected bgcolorcheckbox addactionlistener bgcolorcheckbox bgcolor colorwellbutton bgcolor setenabled bgcolor borderlayout boxlayout x_axis createglue jbutton jedit getproperty getrootpane setdefaultbutton addactionlistener createhorizontalstrut jbutton jedit getproperty addactionlistener createglue borderlayout setlocationrelativeto guiutilities getparentdialog setresizable setvisible action performed method public void action performed action event evt object source evt get source if source ok ok else if source cancel cancel else if source fg color check box fg color set enabled fg color check box is selected else if source bg color check box bg color set enabled bg color check box is selected actionperformed actionperformed actionevent getsource fgcolorcheckbox fgcolor setenabled fgcolorcheckbox isselected bgcolorcheckbox bgcolor setenabled bgcolorcheckbox isselected ok method public void ok ok clicked true dispose okclicked cancel method public void cancel dispose get style method public syntax style get style if ok clicked return null color foreground fg color check box is selected fg color get selected color null color background bg color check box is selected bg color get selected color null return new syntax style foreground background new font dialog italics is selected font italic 0 bold is selected font bold 0 12 getstyle syntaxstyle getstyle okclicked fgcolorcheckbox isselected fgcolor getselectedcolor bgcolorcheckbox isselected bgcolor getselectedcolor syntaxstyle isselected isselected browserio request constructor creates a new browser i o request param type the request type param browser the vfs browser instance param path1 the first path name to operate on param path2 the second path name to operate on param load info a two element array filled out by the request element 1 is the canonical path element 2 is the file list browserio request int type vfs browser browser object session vfs vfs string path1 string path2 object load info this type type this browser browser this session session this vfs vfs this path1 path1 this path2 path2 this load info load info browseriorequest loadinfo browseriorequest vfsbrowser loadinfo loadinfo loadinfo run method public void run switch type case list directory list directory break case delete delete break case rename rename break case mkdir mkdir break list_directory listdirectory to string method public string to string string type string switch type case list directory type string list directory break case delete type string delete break case rename type string rename break case mkdir type string mkdir break default type string unknown break return get class get name type type string vfs vfs path1 path1 path2 path2 tostring tostring typestring list_directory typestring list_directory typestring typestring typestring typestring getclass getname typestring list directory method private void list directory vfs directory entry directory null string args path1 set status j edit get property vfs status listing directory args string canon path path1 try set abortable true canon path vfs canonpath session path1 browser directory vfs listdirectory session canon path browser catch io exception io set abortable false log log log error this io string pp io to string vfs manager error browser path1 ioerror directory error pp catch work thread abort a finally try vfs endvfssession session browser catch io exception io set abortable false log log log error this io string pp io to string vfs manager error browser path1 ioerror directory error pp set abortable false load info 0 canon path load info 1 directory listdirectory listdirectory directoryentry setstatus jedit getproperty canonpath setabortable canonpath _canonpath _listdirectory canonpath ioexception setabortable tostring vfsmanager workthread _endvfssession ioexception setabortable tostring vfsmanager setabortable loadinfo canonpath loadinfo delete method private void delete try set abortable true string args path1 set status j edit get property vfs status deleting args try path1 vfs canonpath session path1 browser if vfs delete session path1 browser vfs manager error browser path1 ioerror delete error null catch io exception io set abortable false log log log error this io string pp io to string vfs manager error browser path1 ioerror directory error pp catch work thread abort a finally try vfs endvfssession session browser catch io exception io set abortable false log log log error this io string pp io to string vfs manager error browser path1 ioerror directory error pp setabortable setstatus jedit getproperty _canonpath _delete vfsmanager ioexception setabortable tostring vfsmanager workthread _endvfssession ioexception setabortable tostring vfsmanager rename method private void rename try set abortable true string args path1 path2 set status j edit get property vfs status renaming args try path1 vfs canonpath session path1 browser path2 vfs canonpath session path2 browser vfs directory entry file vfs getdirectoryentry session path2 browser if file null if operating system isdos derived operating system is macos path1 equals ignore case path2 allow user to change name case else vfs manager error browser path1 ioerror rename exists new string path2 return if vfs rename session path1 path2 browser vfs manager error browser path1 ioerror rename error new string path2 catch io exception io set abortable false log log log error this io string pp io to string vfs manager error browser path1 ioerror directory error pp catch work thread abort a finally try vfs endvfssession session browser catch io exception io set abortable false log log log error this io string pp io to string vfs manager error browser path1 ioerror directory error pp setabortable setstatus jedit getproperty _canonpath _canonpath directoryentry _getdirectoryentry operatingsystem isdosderived operatingsystem ismacos equalsignorecase vfsmanager _rename vfsmanager ioexception setabortable tostring vfsmanager workthread _endvfssession ioexception setabortable tostring vfsmanager mkdir method private void mkdir try set abortable true string args path1 set status j edit get property vfs status mkdir args try path1 vfs canonpath session path1 browser if vfs mkdir session path1 browser vfs manager error browser path1 ioerror mkdir error null catch io exception io set abortable false log log log error this io args 0 io to string vfs manager error browser path1 ioerror args catch work thread abort a finally try vfs endvfssession session browser catch io exception io set abortable false log log log error this io string args io to string vfs manager error browser path1 ioerror args setabortable setstatus jedit getproperty _canonpath _mkdir vfsmanager ioexception setabortable tostring vfsmanager workthread _endvfssession ioexception setabortable tostring vfsmanager public class type bsh primitive type int id super id bshprimitivetype bsh primitive type int id super id public class get type return type bshprimitivetype gettype public final class uncheckedre extends re constructs a regular expression pattern buffer without any compilation flags set and using the default syntax re syntax re syntax perl5 param pattern a regular expression pattern in the form of a string string buffer or char other input types will be converted to strings using the to string method exception runtime exception the input pattern could not be parsed exception null pointer exception the pattern was null public uncheckedre object pattern this pattern 0 re syntax re syntax perl5 resyntax re_syntax_perl5 stringbuffer tostring runtimeexception nullpointerexception resyntax re_syntax_perl5 constructs a regular expression pattern buffer using the specified compilation flags and the default syntax re syntax re syntax perl5 param pattern a regular expression pattern in the form of a string string buffer or char other input types will be converted to strings using the to string method param cflags the logical or of any combination of the compilation flags in the re class exception runtime exception the input pattern could not be parsed exception null pointer exception the pattern was null public uncheckedre object pattern int cflags this pattern cflags re syntax re syntax perl5 resyntax re_syntax_perl5 stringbuffer tostring runtimeexception nullpointerexception resyntax re_syntax_perl5 constructs a regular expression pattern buffer using the specified compilation flags and regular expression syntax param pattern a regular expression pattern in the form of a string string buffer or char other input types will be converted to strings using the to string method param cflags the logical or of any combination of the compilation flags in the re class param syntax the type of regular expression syntax to use exception runtime exception the input pattern could not be parsed exception null pointer exception the pattern was null public uncheckedre object pattern int cflags re syntax syntax try initialize pattern cflags syntax 0 0 catch re exception e throw new runtime exception e get message stringbuffer tostring runtimeexception nullpointerexception resyntax reexception runtimeexception getmessage default input handler constructor creates a new input handler with no key bindings defined param view the view public default input handler view view super view bindings current bindings new hashtable defaultinputhandler defaultinputhandler currentbindings default input handler constructor creates a new input handler with the same set of key bindings as the one specified note that both input handlers share a pointer to exactly the same key binding table so adding a key binding in one will also add it to the other param copy the input handler to copy key bindings from param view the view public default input handler view view default input handler copy super view bindings current bindings copy bindings defaultinputhandler defaultinputhandler defaultinputhandler currentbindings add key binding method adds a key binding to this input handler the key binding is a list of white space separated key strokes of the form i modifiers key i where modifier is c for control a for alt or s for shift and key is either a character a z or a field name in the key event class prefixed with vk e g back space param key binding the key binding param action the action since j edit 4 2pre1 public void add key binding string key binding string action addkeybinding key binding object action addkeybinding keyevent vk_ back_space keybinding jedit addkeybinding keybinding _addkeybinding keybinding add key binding method adds a key binding to this input handler the key binding is a list of white space separated key strokes of the form i modifiers key i where modifier is c for control a for alt or s for shift and key is either a character a z or a field name in the key event class prefixed with vk e g back space param key binding the key binding param action the action public void add key binding string key binding edit action action addkeybinding key binding object action addkeybinding keyevent vk_ back_space keybinding addkeybinding keybinding editaction _addkeybinding keybinding remove key binding method removes a key binding from this input handler this is not yet implemented param key binding the key binding public void remove key binding string key binding hashtable current bindings string tokenizer st new string tokenizer key binding while st has more tokens string key code str st next token key event translator key key stroke key event translator parse key key code str if key stroke null return if st has more tokens object o current get key stroke if o instanceof hashtable current hashtable o else if o null we have binding foo but user asks to remove foo bar current remove key stroke return else user asks to remove non existent return else current remove key stroke removekeybinding keybinding removekeybinding keybinding stringtokenizer stringtokenizer keybinding hasmoretokens keycodestr nexttoken keyeventtranslator keystroke keyeventtranslator parsekey keycodestr keystroke hasmoretokens keystroke keystroke keystroke remove all key bindings method removes all key bindings from this input handler public void remove all key bindings bindings clear removeallkeybindings removeallkeybindings get key binding method returns either an edit action or a hashtable if the specified key is a prefix param key binding the key binding since j edit 3 2pre5 public object get key binding string key binding hashtable current bindings string tokenizer st new string tokenizer key binding while st has more tokens key event translator key key stroke key event translator parse key st next token if key stroke null return null if st has more tokens object o current get key stroke if o instanceof hashtable if st has more tokens return o else current hashtable o else return o else return current get key stroke return null getkeybinding keybinding jedit getkeybinding keybinding stringtokenizer stringtokenizer keybinding hasmoretokens keyeventtranslator keystroke keyeventtranslator parsekey nexttoken keystroke hasmoretokens keystroke hasmoretokens keystroke is prefix active method returns if a prefix key has been pressed public boolean is prefix active return bindings current bindings super is prefix active isprefixactive isprefixactive currentbindings isprefixactive handle key method handles the given keystroke param key stroke the key stroke since j edit 4 2pre5 public boolean handle key key event translator key key stroke char input 0 if key stroke modifiers null key stroke modifiers equals s switch key stroke key case n case t input char key stroke key break default input key stroke input break if read next char null if input 0 set current bindings bindings invoke read next char input repeat count 1 return true else read next char null view get status set message null object o current bindings get key stroke if o null don t beep if the user presses some key we don t know about unless a prefix is active otherwise it will beep when caps lock is pressed etc if current bindings bindings toolkit get default toolkit beep f10 should be passed on but c e f10 shouldn t repeat count 1 set current bindings bindings if input 0 user input input else this is retarded excuse me while i drool and make stupid noises switch key stroke key case key event vk numpad0 case key event vk numpad1 case key event vk numpad2 case key event vk numpad3 case key event vk numpad4 case key event vk numpad5 case key event vk numpad6 case key event vk numpad7 case key event vk numpad8 case key event vk numpad9 case key event vk multiply case key event vk add case key event vk separator case key event vk subtract case key event vk decimal case key event vk divide key event workaround numeric keypad key break else if o instanceof hashtable set current bindings hashtable o return true else if o instanceof string set current bindings bindings invoke action string o return true else if o instanceof edit action set current bindings bindings invoke action edit action o return true return false handlekey keystroke jedit handlekey keyeventtranslator keystroke keystroke keystroke keystroke keystroke keystroke readnextchar setcurrentbindings invokereadnextchar repeatcount readnextchar getstatus setmessage currentbindings keystroke currentbindings getdefaulttoolkit repeatcount setcurrentbindings userinput keystroke keyevent vk_numpad0 keyevent vk_numpad1 keyevent vk_numpad2 keyevent vk_numpad3 keyevent vk_numpad4 keyevent vk_numpad5 keyevent vk_numpad6 keyevent vk_numpad7 keyevent vk_numpad8 keyevent vk_numpad9 keyevent vk_multiply keyevent vk_add keyevent vk_separator keyevent vk_subtract keyevent vk_decimal keyevent vk_divide keyeventworkaround numerickeypadkey setcurrentbindings setcurrentbindings invokeaction editaction setcurrentbindings invokeaction editaction get symbolic modifier name method returns a the symbolic modifier name for the specified java modifier flag param mod a modifier constant from code input event code since j edit 4 1pre3 public static char get symbolic modifier name int mod return key event translator get symbolic modifier name mod getsymbolicmodifiername inputevent jedit getsymbolicmodifiername keyeventtranslator getsymbolicmodifiername get modifier string method returns a string containing symbolic modifier names set in the specified event param evt the event since j edit 4 1pre3 public static string get modifier string input event evt return key event translator get modifier string evt getmodifierstring jedit getmodifierstring inputevent keyeventtranslator getmodifierstring parse key stroke method deprecated we don t use swing key strokes anymore public static key stroke parse key stroke string key stroke if key stroke null return null int modifiers 0 int index key stroke index of if index 1 for int i 0 i index i switch character to upper case key stroke char at i case a modifiers key event translator a break case c modifiers key event translator c break case m modifiers key event translator m break case s modifiers key event translator s break string key key stroke substring index 1 if key length 1 char ch key char at 0 if modifiers 0 return key stroke get key stroke ch else return key stroke get key stroke character to upper case ch modifiers else if key length 0 log log log error default input handler class invalid key stroke key stroke return null else int ch try ch key event class get field vk concat key get int null catch exception e log log log error default input handler class invalid key stroke key stroke return null return key stroke get key stroke ch modifiers parsekeystroke keystrokes keystroke parsekeystroke keystroke keystroke keystroke indexof touppercase keystroke charat keyeventtranslator keyeventtranslator keyeventtranslator keyeventtranslator keystroke charat keystroke getkeystroke keystroke getkeystroke touppercase defaultinputhandler keystroke keyevent getfield vk_ getint defaultinputhandler keystroke keystroke getkeystroke set current bindings method private void set current bindings hashtable bindings view get status set message string bindings get prefix str current bindings bindings setcurrentbindings setcurrentbindings getstatus setmessage prefix_str currentbindings addkeybinding method adds a key binding to this input handler the key binding is a list of white space separated key strokes of the form i modifiers key i where modifier is c for control a for alt or s for shift and key is either a character a z or a field name in the key event class prefixed with vk e g back space param key binding the key binding param action the action public void addkeybinding string key binding object action hashtable current bindings string prefix str null string tokenizer st new string tokenizer key binding while st has more tokens string key code str st next token if prefix str null prefix str key code str else prefix str prefix str key code str key event translator key key stroke key event translator parse key key code str if key stroke null return if st has more tokens object o current get key stroke if o instanceof hashtable current hashtable o else hashtable hash new hashtable hash put prefix str prefix str o hash current put key stroke o current hashtable o else current put key stroke action _addkeybinding keyevent vk_ back_space keybinding _addkeybinding keybinding prefixstr stringtokenizer stringtokenizer keybinding hasmoretokens keycodestr nexttoken prefixstr prefixstr keycodestr prefixstr prefixstr keycodestr keyeventtranslator keystroke keyeventtranslator parsekey keycodestr keystroke hasmoretokens keystroke prefix_str prefixstr keystroke keystroke re token range int sub index char lo char hi boolean ins super sub index this lo insens ins character to lower case lo lo this hi ins character to lower case hi hi retokenrange subindex subindex tolowercase tolowercase int get minimum length return 1 getminimumlength boolean match char indexed input re match mymatch char c input char at mymatch index if c char indexed out of bounds return false if insens c character to lower case c if c lo c hi mymatch index return next input mymatch return false charindexed rematch charat charindexed out_of_bounds tolowercase void dump string buffer os os append lo append append hi stringbuffer dockable window update constructor creates a new dockable window update message param wm the dockable window manager param what what happened param dockable the dockable window in question public dockable window update dockable window manager wm object what string dockable super wm if what null throw new null pointer exception what must be non null this what what this dockable dockable dockablewindowupdate dockablewindowupdate dockablewindowmanager nullpointerexception get what method returns what caused this dockable update public object get what return what getwhat getwhat get dockable method returns the dockable in question or null if the message type is code properties changed code public string get dockable return dockable getdockable properties_changed getdockable param string method public string param string return what what dockable dockable super param string paramstring paramstring paramstring public buffer switcher edit pane edit pane this edit pane edit pane set font new font dialog font bold 10 set renderer new buffer cell renderer set maximum row count j edit get integer property buffer switcher max row count 10 add action listener new action handler bufferswitcher editpane editpane editpane editpane setfont setrenderer buffercellrenderer setmaximumrowcount jedit getintegerproperty bufferswitcher maxrowcount addactionlistener actionhandler public void update buffer list if the buffer count becomes 0 then it is guaranteed to become 1 very soon so don t do anything in that case if j edit get buffer count 0 return updating true set maximum row count j edit get integer property buffer switcher max row count 10 set model new default combo box model j edit get buffers set selected item edit pane get buffer updating false updatebufferlist jedit getbuffercount setmaximumrowcount jedit getintegerproperty bufferswitcher maxrowcount setmodel defaultcomboboxmodel jedit getbuffers setselecteditem editpane getbuffer public void action performed action event evt if updating buffer buffer buffer get selected item if buffer null edit pane set buffer buffer actionperformed actionevent getselecteditem editpane setbuffer public component get list cell renderer component j list list object value int index boolean is selected boolean cell has focus super get list cell renderer component list value index is selected cell has focus buffer buffer buffer value if buffer null set icon null else set icon buffer get icon return this getlistcellrenderercomponent jlist isselected cellhasfocus getlistcellrenderercomponent isselected cellhasfocus seticon seticon geticon init method public static void init j frame set default look and feel decorated j edit get boolean property decorate frames j dialog set default look and feel decorated j edit get boolean property decorate dialogs keyboard focus manager set current keyboard focus manager new my focus manager edit bus add to bus new eb component public void handle message eb message msg if msg instanceof view update view update vu view update msg if vu get what view update created vu get view set focus traversal policy new my focus traversal policy else if msg instanceof edit pane update edit pane update eu edit pane update msg if eu get what edit pane update created init text area eu get edit pane get text area clipboard selection toolkit get default toolkit get system selection if selection null log log log debug java14 class setting register to system selection registers set register new registers clipboard register selection jframe setdefaultlookandfeeldecorated jedit getbooleanproperty jdialog setdefaultlookandfeeldecorated jedit getbooleanproperty keyboardfocusmanager setcurrentkeyboardfocusmanager myfocusmanager editbus addtobus ebcomponent handlemessage ebmessage viewupdate viewupdate viewupdate getwhat viewupdate getview setfocustraversalpolicy myfocustraversalpolicy editpaneupdate editpaneupdate editpaneupdate getwhat editpaneupdate inittextarea geteditpane gettextarea getdefaulttoolkit getsystemselection setregister clipboardregister public void handle message eb message msg if msg instanceof view update view update vu view update msg if vu get what view update created vu get view set focus traversal policy new my focus traversal policy else if msg instanceof edit pane update edit pane update eu edit pane update msg if eu get what edit pane update created init text area eu get edit pane get text area handlemessage ebmessage viewupdate viewupdate viewupdate getwhat viewupdate getview setfocustraversalpolicy myfocustraversalpolicy editpaneupdate editpaneupdate editpaneupdate getwhat editpaneupdate inittextarea geteditpane gettextarea drag and drop callback method called by the text area via reflection to initiate a text drag and drop operation using the jdk 1 4 api since j edit 4 2pre5 public static void drag and drop callback j edit text area text area input event evt boolean copy log log log debug java14 class drag and drop callback transfer handler handler text area get transfer handler handler export as drag text area evt copy transfer handler copy transfer handler move draganddropcallback jedit draganddropcallback jedittextarea textarea inputevent transferhandler textarea gettransferhandler exportasdrag textarea transferhandler transferhandler init text area method static void init text area j edit text area text area text area add mouse wheel listener new mouse wheel handler drag and drop support i d just move the code to j edit text area but it depends on jdk 1 4 ap is text area set transfer handler new text area transfer handler try text area get drop target add drop target listener new drop handler text area text area set drag and drop callback java14 class get method drag and drop callback new class j edit text area class input event class boolean class catch exception e log log log error java14 class e inittextarea inittextarea jedittextarea textarea textarea addmousewheellistener mousewheelhandler jedittextarea apis textarea settransferhandler textareatransferhandler textarea getdroptarget adddroptargetlistener drophandler textarea textarea setdraganddropcallback getmethod draganddropcallback jedittextarea inputevent init buffer switcher method public static void init buffer switcher final edit pane pane buffer switcher switcher switcher add popup menu listener new popup menu listener public void popup menu will become visible popup menu event e public void popup menu will become invisible popup menu event e pane get text area request focus public void popup menu canceled popup menu event e pane get text area request focus initbufferswitcher initbufferswitcher editpane bufferswitcher addpopupmenulistener popupmenulistener popupmenuwillbecomevisible popupmenuevent popupmenuwillbecomeinvisible popupmenuevent gettextarea requestfocus popupmenucanceled popupmenuevent gettextarea requestfocus switcher add popup menu listener new popup menu listener public void popup menu will become visible popup menu event e addpopupmenulistener popupmenulistener popupmenuwillbecomevisible popupmenuevent public void popup menu will become invisible popup menu event e pane get text area request focus popupmenuwillbecomeinvisible popupmenuevent gettextarea requestfocus public void popup menu canceled popup menu event e pane get text area request focus popupmenucanceled popupmenuevent gettextarea requestfocus static class my focus manager extends default keyboard focus manager my focus manager set default focus traversal policy new layout focus traversal policy myfocusmanager defaultkeyboardfocusmanager myfocusmanager setdefaultfocustraversalpolicy layoutfocustraversalpolicy public boolean post process key event key event evt if evt is consumed component comp component evt get source if comp is showing return true for if comp instanceof view view comp process key event evt view view return true else if comp null comp instanceof window comp instanceof j edit text area break else comp comp get parent return super post process key event evt postprocesskeyevent keyevent isconsumed getsource isshowing processkeyevent jedittextarea getparent postprocesskeyevent static class my focus traversal policy extends layout focus traversal policy public component get default component container focus cycle root return gui utilities get view focus cycle root get text area myfocustraversalpolicy layoutfocustraversalpolicy getdefaultcomponent focuscycleroot guiutilities getview focuscycleroot gettextarea public void mouse wheel moved mouse wheel event e j edit text area text area j edit text area e get source move caret depending on pressed control keys alt move cursor do not select alt shift or control move cursor select shift scroll page control scroll single line else scroll 3 lines if e is alt down move caret text area e get wheel rotation e is shift down e is control down else if e is shift down scroll page text area e get wheel rotation else if e is control down scroll line text area e get wheel rotation else if e get scroll type mouse wheel event wheel unit scroll scroll line text area e get units to scroll else scroll line text area 3 e get wheel rotation mousewheelmoved mousewheelevent jedittextarea textarea jedittextarea getsource isaltdown movecaret textarea getwheelrotation isshiftdown iscontroldown isshiftdown scrollpage textarea getwheelrotation iscontroldown scrollline textarea getwheelrotation getscrolltype mousewheelevent wheel_unit_scroll scrollline textarea getunitstoscroll scrollline textarea getwheelrotation private void scroll line j edit text area text area int amt text area set first line text area get first line amt scrollline jedittextarea textarea textarea setfirstline textarea getfirstline private void scroll page j edit text area text area int amt if amt 0 text area scroll down page else text area scroll up page scrollpage jedittextarea textarea textarea scrolldownpage textarea scrolluppage private void move caret j edit text area text area int amt boolean select if amt 0 text area go to prev line select else text area go to next line select movecaret jedittextarea textarea textarea gotoprevline textarea gotonextline protected transferable create transferable j component c log log log debug this create transferable j edit text area text area j edit text area c if text area get selection count 0 return null else drag source text area return new text area selection text area createtransferable jcomponent createtransferable jedittextarea textarea jedittextarea textarea getselectioncount dragsource textarea textareaselection textarea public int get source actions j component c return copy or move getsourceactions jcomponent copy_or_move public boolean import data j component c transferable t log log log debug this import data if can import c t get transfer data flavors return false boolean return value try if t is data flavor supported data flavor java file list flavor return value import file c t else return value import text c t catch exception e log log log error this e return value false gui utilities get view c to front gui utilities get view c request focus c request focus return return value importdata jcomponent canimport gettransferdataflavors returnvalue isdataflavorsupported dataflavor javafilelistflavor returnvalue importfile returnvalue importtext returnvalue guiutilities getview tofront guiutilities getview requestfocus requestfocus returnvalue private boolean import file j component c transferable t throws exception log log log debug this file list edit pane edit pane edit pane gui utilities get component parent c edit pane class buffer buffer null object data t get transfer data data flavor java file list flavor iterator iterator list data iterator while iterator has next file file file iterator next buffer buffer j edit open file null file get path if buffer null buffer buffer if buffer null edit pane set buffer buffer edit pane get view to front edit pane get view request focus edit pane request focus return true importfile jcomponent editpane editpane editpane guiutilities getcomponentparent editpane gettransferdata dataflavor javafilelistflavor hasnext _buffer jedit openfile getpath _buffer _buffer editpane setbuffer editpane getview tofront editpane getview requestfocus editpane requestfocus private boolean import text j component c transferable t throws exception log log log debug this string string str string t get transfer data data flavor string flavor j edit text area text area j edit text area c if drag source null text area get buffer drag source get buffer compound edit true text area get buffer begin compound edit int caret text area get caret position selection s text area get selection at offset caret if user drops into the same selection where they started do nothing if s null if text area drag source return false if user drops into a selection replace selection text area set selected text s str otherwise just insert the text else text area get buffer insert caret str text area scroll to caret true return true importtext jcomponent gettransferdata dataflavor stringflavor jedittextarea textarea jedittextarea dragsource textarea getbuffer dragsource getbuffer compoundedit textarea getbuffer begincompoundedit textarea getcaretposition textarea getselectionatoffset textarea dragsource textarea setselectedtext textarea getbuffer textarea scrolltocaret protected void export done j component c transferable t int action log log log debug this export done j edit text area text area j edit text area c try if t null log log log debug this null transferrable text area select none else if t is data flavor supported data flavor string flavor log log log debug this string if action move text area set selected text null false else text area select none finally if compound edit compound edit false text area get buffer end compound edit drag source null exportdone jcomponent jedittextarea textarea jedittextarea textarea selectnone isdataflavorsupported dataflavor stringflavor textarea setselectedtext textarea selectnone compoundedit compoundedit textarea getbuffer endcompoundedit dragsource public boolean can import j component c data flavor flavors j edit text area text area j edit text area c correctly handle text flavor file list flavor text area read only do an or of all flags boolean return value false for int i 0 i flavors length i if flavors i equals data flavor java file list flavor return value true else if flavors i equals data flavor string flavor if text area is editable return value true log log log debug this can import returning return value return return value canimport jcomponent dataflavor jedittextarea textarea jedittextarea returnvalue dataflavor javafilelistflavor returnvalue dataflavor stringflavor textarea iseditable returnvalue canimport returnvalue returnvalue int saved caret drop handler j edit text area text area this text area text area savedcaret drophandler jedittextarea textarea textarea textarea public void drag enter drop target drag event dtde log log log debug this drag enter saved buffer text area get buffer text area set drag in progress true text area get buffer begin compound edit saved caret text area get caret position dragenter droptargetdragevent savedbuffer textarea getbuffer textarea setdraginprogress textarea getbuffer begincompoundedit savedcaret textarea getcaretposition public void drag over drop target drag event dtde point p dtde get location p swing utilities convert point text area p text area get painter int pos text area xy to offset p x p y text area get painter is block caret enabled text area is overwrite enabled if pos 1 text area move caret position pos j edit text area electric scroll dragover droptargetdragevent getlocation swingutilities convertpoint textarea textarea getpainter textarea xytooffset textarea getpainter isblockcaretenabled textarea isoverwriteenabled textarea movecaretposition jedittextarea electric_scroll public void drag exit drop target event dtde log log log debug this drag exit text area set drag in progress false text area get buffer end compound edit if text area get buffer saved buffer text area move caret position saved caret j edit text area electric scroll saved buffer null dragexit droptargetevent textarea setdraginprogress textarea getbuffer endcompoundedit textarea getbuffer savedbuffer textarea movecaretposition savedcaret jedittextarea electric_scroll savedbuffer public void drop drop target drop event dtde log log log debug this drop text area set drag in progress false text area get buffer end compound edit droptargetdropevent textarea setdraginprogress textarea getbuffer endcompoundedit text area selection j edit text area text area super text area get selected text this text area text area textareaselection jedittextarea textarea textarea getselectedtext textarea textarea construct a basic collection iterator param the object over which we are iterating throws java lang illegal argument exception if the argument is not a supported i e iterable type throws java lang null pointer exception if the argument is null public collection iterator object iterate over me iterator create iterator iterate over me collectioniterator illegalargumentexception nullpointerexception collectioniterator iterateoverme createiterator iterateoverme create an iterator over the given object param iterate over me object of type iterator collection or types supported by collection manager basic bsh iterator return an iterator throws java lang illegal argument exception if the argument is not a supported i e iterable type throws java lang null pointer exception if the argument is null protected iterator create iterator object iterate over me if iterate over me null throw new null pointer exception object arguments passed to the collection iterator constructor cannot be null if iterate over me instanceof iterator return iterator iterate over me if iterate over me instanceof collection return collection iterate over me iterator should we be able to iterate over maps if iterate over me instanceof map return map iterate over me entry set iterator throw new illegal argument exception cannot enumerate object of type iterate over me get class iterateoverme collectionmanager basicbshiterator illegalargumentexception nullpointerexception createiterator iterateoverme iterateoverme nullpointerexception collectioniterator iterateoverme iterateoverme iterateoverme iterateoverme iterateoverme iterateoverme entryset illegalargumentexception iterateoverme getclass fetch the next object in the iteration return the next object public object next return iterator next returns true if and only if there are more objects available via the code next code method return the next object public boolean has next return iterator has next hasnext hasnext line manager constructor public line manager end offsets new int 1 end offsets 0 1 line info new int 1 line info 0 1 screen lines shift line context new token marker line context 1 line count 1 linemanager linemanager endoffsets endoffsets lineinfo lineinfo screen_lines_shift linecontext tokenmarker linecontext linecount get line count method public final int get line count return line count getlinecount getlinecount linecount get line of offset method public int get line of offset int offset int start 0 int end line count 1 for switch end start case 0 if get line end offset start offset return start 1 else return start case 1 if get line end offset start offset if get line end offset end offset return end 1 else return end else return start default int pivot end start 2 int value get line end offset pivot if value offset return pivot 1 else if value offset start pivot 1 else end pivot 1 break getlineofoffset getlineofoffset linecount getlineendoffset getlineendoffset getlineendoffset getlineendoffset get line end offset method public final int get line end offset int line if gap line 1 line gap line return end offsets line gap width else return end offsets line getlineendoffset getlineendoffset gapline gapline endoffsets gapwidth endoffsets get fold level method public final int get fold level int line return line info line fold level mask getfoldlevel getfoldlevel lineinfo fold_level_mask also sets fold level valid flag public final void set fold level int line int level if level 0xffff limitations level 0xffff line info line line info line fold level mask level setfoldlevel lineinfo lineinfo fold_level_mask set first invalid fold level method public void set first invalid fold level int first invalid fold level this first invalid fold level first invalid fold level setfirstinvalidfoldlevel setfirstinvalidfoldlevel firstinvalidfoldlevel firstinvalidfoldlevel firstinvalidfoldlevel get first invalid fold level method public int get first invalid fold level return first invalid fold level getfirstinvalidfoldlevel getfirstinvalidfoldlevel firstinvalidfoldlevel is screen line count valid method public final boolean is screen line count valid int line return line info line screen lines valid mask 0 isscreenlinecountvalid isscreenlinecountvalid lineinfo screen_lines_valid_mask get screen line count method public final int get screen line count int line return line info line screen lines mask screen lines shift getscreenlinecount getscreenlinecount lineinfo screen_lines_mask screen_lines_shift set screen line count method public final void set screen line count int line int count if count 0x7fff limitations count 0x7fff if debug screen lines debug log log log debug this new exception set screen line count line count line info line line info line screen lines mask count screen lines shift screen lines valid mask setscreenlinecount setscreenlinecount screen_lines_debug setscreenlinecount lineinfo lineinfo screen_lines_mask screen_lines_shift screen_lines_valid_mask get line context method public final token marker line context get line context int line return line context line getlinecontext tokenmarker linecontext getlinecontext linecontext set line context method public final void set line context int line token marker line context context line context line context setlinecontext setlinecontext tokenmarker linecontext linecontext set first invalid line context method public void set first invalid line context int first invalid line context this first invalid line context first invalid line context setfirstinvalidlinecontext setfirstinvalidlinecontext firstinvalidlinecontext firstinvalidlinecontext firstinvalidlinecontext get first invalid line context method public int get first invalid line context return first invalid line context getfirstinvalidlinecontext getfirstinvalidlinecontext firstinvalidlinecontext invalidate screen line counts method public void invalidate screen line counts for int i 0 i line count i line info i screen lines valid mask invalidatescreenlinecounts invalidatescreenlinecounts linecount lineinfo screen_lines_valid_mask contentinserted method public void contentinserted integer array end offsets gap line 1 gap width 0 first invalid line context first invalid fold level 0 line count end offsets get size this end offsets end offsets get array line info new int line count for int i 0 i line info length i line info i 1 screen lines shift line context new token marker line context line count _contentinserted _contentinserted integerarray endoffsets gapline gapwidth firstinvalidlinecontext firstinvalidfoldlevel linecount endoffsets getsize endoffsets endoffsets getarray lineinfo linecount lineinfo lineinfo screen_lines_shift linecontext tokenmarker linecontext linecount content inserted method public void content inserted int start line int offset int num lines int length integer array end offsets int end line start line num lines line info start line screen lines valid mask update line info and line context arrays if num lines 0 move gap 1 0 content inserted line count num lines if this end offsets length line count int end offsetsn new int line count 1 2 system arraycopy this end offsets 0 end offsetsn 0 this end offsets length this end offsets end offsetsn if line info length line count int line infon new int line count 1 2 system arraycopy line info 0 line infon 0 line info length line info line infon if line context length line count token marker line context line contextn new token marker line context line count 1 2 system arraycopy line context 0 line contextn 0 line context length line context line contextn system arraycopy this end offsets start line this end offsets end line line count end line system arraycopy line info start line line info end line line count end line system arraycopy line context start line line context end line line count end line if start line gap line gap line num lines else if gap line 1 offset gap width if start line first invalid line context first invalid line context num lines for int i 0 i num lines i this end offsets start line i offset end offsets get i line info start line i 0 if first invalid fold level 1 first invalid fold level start line first invalid fold level start line move gap end line length content inserted contentinserted contentinserted startline numlines integerarray endoffsets endline startline numlines lineinfo startline screen_lines_valid_mask numlines movegap contentinserted linecount numlines endoffsets linecount endoffsetsn linecount endoffsets endoffsetsn endoffsets endoffsets endoffsetsn lineinfo linecount lineinfon linecount lineinfo lineinfon lineinfo lineinfo lineinfon linecontext linecount tokenmarker linecontext linecontextn tokenmarker linecontext linecount linecontext linecontextn linecontext linecontext linecontextn endoffsets startline endoffsets endline linecount endline lineinfo startline lineinfo endline linecount endline linecontext startline linecontext endline linecount endline startline gapline gapline numlines gapline gapwidth startline firstinvalidlinecontext firstinvalidlinecontext numlines numlines endoffsets startline endoffsets lineinfo startline firstinvalidfoldlevel firstinvalidfoldlevel startline firstinvalidfoldlevel startline movegap endline contentinserted content removed method public void content removed int start line int offset int num lines int length int end line start line num lines line info start line screen lines valid mask update line info and line context arrays if num lines 0 move gap 1 0 content removed if start line num lines gap line gap line num lines else if start line gap line gap line start line if start line num lines first invalid line context first invalid line context num lines else if start line first invalid line context first invalid line context start line 1 line count num lines system arraycopy end offsets end line end offsets start line line count start line system arraycopy line info end line line info start line line count start line system arraycopy line context end line line context start line line count start line if first invalid fold level 1 first invalid fold level start line first invalid fold level start line move gap start line length content removed contentremoved contentremoved startline numlines endline startline numlines lineinfo startline screen_lines_valid_mask numlines movegap contentremoved startline numlines gapline gapline numlines startline gapline gapline startline startline numlines firstinvalidlinecontext firstinvalidlinecontext numlines startline firstinvalidlinecontext firstinvalidlinecontext startline linecount numlines endoffsets endline endoffsets startline linecount startline lineinfo endline lineinfo startline linecount startline linecontext endline linecontext startline linecount startline firstinvalidfoldlevel firstinvalidfoldlevel startline firstinvalidfoldlevel startline movegap startline contentremoved set line end offset method private final void set line end offset int line int end end offsets line end setlineendoffset setlineendoffset endoffsets move gap method private final void move gap int new gap line int new gap width string method if gap line 1 gap width new gap width else if new gap line 1 if gap width 0 if debug offset debug gap line line count log log log debug this method update from gap line to line count width gap width for int i gap line i line count i set line end offset i get line end offset i gap width new gap width else if new gap line gap line if gap width 0 if debug offset debug new gap line gap line log log log debug this method update from new gap line to gap line width gap width for int i new gap line i gap line i set line end offset i get line end offset i gap width gap width new gap width else if new gap line gap line if gap width 0 if debug offset debug gap line new gap line log log log debug this method update from gap line to new gap line width gap width for int i gap line i new gap line i set line end offset i get line end offset i gap width new gap width if new gap line line count gap line 1 else gap line new gap line movegap movegap newgapline newgapwidth gapline gapwidth newgapwidth newgapline gapwidth offset_debug gapline linecount gapline linecount gapwidth gapline linecount setlineendoffset getlineendoffset gapwidth newgapwidth newgapline gapline gapwidth offset_debug newgapline gapline newgapline gapline gapwidth newgapline gapline setlineendoffset getlineendoffset gapwidth gapwidth newgapwidth newgapline gapline gapwidth offset_debug gapline newgapline gapline newgapline gapwidth gapline newgapline setlineendoffset getlineendoffset gapwidth newgapwidth newgapline linecount gapline gapline newgapline accept method public boolean accept file pathname if pathname get name ends with scpt return true if pathname get name ends with applescript return true replace this is cocoa api calls later try mrjos type type mrj file utils get file type pathname mrjos type creator mrj file utils get file creator pathname if type equals new mrjos type osas return true else if type equals new mrjos type appl creator equals new mrjos type dplt return true catch exception e return false return false getname endswith getname endswith mrjostype mrjfileutils getfiletype mrjostype mrjfileutils getfilecreator mrjostype mrjostype mrjostype re exception string msg int type int position super msg this type type this pos position reexception returns the type of the exception one of the constants listed above public int get type return type gettype returns the position relative to the string or character array being compiled where the error occurred this position is generally the point where the error was detected not necessarily the starting index of a bad subexpression public int get position return pos getposition reports the descriptive message associated with this exception as well as its index position in the string or character array being compiled public string get message object args new integer pos string buffer sb new string buffer string prefix re get localized message error prefix sb append message format format prefix args sb append n sb append super get message return sb to string getmessage stringbuffer stringbuffer getlocalizedmessage messageformat getmessage tostring public class class path exception extends util eval error public class path exception string msg super msg classpathexception utilevalerror classpathexception the main constructor all constructors should now pass through here param namespace if namespace is non null then this interpreter s root namespace will be set to the one provided if it is null a new one will be created for it param parent the parent interpreter if this interpreter is a child of another may be null children share a bsh class manager with their parent instance param source file info an informative string holding the filename or other description of the source from which this interpreter is reading used for debugging may be null public interpreter reader in print stream out print stream err boolean interactive name space namespace interpreter parent string source file info parser new parser in long t1 system current time millis this in in this out out this err err this interactive interactive debug err this parent parent if parent null set strict java parent get strict java this source file info source file info bsh class manager bcm bsh class manager create class manager this if namespace null this global name space new name space bcm global else this global name space namespace now done in name space automatically when root the classes which are imported by default global name space load default imports create the root bsh system object if it doesn t exist if getu bsh instanceof bsh this init root system object if interactive loadrc files long t2 system current time millis if interpreter debug interpreter debug time to initialize interpreter t2 t1 bshclassmanager sourcefileinfo printstream printstream namespace sourcefileinfo currenttimemillis setstrictjava getstrictjava sourcefileinfo sourcefileinfo bshclassmanager bshclassmanager createclassmanager globalnamespace namespace globalnamespace namespace globalnamespace loaddefaultimports initrootsystemobject loadrcfiles currenttimemillis public interpreter reader in print stream out print stream err boolean interactive name space namespace this in out err interactive namespace null null printstream printstream namespace public interpreter reader in print stream out print stream err boolean interactive this in out err interactive null printstream printstream construct a new interactive interpreter attached to the specified console using the specified parent namespace public interpreter console interface console name space global name space this console get in console get out console get err true global name space set console console consoleinterface namespace globalnamespace getin getout geterr globalnamespace setconsole construct a new interactive interpreter attached to the specified console public interpreter console interface console this console null consoleinterface create an interpreter for evaluation only public interpreter this new string reader system out system err false null eval only true setu bsh eval only new primitive true stringreader evalonly evalonly attach a console note this method is incomplete public void set console console interface console this console console setu bsh console console redundant with constructor set out console get out set err console get err need to set the input stream reinit the parser setconsole consoleinterface setout getout seterr geterr private void init root system object bsh class manager bcm get class manager bsh setu bsh new name space bcm bsh object get this this init the static shared shared object if it s not there yet if shared object null shared object new name space bcm bsh shared system object get this this bsh system setu bsh system shared object setu bsh shared shared object alias bsh help this help text new name space bcm bsh command help text get this this setu bsh help help text bsh cwd try setu bsh cwd system get property user dir catch security exception e applets can t see sys props setu bsh cwd bsh interactive setu bsh interactive new primitive interactive bsh eval only setu bsh eval only new primitive eval only initrootsystemobject bshclassmanager getclassmanager namespace getthis sharedobject sharedobject sharedobject namespace getthis sharedobject sharedobject helptext namespace getthis helptext getproperty securityexception evalonly evalonly evalonly set the global namespace for this interpreter p note this is here for completeness if you re using this a lot it may be an indication that you are doing more work than you have to for example caching the interpreter instance rather than the namespace should not add a significant overhead no state other than the debug status is stored in the interpreter p all features of the namespace can also be accessed using the interpreter via eval and the script variable this namespace or global namespace as necessary public void set name space name space global name space this global name space global name space setnamespace namespace globalnamespace globalnamespace globalnamespace get the global namespace of this interpreter p note this is here for completeness if you re using this a lot it may be an indication that you are doing more work than you have to for example caching the interpreter instance rather than the namespace should not add a significant overhead no state other than the debug status is stored in the interpreter p all features of the namespace can also be accessed using the interpreter via eval and the script variable this namespace or global namespace as necessary public name space get name space return global name space namespace getnamespace globalnamespace run the text only interpreter on the command line or specify a file public static void main string args if args length 0 string filename args 0 string bsh args if args length 1 bsh args new string args length 1 system arraycopy args 1 bsh args 0 args length 1 else bsh args new string 0 interpreter interpreter new interpreter interpreter setu bsh args bsh args try object result interpreter source filename interpreter global name space if result instanceof class try invoke main class result bsh args catch exception e object o e if e instanceof invocation target exception o invocation target exception e get target exception system err println class result main method threw exception o catch file not found exception e system out println file not found e catch target error e system out println script threw exception e if e in native code e print stack trace debug system err catch eval error e system out println evaluation error e catch io exception e system out println i o error e else workaround for jdk bug 4071281 where system in available returns too large a value this bug has been fixed in jdk 1 2 input stream src if system get property os name starts with windows system get property java version starts with 1 1 src new filter input stream system in public int available throws io exception return 0 else src system in reader in new command line reader new input stream reader src interpreter interpreter new interpreter in system out system err true interpreter run bshargs bshargs bshargs bshargs bshargs globalnamespace invokemain bshargs invocationtargetexception invocationtargetexception gettargetexception filenotfoundexception targeterror innativecode printstacktrace evalerror ioexception inputstream getproperty startswith getproperty startswith filterinputstream ioexception commandlinereader inputstreamreader src new filter input stream system in public int available throws io exception return 0 filterinputstream ioexception public static void invoke main class clas string args throws exception method main reflect resolve java method null bsh class manager clas main new class string class true only static if main null main invoke null new object args invokemain resolvejavamethod bshclassmanager onlystatic run interactively printing prompts etc public void run if eval only throw new runtime exception bsh interpreter no stream we ll print our banner using eval string in order to exercise the parser and get the basic expression classes loaded this ameliorates the delay after typing the first statement if interactive try eval print banner catch eval error e println bean shell version by pat niemeyer pat pat net init the callstack call stack callstack new call stack global name space boolean eof false while eof try try to sync up the console system out flush system err flush thread yield this helps a little if interactive print get bsh prompt eof line if get jjtree node arity 0 number of child nodes simple node node simple node get jjtree root node if debug node dump object ret node eval callstack this sanity check during development if callstack depth 1 throw new interpreter error callstack growing callstack if ret instanceof return control ret return control ret value if ret primitive void setu ret object show getu bsh show if show instanceof boolean boolean show boolean value true println ret catch parse exception e error parser error e get message debug if debug e print stack trace if interactive eof true parser re init input in catch interpreter error e error internal error e get message e print stack trace if interactive eof true catch target error e error uncaught exception e if e in native code e print stack trace debug err if interactive eof true setu e e get target catch eval error e if interactive error eval error e to string else error eval error e get message if debug e print stack trace if interactive eof true catch exception e error unknown error e if debug e print stack trace if interactive eof true catch token mgr error e error error parsing input e we get stuck in infinite loops here when unicode escapes fail must re init the char stream reader ascii ucodeesc charstream java parser re init token input in if interactive eof true finally get jjtree reset reinit the callstack if callstack depth 1 callstack clear callstack push global name space if interactive exit oneof system exit 0 evalonly runtimeexception printbanner evalerror beanshell callstack callstack globalnamespace getbshprompt get_jjtree nodearity simplenode simplenode get_jjtree rootnode interpretererror returncontrol returncontrol _ booleanvalue parseexception getmessage printstacktrace reinitinput interpretererror getmessage printstacktrace targeterror innativecode printstacktrace _e gettarget evalerror evalerror tostring evalerror getmessage printstacktrace printstacktrace tokenmgrerror ascii_ucodeesc_charstream reinittokeninput get_jjtree globalnamespace exitoneof read text from file name and eval it public object source string filename name space name space throws file not found exception io exception eval error file file path to file filename if interpreter debug debug sourcing file file reader source in new buffered reader new file reader file try return eval source in name space filename finally source in close filename namespace namespace filenotfoundexception ioexception evalerror pathtofile sourcein bufferedreader filereader sourcein namespace sourcein read text from file name and eval it convenience method use the global namespace public object source string filename throws file not found exception io exception eval error return source filename global name space filename filenotfoundexception ioexception evalerror globalnamespace spawn a non interactive local interpreter to evaluate text in the specified namespace return value is the evaluated object or corresponding primitive wrapper param source file info is for information purposes only it is used to display error messages and in the future may be made available to the script throws eval error on script problems throws target error on unhandled exceptions from the script note we need a form of eval that passes the callstack through can t this be combined with run run seems to have stuff in it for interactive vs non interactive compare them side by side and see what they do differently aside from the exception handling public object eval reader in name space name space string source file info call stack callstack throws eval error object ret val null if interpreter debug debug eval name space name space create non interactive local interpreter for this namespace with source from the input stream and out err same as this interpreter interpreter local interpreter new interpreter in out err false name space this source file info call stack callstack new call stack name space boolean eof false while eof simple node node null try eof local interpreter line if local interpreter get jjtree node arity 0 node simple node local interpreter get jjtree root node nodes remember from where they were sourced node set source file source file info if trace println node get text ret val node eval callstack local interpreter sanity check during development if callstack depth 1 throw new interpreter error callstack growing callstack if ret val instanceof return control ret val return control ret val value break non interactive return control now catch parse exception e throw new eval error sourced file source file info parser error e get message debug node callstack if debug show extra expecting info error e get message debug add the source file info and throw again e set error source file source file info throw e catch interpreter error e e print stack trace throw new eval error sourced file source file info internal error e get message node callstack catch target error e failsafe set the line as the origin of the error if e get node null e set node node e re throw sourced file source file info catch eval error e if debug e print stack trace failsafe set the line as the origin of the error if e get node null e set node node e re throw sourced file source file info catch exception e if debug e print stack trace throw new eval error sourced file source file info unknown error e get message node callstack catch token mgr error e throw new eval error sourced file source file info token parsing error e get message node callstack finally local interpreter get jjtree reset reinit the callstack if callstack depth 1 callstack clear callstack push name space return primitive unwrap ret val sourcefileinfo evalerror targeterror namespace namespace sourcefileinfo callstack evalerror retval namespace namespace localinterpreter namespace sourcefileinfo callstack callstack namespace simplenode localinterpreter localinterpreter get_jjtree nodearity simplenode localinterpreter get_jjtree rootnode setsourcefile sourcefileinfo gettext retval localinterpreter interpretererror retval returncontrol retval returncontrol retval parseexception evalerror sourcefileinfo getmessage getmessage seterrorsourcefile sourcefileinfo interpretererror printstacktrace evalerror sourcefileinfo getmessage targeterror getnode setnode rethrow sourcefileinfo evalerror printstacktrace getnode setnode rethrow sourcefileinfo printstacktrace evalerror sourcefileinfo getmessage tokenmgrerror evalerror sourcefileinfo getmessage localinterpreter get_jjtree namespace retval evaluate the inputstream in this interpreter s global namespace public object eval reader in throws eval error return eval in global name space eval stream evalerror globalnamespace evaluate the string in this interpreter s global namespace public object eval string statements throws eval error if interpreter debug debug eval string statements return eval statements global name space evalerror globalnamespace evaluate the string in the specified namespace public object eval string statements name space name space throws eval error string s statements ends with statements statements return eval new string reader s name space inline evaluation of show eval string s namespace namespace evalerror endswith stringreader namespace showevalstring private string show eval string string s s s replace n s s replace r if s length 80 s s substring 0 80 return s showevalstring print an error message in a standard format on the output stream associated with this interpreter on the gui console this will appear in red etc public final void error object o if console null console error error o n else err println error o err flush get the input stream associated with this interpreter this may be be stdin or the gui console get the outptut stream associated with this interpreter this may be be stdout or the gui console get the error output stream associated with this interpreter this may be be stderr or the gui console public print stream get err return err public final void println object o print string value of o system line separator printstream geterr valueof systemlineseparator public final void print object o if console null console print o else out print o out flush print a debug message on debug stream associated with this interpreter only if debugging is turned on public final static void debug string s if debug debug println debug s get the value of the name name may be any value e g a variable or field public object get string name throws eval error try object ret global name space get name this return primitive unwrap ret catch util eval error e throw e to eval error simple node javacode new call stack evalerror globalnamespace utilevalerror toevalerror simplenode callstack unchecked get for internal use object getu string name try return get name catch eval error e throw new interpreter error set e evalerror interpretererror assign the value to the name name may evaluate to anything assignable e g a variable or field public void set string name object value throws eval error map null to primtive null coming in if value null value primitive null call stack callstack new call stack try if name is compound name lhs lhs global name space get name resolver name tolhs callstack this lhs assign value false else optimization for common case global name space set variable name value false catch util eval error e throw e to eval error simple node javacode callstack evalerror callstack callstack iscompound globalnamespace getnameresolver globalnamespace setvariable utilevalerror toevalerror simplenode unchecked set for internal use void setu string name object value try set name value catch eval error e throw new interpreter error set e evalerror interpretererror public void set string name long value throws eval error set name new primitive value evalerror set name new primitive value public void set string name int value throws eval error set name new primitive value evalerror set name new primitive value public void set string name double value throws eval error set name new primitive value evalerror set name new primitive value public void set string name float value throws eval error set name new primitive value evalerror set name new primitive value public void set string name boolean value throws eval error set name new primitive value evalerror unassign the variable name name should evaluate to a variable public void unset string name throws eval error we jump through some hoops here to handle arbitrary cases like unset bsh foo call stack callstack new call stack try lhs lhs global name space get name resolver name tolhs callstack this if lhs type lhs variable throw new eval error can t unset not a variable name simple node javacode new call stack lhs assign null false lhs name space unset variable name catch util eval error e throw new eval error e get message simple node javacode new call stack evalerror callstack callstack globalnamespace getnameresolver evalerror simplenode callstack namespace unsetvariable utilevalerror evalerror getmessage simplenode callstack get a reference to the interpreter global namespace cast to the specified interface type assuming the appropriate methods of the interface are defined in the interpreter then you may use this interface from java just like any other java object p for example pre interpreter interpreter new interpreter define a method called run interpreter eval run fetch a reference to the interpreter as a runnable runnable runnable runnable interpreter get interface runnable class pre p note that the interpreter does not require that any or all of the methods of the interface be defined at the time the interface is generated however if you attempt to invoke one that is not defined you will get a runtime exception p note also that this convenience method has exactly the same effect as evaluating the script pre type this pre p for example the following is identical to the previous example p pre fetch a reference to the interpreter as a runnable runnable runnable runnable interpreter eval runnable this pre p em version requirement em although standard java interface types are always available to be used with arbitrary interfaces this feature requires that you are using java 1 3 or greater p throws eval error if the interface cannot be generated because the version of java does not support the proxy mechanism public object get interface class interf throws eval error try return global name space get this this get interface interf catch util eval error e throw e to eval error simple node javacode new call stack getinterface evalerror getinterface evalerror globalnamespace getthis getinterface utilevalerror toevalerror simplenode callstack methods for interacting with parser private jjt parser state get jjtree return parser jjtree jjtparserstate get_jjtree private java char stream get jj input stream return parser jj input stream javacharstream get_jj_input_stream jj_input_stream private boolean line throws parse exception return parser line parseexception void loadrc files try string rcfile default is c windows under win98 home under unix system get property user home file separator bshrc source rcfile global name space catch exception e squeltch security exception filenotfoundexception if interpreter debug debug could not find rc file e loadrcfiles getproperty globalnamespace localize a path to the file name based on the bsh cwd interpreter working directory public file path to file string file name throws io exception file file new file file name if relative fix up to bsh cwd if file is absolute string cwd string getu bsh cwd file new file cwd file separator file name the canonical file name is also absolute no need for get absolute path here return new file file get canonical path pathtofile filename ioexception filename isabsolute filename getabsolutepath getcanonicalpath public static void redirect output to file string filename try print stream pout new print stream new file output stream filename system set out pout system set err pout catch io exception e system err println can t redirect output to file filename redirectoutputtofile printstream printstream fileoutputstream setout seterr ioexception set an external class loader to be used for all basic class loading in bean shell p bean shell will use this at the same point it would otherwise use the plain class for name i e if no explicit classpath management is done from the script add class path set class path reload classes then bean shell will only use the supplied classloader if additional classpath management is done then bean shell will perform that in addition to the supplied external classloader however bean shell is not currently able to reload classes supplied through the external classloader p see bsh class manager set class loader class loader public void set class loader class loader externalcl get class manager set class loader externalcl beanshell beanshell forname addclasspath setclasspath reloadclasses beanshell beanshell beanshell bshclassmanager setclassloader classloader setclassloader classloader getclassmanager setclassloader get the class manager associated with this interpreter the bsh class manager of this interpreter s global namespace this is primarily a convenience method public bsh class manager get class manager return get name space get class manager bshclassmanager bshclassmanager getclassmanager getnamespace getclassmanager set strict java mode on or off this mode attempts to make bean shell syntax behave as java syntax eliminating conveniences like loose variables etc when enabled variables are required to be declared or initialized before use and method arguments are reqired to have types p this mode will become more strict in a future release when classes are interpreted and there is an alternative to scripting objects as method closures public void set strict java boolean b this strict java b beanshell setstrictjava strictjava see set strict java boolean public boolean get strict java return this strict java setstrictjava getstrictjava strictjava static void static init apparently in some environments you can t catch the security exception at all e g as an applet in ie will probably have to work around try system line separator system get property line separator debug system err debug boolean get boolean debug trace boolean get boolean trace localscoping boolean get boolean localscoping string outfilename system get property outfile if outfilename null redirect output to file outfilename catch security exception e system err println could not init static e catch exception e system err println could not init static 2 e catch throwable e system err println could not init static 3 e staticinit systemlineseparator getproperty getboolean getboolean getboolean getproperty redirectoutputtofile securityexception specify the source of the text from which this interpreter is reading note there is a difference between what file the interrpeter is sourcing and from what file a method was originally parsed one file may call a method sourced from another file see simple node for origination file info see bsh simple node get source file public string get source file info if source file info null return source file info else return unknown source simplenode simplenode getsourcefile getsourcefileinfo sourcefileinfo sourcefileinfo get the parent interpreter of this interpreter if any currently this relationship implies the following 1 parent and child share a bsh class manager 2 children indicate the parent s source file information in error reporting when created as part of a source eval the child also shares the parent s namespace but that is not necessary in general public interpreter get parent return parent bshclassmanager getparent public void set out print stream out this out out setout printstream this out out public void set err print stream err this err err seterr printstream de serialization setup default out and err streams to stdout stderr if they are null private void read object object input stream stream throws java io io exception class not found exception stream default read object set transient fields if console null set out console get out set err console get err else set out system out set err system err readobject objectinputstream ioexception classnotfoundexception defaultreadobject setout getout seterr geterr setout seterr get the prompt string defined by the get bsh prompt method in the global namespace this may be from the get bsh prompt command or may be defined by the user as with any other method defaults to bsh if the method is not defined or there is an error private string get bsh prompt try return string eval get bsh prompt catch exception e return bsh getbshprompt getbshprompt getbshprompt getbshprompt specify whether in interactive mode the interpreter exits java upon end of input if true when in interactive mode the interpreter will issue a system exit 0 upon eof if false the interpreter no system exit will be done p note if you wish to cause an eof externally you can try closing the input stream this is not guaranteed to work in older versions of java due to java limitations but should work in newer jdk jr es that was the motivation for the java nio package public void set exit oneof boolean value exit oneof value ug jres setexitoneof exitoneof complete word method public static void complete word view view j edit text area text area view get text area buffer buffer view get buffer int caret line text area get caret line int caret text area get caret position if buffer is editable text area get toolkit beep return keyword map keyword map buffer get keyword map at offset caret string no word sep get non alpha numeric word chars buffer keyword map string word get word to complete buffer caret line caret no word sep if word null text area get toolkit beep return completion completions get completions buffer word caret if completions length 0 text area get toolkit beep if there is only one competion insert in buffer else if completions length 1 completion c completions 0 if c text equals word text area get toolkit beep else text area set selected text c text substring word length show popup if 1 else string longest prefix misc utilities get longest prefix completions keyword map null keyword map get ignore case false if word length longest prefix length buffer insert caret longest prefix substring word length text area scroll to caret false point location text area offset toxy caret word length location y text area get painter get font metrics get height swing utilities convert point to screen location text area get painter new complete word view longest prefix completions location no word sep completeword completeword jedittextarea textarea gettextarea getbuffer caretline textarea getcaretline textarea getcaretposition iseditable textarea gettoolkit keywordmap keywordmap getkeywordmapatoffset nowordsep getnonalphanumericwordchars keywordmap getwordtocomplete caretline nowordsep textarea gettoolkit getcompletions textarea gettoolkit textarea gettoolkit textarea setselectedtext longestprefix miscutilities getlongestprefix keywordmap keywordmap getignorecase longestprefix longestprefix textarea scrolltocaret textarea offsettoxy textarea getpainter getfontmetrics getheight swingutilities convertpointtoscreen textarea getpainter completeword longestprefix nowordsep complete word constructor public complete word view view string word completion completions point location string no word sep super view this no word sep no word sep set content pane new j panel new border layout returns if this component can be traversed by pressing the tab key this returns false public boolean is managing focus return false makes the tab key work in java 1 4 public boolean get focus traversal keys enabled return false this view view this text area view get text area this buffer view get buffer this word word words new j list completions words set visible row count math min completions length 8 words add mouse listener new mouse handler words set selected index 0 words set selection mode list selection model single selection words set cell renderer new renderer stupid scrollbar policy is an attempt to work around bugs people have been seeing with ibm s jdk 7 sep 2000 j scroll pane scroller new j scroll pane words j scroll pane vertical scrollbar always j scroll pane horizontal scrollbar never get content pane add scroller border layout center gui utilities request focus this words pack set location location set visible true key handler key handler new key handler add key listener key handler words add key listener key handler view set key event interceptor key handler completeword completeword nowordsep nowordsep nowordsep setcontentpane jpanel borderlayout ismanagingfocus getfocustraversalkeysenabled textarea gettextarea getbuffer jlist setvisiblerowcount addmouselistener mousehandler setselectedindex setselectionmode listselectionmodel single_selection setcellrenderer jscrollpane jscrollpane jscrollpane vertical_scrollbar_always jscrollpane horizontal_scrollbar_never getcontentpane borderlayout guiutilities requestfocus setlocation setvisible keyhandler keyhandler keyhandler addkeylistener keyhandler addkeylistener keyhandler setkeyeventinterceptor keyhandler returns if this component can be traversed by pressing the tab key this returns false public boolean is managing focus return false ismanagingfocus makes the tab key work in java 1 4 public boolean get focus traversal keys enabled return false getfocustraversalkeysenabled dispose method public void dispose view set key event interceptor null super dispose swing utilities invoke later new runnable public void run text area request focus setkeyeventinterceptor swingutilities invokelater textarea requestfocus swing utilities invoke later new runnable public void run text area request focus swingutilities invokelater textarea requestfocus get non alpha numeric word chars method private static string get non alpha numeric word chars buffer buffer keyword map keyword map figure out what constitutes a word character and what doesn t string no word sep buffer get string property no word sep if no word sep null no word sep if keyword map null string keyword no word sep keyword map get non alpha numeric chars if keyword no word sep null no word sep no word sep keyword no word sep return no word sep getnonalphanumericwordchars getnonalphanumericwordchars keywordmap keywordmap nowordsep getstringproperty nowordsep nowordsep nowordsep keywordmap keywordnowordsep keywordmap getnonalphanumericchars keywordnowordsep nowordsep nowordsep keywordnowordsep nowordsep get word to complete method private static string get word to complete buffer buffer int caret line int caret string no word sep string line buffer get line text caret line int dot caret buffer get line start offset caret line if dot 0 return null char ch line char at dot 1 if character is letter or digit ch no word sep index of ch 1 attempting to expand non word char return null int word start text utilities find word start line dot 1 no word sep string word line substring word start dot if word length 0 return null return word getwordtocomplete getwordtocomplete caretline nowordsep getlinetext caretline getlinestartoffset caretline charat isletterordigit nowordsep indexof wordstart textutilities findwordstart nowordsep wordstart get completions method private static completion get completions buffer buffer string word int caret build a list of unique words in all visible buffers set completions new tree set new misc utilities string compare set buffers new hash set only complete current buffer s keyword map keyword map keyword map buffer get keyword map at offset caret string no word sep get non alpha numeric word chars buffer keyword map view views j edit get first view while views null edit pane panes views get edit panes for int i 0 i panes length i buffer b panes i get buffer if buffers contains b continue buffers add b only complete current buffer s keyword map keyword map keywordmap if b buffer keywordmap keyword map else keywordmap null int offset b buffer caret 0 get completions b word keyword map no word sep offset completions views views get next completion completion array completion completions to array new completion completions size return completion array getcompletions getcompletions treeset miscutilities stringcompare hashset keywordmap keywordmap getkeywordmapatoffset nowordsep getnonalphanumericwordchars keywordmap jedit getfirstview editpane geteditpanes getbuffer keywordmap _keywordmap _keywordmap keywordmap _keywordmap getcompletions keywordmap nowordsep getnext completionarray toarray completionarray get completions method private static void get completions buffer buffer string word keyword map keyword map string no word sep int caret set completions int word len word length try to find matching keywords if keyword map null string keywords keyword map get keywords for int i 0 i keywords length i string keyword keywords i if keyword region matches keyword map get ignore case 0 word 0 word len completion keyword new completion keyword true if completions contains keyword completions add keyword loop through all lines of current buffer for int i 0 i buffer get line count i string line buffer get line text i int start buffer get line start offset i check for match at start of line if line starts with word caret start word length string word complete word line 0 no word sep completion comp new completion word false remove duplicates if completions contains comp completions add comp check for match inside line int len line length word length for int j 0 j len j char c line char at j if character is letter or digit c no word sep index of c 1 if line region matches j 1 word 0 word len caret start j word length 1 string word complete word line j 1 no word sep completion comp new completion word false remove duplicates if completions contains comp completions add comp getcompletions getcompletions keywordmap keywordmap nowordsep wordlen keywordmap keywordmap getkeywords _keyword _keyword regionmatches keywordmap getignorecase wordlen _keyword getlinecount getlinetext getlinestartoffset startswith _word completeword nowordsep _word charat isletterordigit nowordsep indexof regionmatches wordlen _word completeword nowordsep _word complete word method private static string complete word string line int offset string no word sep 1 so that find word end doesn t pick up the space at the start int word end text utilities find word end line offset 1 no word sep return line substring offset word end completeword completeword nowordsep findwordend wordend textutilities findwordend nowordsep wordend insert selected method private void insert selected text area set selected text words get selected value to string substring word length dispose insertselected insertselected textarea setselectedtext getselectedvalue tostring completion string text boolean keyword this text text this keyword keyword public string to string return text tostring public int hash code return text hash code hashcode hashcode public boolean equals object obj if obj instanceof completion return completion obj text equals text else return false public component get list cell renderer component j list list object value int index boolean is selected boolean cell has focus super get list cell renderer component list null index is selected cell has focus completion comp completion value if index 9 set text index 1 comp text else if index 9 set text 0 comp text else set text comp text if comp keyword set font list get font derive font font bold else set font list get font return this getlistcellrenderercomponent jlist isselected cellhasfocus getlistcellrenderercomponent isselected cellhasfocus settext settext settext setfont getfont derivefont setfont getfont key pressed method public void key pressed key event evt switch evt get key code case key event vk tab case key event vk enter insert selected evt consume break case key event vk escape dispose evt consume break case key event vk up int selected words get selected index if selected 0 selected words get model get size 1 else if get focus owner words return else selected selected 1 words set selected index selected words ensure index is visible selected evt consume break case key event vk down int selected words get selected index if selected words get model get size 1 selected 0 else if get focus owner words return else selected selected 1 words set selected index selected words ensure index is visible selected evt consume break case key event vk back space if word length 1 text area backspace evt consume dispose else word word substring 0 word length 1 text area backspace int caret text area get caret position completion completions get completions buffer word caret if completions length 0 dispose return words set list data completions words set selected index 0 words set visible row count math min completions length 8 pack evt consume break default if evt is action key evt is control down evt is alt down evt is meta down dispose view process key event evt break keypressed keypressed keyevent getkeycode keyevent vk_tab keyevent vk_enter insertselected keyevent vk_escape keyevent vk_up getselectedindex getmodel getsize getfocusowner setselectedindex ensureindexisvisible keyevent vk_down getselectedindex getmodel getsize getfocusowner setselectedindex ensureindexisvisible keyevent vk_back_space textarea textarea textarea getcaretposition getcompletions setlistdata setselectedindex setvisiblerowcount isactionkey iscontroldown isaltdown ismetadown processkeyevent key typed method public void key typed key event evt char ch evt get key char evt key event workaround process key event evt if evt null return if character is digit ch int index ch 0 if index 0 index 9 else index if index words get model get size words set selected index index text area set selected text words get model get element at index to string substring word length dispose return else fall through t handled above if ch b ch t eg foo c b will insert foobar if character is letter or digit ch no word sep index of ch 1 insert selected text area user input ch dispose return text area user input ch word word ch int caret text area get caret position completion completions get completions buffer word caret if completions length 0 dispose return words set list data completions words set selected index 0 words set visible row count math min completions length 8 keytyped keytyped keyevent getkeychar keyeventworkaround processkeyevent isdigit getmodel getsize setselectedindex textarea setselectedtext getmodel getelementat tostring isletterordigit nowordsep indexof insertselected textarea userinput textarea userinput textarea getcaretposition getcompletions setlistdata setselectedindex setvisiblerowcount class mouse handler extends mouse adapter public void mouse clicked mouse event evt insert selected mousehandler mouseadapter mouseclicked mouseevent insertselected construct a new parser with no associated handler see set handler see parse public xml parser sethandler xmlparser set the handler that will receive parsing events param handler the handler to receive callback events see parse see xml handler public void set handler xml handler handler this handler handler xmlhandler sethandler xmlhandler parse an xml document from a uri p you may parse a document more than once but only one thread may call this method for an object at one time param system id the uri of the document param public id the public identifier of the document or null param encoding the suggested encoding or null if unknown exception java lang exception any exception thrown by your own handlers or any derivation of java io io exception thrown by the parser itself public void parse string system id string public id string encoding throws java lang exception do parse system id public id null null encoding systemid publicid ioexception systemid publicid doparse systemid publicid parse an xml document from a byte stream p the uri that you supply will become the base uri for resolving relative links but a elig lfred will actually read the document from the supplied input stream p you may parse a document more than once but only one thread may call this method for an object at one time param system id the base uri of the document or null if not known param public id the public identifier of the document or null if not known param stream a byte input stream param encoding the suggested encoding or null if unknown exception java lang exception any exception thrown by your own handlers or any derivation of java io io exception thrown by the parser itself public void parse string system id string public id input stream stream string encoding throws java lang exception do parse system id public id null stream encoding aelig systemid publicid ioexception systemid publicid inputstream doparse systemid publicid parse an xml document from a character stream p the uri that you supply will become the base uri for resolving relative links but a elig lfred will actually read the document from the supplied input stream p you may parse a document more than once but only one thread may call this method for an object at one time param system id the base uri of the document or null if not known param public id the public identifier of the document or null if not known param reader a character stream exception java lang exception any exception thrown by your own handlers or any derivation of java io io exception thrown by the parser itself public void parse string system id string public id reader reader throws java lang exception do parse system id public id reader null null aelig systemid publicid ioexception systemid publicid doparse systemid publicid private synchronized void do parse string system id string public id reader reader input stream stream string encoding throws java lang exception base public id public id baseuri system id base reader reader base input stream stream initialize variables set the default entities here set internal entity intern amp 38 set internal entity intern lt 60 set internal entity intern gt 62 set internal entity intern apos 39 set internal entity intern quot 34 if handler null handler start document pushurl document base public id baseuri base reader base input stream encoding parse document if handler null handler end document cleanup variables doparse systemid publicid inputstream basepublicid publicid systemid basereader baseinputstream initializevariables setinternalentity setinternalentity setinternalentity setinternalentity setinternalentity startdocument basepublicid basereader baseinputstream parsedocument enddocument cleanupvariables report an error param message the error message param text found the text that caused the error or null see xml handler error see line void error string message string text found string text expected throws java lang exception error count if text found null message message found text found if text expected null message message expected text expected if handler null string uri null if external entity null uri external entity geturl to string handler error message uri line column textfound xmlhandler textfound textexpected errorcount textfound textfound textexpected textexpected externalentity externalentity tostring report a serious error param message the error message param text found the text that caused the error or null void error string message char text found string text expected throws java lang exception error message new character text found to string text expected textfound textfound textexpected textfound tostring textexpected parse an xml document pre 1 document prolog element misc pre p this is the top level parsing function for a single xml document as a minimum a well formed document must have a document element and a valid document must have a prolog as well void parse document throws java lang exception char c parse prolog require parse element try parse misc skip all white p is and comments c read ch if this doesn t throw an exception error unexpected characters after document end c null catch eof exception e return parsedocument parseprolog parseelement parsemisc pis readch eofexception skip a comment pre 18 comment lt char char pre p the code lt code has already been read void parse comment throws java lang exception skip until parsecomment skipuntil parse a processing instruction and do a call back pre 19 pi lt name s char char gt char gt pre p the code lt code has already been read p an xml processing instruction em must em begin with a name which is the instruction s target void parsepi throws java lang exception string name name read nmtoken true if try read require whitespace parse until if handler null handler processing instruction name data buffer to string readnmtoken tryread requirewhitespace parseuntil processinginstruction databuffertostring parse a cdata marked section pre 20 cd sect cd start c data cd end 21 cd start lt cdata 22 c data char char gt char 23 cd end gt pre p the lt cdata has already been read p note that this just appends characters to the data buffer without actually generating an event void parsecd sect throws java lang exception parse until cdsect cdstart cdata cdend cdstart cdata cdend databuffer parsecdsect parseuntil parse the prolog of an xml document pre 24 prolog xml decl misc doctypedecl misc pre p there are a couple of tricks here first it is necessary to declare the xml default attributes after the dtd if present has been read second it is not possible to expand general references in attribute value literals until after the entire dtd if present has been parsed p we do not look for the xml declaration here because it is handled by pushurl see pushurl void parse prolog throws java lang exception parse misc if try read doctype parse doctypedecl parse misc xmldecl parseprolog parsemisc tryread parsedoctypedecl parsemisc parse the xml declaration pre 25 xml decl lt xml version info encoding decl sd decl s gt 26 version info s version eq 1 0 1 0 33 sd decl s standalone eq yes no s standalone eq yes no 78 encoding decl s encoding eq q encoding pre p 80 to 82 are also significant p the code lt xml code and whitespace have already been read p todo validate value of standalone see parse text decl see check encoding void parsexml decl boolean ignore encoding throws java lang exception string version string encoding name null string standalone null read the version require version parse eq version read literal 0 if version equals 1 0 error unsupported xml version version 1 0 try reading an encoding declaration skip whitespace if try read encoding parse eq encoding name read literal 0 check encoding encoding name ignore encoding try reading a standalone declaration skip whitespace if try read standalone parse eq standalone read literal 0 skip whitespace require xmldecl versioninfo encodingdecl sddecl versioninfo sddecl encodingdecl qencoding parsetextdecl checkencoding parsexmldecl ignoreencoding encodingname parseeq readliteral skipwhitespace tryread parseeq encodingname readliteral checkencoding encodingname ignoreencoding skipwhitespace tryread parseeq readliteral skipwhitespace parse the encoding pi pre 78 encoding decl s encoding eq q encoding 79 encodingpi lt xml s encoding eq q encoding s gt 80 q encoding encoding encoding 81 encoding latin name 82 latin name a za z a za z0 9 pre p the code lt xml code and whitespace have already been read see parsexml decl see check encoding void parse text decl boolean ignore encoding throws java lang exception string encoding name null read an optional version if try read version string version parse eq version read literal 0 if version equals 1 0 error unsupported xml version version 1 0 require whitespace read the encoding require encoding parse eq encoding name read literal 0 check encoding encoding name ignore encoding skip whitespace require encodingdecl qencoding qencoding qencoding latinname latinname _ parsexmldecl checkencoding parsetextdecl ignoreencoding encodingname tryread parseeq readliteral requirewhitespace parseeq encodingname readliteral checkencoding encodingname ignoreencoding skipwhitespace check that the encoding specified makes sense p compare what the author has specified in the xml declaration or encoding pi with what we have detected p this is also important for distinguishing among the various 7 and 8 bit encodings such as iso latin 1 i cannot autodetect those param encoding name the name of the encoding specified by the user see parsexml decl see parse text decl void check encoding string encoding name boolean ignore encoding throws java lang exception encoding name encoding name to upper case if ignore encoding return switch encoding 8 bit encodings case encoding utf 8 if encoding name equals iso 8859 1 encoding encoding iso 8859 1 else if encoding name equals utf 8 error unsupported 8 bit encoding encoding name utf 8 or iso 8859 1 break 16 bit encodings case encoding ucs 2 12 case encoding ucs 2 21 if encoding name equals iso 10646 ucs 2 encoding name equals utf 16 error unsupported 16 bit encoding encoding name iso 10646 ucs 2 break 32 bit encodings case encoding ucs 4 1234 case encoding ucs 4 4321 case encoding ucs 4 2143 case encoding ucs 4 3412 if encoding name equals iso 10646 ucs 4 error unsupported 32 bit encoding encoding name iso 10646 ucs 4 encodingname parsexmldecl parsetextdecl checkencoding encodingname ignoreencoding encodingname encodingname touppercase ignoreencoding encoding_utf_8 encodingname encoding_iso_8859_1 encodingname encodingname encoding_ucs_2_12 encoding_ucs_2_21 encodingname encodingname encodingname encoding_ucs_4_1234 encoding_ucs_4_4321 encoding_ucs_4_2143 encoding_ucs_4_3412 encodingname encodingname parse miscellaneous markup outside the document element and doctype declaration pre 27 misc comment pi s pre void parse misc throws java lang exception while true skip whitespace if try read parsepi else if try read parse comment else return parsemisc skipwhitespace tryread tryread parsecomment parse a document type declaration pre 28 doctypedecl lt doctype s name s externalid s markupdecl s gt pre p the code lt doctype code has already been read void parse doctypedecl throws java lang exception char c string doctype name ids read the document type name require whitespace doctype name read nmtoken true read the externali ds skip whitespace ids read external ids false look for a declaration subset skip whitespace if try read loop until the subset ends while true context context dtd skip whitespace context context none if try read break end of subset else context context dtd parse markupdecl context context none read the external subset if any if ids 1 null pushurl external subset ids 0 ids 1 null null null loop until we end up back at while true context context dtd skip whitespace context context none if try read break else context context dtd parse markupdecl context context none else no external subset skip whitespace require if handler null handler doctype decl doctype name ids 0 ids 1 expand general entities in default values of attributes do this after the doctype decl event expand attribute default values parsedoctypedecl doctypename requirewhitespace doctypename readnmtoken externalids skipwhitespace readexternalids skipwhitespace tryread context_dtd skipwhitespace context_none tryread context_dtd parsemarkupdecl context_none context_dtd skipwhitespace context_none tryread context_dtd parsemarkupdecl context_none skipwhitespace doctypedecl doctypename doctypedecl expandattributedefaultvalues parse a markup declaration in the internal or external dtd subset pre 29 markupdecl elementdecl attlist decl entity decl notation decl pi s comment internalpe ref 30 internalpe ref pe reference 31 ext subset markupdecl conditional sect pre void parse markupdecl throws java lang exception if try read element parse elementdecl else if try read attlist parse attlist decl else if try read entity parse entity decl else if try read notation parse notation decl else if try read parsepi else if try read parse comment else if try read parse conditional sect else error expected markup declaration null null attlistdecl entitydecl notationdecl internalperef internalperef pereference extsubset conditionalsect parsemarkupdecl tryread parseelementdecl tryread parseattlistdecl tryread parseentitydecl tryread parsenotationdecl tryread tryread parsecomment tryread parseconditionalsect parse an element with its tags pre 33 s tag lt name s attribute s gt wfc unique att spec 38 element empty element s tag content e tag 39 empty element lt name s attribute s gt wfc unique att spec pre p the lt has already been read p note this method actually chains onto parse content if necessary and parse content will take care of calling parsee tag void parse element throws java lang exception string gi char c int old element content current element content string old element current element this is the global counter for the array of specified attributes tag attribute pos 0 read the element type name gi read nmtoken true determine the current content type current element gi current element content get element content type gi if current element content content undeclared current element content content any read the attributes if any after this loop we should be just in front of the closing delimiter skip whitespace c read ch while c c unread c parse attribute gi skip whitespace c read ch unread c supply any defaulted attributes enumeration atts declared attributes gi if atts null string aname loop while atts has more elements aname string atts next element see if it was specified for int i 0 i tag attribute pos i if tag attributes i aname continue loop i guess not if handler null handler attribute aname get attribute expanded value gi aname false figure out if this is a start tag or an empty element and dispatch an event accordingly c read ch switch c case if handler null handler start element gi parse content break case require if handler null handler start element gi handler end element gi break restore the previous state current element old element current element content old element content stag emptyelement stag etag emptyelement parsecontent parsecontent parseetag parseelement oldelementcontent currentelementcontent oldelement currentelement tagattributepos readnmtoken currentelement currentelementcontent getelementcontenttype currentelementcontent content_undeclared currentelementcontent content_any skipwhitespace readch parseattribute skipwhitespace readch declaredattributes hasmoreelements nextelement tagattributepos tagattributes getattributeexpandedvalue readch startelement parsecontent startelement endelement currentelement oldelement currentelementcontent oldelementcontent parse an attribute assignment pre 34 attribute name eq att value pre param name the name of the attribute s element see xml handler attribute void parse attribute string name throws java lang exception string aname int type string value read the attribute name aname read nmtoken true intern type get attribute default value type name aname parse parse eq read the value normalizing whitespace if it is not cdata if type attribute cdata type attribute undeclared value read literal lit char ref lit entity ref else value read literal lit char ref lit entity ref lit normalize inform the handler about the attribute if handler null handler attribute aname value true data buffer pos 0 note that the attribute has been specified if tag attribute pos tag attributes length string new attrib new string tag attributes length 2 system arraycopy tag attributes 0 new attrib 0 tag attribute pos tag attributes new attrib tag attributes tag attribute pos aname attvalue xmlhandler parseattribute readnmtoken getattributedefaultvaluetype parseeq attribute_cdata attribute_undeclared readliteral lit_char_ref lit_entity_ref readliteral lit_char_ref lit_entity_ref lit_normalize databufferpos tagattributepos tagattributes newattrib tagattributes tagattributes newattrib tagattributepos tagattributes newattrib tagattributes tagattributepos parse an equals sign surrounded by optional whitespace 35 eq s s void parse eq throws java lang exception skip whitespace require skip whitespace parseeq skipwhitespace skipwhitespace parse an end tag 36 e tag name s note parse content chains to here void parsee tag throws java lang exception string name name read nmtoken true if name current element error mismatched end tag name current element skip whitespace require if handler null handler end element name etag parsecontent parseetag readnmtoken currentelement currentelement skipwhitespace endelement parse the content of an element 37 content element pc data reference cd sect pi comment 68 reference entity ref char ref void parse content throws java lang exception string data char c while true switch current element content case content any case content mixed parsepc data break case content elements parse whitespace break handle delimiters c read ch switch c case found c read ch if c parse char ref else unread c parse entity ref true break case found c read ch switch c case found c read ch switch c case found require parse comment break case found require cdata parsecd sect break default error expected comment or cdata section c null break break case found data buffer flush parsepi break case found data buffer flush parsee tag return default found followed by something else data buffer flush unread c parse element break pcdata cdsect entityref charref parsecontent currentelementcontent content_any content_mixed parsepcdata content_elements parsewhitespace readch readch parsecharref parseentityref readch readch parsecomment parsecdsect databufferflush databufferflush parseetag databufferflush parseelement parse an element type declaration 40 elementdecl element s name s s s contentspec s vc unique element declaration note the element has already been read void parse elementdecl throws java lang exception string name require whitespace read the element type name name read nmtoken true require whitespace read the content model parse contentspec name skip whitespace require parseelementdecl requirewhitespace readnmtoken requirewhitespace parsecontentspec skipwhitespace content specification 41 contentspec empty any mixed elements void parse contentspec string name throws java lang exception if try read empty set element name content empty null null return else if try read any set element name content any null null return else require data buffer append skip whitespace if try read pcdata data buffer append pcdata parse mixed set element name content mixed data buffer to string null else parse elements set element name content elements data buffer to string null parsecontentspec tryread setelement content_empty tryread setelement content_any databufferappend skipwhitespace tryread databufferappend parsemixed setelement content_mixed databuffertostring parseelements setelement content_elements databuffertostring parse an element content model 42 elements choice seq 44 cps s cp s 45 choice s ctokplus s s ctoks s 46 ctokplus cps cps 47 ctoks cps cps 48 seq s stoks s s stoks s 49 stoks cps cps note the opening and s have already been read todo go over parameter entity boundaries more carefully void parse elements throws java lang exception char c char sep parse the first content particle skip whitespace parse cp check for end or for a separator skip whitespace c read ch switch c case data buffer append c read ch switch c case case case data buffer append c break default unread c return case register the separator case sep c data buffer append c break default error bad separator in content model c null return parse the rest of the content model while true skip whitespace parse cp skip whitespace c read ch if c data buffer append break else if c sep error bad separator in content model c null return else data buffer append c check for the occurrence indicator c read ch switch c case case case data buffer append c return default unread c return parseelements skipwhitespace parsecp skipwhitespace readch databufferappend readch databufferappend databufferappend skipwhitespace parsecp skipwhitespace readch databufferappend databufferappend readch databufferappend parse a content particle 43 cp name choice seq note i actually use a slightly different production here cp elements name void parse cp throws java lang exception char c if try read data buffer append parse elements else data buffer append read nmtoken true c read ch switch c case case case data buffer append c break default unread c break parsecp tryread databufferappend parseelements databufferappend readnmtoken readch databufferappend parse mixed content 50 mixed s pcdata s s mtoks s s pcdata s 51 mtoks name s s name note the s and pcdata have already been read void parse mixed throws java lang exception char c check for pcdata alone skip whitespace if try read data buffer append try read return parse mixed content skip whitespace while try read require data buffer append skip whitespace data buffer append read nmtoken true skip whitespace data buffer append parsemixed skipwhitespace tryread databufferappend tryread skipwhitespace tryread databufferappend skipwhitespace databufferappend readnmtoken skipwhitespace databufferappend parse an attribute list declaration 52 attlist decl attlist s name s att def s note the attlist has already been read void parse attlist decl throws java lang exception string element name require whitespace element name read nmtoken true require whitespace while try read parse att def element name skip whitespace attlistdecl attdef parseattlistdecl elementname requirewhitespace elementname readnmtoken requirewhitespace tryread parseattdef elementname skipwhitespace parse a single attribute definition 53 att def s name s att type s default void parse att def string element name throws java lang exception string name int type string enumeration null read the attribute name name read nmtoken true read the attribute type require whitespace type read att type get the string of enumerated values if necessary if type attribute enumerated type attribute notation enumeration data buffer to string read the default value require whitespace parse default element name name type enumeration attdef atttype parseattdef elementname readnmtoken requirewhitespace readatttype attribute_enumerated attribute_notation databuffertostring requirewhitespace parsedefault elementname parse the attribute type 54 att type string type tokenized type enumerated type 55 string type cdata 56 tokenized type id idref idrefs entity entities nmtoken nmtokens 57 enumerated type notation type enumeration todo validate the type int read att type throws java lang exception string type string integer type if try read parse enumeration return attribute enumerated else type string read nmtoken true if type string equals notation parse notation type type integer attribute type hash get type string if type null error illegal attribute type type string null return attribute undeclared else return type int value atttype stringtype tokenizedtype enumeratedtype stringtype tokenizedtype enumeratedtype notationtype readatttype typestring tryread parseenumeration attribute_enumerated typestring readnmtoken typestring parsenotationtype attributetypehash typestring typestring attribute_undeclared intvalue parse an enumeration 60 enumeration s etoks s s etoks s 61 etoks nmtoken s s nmtoken note the has already been read void parse enumeration throws java lang exception char c data buffer append read the first token skip whitespace data buffer append read nmtoken true read the remaining tokens skip whitespace while try read require data buffer append skip whitespace data buffer append read nmtoken true skip whitespace data buffer append parseenumeration databufferappend skipwhitespace databufferappend readnmtoken skipwhitespace tryread databufferappend skipwhitespace databufferappend readnmtoken skipwhitespace databufferappend parse a notation type for an attribute 58 notation type notation s s ntoks s s ntoks s 59 ntoks name s s name note the notation has already been read void parse notation type throws java lang exception require whitespace require parse enumeration notationtype parsenotationtype requirewhitespace parseenumeration parse the default value for an attribute 62 default required implied fixed s att value void parse default string element name string name int type string enumeration throws java lang exception int value type attribute default specified string value null boolean normalizews flag if try read if try read fixed value type attribute default fixed require whitespace context context attributevalue value read literal lit char ref context context dtd else if try read required value type attribute default required else if try read implied value type attribute default implied else error illegal keyword for attribute default value null null else context context attributevalue value read literal lit char ref context context dtd set attribute element name name type enumeration value value type attvalue parsedefault elementname valuetype attribute_default_specified normalizewsflag tryread tryread valuetype attribute_default_fixed requirewhitespace context_attributevalue readliteral lit_char_ref context_dtd tryread valuetype attribute_default_required tryread valuetype attribute_default_implied context_attributevalue readliteral lit_char_ref context_dtd setattribute elementname valuetype parse a conditional section 63 conditional sect include sect ignore sect 64 include sect include markupdecl 65 ignore sect ignore ignore sect contents 66 ignore sect contents skip lit comment pi char ignore sect contents char char note the has already been read todo verify that i am handling ignore sect contents right void parse conditional sect throws java lang exception skip whitespace if try read include skip whitespace require skip whitespace while try read parse markupdecl skip whitespace else if try read ignore skip whitespace require int nesting 1 char c for int nest 1 nest 0 c read ch switch c case if try read nest case if try read nest else error conditional section must begin with include or ignore null null conditionalsect includesect ignoresect includesect ignoresect ignoresectcontents ignoresectcontents skiplit ignoresectcontents ignoresectcontents parseconditionalsect skipwhitespace tryread skipwhitespace skipwhitespace tryread parsemarkupdecl skipwhitespace tryread skipwhitespace readch tryread tryread read a character reference 67 char ref 0 9 x 0 9a fa f note the has already been read void parse char ref throws java lang exception int value 0 char c if try read x loop1 while true c read ch switch c case 0 case 1 case 2 case 3 case 4 case 5 case 6 case 7 case 8 case 9 case a case a case b case b case c case c case d case d case e case e case f case f value 16 value integer parse int new character c to string 16 break case break loop1 default error illegal character in character reference c null break loop1 else loop2 while true c read ch switch c case 0 case 1 case 2 case 3 case 4 case 5 case 6 case 7 case 8 case 9 value 10 value integer parse int new character c to string 10 break case break loop2 default error illegal character in character reference c null break loop2 check for surrogates 00000000 0000xxxx yyyyyyyy zzzzzzzz 1101 10xx xxyy yyyy 1101 11yy zzzz zzzz if value 0x0000ffff no surrogates needed data buffer append char value else if value 0x000fffff 16 bits surrogate needed data buffer append char 0xd8 value 0x000ffc00 10 data buffer append char 0xdc value 0x0003ff else too big for surrogate error character reference value is too large for utf 16 new integer value to string null charref parsecharref tryread readch parseint tostring readch parseint tostring databufferappend databufferappend databufferappend tostring parse a reference 69 entity ref name note the has already been read param external allowed external entities are allowed here void parse entity ref boolean external allowed throws java lang exception string name name read nmtoken true require switch get entity type name case entity undeclared error reference to undeclared entity name null break case entity internal push string name get entity value name break case entity text if external allowed pushurl name get entity public id name get entity system id name null null null else error reference to external entity in attribute value name null break case entity ndata if external allowed error data entity reference in content name null else error reference to external entity in attribute value name null break entityref externalallowed parseentityref externalallowed readnmtoken getentitytype entity_undeclared entity_internal pushstring getentityvalue entity_text externalallowed getentitypublicid getentitysystemid entity_ndata externalallowed parse a parameter entity reference 70 pe reference name note the has already been read void parsepe reference boolean is entity value throws java lang exception string name name read nmtoken true require switch get entity type name case entity undeclared error reference to undeclared parameter entity name null break case entity internal if is entity value push string name get entity value name else push string name get entity value name break case entity text if is entity value push string null pushurl name get entity public id name get entity system id name null null null if is entity value push string null break pereference parsepereference isentityvalue readnmtoken getentitytype entity_undeclared entity_internal isentityvalue pushstring getentityvalue pushstring getentityvalue entity_text isentityvalue pushstring getentitypublicid getentitysystemid isentityvalue pushstring parse an entity declaration 71 entity decl entity s name s entity def s entity s s name s entity def s 72 entity def entity value external def 73 external def externalid n data decl 74 externalid system s system literal public s pubid literal s system literal 75 n data decl s ndata s name note the entity has already been read void parse entity decl throws java lang exception char c boolean pe flag false string name value notation name ids check for a parameter entity require whitespace if try read pe flag true require whitespace read the entity name and prepend if necessary name read nmtoken true if pe flag name name read the entity value require whitespace c read ch unread c if c c internal entity context context entityvalue value read literal lit char ref lit pe ref context context dtd set internal entity name value else read the external i ds ids read external ids false if ids 1 null error system identifer missing name null check for ndata declaration skip whitespace if try read ndata require whitespace notation name read nmtoken true set external data entity name ids 0 ids 1 notation name else set external text entity name ids 0 ids 1 finish the declaration skip whitespace require entitydecl entitydef entitydef entitydef entityvalue externaldef externaldef ndatadecl systemliteral pubidliteral systemliteral ndatadecl parseentitydecl peflag notationname requirewhitespace tryread peflag requirewhitespace readnmtoken peflag requirewhitespace readch context_entityvalue readliteral lit_char_ref lit_pe_ref context_dtd setinternalentity ids readexternalids skipwhitespace tryread requirewhitespace notationname readnmtoken setexternaldataentity notationname setexternaltextentity skipwhitespace parse a notation declaration 81 notation decl notation s name s externalid s note the notation has already been read void parse notation decl throws java lang exception string nname ids require whitespace nname read nmtoken true require whitespace read the external identifiers ids read external ids true if ids 0 null ids 1 null error external identifer missing nname null register the notation set notation nname ids 0 ids 1 skip whitespace require notationdecl parsenotationdecl requirewhitespace readnmtoken requirewhitespace readexternalids setnotation skipwhitespace parse pcdata pre 16 pc data lt amp pre p the trick here is that the data stays in the data buffer without necessarily being converted to a string right away void parsepc data throws java lang exception char c start with a little cheat in most cases the entire sequence of character data will already be in the read buffer if not fall through to the normal approach if use cheats int line augment 0 int column augment 0 loop for int i read buffer pos i read buffer length i switch read buffer i case n line augment column augment 0 break case case int start read buffer pos column augment read buffer pos i if line augment 0 line line augment column column augment else column column augment data buffer append read buffer start i start return default column augment ok the cheat didn t work start over and do it by the book while true c read ch switch c case case unread c return default data buffer append c break pcdata databuffer parsepcdata readbuffer use_cheats lineaugment columnaugment readbufferpos readbufferlength readbuffer lineaugment columnaugment readbufferpos columnaugment readbufferpos lineaugment lineaugment columnaugment columnaugment databufferappend readbuffer columnaugment readch databufferappend require whitespace characters 1 s x20 x9 xd xa void require whitespace throws java lang exception char c read ch if is whitespace c skip whitespace else error whitespace expected c null requirewhitespace readch iswhitespace skipwhitespace parse whitespace characters and leave them in the data buffer void parse whitespace throws java lang exception char c read ch while is whitespace c data buffer append c c read ch unread c parsewhitespace readch iswhitespace databufferappend readch skip whitespace characters 1 s x20 x9 xd xa void skip whitespace throws java lang exception start with a little cheat most of the time the white space will fall within the current read buffer if not then fall through if use cheats int line augment 0 int column augment 0 loop for int i read buffer pos i read buffer length i switch read buffer i case case t case r column augment break case n line augment column augment 0 break case if context context dtd context context entityvalue break loop else fall through default read buffer pos i if line augment 0 line line augment column column augment else column column augment return ok do it by the book char c read ch while is whitespace c c read ch unread c skipwhitespace use_cheats lineaugment columnaugment readbufferpos readbufferlength readbuffer columnaugment lineaugment columnaugment context_dtd context_entityvalue readbufferpos lineaugment lineaugment columnaugment columnaugment readch iswhitespace readch read a name or name token 5 name letter name char 7 nmtoken name char note 6 is implemented implicitly where required string read nmtoken boolean is name throws java lang exception char c if use cheats loop for int i read buffer pos i read buffer length i switch read buffer i case if context context dtd context context entityvalue break loop else fall through case case case case case case case case case case case case case case case t case r case n case case case int start read buffer pos if i start error name expected read buffer i null read buffer pos i return intern read buffer start i start name buffer pos 0 read the first character loop while true c read ch switch c case case case case case case case case case case case case case case case case t case n case r case case unread c if name buffer pos 0 error name expected null null string s intern name buffer 0 name buffer pos name buffer pos 0 return s default name buffer char extend array name buffer name buffer length name buffer pos name buffer name buffer pos c _ namechar namechar readnmtoken isname use_cheats readbufferpos readbufferlength readbuffer context_dtd context_entityvalue readbufferpos readbuffer readbufferpos readbuffer namebufferpos readch namebufferpos namebuffer namebufferpos namebufferpos namebuffer extendarray namebuffer namebuffer namebufferpos namebuffer namebufferpos read a literal 10 att value reference reference 11 system literal ur lchar ur lchar 13 pubid literal pubid char pubid char 9 entity value pe reference reference pe reference reference string read literal int flags throws java lang exception char delim c int start line line find the delimiter delim read ch if delim delim delim char 0 error expected or delim null return null read the literal try c read ch loop while c delim switch c literals never have line ends case n case r c break references may be allowed case if flags lit char ref 0 c read ch if c parse char ref c read ch continue loop check the next character else if flags lit entity ref 0 unread c parse entity ref false c read ch continue loop else data buffer append break default break data buffer append c c read ch catch eof exception e error end of input while looking for delimiter started on line start line null new character delim to string normalise whitespace if necessary if flags lit normalize 0 data buffer normalize return the value return data buffer to string attvalue systemliteral urlchar urlchar pubidliteral pubidchar pubidchar entityvalue pereference pereference readliteral startline readch readch lit_char_ref readch parsecharref readch lit_entity_ref parseentityref readch databufferappend databufferappend readch eofexception startline tostring lit_normalize databuffernormalize databuffertostring try reading external identifiers p the system identifier is not required for notations param in notation are we in a notation return a two member string array containing the identifiers string read external ids boolean in notation throws java lang exception char c string ids new string 2 if try read public require whitespace ids 0 read literal lit normalize public id if in notation skip whitespace if try read try read ids 1 read literal 0 else require whitespace ids 1 read literal 0 system id else if try read system require whitespace ids 1 read literal 0 system id return ids innotation readexternalids innotation tryread requirewhitespace readliteral lit_normalize innotation skipwhitespace tryread tryread readliteral requirewhitespace readliteral tryread requirewhitespace readliteral test if a character is whitespace pre 1 s x20 x9 xd xa pre param c the character to test return true if the character is whitespace final boolean is whitespace char c switch int c case 0x20 case 0x09 case 0x0d case 0x0a return true default return false iswhitespace add a character to the data buffer void data buffer append char c expand buffer if necessary data buffer char extend array data buffer data buffer length data buffer pos data buffer data buffer pos c databufferappend databuffer extendarray databuffer databuffer databufferpos databuffer databufferpos add a string to the data buffer void data buffer append string s data buffer append s to char array 0 s length databufferappend databufferappend tochararray append part of a character array to the data buffer void data buffer append char ch int start int length data buffer char extend array data buffer data buffer length data buffer pos length system arraycopy object ch start object data buffer data buffer pos length data buffer pos length databufferappend databuffer extendarray databuffer databuffer databufferpos databuffer databufferpos databufferpos normalise whitespace in the data buffer void data buffer normalize int i 0 int j 0 int end data buffer pos skip whitespace at the start while j end is whitespace data buffer j j skip whitespace at the end while end j is whitespace data buffer end 1 end start copying to the left while j end char c data buffer j normalise all other whitespace to a single space if is whitespace c while j end is whitespace data buffer j data buffer i data buffer i data buffer j 1 else data buffer i c the new length is the old one data buffer pos i databuffernormalize databufferpos iswhitespace databuffer iswhitespace databuffer databuffer iswhitespace iswhitespace databuffer databuffer databuffer databuffer databuffer databufferpos convert the data buffer to a string param intern flag true if the contents should be interned see intern char int int string data buffer to string string s new string data buffer 0 data buffer pos data buffer pos 0 return s internflag databuffertostring databuffer databufferpos databufferpos flush the contents of the data buffer to the handler if appropriate and reset the buffer for new input void data buffer flush throws java lang exception if data buffer pos 0 switch current element content case content undeclared case content empty do nothing break case content mixed case content any if handler null handler char data data buffer 0 data buffer pos break case content elements if handler null handler ignorable whitespace data buffer 0 data buffer pos break data buffer pos 0 databufferflush databufferpos currentelementcontent content_undeclared content_empty content_mixed content_any chardata databuffer databufferpos content_elements ignorablewhitespace databuffer databufferpos databufferpos require a string to appear or throw an exception void require string delim throws java lang exception char ch delim to char array for int i 0 i ch length i require ch i tochararray require a character to appear or throw an exception void require char delim throws java lang exception char c read ch if c delim error expected character c new character delim to string readch tostring return an internalised version of a string p a elig lfred uses this method to create an internalised version of all names and attribute values so that it can test equality with code code instead of code string equals code p if you want to be able to test for equality in the same way you can use this method to internalise your own strings first pre string para handler intern para pre p note that this will not return the same results as string intern param s the string to internalise return an internalised version of the string see intern char int int see java lang string intern public string intern string s char ch s to char array return intern ch 0 ch length aelig tochararray create an internalised string from a character array p this is much more efficient than constructing a non internalised string first and then internalising it p note that this will not return the same results as string intern param ch an array of characters for building the string param start the starting position in the array param length the number of characters to place in the string return an internalised string see intern string see java lang string intern public string intern char ch int start int length int index int hash 0 generate a hash code for int i start i start length i hash hash 1 0xffffff int ch i hash hash symbol table length get the bucket object bucket object symbol table hash if bucket null symbol table hash bucket new object 8 search for a matching tuple and return the string if we find one for index 0 index bucket length index 2 char ch found char bucket index stop when we hit a null index if ch found null break if they re the same length check for a match if the loop finishes index will contain the current bucket position if ch found length length for int i 0 i ch found length i stop if there are no more tuples if ch start i ch found i break else if i length 1 that s it we have a match return string bucket index 1 not found we ll have to add it do we have to grow the bucket bucket object extend array bucket bucket length index ok add it to the end of the bucket string s new string ch start length bucket index s to char array bucket index 1 s symbol table hash bucket return s symbol_table_length symboltable symboltable chfound chfound chfound chfound chfound extendarray tochararray symboltable ensure the capacity of an array allocating a new one if necessary object extend array object array int current size int required size if required size current size return array else object new array null int new size current size 2 if new size required size new size required size 1 if array instanceof char new array new char new size else if array instanceof object new array new object new size system arraycopy array 0 new array 0 current size return new array extendarray currentsize requiredsize requiredsize currentsize newarray newsize currentsize newsize requiredsize newsize requiredsize newarray newsize newarray newsize newarray currentsize newarray get the declared elements for an xml document p the results will be valid only after the dtd if any has been parsed return an enumeration of all element types declared for this document as strings see get element content type see get element content model public enumeration declared elements return element info keys getelementcontenttype getelementcontentmodel declaredelements elementinfo look up the content type of an element param name the element type name return an integer constant representing the content type see get element content model see content undeclared see content any see content empty see content mixed see content elements public int get element content type string name object element object element info get name if element null return content undeclared else return integer element 0 int value getelementcontentmodel content_undeclared content_any content_empty content_mixed content_elements getelementcontenttype elementinfo content_undeclared intvalue look up the content model of an element p the result will always be null unless the content type is content elements or content mixed param name the element type name return the normalised content model as a string see get element content type public string get element content model string name object element object element info get name if element null return null else return string element 1 content_elements content_mixed getelementcontenttype getelementcontentmodel elementinfo register an element array format element type attribute hash table void set element string name int content type string content model hashtable attributes throws java lang exception object element try looking up the element element object element info get name make a new one if necessary if element null element new object 3 element 0 new integer content undeclared element 1 null element 2 null else if content type content undeclared integer element 0 int value content undeclared error multiple declarations for element type name null return insert the content type if any if content type content undeclared element 0 new integer content type insert the content model if any if content model null element 1 content model insert the attributes if any if attributes null element 2 attributes save the element info element info put name element setelement contenttype contentmodel elementinfo content_undeclared contenttype content_undeclared intvalue content_undeclared contenttype content_undeclared contenttype contentmodel contentmodel elementinfo look up the attribute hash table for an element the hash table is the second item in the element array hashtable get element attributes string name object element object element info get name if element null return null else return hashtable element 2 getelementattributes elementinfo get the declared attributes for an element type param elname the name of the element type return an enumeration of all the attributes declared for a specific element type the results will be valid only after the dtd if any has been parsed see get attribute type see get attribute enumeration see get attribute default value type see get attribute default value see get attribute expanded value public enumeration declared attributes string elname hashtable attlist get element attributes elname if attlist null return null else return attlist keys getattributetype getattributeenumeration getattributedefaultvaluetype getattributedefaultvalue getattributeexpandedvalue declaredattributes getelementattributes retrieve the declared type of an attribute param name the name of the associated element param aname the name of the attribute return an integer constant representing the attribute type see attribute undeclared see attribute cdata see attribute id see attribute idref see attribute idrefs see attribute entity see attribute entities see attribute nmtoken see attribute nmtokens see attribute enumerated see attribute notation public int get attribute type string name string aname object attribute get attribute name aname if attribute null return attribute undeclared else return integer attribute 0 int value attribute_undeclared attribute_cdata attribute_id attribute_idref attribute_idrefs attribute_entity attribute_entities attribute_nmtoken attribute_nmtokens attribute_enumerated attribute_notation getattributetype getattribute attribute_undeclared intvalue retrieve the allowed values for an enumerated attribute type param name the name of the associated element param aname the name of the attribute return a string containing the token list see attribute enumerated see attribute notation public string get attribute enumeration string name string aname object attribute get attribute name aname if attribute null return null else return string attribute 3 attribute_enumerated attribute_notation getattributeenumeration getattribute retrieve the default value of a declared attribute param name the name of the associated element param aname the name of the attribute return the default value or null if the attribute was implied or simply undeclared and unspecified see get attribute expanded value public string get attribute default value string name string aname object attribute get attribute name aname if attribute null return null else return string attribute 1 getattributeexpandedvalue getattributedefaultvalue getattribute retrieve the expanded value of a declared attribute p all general entities will be expanded param name the name of the associated element param aname the name of the attribute return the expanded default value or null if the attribute was implied or simply undeclared see get attribute default value public string get attribute expanded value string name string aname object attribute get attribute name aname if attribute null return null else if attribute 4 null attribute 1 null try push string null char 0 string attribute 1 char 0 attribute 4 read literal lit normalize lit char ref lit entity ref catch exception e return string attribute 4 getattributedefaultvalue getattributeexpandedvalue getattribute pushstring readliteral lit_normalize lit_char_ref lit_entity_ref retrieve the default value type of a declared attribute see attribute default specified see attribute default implied see attribute default required see attribute default fixed public int get attribute default value type string name string aname object attribute get attribute name aname if attribute null return attribute default undeclared else return integer attribute 2 int value attribute_default_specified attribute_default_implied attribute_default_required attribute_default_fixed getattributedefaultvaluetype getattribute attribute_default_undeclared intvalue register an attribute declaration for later retrieval format string type string default value int value type todo do something with attribute types void set attribute string el name string name int type string enumeration string value int value type throws java lang exception hashtable attlist object attribute create a new hashtable if necessary attlist get element attributes el name if attlist null attlist new hashtable check that the attribute doesn t already exist if attlist get name null return else attribute new object 5 attribute 0 new integer type attribute 1 value attribute 2 new integer value type attribute 3 enumeration attribute 4 null attlist put name intern attribute use content undeclared to avoid overwriting existing element declaration set element el name content undeclared null attlist setattribute elname valuetype getelementattributes elname valuetype content_undeclared setelement elname content_undeclared retrieve the three member array representing an attribute declaration object get attribute string el name string name hashtable attlist object attribute attlist get element attributes el name if attlist null return null attribute object attlist get name return attribute getattribute elname getelementattributes elname get declared entities return an enumeration of all the entities declared for this xml document the results will be valid only after the dtd if any has been parsed see get entity type see get entity public id see get entity system id see get entity value see get entity notation name public enumeration declared entities return entity info keys getentitytype getentitypublicid getentitysystemid getentityvalue getentitynotationname declaredentities entityinfo find the type of an entity returns an integer constant representing the entity type see entity undeclared see entity internal see entity ndata see entity text public int get entity type string ename object entity object entity info get ename if entity null return entity undeclared else return integer entity 0 int value entity_undeclared entity_internal entity_ndata entity_text getentitytype entityinfo entity_undeclared intvalue return an external entity s public identifier if any param ename the name of the external entity return the entity s system identifier or null if the entity was not declared if it is not an external entity or if no public identifier was provided see get entity type public string get entity public id string ename object entity object entity info get ename if entity null return null else return string entity 1 getentitytype getentitypublicid entityinfo return an external entity s system identifier param ename the name of the external entity return the entity s system identifier or null if the entity was not declared or if it is not an external entity see get entity type public string get entity system id string ename object entity object entity info get ename if entity null return null else return string entity 2 getentitytype getentitysystemid entityinfo return the value of an internal entity param ename the name of the internal entity return the entity s value or null if the entity was not declared or if it is not an internal entity see get entity type public string get entity value string ename object entity object entity info get ename if entity null return null else return string entity 3 getentitytype getentityvalue entityinfo get the notation name associated with an ndata entity param ename the ndata entity name return the associated notation name or null if the entity was not declared or if it is not an ndata entity see get entity type public string get entity notation name string e name object entity object entity info get e name if entity null return null else return string entity 4 getentitytype getentitynotationname ename entityinfo ename register an entity declaration for later retrieval void set internal entity string e name string value set entity e name entity internal null null value null setinternalentity ename setentity ename entity_internal register an external data entity void set external data entity string e name string pubid string sysid string n name set entity e name entity ndata pubid sysid null n name setexternaldataentity ename nname setentity ename entity_ndata nname register an external text entity void set external text entity string e name string pubid string sysid set entity e name entity text pubid sysid null null setexternaltextentity ename setentity ename entity_text register an entity declaration for later retrieval void set entity string e name int e class string pubid string sysid string value string n name object entity if entity info get e name null entity new object 5 entity 0 new integer e class entity 1 pubid entity 2 sysid entity 3 value entity 4 n name entity info put e name entity setentity ename eclass nname entityinfo ename eclass nname entityinfo ename get declared notations return an enumeration of all the notations declared for this xml document the results will be valid only after the dtd if any has been parsed see get notation public id see get notation system id public enumeration declared notations return notation info keys getnotationpublicid getnotationsystemid declarednotations notationinfo look up the public identifier for a notation you will normally use this method to look up a notation that was provided as an attribute value or for an ndata entity param nname the name of the notation return a string containing the public identifier or null if none was provided or if no such notation was declared see get notation system id public string get notation public id string nname object notation object notation info get nname if notation null return null else return string notation 0 getnotationsystemid getnotationpublicid notationinfo look up the system identifier for a notation you will normally use this method to look up a notation that was provided as an attribute value or for an ndata entity param nname the name of the notation return a string containing the system identifier or null if no such notation was declared see get notation public id public string get notation system id string nname object notation object notation info get nname if notation null return null else return string notation 1 getnotationpublicid getnotationsystemid notationinfo register a notation declaration for later retrieval format public id system id void set notation string nname string pubid string sysid throws java lang exception object notation if notation info get nname null notation new object 2 notation 0 pubid notation 1 sysid notation info put nname notation else error multiple declarations of notation nname null setnotation notationinfo notationinfo return the current line number public int get line number return line getlinenumber return the current column number public int get column number return column getcolumnnumber read a single character from the read buffer p the read data chunk method maintains the buffer p if we hit the end of an entity try to pop the stack and keep going p this approach doesn t really enforce xml s rules about entity boundaries but this is not currently a validating parser p this routine also attempts to keep track of the current position in external entities but it s not entirely accurate return the next available input character see unread char see unread string see read data chunk see read buffer see line return the next character from the current input source char read ch throws java lang exception char c as long as there s nothing in the read buffer try reading more data for an external entity or popping the entity stack for either while read buffer pos read buffer length switch source type case input reader case input external case input stream read data chunk while read buffer length 1 pop input if read buffer length 1 read data chunk break default pop input break c read buffer read buffer pos this is a particularly nasty bit of code that checks for a parameter entity reference but peeks ahead to catch the in parameter entity declarations if c context context dtd context context entityvalue char c2 read ch unread c2 if is whitespace c2 parsepe reference context context entityvalue return read ch if c n line column 0 else column return c readbuffer readdatachunk readdatachunk readbuffer readch readbufferpos readbufferlength sourcetype input_reader input_external input_stream readdatachunk readbufferlength popinput readbufferlength readdatachunk popinput readbuffer readbufferpos context_dtd context_entityvalue readch iswhitespace parsepereference context_entityvalue readch push a single character back onto the current input stream p this method usually pushes the character back onto the read buffer while the unread string method treats the string as a new internal entity p i don t think that this would ever be called with read buffer pos 0 because the methods always reads a character before unreading it but just in case i ve added a boundary condition param c the character to push back see read ch see unread string see unread char see read buffer void unread char c throws java lang exception normal condition if c n line column 1 if read buffer pos 0 read buffer read buffer pos c else push string null new character c to string readbuffer readbufferpos readch readbuffer readbufferpos readbuffer readbufferpos pushstring tostring push a char array back onto the current input stream p note you must em never em push back characters that you haven t actually read use push string instead see read ch see unread char see unread string see read buffer see push string void unread char ch int length throws java lang exception for int i 0 i length i if ch i n line column 1 if length read buffer pos read buffer pos length else push char array null ch 0 length source type input buffer pushstring readch readbuffer pushstring readbufferpos readbufferpos pushchararray sourcetype input_buffer push a new external input source p the source will be either an external text entity or the dtd external subset p to do right now this method always attempts to autodetect the encoding in the future it should allow the caller to request an encoding explicitly and it should also look at the headers with an http connection param url the java net url object for the entity see xml handler resolve entity see push string see source type see push input see detect encoding see source type see read buffer void pushurl string ename string public id string system id reader reader input stream stream string encoding throws java lang exception url url boolean ignore encoding false push the existing status push input ename create a new read buffer note the four character margin read buffer new char read buffer max 4 read buffer pos 0 read buffer length 0 read buffer overflow 1 is null line 1 current byte count 0 flush any remaining data data buffer flush make the url absolute if system id null external entity null system id new url external entity geturl system id to string else if baseuri null try system id new url new url baseuri system id to string catch exception e see if the application wants to redirect the system id and or supply its own character stream if system id null handler null object input handler resolve entity public id system id if input null if input instanceof string system id string input else if input instanceof input stream stream input stream input else if input instanceof reader reader reader input start the entity if handler null if system id null handler start external entity system id else handler start external entity external stream figure out what we re reading from if reader null there s an explicit character stream source type input reader this reader reader try encoding decl true return else if stream null source type input stream is stream else we have to open our own stream to the url set the new status source type input external url new url system id external entity url open connection external entity connect is external entity get input stream if we get to here there must be an input stream available if is mark supported is new buffered input stream is attempt to detect the encoding if encoding null external entity null encoding external entity get content encoding if encoding null check encoding encoding false ignore encoding true else detect encoding ignore encoding false read an xml or text declaration try encoding decl ignore encoding xmlhandler resolveentity pushstring sourcetype pushinput detectencoding sourcetype readbuffer publicid systemid inputstream ignoreencoding pushinput readbuffer read_buffer_max readbufferpos readbufferlength readbufferoverflow currentbytecount databufferflush systemid externalentity systemid externalentity systemid tostring systemid systemid tostring systemid resolveentity publicid systemid systemid inputstream inputstream systemid startexternalentity systemid startexternalentity sourcetype input_reader tryencodingdecl sourcetype input_stream sourcetype input_external systemid externalentity openconnection externalentity externalentity getinputstream inputstream marksupported bufferedinputstream externalentity externalentity getcontentencoding checkencoding ignoreencoding detectencoding ignoreencoding tryencodingdecl ignoreencoding check for an encoding declaration void try encoding decl boolean ignore encoding throws java lang exception read the xml encoding declaration if try read xml if try whitespace if input stack size 0 parse text decl ignore encoding else parsexml decl ignore encoding else unread xml to char array 3 parsepi tryencodingdecl ignoreencoding tryread trywhitespace inputstack parsetextdecl ignoreencoding parsexmldecl ignoreencoding tochararray attempt to detect the encoding of an entity p the trick here as suggested in the xml standard is that any entity not in utf 8 or in ucs 2 with a byte order mark b must b begin with an xml declaration or an encoding declaration we simply have to look for lt xml in various encodings p this method has no way to distinguish among 8 bit encodings instead it assumes utf 8 then possibly revises its assumption later in check encoding any ascii derived 8 bit encoding should work but most will be rejected later by check encoding p i don t currently detect ebcdic since i m concerned that it could also be a valid utf 8 sequence i ll have to do more checking later see try encoding byte byte byte byte byte see try encoding byte byte byte see check encoding see read8bit encoding declaration void detect encoding throws java lang exception byte signature new byte 4 read the first four bytes for autodetection is mark 4 is read signature is reset look for a known signature if try encoding signature byte 0x00 byte 0x00 byte 0x00 byte 0x3c ucs 4 must begin with xml 0x00 0x00 0x00 0x3c ucs 4 big endian 1234 encoding encoding ucs 4 1234 else if try encoding signature byte 0x3c byte 0x00 byte 0x00 byte 0x00 ucs 4 must begin with xml 0x3c 0x00 0x00 0x00 ucs 4 little endian 4321 encoding encoding ucs 4 4321 else if try encoding signature byte 0x00 byte 0x00 byte 0x3c byte 0x00 ucs 4 must begin with xml 0x00 0x00 0x3c 0x00 ucs 4 unusual 2143 encoding encoding ucs 4 2143 else if try encoding signature byte 0x00 byte 0x3c byte 0x00 byte 0x00 ucs 4 must begin with xml 0x00 0x3c 0x00 0x00 ucs 4 unusual 3421 encoding encoding ucs 4 3412 else if try encoding signature byte 0xfe byte 0xff ucs 2 with a byte order marker 0xfe 0xff ucs 2 big endian 12 encoding encoding ucs 2 12 is read is read else if try encoding signature byte 0xff byte 0xfe ucs 2 with a byte order marker 0xff 0xfe ucs 2 little endian 21 encoding encoding ucs 2 21 is read is read else if try encoding signature byte 0x00 byte 0x3c byte 0x00 byte 0x3f ucs 2 without a bom must begin with xml 0x00 0x3c 0x00 0x3f ucs 2 big endian no byte order mark encoding encoding ucs 2 12 error no byte order mark for ucs 2 entity null null else if try encoding signature byte 0x3c byte 0x00 byte 0x3f byte 0x00 ucs 2 without a bom must begin with xml 0x3c 0x00 0x3f 0x00 ucs 2 little endian no byte order mark encoding encoding ucs 2 21 error no byte order mark for ucs 2 entity null null else if try encoding signature byte 0x3c byte 0x3f byte 0x78 byte 0x6d some kind of 8 bit encoding with xml 0x3c 0x3f 0x78 0x6d utf 8 or other 8 bit markup read encoding encoding encoding utf 8 read8bit encoding declaration else some kind of 8 bit encoding without xml otherwise utf 8 without encoding xml declaration encoding encoding utf 8 checkencoding checkencoding tryencoding tryencoding checkencoding read8bitencodingdeclaration detectencoding tryencoding encoding_ucs_4_1234 tryencoding encoding_ucs_4_4321 tryencoding encoding_ucs_4_2143 tryencoding encoding_ucs_4_3412 tryencoding encoding_ucs_2_12 tryencoding encoding_ucs_2_21 tryencoding encoding_ucs_2_12 tryencoding encoding_ucs_2_21 tryencoding encoding_utf_8 read8bitencodingdeclaration encoding_utf_8 check for a four byte signature p utility routine for detect encoding p always looks for some part of xml in a specific encoding param sig the first four bytes read param b1 the first byte of the signature param b2 the second byte of the signature param b3 the third byte of the signature param b4 the fourth byte of the signature see detect encoding boolean try encoding byte sig byte b1 byte b2 byte b3 byte b4 return sig 0 b1 sig 1 b2 sig 2 b3 sig 3 b4 detectencoding detectencoding tryencoding check for a two byte signature p looks for a ucs 2 byte order mark p utility routine for detect encoding param sig the first four bytes read param b1 the first byte of the signature param b2 the second byte of the signature see detect encoding boolean try encoding byte sig byte b1 byte b2 return sig 0 b1 sig 1 b2 detectencoding detectencoding tryencoding this method pushes a string back onto input p it is useful either as the expansion of an internal entity or for backtracking during the parse p call push char array to do the actual work param s the string to push back onto input see push char array void push string string ename string s throws java lang exception char ch s to char array push char array ename ch 0 ch length pushchararray pushchararray pushstring tochararray pushchararray push a new internal input source p this method is useful for expanding an internal entity or for unreading a string of characters it creates a new read buffer containing the characters in the array instead of characters converted from an input byte stream p i ve added a couple of optimisations don t push zero length strings and just push back a single character for 1 character strings this should save some time and memory param ch the char array to push see push string see pushurl see read buffer see source type see push input void push char array string ename char ch int start int length throws java lang exception push the existing status push input ename source type input internal read buffer ch read buffer pos start read buffer length length read buffer overflow 1 readbuffer pushstring readbuffer sourcetype pushinput pushchararray pushinput sourcetype input_internal readbuffer readbufferpos readbufferlength readbufferoverflow save the current input source onto the stack p this method saves all of the global variables associated with the current input source so that they can be restored when a new input source has finished it also tests for entity recursion p the method saves the following global variables onto a stack using a fixed length array ol li source type li external entity li read buffer li read buffer pos li read buffer length li line li encoding ol param ename the name of the entity if any causing the new input see pop input see source type see external entity see read buffer see read buffer pos see read buffer length see line see encoding void push input string ename throws java lang exception object input new object 12 check for entity recursion if ename null enumeration entities entity stack elements while entities has more elements string e string entities next element if e ename error recursive reference to entity ename null entity stack push ename don t bother if there is no input if source type input none return set up a snapshot of the current input source input 0 new integer source type input 1 external entity input 2 read buffer input 3 new integer read buffer pos input 4 new integer read buffer length input 5 new integer line input 6 new integer encoding input 7 new integer read buffer overflow input 8 is input 9 new integer current byte count input 10 new integer column input 11 reader push it onto the stack input stack push input sourcetype externalentity readbuffer readbufferpos readbufferlength popinput sourcetype externalentity readbuffer readbufferpos readbufferlength pushinput entitystack hasmoreelements nextelement entitystack sourcetype input_none sourcetype externalentity readbuffer readbufferpos readbufferlength readbufferoverflow currentbytecount inputstack restore a previous input source p this method restores all of the global variables associated with the current input source exception java io eof exception if there are no more entries on the input stack see push input see source type see external entity see read buffer see read buffer pos see read buffer length see line see encoding void pop input throws java lang exception object input switch source type case input external data buffer flush if handler null external entity null handler end external entity external entity geturl to string break case input stream data buffer flush if baseuri null if handler null handler end external entity baseuri break case input reader data buffer flush if baseuri null if handler null handler end external entity baseuri break throw an eof exception if there is nothing else to pop if input stack is empty throw new eof exception else string s input object input stack pop s string entity stack pop source type integer input 0 int value external entity url connection input 1 read buffer char input 2 read buffer pos integer input 3 int value read buffer length integer input 4 int value line integer input 5 int value encoding integer input 6 int value read buffer overflow integer input 7 int value is input stream input 8 current byte count integer input 9 int value column integer input 10 int value reader reader input 11 eofexception pushinput sourcetype externalentity readbuffer readbufferpos readbufferlength popinput sourcetype input_external databufferflush externalentity endexternalentity externalentity tostring input_stream databufferflush endexternalentity input_reader databufferflush endexternalentity eofexception inputstack isempty eofexception inputstack entitystack sourcetype intvalue externalentity urlconnection readbuffer readbufferpos intvalue readbufferlength intvalue intvalue intvalue readbufferoverflow intvalue inputstream currentbytecount intvalue intvalue return true if we can read the expected character p note that the character will be removed from the input stream on success but will be put back on failure do not attempt to read the character again if the method succeeds param delim the character that should appear next for a insensitive match you must supply this in upper case return true if the character was successfully read or false if it was not see try read string boolean try read char delim throws java lang exception char c read the character c read ch test for a match and push the character back if the match fails if c delim return true else unread c return false tryread tryread readch return true if we can read the expected string p this is simply a convenience method p note that the string will be removed from the input stream on success but will be put back on failure do not attempt to read the string again if the method succeeds p this method will push back a character rather than an array whenever possible probably the majority of cases p b note b this method currently has a hard coded limit of 100 characters for the delimiter param delim the string that should appear next return true if the string was successfully read or false if it was not see try read char boolean try read string delim throws java lang exception char ch delim to char array char c compare the input character by character for int i 0 i ch length i c read ch if c ch i unread c if i 0 unread ch i return false return true tryread tryread tochararray readch return true if we can read some whitespace p this is simply a convenience method p this method will push back a character rather than an array whenever possible probably the majority of cases return true if whitespace was found boolean try whitespace throws java lang exception char c c read ch if is whitespace c skip whitespace return true else unread c return false trywhitespace readch iswhitespace skipwhitespace read all data until we find the specified string p this is especially useful for scanning marked sections p this is a a little inefficient right now since it calls try read for every character param delim the string delimiter see try read string boolean see read ch void parse until string delim throws java lang exception char c int start line line try while try read delim c read ch data buffer append c catch eof exception e error end of input while looking for delimiter started on line start line null delim tryread tryread readch parseuntil startline tryread readch databufferappend eofexception startline skip all data until we find the specified string p this is especially useful for scanning comments p this is a a little inefficient right now since it calls try read for every character param delim the string delimiter see try read string boolean see read ch void skip until string delim throws java lang exception while try read delim read ch tryread tryread readch skipuntil tryread readch read just the encoding declaration or xml declaration at the start of an external entity when this method is called we know that the declaration is present or appears to be we also know that the entity is in some sort of ascii derived 8 bit encoding the idea of this is to let us read what the 8 bit encoding is before we ve committed to converting any more of the file the xml or encoding declaration must be in 7 bit ascii so we re safe as long as we don t go past it void read8bit encoding declaration throws java lang exception int ch read buffer pos read buffer length 0 while true ch is read read buffer read buffer length char ch switch ch case int return case 1 error end of file before end of xml or encoding declaration null return if read buffer length read buffer length error unfinished xml or encoding declaration null null read8bitencodingdeclaration readbufferpos readbufferlength readbuffer readbufferlength readbuffer readbufferlength read a chunk of data from an external input source p this is simply a front end that fills the raw read buffer with bytes then calls the appropriate encoding handler see encoding see raw read buffer see read buffer see filtercr see copy utf8 read buffer see copyiso8859 1readbuffer see copyucs 2readbuffer see copyucs 4readbuffer void read data chunk throws java lang exception int count i j see if we have any overflow if read buffer overflow 1 read buffer 0 char read buffer overflow read buffer overflow 1 read buffer pos 1 sawcr true else read buffer pos 0 sawcr false special situation we re taking input from a character stream if source type input reader count reader read read buffer read buffer pos read buffer max 1 if count 0 read buffer length 1 else read buffer length read buffer pos count filtercr sawcr false return read as many bytes as possible into the read buffer count is read raw read buffer 0 read buffer max dispatch to an encoding specific reader method to populate the read buffer switch encoding case encoding utf 8 copy utf8 read buffer count break case encoding iso 8859 1 copyiso8859 1readbuffer count break case encoding ucs 2 12 copy ucs2 read buffer count 8 0 break case encoding ucs 2 21 copy ucs2 read buffer count 0 8 break case encoding ucs 4 1234 copy ucs4 read buffer count 24 16 8 0 break case encoding ucs 4 4321 copy ucs4 read buffer count 0 8 16 24 break case encoding ucs 4 2143 copy ucs4 read buffer count 16 24 0 8 break case encoding ucs 4 3412 copy ucs4 read buffer count 8 0 24 16 break filter out all carriage returns if we ve seen any if sawcr filtercr sawcr false reset the position read buffer pos 0 current byte count count rawreadbuffer rawreadbuffer readbuffer copyutf8readbuffer copyiso8859_1readbuffer copyucs_2readbuffer copyucs_4readbuffer readdatachunk readbufferoverflow readbuffer readbufferoverflow readbufferoverflow readbufferpos readbufferpos sourcetype input_reader readbuffer readbufferpos read_buffer_max readbufferlength readbufferlength readbufferpos rawreadbuffer read_buffer_max readbuffer encoding_utf_8 copyutf8readbuffer encoding_iso_8859_1 copyiso8859_1readbuffer encoding_ucs_2_12 copyucs2readbuffer encoding_ucs_2_21 copyucs2readbuffer encoding_ucs_4_1234 copyucs4readbuffer encoding_ucs_4_4321 copyucs4readbuffer encoding_ucs_4_2143 copyucs4readbuffer encoding_ucs_4_3412 copyucs4readbuffer readbufferpos currentbytecount filter carriage returns in the read buffer p crlf becomes lf cr becomes lf see read data chunk see read buffer see read buffer overflow void filtercr int i j read buffer overflow 1 loop for i 0 j 0 j read buffer length i j switch read buffer j case r if j read buffer length 1 read buffer overflow r read buffer length break loop else if read buffer j 1 n j read buffer i n break case n default read buffer i read buffer j break read buffer length i readdatachunk readbuffer readbufferoverflow readbufferoverflow readbufferlength readbuffer readbufferlength readbufferoverflow readbufferlength readbuffer readbuffer readbuffer readbuffer readbufferlength convert a buffer of utf 8 encoded bytes into utf 16 characters p when read data chunk calls this method the raw bytes are in raw read buffer and the final characters will appear in read buffer p the tricky part of this is dealing with utf 8 multi byte sequences but it doesn t seem to slow things down too much param count the number of bytes to convert see read data chunk see raw read buffer see read buffer see get next utf8 byte void copy utf8 read buffer int count throws java lang exception int i 0 int j read buffer pos int b1 boolean is surrogate false while i count b1 raw read buffer i is surrogate false determine whether we are dealing with a one two three or four byte sequence if b1 0x80 0 1 byte sequence 000000000xxxxxxx 0xxxxxxx read buffer j char b1 else if b1 0xe0 0xc0 2 byte sequence 00000yyyyyxxxxxx 110yyyyy 10xxxxxx read buffer j char b1 0x1f 6 get next utf8 byte i count else if b1 0xf0 0xe0 3 byte sequence zzzzyyyyyyxxxxxx 1110zzzz 10yyyyyy 10xxxxxx read buffer j char b1 0x0f 12 get next utf8 byte i count 6 get next utf8 byte i count else if b1 0xf8 0xf0 4 byte sequence 11101110wwwwzzzzyy 110111yyyyxxxxxx 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx uuuuu wwww 1 is surrogate true int b2 get next utf8 byte i count int b3 get next utf8 byte i count int b4 get next utf8 byte i count read buffer j char 0xd800 b1 0x07 2 b2 0x30 4 1 6 b2 0x0f 2 b3 0x30 4 read buffer j char 0xdc b3 0x0f 6 b4 todo test that surrogate value is legal else otherwise the 8th bit may not be set in utf 8 encoding error bad start for utf 8 multi byte sequence b1 i if read buffer j 1 r sawcr true how many characters have we read read buffer length j readdatachunk rawreadbuffer readbuffer readdatachunk rawreadbuffer readbuffer getnextutf8byte copyutf8readbuffer readbufferpos issurrogate rawreadbuffer issurrogate readbuffer readbuffer getnextutf8byte readbuffer getnextutf8byte getnextutf8byte issurrogate getnextutf8byte getnextutf8byte getnextutf8byte readbuffer readbuffer encodingerror readbuffer readbufferlength return the next byte value in a utf 8 sequence if it is not possible to get a byte from the current entity throw an exception param pos the current position in the raw read buffer param count the number of bytes in the raw read buffer return the significant six bits of a non initial byte in a utf 8 sequence exception eof exception if the sequence is incomplete int get next utf8 byte int pos int count throws java lang exception int val take a character from the buffer or from the actual input stream if pos count val raw read buffer pos else val is read if val 1 encoding error unfinished multi byte utf 8 sequence at eof 1 pos check for the correct bits at the start if val 0xc0 0x80 encoding error bad continuation of multi byte utf 8 sequence val pos 1 return the significant bits return val 0x3f rawreadbuffer rawreadbuffer eofexception getnextutf8byte rawreadbuffer encodingerror encodingerror convert a buffer of iso 8859 1 encoded bytes into utf 16 characters p when read data chunk calls this method the raw bytes are in raw read buffer and the final characters will appear in read buffer p this is a direct conversion with no tricks param count the number of bytes to convert see read data chunk see raw read buffer see read buffer void copyiso8859 1readbuffer int count int i j for i 0 j read buffer pos i count i j read buffer j char raw read buffer i 0xff if read buffer j r sawcr true read buffer length j readdatachunk rawreadbuffer readbuffer readdatachunk rawreadbuffer readbuffer copyiso8859_1readbuffer readbufferpos readbuffer rawreadbuffer readbuffer readbufferlength convert a buffer of ucs 2 encoded bytes into utf 16 characters p when read data chunk calls this method the raw bytes are in raw read buffer and the final characters will appear in read buffer param count the number of bytes to convert param shift1 the number of bits to shift byte 1 param shift2 the number of bits to shift byte 2 see read data chunk see raw read buffer see read buffer void copy ucs2 read buffer int count int shift1 int shift2 throws java lang exception int j read buffer pos if count 0 count 2 0 encoding error odd number of bytes in ucs 2 encoding 1 count for int i 0 i count i 2 read buffer j char raw read buffer i 0xff shift1 raw read buffer i 1 0xff shift2 if read buffer j 1 r sawcr true read buffer length j readdatachunk rawreadbuffer readbuffer readdatachunk rawreadbuffer readbuffer copyucs2readbuffer readbufferpos encodingerror readbuffer rawreadbuffer rawreadbuffer readbuffer readbufferlength convert a buffer of ucs 4 encoded bytes into utf 16 characters p when read data chunk calls this method the raw bytes are in raw read buffer and the final characters will appear in read buffer p java has 16 bit chars but this routine will attempt to use surrogates to encoding values between 0x00010000 and 0x000fffff param count the number of bytes to convert param shift1 the number of bits to shift byte 1 param shift2 the number of bits to shift byte 2 param shift3 the number of bits to shift byte 2 param shift4 the number of bits to shift byte 2 see read data chunk see raw read buffer see read buffer void copy ucs4 read buffer int count int shift1 int shift2 int shift3 int shift4 throws java lang exception int j read buffer pos int value if count 0 count 4 0 encoding error number of bytes in ucs 4 encoding not divisible by 4 1 count for int i 0 i count i 4 value raw read buffer i 0xff shift1 raw read buffer i 1 0xff shift2 raw read buffer i 2 0xff shift3 raw read buffer i 3 0xff shift4 if value 0x0000ffff read buffer j char value if value int r sawcr true else if value 0x000fffff read buffer j char 0xd8 value 0x000ffc00 10 read buffer j char 0xdc value 0x0003ff else encoding error value cannot be represented in utf 16 value i read buffer length j readdatachunk rawreadbuffer readbuffer readdatachunk rawreadbuffer readbuffer copyucs4readbuffer readbufferpos encodingerror rawreadbuffer rawreadbuffer rawreadbuffer rawreadbuffer readbuffer readbuffer readbuffer encodingerror readbufferlength report a character encoding error void encoding error string message int value int offset throws java lang exception string uri if value 0 message message byte value 0x integer to hex string value if external entity null uri external entity geturl to string else uri baseuri handler error message uri 1 offset current byte count encodingerror tohexstring externalentity externalentity tostring currentbytecount re initialize the variables for each parse void initialize variables no errors first line error count 0 line 1 column 0 set up the buffers for data and names data buffer pos 0 data buffer new char data buffer initial name buffer pos 0 name buffer new char name buffer initial set up the dtd hash tables element info new hashtable entity info new hashtable notation info new hashtable set up the variables for the current element context current element null current element content content undeclared set up the input variables source type input none input stack new stack entity stack new stack external entity null tag attribute pos 0 tag attributes new string 100 raw read buffer new byte read buffer max read buffer overflow 1 context context none symbol table new object symbol table length initializevariables errorcount databufferpos databuffer data_buffer_initial namebufferpos namebuffer name_buffer_initial elementinfo entityinfo notationinfo currentelement currentelementcontent content_undeclared sourcetype input_none inputstack entitystack externalentity tagattributepos tagattributes rawreadbuffer read_buffer_max readbufferoverflow context_none symboltable symbol_table_length clean up after the parse to allow some garbage collection leave around anything that might be useful for queries void cleanup variables error count 1 line 1 column 1 data buffer null name buffer null current element null current element content content undeclared source type input none input stack null external entity null entity stack null cleanupvariables errorcount databuffer namebuffer currentelement currentelementcontent content_undeclared sourcetype input_none inputstack externalentity entitystack show run script dialog method prompts for one or more files to run as macros param view the view since j edit 4 0pre7 public static void show run script dialog view view string paths gui utilities showvfs file dialog view null j file chooser open dialog true if paths null buffer buffer view get buffer try buffer begin compound edit file loop for int i 0 i paths length i run script view paths i false finally buffer end compound edit showrunscriptdialog jedit showrunscriptdialog guiutilities showvfsfiledialog jfilechooser open_dialog getbuffer begincompoundedit file_loop runscript endcompoundedit run script method runs the specified script unlike the link bean shell run script view string reader boolean method this method can run scripts supported by any registered macro handler param view the view param path the vfs path of the script param ignore unknown if true then unknown file types will be ignored otherwise a warning message will be printed and they will be evaluated as bean shell scripts since j edit 4 1pre2 public static void run script view view string path boolean ignore unknown handler handler get handler for path name path if handler null try macro new macro handler create macro misc utilities get file name path path new macro invoke view catch exception e log log log error macros class e return return only executed if above loop falls through ie there is no handler for this file if ignore unknown log log log notice macros class path cannot find a suitable macro handler else log log log error macros class path cannot find a suitable macro handler assuming bean shell get handler beanshell create macro path path invoke view runscript beanshell runscript ignoreunknown beanshell jedit runscript ignoreunknown gethandlerforpathname newmacro createmacro miscutilities getfilename newmacro ignoreunknown beanshell gethandler createmacro message method utility method that can be used to display a message dialog in a macro param comp the component to show the dialog on behalf of this will usually be a view instance param message the message since j edit 2 7pre2 public static void message component comp string message gui utilities hide splash screen j option pane show message dialog comp message j edit get property macro message title j option pane information message jedit guiutilities hidesplashscreen joptionpane showmessagedialog jedit getproperty joptionpane information_message error method utility method that can be used to display an error dialog in a macro param comp the component to show the dialog on behalf of this will usually be a view instance param message the message since j edit 2 7pre2 public static void error component comp string message gui utilities hide splash screen j option pane show message dialog comp message j edit get property macro message title j option pane error message jedit guiutilities hidesplashscreen joptionpane showmessagedialog jedit getproperty joptionpane error_message input method utility method that can be used to prompt for input in a macro param comp the component to show the dialog on behalf of this will usually be a view instance param prompt the prompt string since j edit 2 7pre2 public static string input component comp string prompt gui utilities hide splash screen return input comp prompt null jedit guiutilities hidesplashscreen input method utility method that can be used to prompt for input in a macro param comp the component to show the dialog on behalf of this will usually be a view instance param prompt the prompt string since j edit 3 1final public static string input component comp string prompt string default value gui utilities hide splash screen return string j option pane show input dialog comp prompt j edit get property macro input title j option pane question message null null default value jedit defaultvalue guiutilities hidesplashscreen joptionpane showinputdialog jedit getproperty joptionpane question_message defaultvalue confirm method utility method that can be used to ask for confirmation in a macro param comp the component to show the dialog on behalf of this will usually be a view instance param prompt the prompt string param buttons the buttons to display for example j option pane yes no cancel option since j edit 4 0pre2 public static int confirm component comp string prompt int buttons gui utilities hide splash screen return j option pane show confirm dialog comp prompt j edit get property macro confirm title buttons j option pane question message joptionpane yes_no_cancel_option jedit guiutilities hidesplashscreen joptionpane showconfirmdialog jedit getproperty joptionpane question_message confirm method utility method that can be used to ask for confirmation in a macro param comp the component to show the dialog on behalf of this will usually be a view instance param prompt the prompt string param buttons the buttons to display for example j option pane yes no cancel option param type the dialog type for example j option pane warning message public static int confirm component comp string prompt int buttons int type gui utilities hide splash screen return j option pane show confirm dialog comp prompt j edit get property macro confirm title buttons type joptionpane yes_no_cancel_option joptionpane warning_message guiutilities hidesplashscreen joptionpane showconfirmdialog jedit getproperty load macros method rebuilds the macros list and sends a macros changed message views update their macros menu upon receiving it since j edit 2 2pre4 public static void load macros macro action set remove all actions macro hierarchy remove all elements macro hash clear since subsequent macros with the same name are ignored load user macros first so that they override the system macros string settings j edit get settings directory if settings null user macro path misc utilities construct path settings macros load macros macro hierarchy new file user macro path if j edit getj edit home null system macro path misc utilities construct path j edit getj edit home macros load macros macro hierarchy new file system macro path edit bus send new dynamic menu changed macros loadmacros macroschanged jedit loadmacros macroactionset removeallactions macrohierarchy removeallelements macrohash jedit getsettingsdirectory usermacropath miscutilities constructpath loadmacros macrohierarchy usermacropath jedit getjedithome systemmacropath miscutilities constructpath jedit getjedithome loadmacros macrohierarchy systemmacropath editbus dynamicmenuchanged register handler method adds a macro handler to the handlers list since j edit 4 0pre6 public static void register handler handler handler if get handler handler get name null log log log error macros class cannot register more than one macro handler with the same name return log log log debug macros class registered handler get name macro handler macro handlers add handler registerhandler jedit registerhandler gethandler getname getname macrohandlers get handlers method returns an array containing the list of registered macro handlers since j edit 4 0pre6 public static handler get handlers handler handlers new handler macro handlers size return handler macro handlers to array handlers gethandlers jedit gethandlers macrohandlers macrohandlers toarray get handler for file name method returns the macro handler suitable for running the specified file name or null if there is no suitable handler since j edit 4 1pre3 public static handler get handler for path name string path name for int i 0 i macro handlers size i handler handler handler macro handlers get i if handler accept path name return handler return null gethandlerforfilename jedit gethandlerforpathname pathname macrohandlers macrohandlers pathname get handler method returns the macro handler with the specified name or null if there is no registered handler with that name since j edit 4 0pre6 public static handler get handler string name handler handler null for int i 0 i macro handlers size i handler handler macro handlers get i if handler get name equals name return handler return null gethandler jedit gethandler macrohandlers macrohandlers getname get macro hierarchy method returns a vector hierarchy with all known macros in it each element of this vector is either a macro name string or another vector if it is a vector the first element is a string label the rest are again either macro name strings or vectors since j edit 2 6pre1 public static vector get macro hierarchy return macro hierarchy getmacrohierarchy jedit getmacrohierarchy macrohierarchy get macro action set method returns an action set with all known macros in it since j edit 4 0pre1 public static action set get macro action set return macro action set getmacroactionset jedit actionset getmacroactionset macroactionset get macro method returns the macro with the specified name param macro the macro s name since j edit 2 6pre1 public static macro get macro string macro return macro macro hash get macro getmacro jedit getmacro macrohash macro constructor public macro handler handler string name string label string path super name this handler handler this label label this path path get handler method public handler get handler return handler gethandler gethandler get path method public string get path return path getpath getpath invoke method public void invoke view view if view null handler run macro null this else buffer buffer view get buffer try buffer begin compound edit handler run macro view this finally buffer end compound edit runmacro getbuffer begincompoundedit runmacro endcompoundedit get code method public string get code return macros get macro get name invoke view getcode getcode getmacro getname macro name to label method public static string macro name to label string macro name int index macro name last index of return macro name substring index 1 replace macronametolabel macronametolabel macroname macroname lastindexof macroname _ record temporary macro method starts recording a temporary macro param view the view since j edit 2 7pre2 public static void record temporary macro view view string settings j edit get settings directory if settings null gui utilities error view no settings new string 0 return if view get macro recorder null gui utilities error view already recording new string 0 return buffer buffer j edit open file null settings file separator macros temporary macro bsh true null if buffer null return buffer remove 0 buffer get length buffer insert 0 j edit get property macro temp header record macro view buffer true recordtemporarymacro jedit recordtemporarymacro jedit getsettingsdirectory guiutilities getmacrorecorder guiutilities jedit openfile temporary_macro getlength jedit getproperty recordmacro record macro method starts recording a macro param view the view since j edit 2 7pre2 public static void record macro view view string settings j edit get settings directory if settings null gui utilities error view no settings new string 0 return if view get macro recorder null gui utilities error view already recording new string 0 return string name gui utilities input view record null if name null return name name replace buffer buffer j edit open file null null misc utilities construct path settings macros name bsh true null if buffer null return buffer remove 0 buffer get length buffer insert 0 j edit get property macro header record macro view buffer false recordmacro jedit recordmacro jedit getsettingsdirectory guiutilities getmacrorecorder guiutilities guiutilities _ jedit openfile miscutilities constructpath getlength jedit getproperty recordmacro stop recording method stops a recording currently in progress param view the view since j edit 2 7pre2 public static void stop recording view view recorder recorder view get macro recorder if recorder null gui utilities error view macro not recording null else view set macro recorder null if recorder temporary view set buffer recorder buffer recorder dispose stoprecording jedit stoprecording getmacrorecorder guiutilities setmacrorecorder setbuffer run temporary macro method runs the temporary macro param view the view since j edit 2 7pre2 public static void run temporary macro view view string settings j edit get settings directory if settings null gui utilities error view no settings null return string path misc utilities construct path j edit get settings directory macros temporary macro bsh if j edit get buffer path null gui utilities error view no temp macro null return handler handler get handler beanshell macro temp handler create macro path path buffer buffer view get buffer try buffer begin compound edit temp invoke view finally i already wrote a comment expaining this in macro invoke if buffer inside compound edit buffer end compound edit runtemporarymacro jedit runtemporarymacro jedit getsettingsdirectory guiutilities miscutilities constructpath jedit getsettingsdirectory temporary_macro jedit getbuffer guiutilities gethandler createmacro getbuffer begincompoundedit insidecompoundedit endcompoundedit load macros method private static void load macros vector vector string path file directory file macro files directory list files if macro files null macro files length 0 return for int i 0 i macro files length i file file macro files i string file name file get name if file is hidden do nothing continue else if file is directory string submenu name file name replace vector submenu null try to merge with an existing menu first for int j 0 j vector size j object obj vector get j if obj instanceof vector vector vec vector obj if string vec get 0 equals submenu name submenu vec break if submenu null submenu new vector submenu add element submenu name vector add element submenu load macros submenu path file name file else add macro file path vector loadmacros loadmacros macrofiles listfiles macrofiles macrofiles macrofiles macrofiles filename getname ishidden isdirectory submenuname filename _ submenuname addelement submenuname addelement loadmacros filename addmacro add macro method private static void add macro file file string path vector vector string file name file get name handler handler get handler for path name file get path if handler null return try in case macro file name has a space in it spaces break the view tool bar property for instance since it uses spaces to delimit action names string macro name path file name replace macro new macro handler create macro macro name file get path ignore if already added see comment in load macros if macro hash get new macro get name null return vector add element new macro get name j edit set temporary property new macro get name label new macro label j edit set temporary property new macro get name mouse over handler get label file get path macro action set add action new macro macro hash put new macro get name new macro catch exception e log log log error macros class e macro handlers remove handler addmacro addmacro filename getname gethandlerforpathname getpath toolbar macroname filename _ newmacro createmacro macroname getpath loadmacros macrohash newmacro getname addelement newmacro getname jedit settemporaryproperty newmacro getname newmacro jedit settemporaryproperty newmacro getname getlabel getpath macroactionset addaction newmacro macrohash newmacro getname newmacro macrohandlers record macro method starts recording a macro param view the view param buffer the buffer to record to param temporary true if this is a temporary macro since j edit 3 0pre5 private static void record macro view view buffer buffer boolean temporary view set macro recorder new recorder view buffer temporary setting the message to null causes the status bar to check if a recording is in progress view get status set message null recordmacro jedit recordmacro setmacrorecorder getstatus setmessage recorder constructor public recorder view view buffer buffer boolean temporary this view view this buffer buffer this temporary temporary edit bus add to bus this editbus addtobus record method public void record string code flush input append n append code flushinput record method public void record int repeat string code if repeat 1 record code else record for int i 1 i repeat i n n code n record input method since j edit 4 2pre5 public void record input int repeat char ch boolean overwrite record n and t on lines specially so that auto indent can take place if ch n record repeat text area user input n else if ch t record repeat text area user input t else string buffer buf new string buffer for int i 0 i repeat i buf append ch record input buf to string overwrite recordinput jedit recordinput textarea userinput textarea userinput stringbuffer stringbuffer recordinput tostring record input method since j edit 4 2pre5 public void record input string str boolean overwrite string char str misc utilities chars to escapes str if overwrite if last was overwrite overwrite count append char str else flush input overwrite count 1 last was overwrite true append ntext area set selected text char str else if last was input append char str else flush input last was input true append ntext area set selected text char str recordinput jedit recordinput charstr miscutilities charstoescapes lastwasoverwrite overwritecount charstr flushinput overwritecount lastwasoverwrite ntextarea setselectedtext charstr lastwasinput charstr flushinput lastwasinput ntextarea setselectedtext charstr handle message method public void handle message eb message msg if msg instanceof buffer update buffer update bmsg buffer update msg if bmsg get what buffer update closed if bmsg get buffer buffer stop recording view handlemessage handlemessage ebmessage bufferupdate bufferupdate bufferupdate getwhat bufferupdate getbuffer stoprecording append method private void append string str buffer insert buffer get length str getlength dispose method private void dispose flush input for int i 0 i buffer get line count i buffer indent line i true edit bus remove from bus this setting the message to null causes the status bar to check if a recording is in progress view get status set message null flushinput getlinecount indentline editbus removefrombus getstatus setmessage flush input method we try to merge consecutive inputs this helper method is called when something other than input is to be recorded private void flush input if last was input last was input false append if last was overwrite last was overwrite false append n append offset buffer get line end offset text area get caret line 1 n append buffer remove text area get caret position math min overwrite count offset text area get caret position flushinput flushinput lastwasinput lastwasinput lastwasoverwrite lastwasoverwrite getlineendoffset textarea getcaretline textarea getcaretposition overwritecount textarea getcaretposition get name method public string get name return name getname getname get label method public string get label return label getlabel getlabel accept method public boolean accept string path return filter is match misc utilities get file name path ismatch miscutilities getfilename create macro method public abstract macro create macro string macro name string path createmacro createmacro macroname run macro method runs the specified macro param view the view may be null param macro the macro runmacro run macro method runs the specified macro this method is optional it is called if the specified macro is a startup script the default behavior is to simply call link run macro view macros macro param view the view may be null param macro the macro param own namespace a hint indicating whenever functions and variables defined in the script are to be self contained or made available to other scripts the macro handler may ignore this parameter since j edit 4 1pre3 public void run macro view view macro macro boolean own namespace run macro view macro runmacro runmacro ownnamespace jedit runmacro ownnamespace runmacro handler constructor protected handler string name this name name label j edit get property macro handler name label name try filter new re misc utilities glob tore j edit get property macro handler name glob catch exception e throw new internal error missing or invalid glob for handler name jedit getproperty miscutilities globtore jedit getproperty internalerror bean shell handler constructor bean shell handler super beanshell beanshellhandler beanshellhandler create macro method public macro create macro string macro name string path remove bsh macro name macro name substring 0 macro name length 4 return new macro this macro name macro macro name to label macro name path createmacro createmacro macroname macroname macroname macroname macroname macronametolabel macroname run macro method public void run macro view view macro macro bean shell run script view macro get path null true runmacro runmacro beanshell runscript getpath run macro method public void run macro view view macro macro boolean own namespace bean shell run script view macro get path null own namespace runmacro runmacro ownnamespace beanshell runscript getpath ownnamespace edit abbrev dialog constructor since j edit 4 2pre3 public edit abbrev dialog frame frame string abbrev string expansion map abbrevs super frame j edit get property edit abbrev title true init abbrev expansion abbrevs editabbrevdialog jedit editabbrevdialog jedit getproperty edit abbrev dialog constructor public edit abbrev dialog dialog dialog string abbrev string expansion map abbrevs super dialog j edit get property edit abbrev title true init abbrev expansion abbrevs editabbrevdialog editabbrevdialog jedit getproperty get abbrev method public string get abbrev if isok return null return editor get abbrev getabbrev getabbrev getabbrev get expansion method public string get expansion if isok return null return editor get expansion getexpansion getexpansion getexpansion init method private void init string abbrev string expansion map abbrevs this abbrevs abbrevs this original abbrev abbrev j panel content new j panel new border layout content set border new empty border 12 12 12 12 set content pane content editor new abbrev editor editor set abbrev abbrev editor set expansion expansion editor set border new empty border 0 0 12 0 content add border layout center editor box box new box box layout x axis box add box create glue ok new j button j edit get property common ok ok add action listener new action handler get root pane set default button ok box add ok box add box create horizontal strut 6 cancel new j button j edit get property common cancel cancel add action listener new action handler box add cancel box add box create glue content add border layout south box key listener listener new key handler add key listener listener editor get before caret text area add key listener listener editor get after caret text area add key listener listener set default close operation dispose on close pack set location relative to get parent set visible true originalabbrev jpanel jpanel borderlayout setborder emptyborder setcontentpane abbreveditor setabbrev setexpansion setborder emptyborder borderlayout boxlayout x_axis createglue jbutton jedit getproperty addactionlistener actionhandler getrootpane setdefaultbutton createhorizontalstrut jbutton jedit getproperty addactionlistener actionhandler createglue borderlayout keylistener keyhandler addkeylistener getbeforecarettextarea addkeylistener getaftercarettextarea addkeylistener setdefaultcloseoperation dispose_on_close setlocationrelativeto getparent setvisible check for existing abbrev method private boolean check for existing abbrev string abbrev editor get abbrev if abbrevs get abbrev null if abbrev equals original abbrev return true int result gui utilities confirm this edit abbrev duplicate null j option pane yes no option j option pane warning message return result j option pane yes option return true checkforexistingabbrev checkforexistingabbrev getabbrev originalabbrev guiutilities joptionpane yes_no_option joptionpane warning_message joptionpane yes_option public void action performed action event evt if evt get source ok if editor get abbrev null editor get abbrev length 0 get toolkit beep return if check for existing abbrev return isok true dispose actionperformed actionevent getsource getabbrev getabbrev gettoolkit checkforexistingabbrev public void key pressed key event evt if evt get key code key event vk escape dispose keypressed keyevent getkeycode keyevent vk_escape creates a new properties changed message param source the message source public properties changed eb component source super source propertieschanged ebcomponent explicit fold handler constructor public explicit fold handler super explicit explicitfoldhandler explicitfoldhandler get fold level method returns the fold level of the specified line param buffer the buffer in question param line index the line index param seg a segment the fold handler can use to obtain any text from the buffer if necessary return the fold level of the specified line since j edit 4 0pre1 public int get fold level buffer buffer int line index segment seg if line index 0 return 0 else int fold level buffer get fold level line index 1 buffer get line text line index 1 seg int offset seg offset int count seg count int opening brackets 0 closing brackets 0 for int i 0 i count i switch seg array offset i case closing brackets 0 opening brackets if opening brackets 3 fold level opening brackets 0 break case opening brackets 0 closing brackets if closing brackets 3 if fold level 0 fold level closing brackets 0 break default closing brackets opening brackets 0 break return fold level getfoldlevel lineindex jedit getfoldlevel lineindex lineindex foldlevel getfoldlevel lineindex getlinetext lineindex openingbrackets closingbrackets closingbrackets openingbrackets openingbrackets foldlevel openingbrackets openingbrackets closingbrackets closingbrackets foldlevel foldlevel closingbrackets closingbrackets openingbrackets foldlevel font selector constructor creates a new font selector control param font the font public font selector font font this font false fontselector fontselector font selector constructor creates a new font selector control param font the font param anti alias is anti aliasing enabled since j edit 4 2pre7 public font selector font font boolean anti alias set font font this anti alias anti alias update text set request focus enabled false add action listener new action handler fontselector antialias jedit fontselector antialias setfont antialias antialias updatetext setrequestfocusenabled addactionlistener actionhandler paint component method public void paint component graphics g set anti alias enabled g super paint component g paintcomponent paintcomponent setantialiasenabled paintcomponent is anti alias enabled method public boolean is anti alias enabled return anti alias isantialiasenabled isantialiasenabled antialias set anti alias enabled method public void set anti alias enabled boolean anti alias this anti alias anti alias setantialiasenabled setantialiasenabled antialias antialias antialias update text method private void update text font font get font string style string switch font get style case font plain style string j edit get property font selector plain break case font bold style string j edit get property font selector bold break case font italic style string j edit get property font selector italic break case font bold font italic style string j edit get property font selector bolditalic break default style string unknown break set text font get name font get size style string updatetext updatetext getfont stylestring getstyle stylestring jedit getproperty stylestring jedit getproperty stylestring jedit getproperty stylestring jedit getproperty stylestring settext getname getsize stylestring set anti alias enabled method void set anti alias enabled graphics g if anti alias graphics2d g2 graphics2d g g2 set rendering hint rendering hints key antialiasing rendering hints value antialias on setantialiasenabled setantialiasenabled antialias setrenderinghint renderinghints key_antialiasing renderinghints value_antialias_on public void action performed action event evt font font j dialog dialog gui utilities get parent dialog font selector this if dialog null font new font selector dialog j option pane get frame for component font selector this get font font selector this get selected font else font new font selector dialog dialog get font font selector this get selected font if font null set font font update text actionperformed actionevent jdialog guiutilities getparentdialog fontselector fontselectordialog joptionpane getframeforcomponent fontselector getfont fontselector getselectedfont fontselectordialog getfont fontselector getselectedfont setfont updatetext font selector dialog constructor public font selector dialog frame parent font font super parent j edit get property font selector title true init font fontselectordialog fontselectordialog jedit getproperty font selector dialog constructor public font selector dialog dialog parent font font super parent j edit get property font selector title true init font fontselectordialog fontselectordialog jedit getproperty font selector dialog constructor public font selector dialog frame parent font font font selector font selector super parent j edit get property font selector title true this font selector font selector init font fontselectordialog fontselectordialog fontselector fontselector jedit getproperty fontselector fontselector font selector dialog constructor public font selector dialog dialog parent font font font selector font selector super parent j edit get property font selector title true this font selector font selector init font fontselectordialog fontselectordialog fontselector fontselector jedit getproperty fontselector fontselector ok method public void ok isok true dispose cancel method public void cancel dispose get selected font method public font get selected font if isok return null int size try size integer parse int size field get text catch exception e size 12 return new font family field get text style list get selected index size getselectedfont getselectedfont parseint sizefield gettext familyfield gettext stylelist getselectedindex init method private void init font font j panel content new j panel new border layout content set border new empty border 12 12 12 12 set content pane content j panel list panel new j panel new grid layout 1 3 6 6 string fonts try fonts get font list catch exception e log log log error this broken java implementation log log log error this using deprecated toolkit get font list log log log error this e fonts get toolkit get font list fonts new string broken java implementation j panel family panel create text field and list panel font selector family family field new j text field family list new j list fonts list panel add family panel string sizes 9 10 12 14 16 18 24 j panel size panel create text field and list panel font selector size size field new j text field size list new j list sizes list panel add size panel string styles j edit get property font selector plain j edit get property font selector bold j edit get property font selector italic j edit get property font selector bolditalic j panel style panel create text field and list panel font selector style style field new j text field style list new j list styles style field set editable false list panel add style panel family list set selected value font get family true family field set text font get family size list set selected value string value of font get size true size field set text string value of font get size style list set selected index font get style style field set text string style list get selected value list handler list handler new list handler family list add list selection listener list handler size list add list selection listener list handler style list add list selection listener list handler content add border layout north list panel preview new j label j edit get property font selector long text public void paint component graphics g if font selector null font selector set anti alias enabled g super paint component g preview set border new titled border j edit get property font selector preview update preview dimension pref size preview get preferred size pref size height 50 preview set preferred size pref size content add border layout center preview j panel buttons new j panel buttons set layout new box layout buttons box layout x axis buttons set border new empty border 12 0 0 0 buttons add box create glue ok new j button j edit get property common ok ok add action listener new action handler get root pane set default button ok buttons add ok buttons add box create horizontal strut 6 cancel new j button j edit get property common cancel cancel add action listener new action handler buttons add cancel buttons add box create glue content add border layout south buttons pack set location relative to get parent set visible true jpanel jpanel borderlayout setborder emptyborder setcontentpane jpanel listpanel jpanel gridlayout getfontlist getfontlist gettoolkit getfontlist jpanel familypanel createtextfieldandlistpanel familyfield jtextfield familylist jlist listpanel familypanel jpanel sizepanel createtextfieldandlistpanel sizefield jtextfield sizelist jlist listpanel sizepanel jedit getproperty jedit getproperty jedit getproperty jedit getproperty jpanel stylepanel createtextfieldandlistpanel stylefield jtextfield stylelist jlist stylefield seteditable listpanel stylepanel familylist setselectedvalue getfamily familyfield settext getfamily sizelist setselectedvalue valueof getsize sizefield settext valueof getsize stylelist setselectedindex getstyle stylefield settext stylelist getselectedvalue listhandler listhandler listhandler familylist addlistselectionlistener listhandler sizelist addlistselectionlistener listhandler stylelist addlistselectionlistener listhandler borderlayout listpanel jlabel jedit getproperty paintcomponent fontselector fontselector setantialiasenabled paintcomponent setborder titledborder jedit getproperty updatepreview prefsize getpreferredsize prefsize setpreferredsize prefsize borderlayout jpanel jpanel setlayout boxlayout boxlayout x_axis setborder emptyborder createglue jbutton jedit getproperty addactionlistener actionhandler getrootpane setdefaultbutton createhorizontalstrut jbutton jedit getproperty addactionlistener actionhandler createglue borderlayout setlocationrelativeto getparent setvisible preview new j label j edit get property font selector long text public void paint component graphics g if font selector null font selector set anti alias enabled g super paint component g jlabel jedit getproperty paintcomponent fontselector fontselector setantialiasenabled paintcomponent get font list method private string get font list string name array graphics environment get local graphics environment get available font family names vector name vector new vector name array length for int i 0 j i name array length i for j 0 j hidefonts length j if name array i index of hidefonts j 0 break if j hidefonts length name vector add element name array i string array new string name vector size name vector copy into array return array getfontlist getfontlist namearray graphicsenvironment getlocalgraphicsenvironment getavailablefontfamilynames namevector namearray namearray namearray indexof namevector addelement namearray _array namevector namevector copyinto _array _array create text field and list panel method private j panel create text field and list panel string label j text field text field j list list grid bag layout layout new grid bag layout j panel panel new j panel layout grid bag constraints cons new grid bag constraints cons gridx cons gridy 0 cons gridwidth cons gridheight 1 cons fill grid bag constraints both cons weightx 1 0f j label label new j label j edit get property label layout set constraints label cons panel add label cons gridy 1 component vs box create vertical strut 6 layout set constraints vs cons panel add vs cons gridy 2 layout set constraints text field cons panel add text field cons gridy 3 vs box create vertical strut 6 layout set constraints vs cons panel add vs cons gridy 4 cons gridheight grid bag constraints remainder cons weighty 1 0f j scroll pane scroller new j scroll pane list layout set constraints scroller cons panel add scroller return panel createtextfieldandlistpanel jpanel createtextfieldandlistpanel jtextfield textfield jlist gridbaglayout gridbaglayout jpanel jpanel gridbagconstraints gridbagconstraints gridbagconstraints jlabel _label jlabel jedit getproperty setconstraints _label _label createverticalstrut setconstraints setconstraints textfield textfield createverticalstrut setconstraints gridbagconstraints jscrollpane jscrollpane setconstraints update preview method private void update preview string family family field get text int size try size integer parse int size field get text catch exception e size 12 int style style list get selected index preview set font new font family style size updatepreview updatepreview familyfield gettext parseint sizefield gettext stylelist getselectedindex setfont public void action performed action event evt if evt get source ok ok else if evt get source cancel cancel actionperformed actionevent getsource getsource public void value changed list selection event evt object source evt get source if source family list string family string family list get selected value if family null family field set text family else if source size list string size string size list get selected value if size null size field set text size else if source style list string style string style list get selected value if style null style field set text style update preview valuechanged listselectionevent getsource familylist familylist getselectedvalue familyfield settext sizelist sizelist getselectedvalue sizefield settext stylelist stylelist getselectedvalue stylefield settext updatepreview to string method public static string to string key event evt string id switch evt getid case key event key pressed id key pressed break case key event key released id key released break case key event key typed id key typed break default id unknown type break return id key code 0x integer to string evt get key code 16 key char 0x integer to string evt get key char 16 modifiers 0x integer to string evt get modifiers 16 tostring tostring keyevent keyevent key_pressed key_pressed keyevent key_released key_released keyevent key_typed key_typed keycode tostring getkeycode keychar tostring getkeychar tostring getmodifiers grab key dialog constructor create and show a new modal dialog param parent center dialog on this component param binding the action macro that should get a binding param all bindings all other key bindings param debug buffer debug info will be dumped to this buffer may be null since j edit 4 1pre7 public grab key dialog dialog parent key binding binding vector all bindings buffer debug buffer super parent j edit get property grab key title true init binding all bindings debug buffer grabkeydialog allbindings debugbuffer jedit grabkeydialog keybinding allbindings debugbuffer jedit getproperty allbindings debugbuffer grab key dialog constructor create and show a new modal dialog param parent center dialog on this component param binding the action macro that should get a binding param all bindings all other key bindings param debug buffer debug info will be dumped to this buffer may be null since j edit 4 1pre7 public grab key dialog frame parent key binding binding vector all bindings buffer debug buffer super parent j edit get property grab key title true init binding all bindings debug buffer grabkeydialog allbindings debugbuffer jedit grabkeydialog keybinding allbindings debugbuffer jedit getproperty allbindings debugbuffer get shortcut method returns the shortcut or null if the current shortcut should be removed or the dialog either has been cancelled use isok to determine if the latter is true public string get shortcut if isok return shortcut get text else return null getshortcut getshortcut gettext isok method returns true if the dialog has not been cancelled since j edit 3 2pre9 public boolean isok return isok jedit is managing focus method returns if this component can be traversed by pressing the tab key this returns false public boolean is managing focus return false ismanagingfocus ismanagingfocus get focus traversal keys enabled method makes the tab key work in java 1 4 since j edit 3 2pre4 public boolean get focus traversal keys enabled return false getfocustraversalkeysenabled jedit getfocustraversalkeysenabled process key event method protected void process key event key event evt shortcut process key event evt processkeyevent processkeyevent keyevent processkeyevent init method private void init key binding binding vector all bindings buffer debug buffer this binding binding this all bindings all bindings this debug buffer debug buffer enable events awt event key event mask create a panel with a box layout can t use box here because box doesn t have set border j panel content new j panel new grid layout 0 1 0 6 returns if this component can be traversed by pressing the tab key this returns false public boolean is managing focus return false makes the tab key work in java 1 4 since j edit 3 2pre4 public boolean get focus traversal keys enabled return false content set border new empty border 12 12 12 12 set content pane content j label label new j label debug buffer null j edit get property grab key caption new string binding label j edit get property grab key keyboard test box input box create horizontal box shortcut new input pane input add shortcut input add box create horizontal strut 12 clear new j button j edit get property grab key clear clear add action listener new action handler input add clear assigned to new j label if debug buffer null update assigned to null box buttons box create horizontal box buttons add box create glue if debug buffer null ok new j button j edit get property common ok ok add action listener new action handler buttons add ok buttons add box create horizontal strut 12 if binding is assigned show remove button remove new j button j edit get property grab key remove remove add action listener new action handler buttons add remove buttons add box create horizontal strut 12 cancel new j button j edit get property common cancel cancel add action listener new action handler buttons add cancel buttons add box create glue content add label content add input if debug buffer null content add assigned to content add buttons set default close operation dispose on close pack set location relative to get parent set resizable false set visible true keybinding allbindings debugbuffer allbindings allbindings debugbuffer debugbuffer enableevents awtevent key_event_mask boxlayout setborder jpanel jpanel gridlayout ismanagingfocus jedit getfocustraversalkeysenabled setborder emptyborder setcontentpane jlabel jlabel debugbuffer jedit getproperty jedit getproperty createhorizontalbox inputpane createhorizontalstrut jbutton jedit getproperty addactionlistener actionhandler assignedto jlabel debugbuffer updateassignedto createhorizontalbox createglue debugbuffer jbutton jedit getproperty addactionlistener actionhandler createhorizontalstrut isassigned jbutton jedit getproperty addactionlistener actionhandler createhorizontalstrut jbutton jedit getproperty addactionlistener actionhandler createglue debugbuffer assignedto setdefaultcloseoperation dispose_on_close setlocationrelativeto getparent setresizable setvisible returns if this component can be traversed by pressing the tab key this returns false public boolean is managing focus return false ismanagingfocus makes the tab key work in java 1 4 since j edit 3 2pre4 public boolean get focus traversal keys enabled return false jedit getfocustraversalkeysenabled get symbolic name method private string get symbolic name int key code if key code key event vk undefined return null else if key code key event vk open bracket return else if key code key event vk close bracket return if key code key event vk a key code key event vk z return string value of character to lower case char key code try field fields key event class get fields for int i 0 i fields length i field field fields i string name field get name if name starts with vk field get int null key code return name substring 3 catch exception e log log log error this e return null getsymbolicname getsymbolicname keycode keycode keyevent vk_undefined keycode keyevent vk_open_bracket keycode keyevent vk_close_bracket keycode keyevent vk_a keycode keyevent vk_z valueof tolowercase keycode keyevent getfields getname startswith vk_ getint keycode update assigned to method private void update assigned to string shortcut string text j edit get property grab key assigned to none key binding kb get key binding shortcut if kb null if kb is prefix text j edit get property grab key assigned to prefix new string shortcut else text kb label if ok null ok set enabled kb null kb is prefix assigned to set text j edit get property grab key assigned to new string text updateassignedto updateassignedto jedit getproperty keybinding getkeybinding isprefix jedit getproperty setenabled isprefix assignedto settext jedit getproperty get key binding method private key binding get key binding string shortcut if shortcut null shortcut length 0 return null string spaced shortcut shortcut enumeration e all bindings elements while e has more elements key binding kb key binding e next element if kb is assigned continue string spaced kb shortcut kb shortcut eg trying to bind c n c p if c n already bound if spaced shortcut starts with spaced kb shortcut return kb eg trying to bind c e if c e is a prefix if spaced kb shortcut starts with spaced shortcut create a temporary synthetic prefix key binding that won t be saved return new key binding kb name kb label shortcut true return null getkeybinding keybinding getkeybinding spacedshortcut allbindings hasmoreelements keybinding keybinding nextelement isassigned spacedkbshortcut spacedshortcut startswith spacedkbshortcut spacedkbshortcut startswith spacedshortcut keybinding keybinding public key binding string name string label string shortcut boolean is prefix this name name this label label this shortcut shortcut this is prefix is prefix keybinding isprefix isprefix isprefix public boolean is prefix public boolean is assigned return shortcut null shortcut length 0 isprefix isassigned get focus traversal keys enabled method makes the tab key work in java 1 4 since j edit 3 2pre4 public boolean get focus traversal keys enabled return false getfocustraversalkeysenabled jedit getfocustraversalkeysenabled process key event method protected void process key event key event evt key event evt key event workaround process key event evt if debug buffer null debug buffer insert debug buffer get length event grab key dialog to string evt evt null filtered n passed n if evt null return evt consume key event translator key key key event translator translate key event evt if key null return if debug buffer null debug buffer insert debug buffer get length translated to key n string buffer key string new string buffer get text if get document get length 0 key string append if key modifiers null key string append key modifiers append if key input key string append space else if key input 0 key string append key input else string symbolic name get symbolic name key key if symbolic name null return key string append symbolic name set text key string to string if debug buffer null update assigned to key string to string processkeyevent processkeyevent keyevent _evt keyevent keyeventworkaround processkeyevent _evt debugbuffer debugbuffer debugbuffer getlength grabkeydialog tostring _evt keyeventtranslator keyeventtranslator translatekeyevent debugbuffer debugbuffer debugbuffer getlength stringbuffer keystring stringbuffer gettext getdocument getlength keystring keystring keystring keystring symbolicname getsymbolicname symbolicname keystring symbolicname settext keystring tostring debugbuffer updateassignedto keystring tostring action performed method public void action performed action event evt if evt get source ok if can close dispose else if evt get source remove shortcut set text null isok true dispose else if evt get source cancel dispose else if evt get source clear shortcut set text null if debug buffer null update assigned to null shortcut request focus actionperformed actionperformed actionevent getsource canclose getsource settext getsource getsource settext debugbuffer updateassignedto requestfocus can close method private boolean can close string shortcut string shortcut get text if shortcut string length 0 binding is assigned ask whether to remove the old shortcut int answer gui utilities confirm grab key dialog this grab key remove ask null j option pane yes no option j option pane question message if answer j option pane yes option shortcut set text null isok true else return false check whether this shortcut already exists key binding other get key binding shortcut string if other null other binding isok true return true check whether the other shortcut is the alt shortcut if other name binding name we don t need two identical shortcuts gui utilities error grab key dialog this grab key duplicate alt shortcut null return false check whether shortcut is a prefix to others if other is prefix can t override prefix shortcuts gui utilities error grab key dialog this grab key prefix shortcut null return false ask whether to override that other shortcut int answer gui utilities confirm grab key dialog this grab key duplicate shortcut new object other label j option pane yes no option j option pane question message if answer j option pane yes option if other shortcut null shortcut string starts with other shortcut other shortcut null isok true return true else return false canclose canclose shortcutstring gettext shortcutstring isassigned guiutilities grabkeydialog joptionpane yes_no_option joptionpane question_message joptionpane yes_option settext keybinding getkeybinding shortcutstring guiutilities grabkeydialog isprefix guiutilities grabkeydialog guiutilities grabkeydialog joptionpane yes_no_option joptionpane question_message joptionpane yes_option shortcutstring startswith undo manager constructor public undo manager buffer buffer this buffer buffer undomanager undomanager set limit method public void set limit int limit this limit limit setlimit setlimit clear method public void clear undos first undos last redos first redos last null undo count 0 undosfirst undoslast redosfirst redoslast undocount undo method public int undo if inside compound edit throw new internal error unbalanced begin end compound edit if undos last null return 1 else undo count int caret undos last undo redos first undos last undos last undos last prev if undos last null undos first null return caret insidecompoundedit internalerror endcompoundedit undoslast undocount undoslast redosfirst undoslast undoslast undoslast undoslast undosfirst redo method public int redo if inside compound edit throw new internal error unbalanced begin end compound edit if redos first null return 1 else undo count int caret redos first redo undos last redos first if undos first null undos first undos last redos first redos first next return caret insidecompoundedit internalerror endcompoundedit redosfirst undocount redosfirst undoslast redosfirst undosfirst undosfirst undoslast redosfirst redosfirst begin compound edit method public void begin compound edit if compound edit count 0 compound edit new compound edit compound edit count begincompoundedit begincompoundedit compoundeditcount compoundedit compoundedit compoundeditcount end compound edit method public void end compound edit if compound edit count 0 log log log warning this new exception unbalanced begin end compound edit return else if compound edit count 1 if compound edit first null nothing done between begin end calls else if compound edit first compound edit last add edit compound edit first else add edit compound edit compound edit null compound edit count endcompoundedit endcompoundedit compoundeditcount endcompoundedit compoundeditcount compoundedit compoundedit compoundedit addedit compoundedit addedit compoundedit compoundedit compoundeditcount inside compound edit method public boolean inside compound edit return compound edit count 0 insidecompoundedit insidecompoundedit compoundeditcount content inserted method public void content inserted int offset int length string text boolean clear dirty edit last get last edit edit to merge get merge edit if clear dirty to merge instanceof insert redos first null insert ins insert to merge if ins offset offset ins str text concat ins str ins length length return else if ins offset ins length offset ins str ins str concat text ins length length return insert ins new insert this offset length text if clear dirty redo clear dirty last undo clear dirty ins if compound edit null compound edit add ins else add edit ins contentinserted contentinserted cleardirty getlastedit tomerge getmergeedit cleardirty tomerge redosfirst tomerge cleardirty redocleardirty undocleardirty compoundedit compoundedit addedit content removed method public void content removed int offset int length string text boolean clear dirty edit last get last edit edit to merge get merge edit if clear dirty to merge instanceof remove redos first null remove rem remove to merge if rem offset offset rem str rem str concat text rem hashcode rem str hash code rem length length kill ring changed rem return else if offset length rem offset rem str text concat rem str rem hashcode rem str hash code rem length length rem offset offset kill ring changed rem return remove rem new remove this offset length text if clear dirty redo clear dirty last undo clear dirty rem if compound edit null compound edit add rem else add edit rem kill ring add rem contentremoved contentremoved cleardirty getlastedit tomerge getmergeedit cleardirty tomerge redosfirst tomerge hashcode killring hashcode killring cleardirty redocleardirty undocleardirty compoundedit compoundedit addedit killring buffer saved method public void buffer saved redo clear dirty get last edit if redos first instanceof compound edit undo clear dirty compound edit redos first first else undo clear dirty redos first buffersaved buffersaved redocleardirty getlastedit redosfirst compoundedit undocleardirty compoundedit redosfirst undocleardirty redosfirst add edit method private void add edit edit edit if undos first null undos first undos last edit else undos last next edit edit prev undos last undos last edit redos first redos last null undo count while undo count limit undo count if undos first undos last undos first undos last null else undos first next prev null undos first undos first next addedit addedit undosfirst undosfirst undoslast undoslast undoslast undoslast redosfirst redoslast undocount undocount undocount undosfirst undoslast undosfirst undoslast undosfirst undosfirst undosfirst get merge edit method private edit get merge edit edit last get last edit return compound edit null compound edit last last getmergeedit getmergeedit getlastedit compoundedit compoundedit get last edit method private edit get last edit if undos last instanceof compound edit return compound edit undos last last else return undos last getlastedit getlastedit undoslast compoundedit compoundedit undoslast undoslast undo method abstract int undo redo method abstract int redo insert constructor insert undo manager mgr int offset int length string str this mgr mgr this offset offset this length length this str str undomanager undo method int undo mgr buffer remove offset length if mgr undo clear dirty this mgr buffer set dirty false return offset undocleardirty setdirty redo method int redo mgr buffer insert offset str if mgr redo clear dirty this mgr buffer set dirty false return offset length redocleardirty setdirty remove constructor remove undo manager mgr int offset int length string str this mgr mgr this offset offset this length length this str str hashcode str hash code undomanager hashcode undo method int undo mgr buffer insert offset str if mgr undo clear dirty this mgr buffer set dirty false return offset length undocleardirty setdirty redo method int redo mgr buffer remove offset length if mgr redo clear dirty this mgr buffer set dirty false return offset redocleardirty setdirty to string method public string to string return str tostring tostring undo method public int undo int ret val 1 edit edit last while edit null ret val edit undo edit edit prev return ret val retval retval retval redo method public int redo int ret val 1 edit edit first while edit null ret val edit redo edit edit next return ret val retval retval retval add method public void add edit edit if first null first last edit else edit prev last last next edit last edit public url connection open connection url url throws io exception plugin resurl connection c new plugin resurl connection url c connect return c urlconnection openconnection ioexception pluginresurlconnection pluginresurlconnection close dialog constructor public close dialog view view super view j edit get property close title true this view view j panel content new j panel new border layout 12 12 content set border new empty border 12 12 12 12 set content pane content box icon box new box box layout y axis icon box add new j label ui manager get icon option pane warning icon icon box add box create glue content add border layout west icon box j panel center panel new j panel new border layout j label label new j label j edit get property close caption label set border new empty border 0 0 6 0 center panel add border layout north label buffer list new j list buffer model new default list model buffer list set visible row count 10 buffer list add list selection listener new list handler buffer buffers j edit get buffers for int i 0 i buffers length i buffer buffer buffers i if buffer is dirty buffer model add element buffer get path center panel add border layout center new j scroll pane buffer list content add border layout center center panel action handler action listener new action handler box buttons new box box layout x axis buttons add box create glue buttons add select all new j button j edit get property close select all select all set mnemonic j edit get property close select all mnemonic char at 0 select all add action listener action listener buttons add box create horizontal strut 6 buttons add save new j button j edit get property close save save set mnemonic j edit get property close save mnemonic char at 0 save add action listener action listener buttons add box create horizontal strut 6 buttons add discard new j button j edit get property close discard discard set mnemonic j edit get property close discard mnemonic char at 0 discard add action listener action listener buttons add box create horizontal strut 6 buttons add cancel new j button j edit get property common cancel cancel add action listener action listener buttons add box create glue buffer list set selected index 0 content add border layout south buttons gui utilities request focus this buffer list pack set location relative to view set visible true closedialog closedialog jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane iconbox boxlayout y_axis iconbox jlabel uimanager geticon optionpane warningicon iconbox createglue borderlayout iconbox jpanel centerpanel jpanel borderlayout jlabel jlabel jedit getproperty setborder emptyborder centerpanel borderlayout bufferlist jlist buffermodel defaultlistmodel bufferlist setvisiblerowcount bufferlist addlistselectionlistener listhandler jedit getbuffers isdirty buffermodel addelement getpath centerpanel borderlayout jscrollpane bufferlist borderlayout centerpanel actionhandler actionlistener actionhandler boxlayout x_axis createglue selectall jbutton jedit getproperty selectall selectall setmnemonic jedit getproperty selectall charat selectall addactionlistener actionlistener createhorizontalstrut jbutton jedit getproperty setmnemonic jedit getproperty charat addactionlistener actionlistener createhorizontalstrut jbutton jedit getproperty setmnemonic jedit getproperty charat addactionlistener actionlistener createhorizontalstrut jbutton jedit getproperty addactionlistener actionlistener createglue bufferlist setselectedindex borderlayout guiutilities requestfocus bufferlist setlocationrelativeto setvisible isok method public boolean isok return ok ok method public void ok do nothing cancel method public void cancel dispose private void update buttons int index buffer list get selected index save get model set enabled index 1 discard get model set enabled index 1 updatebuttons bufferlist getselectedindex getmodel setenabled getmodel setenabled public void action performed action event evt object source evt get source if source select all i m too tired to think of a better way to handle this right now try select all flag true buffer list set selection interval 0 buffer model get size 1 finally select all flag false buffer list request focus else if source save object paths buffer list get selected values for int i 0 i paths length i string path string paths i buffer buffer j edit get buffer path if buffer save view null true return vfs manager wait for requests if buffer get boolean property bufferio request error occurred return j edit closebuffer view buffer buffer model remove element path if buffer model get size 0 ok true dispose else buffer list set selected index 0 buffer list request focus else if source discard object paths buffer list get selected values for int i 0 i paths length i string path string paths i buffer buffer j edit get buffer path j edit closebuffer view buffer buffer model remove element path if buffer model get size 0 ok true dispose else buffer list set selected index 0 buffer list request focus else if source cancel cancel actionperformed actionevent getsource selectall selectallflag bufferlist setselectioninterval buffermodel getsize selectallflag bufferlist requestfocus bufferlist getselectedvalues jedit getbuffer vfsmanager waitforrequests getbooleanproperty bufferiorequest error_occurred jedit _closebuffer buffermodel removeelement buffermodel getsize bufferlist setselectedindex bufferlist requestfocus bufferlist getselectedvalues jedit getbuffer jedit _closebuffer buffermodel removeelement buffermodel getsize bufferlist setselectedindex bufferlist requestfocus public void value changed list selection event evt if select all flag return int index buffer list get selected index if index 1 view go to buffer j edit get buffer string buffer model get element at index update buttons valuechanged listselectionevent selectallflag bufferlist getselectedindex gotobuffer jedit getbuffer buffermodel getelementat updatebuttons public static class generator get class generator throws util eval error if cg null try class clas class for name bsh class generator impl cg class generator clas new instance catch exception e throw new unavailable class generator unavailable e return cg classgenerator getclassgenerator utilevalerror forname classgeneratorimpl classgenerator newinstance classgenerator parse the bsh block for the class definition and generate the class public abstract class generate class string name modifiers modifiers class interfaces class super class bsh block block boolean is interface call stack callstack interpreter interpreter bshblock generateclass superclass bshblock isinterface callstack invoke a super method style superclass method on an object instance this is not a normal function of the java reflection api and is provided by generated class accessor methods public abstract object invoke superclass method bsh class manager bcm object instance string method name object args invokesuperclassmethod bshclassmanager methodname change the parent of the class instance namespace this is currently used for inner class support note this method will likely be removed in the future public abstract void set instance name space parent setinstancenamespaceparent j edit text area constructor creates a new j edit text area public j edit text area view view enable events awt event focus event mask awt event key event mask this view view initialize some misc stuff selection new vector chunk cache new chunk cache this painter new text area painter this gutter new gutter view this listener list new event listener list caret event new mutable caret event blink true line segment new segment return value new point structure matchers new linked list structure matchers add new structure matcher bracket matcher initialize the gui set layout new scroll layout add center painter add left gutter some plugins add stuff in a right hand gutter vertical box new box box layout x axis vertical box add vertical new j scroll bar j scroll bar vertical vertical set request focus enabled false add right vertical box add bottom horizontal new j scroll bar j scroll bar horizontal horizontal set request focus enabled false horizontal set values 0 0 0 0 this ensures that the text area s look is slightly more consistent with the rest of the metal l f while it depends on not so well documented portions of swing it only affects appearance so future breakage shouldn t matter if ui manager get look and feel instanceof metal look and feel set border new text area border vertical put client property j scroll bar is free standing boolean false horizontal put client property j scroll bar is free standing boolean false horizontal set border null add some event listeners vertical add adjustment listener new adjust handler horizontal add adjustment listener new adjust handler mouse handler new mouse handler painter add mouse listener mouse handler painter add mouse motion listener mouse handler add focus listener new focus handler this doesn t seem very correct but it fixes a problem when setting the initial caret position for a buffer eg from the recent file list focused component this popup enabled true jedittextarea jedittextarea jedittextarea enableevents awtevent focus_event_mask awtevent key_event_mask chunkcache chunkcache textareapainter listenerlist eventlistenerlist caretevent mutablecaretevent linesegment returnvalue structurematchers linkedlist structurematchers structurematcher bracketmatcher setlayout scrolllayout verticalbox boxlayout x_axis verticalbox jscrollbar jscrollbar setrequestfocusenabled verticalbox jscrollbar jscrollbar setrequestfocusenabled setvalues uimanager getlookandfeel metallookandfeel setborder textareaborder putclientproperty jscrollbar isfreestanding putclientproperty jscrollbar isfreestanding setborder addadjustmentlistener adjusthandler addadjustmentlistener adjusthandler mousehandler mousehandler addmouselistener mousehandler addmousemotionlistener mousehandler addfocuslistener focushandler focusedcomponent popupenabled dispose method plugins and macros should not call this method since j edit 4 2pre1 public void dispose display manager text area disposed this jedit displaymanager textareadisposed get view method returns this text area s view since j edit 4 2pre5 public view get view return view getview jedit getview get painter method returns the object responsible for painting this text area public final text area painter get painter return painter getpainter textareapainter getpainter get gutter method returns the gutter to the left of the text area or null if the gutter is disabled public final gutter get gutter return gutter getgutter getgutter get display manager method returns the display manager used by this text area since j edit 4 2pre1 public display manager get display manager return display manager getdisplaymanager jedit displaymanager getdisplaymanager displaymanager is caret blink enabled method returns true if the caret is blinking false otherwise public final boolean is caret blink enabled return caret blinks iscaretblinkenabled iscaretblinkenabled caretblinks set caret blink enabled method toggles caret blinking param caret blinks true if the caret should blink false otherwise public void set caret blink enabled boolean caret blinks this caret blinks caret blinks if caret blinks blink false if buffer null invalidate line caret line setcaretblinkenabled caretblinks setcaretblinkenabled caretblinks caretblinks caretblinks caretblinks invalidateline caretline get electric scroll method returns the number of lines from the top and button of the text area that are always visible public final int get electric scroll return electric scroll getelectricscroll getelectricscroll electricscroll set electric scroll method sets the number of lines from the top and bottom of the text area that are always visible param electric scroll the number of lines always visible from the top or bottom public final void set electric scroll int electric scroll this electric scroll electric scroll setelectricscroll electricscroll setelectricscroll electricscroll electricscroll electricscroll is quick copy enabled method returns if clicking the middle mouse button pastes the most recent selection register and if control dragging inserts the selection at the caret public final boolean is quick copy enabled return quick copy isquickcopyenabled isquickcopyenabled quickcopy set quick copy enabled method sets if clicking the middle mouse button pastes the most recent selection register and if control dragging inserts the selection at the caret param quick copy a boolean flag public final void set quick copy enabled boolean quick copy this quick copy quick copy setquickcopyenabled quickcopy setquickcopyenabled quickcopy quickcopy quickcopy get buffer method returns the buffer this text area is editing public final buffer get buffer return buffer getbuffer getbuffer set buffer method sets the buffer this text area is editing do not call this method use link org gjt sp jedit edit pane set buffer buffer instead param buffer the buffer public void set buffer buffer buffer if this buffer buffer return try buffer changing true if this buffer null dubious set first line 0 select none caret line caret caret screen line 0 match null this buffer buffer chunk cache set buffer buffer properties changed if display manager null display manager release display manager display manager display manager display manager get display manager buffer this display manager init if buffer is loaded update scroll bars repaint fire scroll event true finally buffer changing false setbuffer editpane setbuffer setbuffer bufferchanging setfirstline selectnone caretline caretscreenline chunkcache setbuffer propertieschanged displaymanager displaymanager releasedisplaymanager displaymanager displaymanager displaymanager getdisplaymanager displaymanager isloaded updatescrollbars firescrollevent bufferchanging is editable method returns true if this text area is editable false otherwise public final boolean is editable return buffer is editable iseditable iseditable iseditable get drag and drop callback method drag and drop of text in j edit is implementing using j edit 1 4 ap is however since j edit must run with java 1 3 this class only has the necessary support to call a hook method via reflection the method is provided by the link org gjt sp jedit java14 class and handles the drag and drop api calls themselves since j edit 4 2pre5 public method get drag and drop callback return dnd callback getdraganddropcallback jedit jedit apis jedit jedit getdraganddropcallback dndcallback set drag and drop callback method drag and drop of text in j edit is implementing using j edit 1 4 ap is however since j edit must run with java 1 3 this class only has the necessary support to call a hook method via reflection the method is provided by the link org gjt sp jedit java14 class and handles the drag and drop api calls themselves since j edit 4 2pre5 public void set drag and drop callback method meth dnd callback meth setdraganddropcallback jedit jedit apis jedit jedit setdraganddropcallback dndcallback is drag in progress method drag and drop of text in j edit is implementing using j edit 1 4 ap is however since j edit must run with java 1 3 this class only has the necessary support to call a hook method via reflection this method is called by the link org gjt sp jedit java14 class to signal that a drag is in progress since j edit 4 2pre5 public boolean is drag in progress return dnd in progress isdraginprogress jedit jedit apis jedit jedit isdraginprogress dndinprogress set drag in progress method drag and drop of text in j edit is implementing using j edit 1 4 ap is however since j edit must run with java 1 3 this class only has the necessary support to call a hook method via reflection this method is called by the link org gjt sp jedit java14 class to signal that a drag is in progress since j edit 4 2pre5 public void set drag in progress boolean dnd in progress this dnd in progress dnd in progress setdraginprogress jedit jedit apis jedit jedit setdraginprogress dndinprogress dndinprogress dndinprogress is drag enabled method returns if drag and drop of text is enabled since j edit 4 2pre5 public boolean is drag enabled return dnd enabled isdragenabled jedit isdragenabled dndenabled set drag enabled method sets if drag and drop of text is enabled since j edit 4 2pre5 public void set drag enabled boolean dnd enabled this dnd enabled dnd enabled setdragenabled jedit setdragenabled dndenabled dndenabled dndenabled get first line method returns the vertical scroll bar position since j edit 4 2pre1 public final int get first line return display manager first line scroll line display manager first line skew getfirstline jedit getfirstline displaymanager firstline scrollline displaymanager firstline public exception trace sets the vertical scroll bar position param first line the scroll bar position public void set first line int first line if debug scroll debug log log log debug this set first line from get first line to first line ensure we don t have empty space at the bottom or top etc int max display manager get scroll line count visible lines last line partial 1 0 if first line max first line max if first line 0 first line 0 int old first line get first line if first line old first line return trace new exception if first line old first line visible lines display manager first line scroll down first line old first line chunk cache invalidate all else if first line old first line visible lines display manager first line scroll up old first line first line chunk cache invalidate all else if first line old first line display manager first line scroll down first line old first line chunk cache scroll down first line old first line else if first line old first line display manager first line scroll up old first line first line chunk cache scroll up old first line first line we have to be careful display manager notifyscreenlinechanges if buffer is loaded recalculate last physical line repaint fire scroll event true firstline setfirstline firstline scroll_debug setfirstline getfirstline firstline displaymanager getscrolllinecount visiblelines lastlinepartial firstline firstline firstline firstline oldfirstline getfirstline firstline oldfirstline firstline oldfirstline visiblelines displaymanager firstline scrolldown firstline oldfirstline chunkcache invalidateall firstline oldfirstline visiblelines displaymanager firstline scrollup oldfirstline firstline chunkcache invalidateall firstline oldfirstline displaymanager firstline scrolldown firstline oldfirstline chunkcache scrolldown firstline oldfirstline firstline oldfirstline displaymanager firstline scrollup oldfirstline firstline chunkcache scrollup oldfirstline firstline displaymanager _notifyscreenlinechanges isloaded recalculatelastphysicalline firescrollevent get first physical line method returns the first visible physical line index since j edit 4 0pre4 public final int get first physical line return display manager first line physical line getfirstphysicalline jedit getfirstphysicalline displaymanager firstline physicalline set first physical line method sets the vertical scroll bar position param phys first line the first physical line to display since j edit 4 2pre1 public void set first physical line int phys first line set first physical line phys first line 0 setfirstphysicalline physfirstline jedit setfirstphysicalline physfirstline setfirstphysicalline physfirstline set first physical line method sets the vertical scroll bar position param phys first line the first physical line to display param skew a local screen line delta since j edit 4 2pre1 public void set first physical line int phys first line int skew if debug scroll debug log log log debug this set first physical line phys first line skew ensure we don t have empty space at the bottom or top etc int screen line count 0 int physical line display manager get last visible line int visible lines this visible lines last line partial 1 0 for screen line count display manager get screen line count physical line if screen line count visible lines break int prev line display manager get prev visible line physical line if prev line 1 break physical line prev line if phys first line physical line phys first line physical line int amount phys first line display manager first line physical line int old first line get first line if amount 0 skew display manager first line skew j edit text area scroll to needs this to simplify its code if skew 0 display manager first line scroll up skew else if skew 0 display manager first line scroll down skew else nothing to do return else if amount 0 display manager first line phys down amount skew else if amount 0 display manager first line phys up amount skew int first line get first line if first line old first line do nothing else if first line old first line visible lines first line old first line visible lines chunk cache invalidate all else if first line old first line chunk cache scroll down first line old first line else if first line old first line chunk cache scroll up old first line first line we have to be careful display manager notifyscreenlinechanges if buffer is loaded recalculate last physical line repaint fire scroll event true setfirstphysicalline physfirstline jedit setfirstphysicalline physfirstline scroll_debug setfirstphysicalline physfirstline screenlinecount physicalline displaymanager getlastvisibleline visiblelines visiblelines lastlinepartial screenlinecount displaymanager getscreenlinecount physicalline screenlinecount visiblelines prevline displaymanager getprevvisibleline physicalline prevline physicalline prevline physfirstline physicalline physfirstline physicalline physfirstline displaymanager firstline physicalline oldfirstline getfirstline displaymanager firstline jedittextarea scrollto displaymanager firstline scrollup displaymanager firstline scrolldown displaymanager firstline physdown displaymanager firstline physup firstline getfirstline firstline oldfirstline firstline oldfirstline visiblelines firstline oldfirstline visiblelines chunkcache invalidateall firstline oldfirstline chunkcache scrolldown firstline oldfirstline firstline oldfirstline chunkcache scrollup oldfirstline firstline displaymanager _notifyscreenlinechanges isloaded recalculatelastphysicalline firescrollevent get last physical line method returns the last visible physical line index since j edit 4 0pre4 public final int get last physical line return phys last line getlastphysicalline jedit getlastphysicalline physlastline get visible lines method returns the number of lines visible in this text area public final int get visible lines return visible lines getvisiblelines getvisiblelines visiblelines get horizontal offset method returns the horizontal offset of drawn lines public final int get horizontal offset return horizontal offset gethorizontaloffset gethorizontaloffset horizontaloffset set horizontal offset method sets the horizontal offset of drawn lines this can be used to implement horizontal scrolling param horizontal offset offset the new horizontal offset public void set horizontal offset int horizontal offset if horizontal offset 0 horizontal offset 0 if horizontal offset this horizontal offset return this horizontal offset horizontal offset if horizontal offset horizontal get value update scroll bars painter repaint fire scroll event false sethorizontaloffset horizontaloffset sethorizontaloffset horizontaloffset horizontaloffset horizontaloffset horizontaloffset horizontaloffset horizontaloffset horizontaloffset horizontaloffset getvalue updatescrollbars firescrollevent scroll up line method scrolls up by one line since j edit 2 7pre2 public void scroll up line set first line get first line 1 scrollupline jedit scrollupline setfirstline getfirstline scroll up page method scrolls up by one page since j edit 2 7pre2 public void scroll up page set first line get first line get visible lines last line partial 1 0 scrolluppage jedit scrolluppage setfirstline getfirstline getvisiblelines lastlinepartial scroll down line method scrolls down by one line since j edit 2 7pre2 public void scroll down line set first line get first line 1 scrolldownline jedit scrolldownline setfirstline getfirstline scroll down page method scrolls down by one page since j edit 2 7pre2 public void scroll down page set first line get first line get visible lines last line partial 1 0 scrolldownpage jedit scrolldownpage setfirstline getfirstline getvisiblelines lastlinepartial scroll to caret method ensures that the caret is visible by scrolling the text area if necessary param do electric scroll if true electric scrolling will be performed public void scroll to caret boolean do electric scroll scroll to caret line caret buffer get line start offset caret line do electric scroll scrolltocaret doelectricscroll scrolltocaret doelectricscroll scrollto caretline getlinestartoffset caretline doelectricscroll scroll to method ensures that the specified location in the buffer is visible param offset the offset from the start of the buffer param do electric scroll if true electric scrolling will be performed since j edit 4 2pre3 public void scroll to int offset boolean do electric scroll int line buffer get line of offset offset scroll to line offset buffer get line start offset line do electric scroll scrollto doelectricscroll jedit scrollto doelectricscroll getlineofoffset scrollto getlinestartoffset doelectricscroll scroll to method ensures that the specified location in the buffer is visible param line the line number param offset the offset from the start of the line param do electric scroll if true electric scrolling will be performed since j edit 4 0pre6 public void scroll to int line int offset boolean do electric scroll if debug scroll to debug log log log debug this scroll to line count get line count get ready int extra end virt int line length buffer get line length line if offset line length extra end virt char width offset line length offset line length else extra end virt 0 int electricscroll do electric scroll visible lines 1 electric scroll 2 electric scroll 0 if visible lines 1 if debug scroll to debug log log log debug this visible lines 0 set first physical line line electricscroll return scroll vertically int screen line chunk cache get screen line of offset line offset int visible lines get visible lines if screen line 1 if debug scroll to debug log log log debug this screen line 1 chunk cache line info infos chunk cache get line infos for physical line line int subregion chunk cache get subregion of offset offset infos int prev line display manager get prev visible line get first physical line int next line display manager get next visible line get last physical line if line get first physical line if debug scroll to debug log log log debug this line get first physical line set first physical line line subregion electricscroll else if line prev line if debug scroll to debug log log log debug this line prev line set first physical line prev line subregion electricscroll else if line get last physical line if debug scroll to debug log log log debug this line get last physical line set first physical line line subregion electricscroll visible lines last line partial 2 1 else if line next line if debug scroll to debug log log log debug this line next line set first physical line next line subregion electric scroll visible lines last line partial 2 1 else if debug scroll to debug log log log debug this neither log log log debug this last physical line is get last physical line set first physical line line subregion visible lines 2 if debug scroll to debug log log log debug this last physical line is get last physical line else if screen line electricscroll if debug scroll to debug log log log debug this electric up set first line get first line electricscroll screen line else if screen line visible lines electricscroll last line partial 2 1 if debug scroll to debug log log log debug this electric down set first line get first line electricscroll visible lines screen line last line partial 2 1 scroll horizontally if display manager is line visible line return point point offset toxy line offset return value if point null log log log error this bug screen line screen line visible lines visible lines physical line line first physical line get first physical line last physical line get last physical line point x extra end virt if point x 0 set horizontal offset horizontal offset point x char width 5 else if point x painter get width char width 5 set horizontal offset horizontal offset painter get width point x char width 5 scrollto doelectricscroll jedit scrollto doelectricscroll scroll_to_debug scrollto linecount getlinecount extraendvirt linelength getlinelength linelength extraendvirt charwidth linelength linelength extraendvirt _electricscroll doelectricscroll visiblelines electricscroll electricscroll visiblelines scroll_to_debug visiblelines setfirstphysicalline _electricscroll screenline chunkcache getscreenlineofoffset visiblelines getvisiblelines screenline scroll_to_debug screenline chunkcache lineinfo chunkcache getlineinfosforphysicalline chunkcache getsubregionofoffset prevline displaymanager getprevvisibleline getfirstphysicalline nextline displaymanager getnextvisibleline getlastphysicalline getfirstphysicalline scroll_to_debug getfirstphysicalline setfirstphysicalline _electricscroll prevline scroll_to_debug prevline setfirstphysicalline prevline _electricscroll getlastphysicalline scroll_to_debug getlastphysicalline setfirstphysicalline _electricscroll visiblelines lastlinepartial nextline scroll_to_debug nextline setfirstphysicalline nextline electricscroll visiblelines lastlinepartial scroll_to_debug getlastphysicalline setfirstphysicalline visiblelines scroll_to_debug getlastphysicalline screenline _electricscroll scroll_to_debug setfirstline getfirstline _electricscroll screenline screenline visiblelines _electricscroll lastlinepartial scroll_to_debug setfirstline getfirstline _electricscroll visiblelines screenline lastlinepartial displaymanager islinevisible offsettoxy returnvalue screenline screenline visiblelines visiblelines physicalline firstphysicalline getfirstphysicalline lastphysicalline getlastphysicalline extraendvirt sethorizontaloffset horizontaloffset charwidth getwidth charwidth sethorizontaloffset horizontaloffset getwidth charwidth add scroll listener method adds a scroll listener to this text area param listener the listener since j edit 3 2pre2 public final void add scroll listener scroll listener listener listener list add scroll listener class listener addscrolllistener jedit addscrolllistener scrolllistener listenerlist scrolllistener remove scroll listener method removes a scroll listener from this text area param listener the listener since j edit 3 2pre2 public final void remove scroll listener scroll listener listener listener list remove scroll listener class listener removescrolllistener jedit removescrolllistener scrolllistener listenerlist scrolllistener get physical line of screen line method returns the physical line number that contains the specified screen line param screen line the screen line since j edit 4 0pre6 public int get physical line of screen line int screen line return chunk cache get line info screen line physical line getphysicallineofscreenline screenline jedit getphysicallineofscreenline screenline chunkcache getlineinfo screenline physicalline get screen line of offset method returns the screen wrapped line containing the specified offset returns 1 if the line is not currently visible on the screen param offset the offset since j edit 4 0pre4 public int get screen line of offset int offset int line buffer get line of offset offset offset buffer get line start offset line return chunk cache get screen line of offset line offset getscreenlineofoffset jedit getscreenlineofoffset getlineofoffset getlinestartoffset chunkcache getscreenlineofoffset get screen line start offset method returns the start offset of the specified screen wrapped line param line the line since j edit 4 0pre4 public int get screen line start offset int line chunk cache line info line info chunk cache get line info line if line info physical line 1 return 1 return buffer get line start offset line info physical line line info offset getscreenlinestartoffset jedit getscreenlinestartoffset chunkcache lineinfo lineinfo chunkcache getlineinfo lineinfo physicalline getlinestartoffset lineinfo physicalline lineinfo get screen line end offset method returns the end offset of the specified screen wrapped line param line the line since j edit 4 0pre4 public int get screen line end offset int line chunk cache line info line info chunk cache get line info line if line info physical line 1 return 1 return buffer get line start offset line info physical line line info offset line info length getscreenlineendoffset jedit getscreenlineendoffset chunkcache lineinfo lineinfo chunkcache getlineinfo lineinfo physicalline getlinestartoffset lineinfo physicalline lineinfo lineinfo xy to offset method converts a point to an offset note that unlike in previous j edit versions this method now returns 1 if the y co ordinate is out of bounds param x the x co ordinate of the point param y the y co ordinate of the point public int xy to offset int x int y return xy to offset x y true xytooffset jedit xytooffset xytooffset xy to offset method converts a point to an offset note that unlike in previous j edit versions this method now returns 1 if the y co ordinate is out of bounds param x the x co ordinate of the point param y the y co ordinate of the point param round round up to next letter if past the middle of a letter since j edit 3 2pre6 public int xy to offset int x int y boolean round font metrics fm painter get font metrics int height fm get height int line y height if line 0 line visible lines return 1 return x to screen line offset line x round xytooffset jedit jedit xytooffset fontmetrics getfontmetrics getheight visiblelines xtoscreenlineoffset x to screen line offset method converts a point in a given screen line to an offset note that unlike in previous j edit versions this method now returns 1 if the y co ordinate is out of bounds param x the x co ordinate of the point param screen line the screen line param round round up to next letter if past the middle of a letter since j edit 3 2pre6 public int x to screen line offset int screen line int x boolean round chunk cache line info line info chunk cache get line info screen line if line info physical line 1 return get line end offset display manager get last visible line 1 else int offset chunk x to offset line info chunks x horizontal offset round if offset 1 offset line info offset line info length offset line info offset line info length 1 return get line start offset line info physical line offset xtoscreenlineoffset jedit screenline jedit xtoscreenlineoffset screenline chunkcache lineinfo lineinfo chunkcache getlineinfo screenline lineinfo physicalline getlineendoffset displaymanager getlastvisibleline xtooffset lineinfo horizontaloffset lineinfo lineinfo lineinfo lineinfo getlinestartoffset lineinfo physicalline offset toxy method converts an offset into a point in the text area painter s co ordinate space param offset the offset return the location of the offset on screen or code null code if the specified offset is not visible public point offset toxy int offset int line buffer get line of offset offset offset buffer get line start offset line point ret val new point return offset toxy line offset ret val offsettoxy offsettoxy getlineofoffset getlinestartoffset retval offsettoxy retval offset toxy method converts an offset into a point in the text area painter s co ordinate space param line the physical line number param offset the offset from the start of the line param ret val the point to store the return value in return code ret val code for convenience or code null code if the specified offset is not visible since j edit 4 0pre4 public point offset toxy int line int offset point ret val if display manager is line visible line return null int screen line chunk cache get screen line of offset line offset if screen line 1 return null font metrics fm painter get font metrics ret val y screen line fm get height chunk cache line info info chunk cache get line info screen line ret val x int horizontal offset chunk offset tox info chunks offset return ret val offsettoxy retval retval jedit offsettoxy retval displaymanager islinevisible screenline chunkcache getscreenlineofoffset screenline fontmetrics getfontmetrics retval screenline getheight chunkcache lineinfo chunkcache getlineinfo screenline retval horizontaloffset offsettox retval invalidate screen line range method marks a range of screen lines as needing a repaint param start the first line param end the last line since j edit 4 0pre4 public void invalidate screen line range int start int end if buffer is loaded return if start end system err println start end chunk cache need full repaint if start end int tmp end end start start tmp if chunk cache need full repaint end visible lines font metrics fm painter get font metrics int y start fm get height int height end start 1 fm get height painter repaint 0 y painter get width height gutter repaint 0 y gutter get width height invalidatescreenlinerange jedit invalidatescreenlinerange isloaded chunkcache needfullrepaint chunkcache needfullrepaint visiblelines fontmetrics getfontmetrics getheight getheight getwidth getwidth invalidate line method marks a line as needing a repaint param line the physical line to invalidate public void invalidate line int line if is showing buffer is loaded line get first physical line line phys last line display manager is line visible line return int start line 1 int end line 1 for int i 0 i visible lines i chunk cache line info info chunk cache get line info i if info physical line line info physical line 1 start line 1 start line i if info physical line line info last subregion info physical line 1 end line i break if chunk cache need full repaint end line 1 end line visible lines if start line end line system err println start line end line invalidate screen line range start line end line invalidateline invalidateline isshowing isloaded getfirstphysicalline physlastline displaymanager islinevisible startline endline visiblelines chunkcache lineinfo chunkcache getlineinfo physicalline physicalline startline startline physicalline lastsubregion physicalline endline chunkcache needfullrepaint endline endline visiblelines startline endline startline endline invalidatescreenlinerange startline endline invalidate line range method marks a range of physical lines as needing a repaint param start the first line to invalidate param end the last line to invalidate public void invalidate line range int start int end if is showing buffer is loaded return if end start int tmp end end start start tmp if end get first physical line start get last physical line return int start screen line 1 int end screen line 1 for int i 0 i visible lines i chunk cache line info info chunk cache get line info i if info physical line start info physical line 1 start screen line 1 start screen line i if info physical line end info last subregion info physical line 1 end screen line i break if start screen line 1 start screen line 0 if chunk cache need full repaint end screen line 1 end screen line visible lines invalidate screen line range start screen line end screen line invalidatelinerange invalidatelinerange isshowing isloaded getfirstphysicalline getlastphysicalline startscreenline endscreenline visiblelines chunkcache lineinfo chunkcache getlineinfo physicalline physicalline startscreenline startscreenline physicalline lastsubregion physicalline endscreenline startscreenline startscreenline chunkcache needfullrepaint endscreenline endscreenline visiblelines invalidatescreenlinerange startscreenline endscreenline invalidate selected lines method repaints the lines containing the selection public void invalidate selected lines to hide line highlight if selections are being added later on invalidate line caret line for int i 0 i selection size i selection s selection selection element at i invalidate line range s start line s end line invalidateselectedlines invalidateselectedlines invalidateline caretline elementat invalidatelinerange startline endline get buffer length method returns the length of the buffer public final int get buffer length return buffer get length getbufferlength getbufferlength getlength get line count method returns the number of physical lines in the buffer public final int get line count return buffer get line count getlinecount getlinecount getlinecount get line of offset method returns the line containing the specified offset param offset the offset public final int get line of offset int offset return buffer get line of offset offset getlineofoffset getlineofoffset getlineofoffset get line start offset method returns the start offset of the specified line param line the line return the start offset of the specified line or 1 if the line is invalid public int get line start offset int line return buffer get line start offset line getlinestartoffset getlinestartoffset getlinestartoffset get line end offset method returns the end offset of the specified line param line the line return the end offset of the specified line or 1 if the line is invalid public int get line end offset int line return buffer get line end offset line getlineendoffset getlineendoffset getlineendoffset get line length method returns the length of the specified line param line the line public int get line length int line return buffer get line length line getlinelength getlinelength getlinelength get text method returns the specified substring of the buffer param start the start offset param len the length of the substring return the substring public final string get text int start int len return buffer get text start len gettext gettext gettext get text method copies the specified substring of the buffer into a segment param start the start offset param len the length of the substring param segment the segment public final void get text int start int len segment segment buffer get text start len segment gettext gettext gettext get line text method returns the text on the specified line param line index the line return the text or null if the line is invalid public final string get line text int line index return buffer get line text line index getlinetext lineindex getlinetext lineindex getlinetext lineindex get line text method copies the text on the specified line into a segment if the line is invalid the segment will contain a null string param line index the line public final void get line text int line index segment segment buffer get line text line index segment getlinetext lineindex getlinetext lineindex getlinetext lineindex get text method returns the entire text of this text area public string get text return buffer get text 0 buffer get length gettext gettext gettext getlength set text method sets the entire text of this text area public void set text string text try buffer begin compound edit buffer remove 0 buffer get length buffer insert 0 text finally buffer end compound edit settext settext begincompoundedit getlength endcompoundedit select all method selects all text in the buffer public final void select all set selection new selection range 0 buffer get length move caret position buffer get length true selectall selectall setselection getlength movecaretposition getlength select line method selects the current line since j edit 2 7pre2 public void select line int caret line get caret line int start get line start offset caret line int end get line end offset caret line 1 selection s new selection range start end if multi add to selection s else set selection s move caret position end selectline jedit selectline caretline getcaretline getlinestartoffset caretline getlineendoffset caretline addtoselection setselection movecaretposition select paragraph method selects the paragraph at the caret position since j edit 2 7pre2 public void select paragraph int caret line get caret line if get line length caret line 0 get toolkit beep return int start caret line int end caret line while start 0 if get line length start 0 break else start while end get line count if get line length end 0 break else end int selection start get line start offset start 1 int selection end get line end offset end 1 1 selection s new selection range selection start selection end if multi add to selection s else set selection s move caret position selection end selectparagraph jedit selectparagraph caretline getcaretline getlinelength caretline gettoolkit caretline caretline getlinelength getlinecount getlinelength selectionstart getlinestartoffset selectionend getlineendoffset selectionstart selectionend addtoselection setselection movecaretposition selectionend selects the word at the caret position since j edit 2 7pre2 public void select word int line get caret line int line start get line start offset line int offset get caret position line start if get line length line 0 return string line text get line text line string no word sep buffer get string property no word sep if offset get line length line offset int word start text utilities find word start line text offset no word sep int word end text utilities find word end line text offset 1 no word sep selection s new selection range line start word start line start word end if multi add to selection s else set selection s move caret position line start word end jedit selectword getcaretline linestart getlinestartoffset getcaretposition linestart getlinelength linetext getlinetext nowordsep getstringproperty nowordsep getlinelength wordstart textutilities findwordstart linetext nowordsep wordend textutilities findwordend linetext nowordsep linestart wordstart linestart wordend addtoselection setselection movecaretposition linestart wordend select to matching bracket method selects from the bracket at the specified position to the corresponding bracket since j edit 4 2pre1 public selection select to matching bracket int position boolean quick copy int position line buffer get line of offset position int line offset position buffer get line start offset position line if get line length position line 0 int bracket text utilities find matching bracket buffer position line math max 0 line offset 1 if bracket 1 selection s if bracket position if quick copy move caret position position false s new selection range bracket position else if quick copy move caret position bracket 1 false s new selection range position 1 bracket 1 if multi quick copy select none add to selection s return s return null selecttomatchingbracket jedit selecttomatchingbracket quickcopy positionline getlineofoffset lineoffset getlinestartoffset positionline getlinelength positionline textutilities findmatchingbracket positionline lineoffset quickcopy movecaretposition quickcopy movecaretposition quickcopy selectnone addtoselection select to matching bracket method selects from the bracket at the caret position to the corresponding bracket since j edit 4 0pre2 public void select to matching bracket select to matching bracket caret false selecttomatchingbracket jedit selecttomatchingbracket selecttomatchingbracket select block method selects the code block surrounding the caret since j edit 2 7pre2 public void select block string open brackets string close brackets selection s get selection at offset caret int start end if s null start end caret else start s start end s end string text get text 0 buffer get length scan backwards trying to find a bracket int count 1 char open bracket 0 char close bracket 0 we can t do the backward scan if start 0 if start 0 get toolkit beep return backward scan while start 0 char c text char at start int index open brackets index of c if index 1 if count 0 open bracket c close bracket close brackets char at index break backward scan else if close brackets index of c 1 count reset count count 1 scan forward matching that bracket if open bracket 0 get toolkit beep return else forward scan do char c text char at end if c close bracket if count 0 end break forward scan else if c open bracket count while end buffer get length s new selection range start end if multi add to selection s else set selection s move caret position end selectblock jedit selectblock openbrackets closebrackets getselectionatoffset gettext getlength openbracket closebracket gettoolkit backward_scan charat openbrackets indexof openbracket closebracket closebrackets charat backward_scan closebrackets indexof openbracket gettoolkit forward_scan charat closebracket forward_scan openbracket getlength addtoselection setselection movecaretposition line in structure scope method returns if the specified line is contained in the currently matched structure s scope since j edit 4 2pre3 public boolean line in structure scope int line if match null return false if match start line caret line return line match start line line caret line else return line match end line line caret line lineinstructurescope jedit lineinstructurescope startline caretline startline caretline endline caretline invert selection method inverts the selection since j edit 4 0pre1 public final void invert selection selection new selection new selection selection size 1 int last offset 0 for int i 0 i selection size i selection s selection selection element at i new selection i new selection range last offset s get start last offset s get end new selection selection size new selection range last offset buffer get length set selection new selection invertselection jedit invertselection newselection lastoffset elementat newselection lastoffset getstart lastoffset getend newselection lastoffset getlength setselection newselection get selection count method returns the number of selections this can be used to test for the existence of selections since j edit 3 2pre2 public int get selection count return selection size getselectioncount jedit getselectioncount get selection method returns the current selection since j edit 3 2pre1 public selection get selection selection sel new selection selection size selection copy into sel return sel getselection jedit getselection copyinto select none method deselects everything public void select none set selection selection null selectnone selectnone setselection set selection method sets the selection nested and overlapping selections are merged where possible param selection the new selection since j edit 3 2pre1 public void set selection selection selection invalidate the old selection invalidate selected lines this selection remove all elements if selection null for int i 0 i selection length i addtoselection selection i fire caret event setselection jedit setselection invalidateselectedlines removeallelements _addtoselection firecaretevent set selection method sets the selection nested and overlapping selections are merged where possible param selection the new selection since j edit 3 2pre1 public void set selection selection selection invalidate selected lines this selection remove all elements if selection null addtoselection selection fire caret event setselection jedit setselection invalidateselectedlines removeallelements _addtoselection firecaretevent add to selection method adds to the selection nested and overlapping selections are merged where possible param selection the new selection since j edit 3 2pre1 public void add to selection selection selection if selection null for int i 0 i selection length i addtoselection selection i to hide current line highlight invalidate line caret line fire caret event addtoselection jedit addtoselection _addtoselection invalidateline caretline firecaretevent add to selection method adds to the selection nested and overlapping selections are merged where possible param selection the new selection since j edit 3 2pre1 public void add to selection selection selection addtoselection selection to hide current line highlight invalidate line caret line fire caret event addtoselection jedit addtoselection _addtoselection invalidateline caretline firecaretevent get selection at offset method returns the selection containing the specific offset or code null code if there is no selection at that offset param offset the offset since j edit 3 2pre1 public selection get selection at offset int offset if selection null for int i 0 i selection size i selection s selection selection element at i if offset s start offset s end return s return null getselectionatoffset jedit getselectionatoffset elementat remove from selection method deactivates the specified selection param sel the selection since j edit 3 2pre1 public void remove from selection selection sel selection remove element sel invalidate line range sel start line sel end line to hide current line highlight invalidate line caret line fire caret event removefromselection jedit removefromselection removeelement invalidatelinerange startline endline invalidateline caretline firecaretevent remove from selection method deactivates the selection at the specified offset if there is no selection at that offset does nothing param offset the offset since j edit 3 2pre1 public void remove from selection int offset selection sel get selection at offset offset if sel null return selection remove element sel invalidate line range sel start line sel end line to hide current line highlight invalidate line caret line fire caret event removefromselection jedit removefromselection getselectionatoffset removeelement invalidatelinerange startline endline invalidateline caretline firecaretevent resize selection method resizes the selection at the specified offset or creates a new one if there is no selection at the specified offset this is a utility method that is mainly useful in the mouse event handler because it handles the case of end being before offset gracefully unlike the rest of the selection api param offset the offset param end the new selection end param extra end virt only for rectangular selections specifies how far it extends into virtual space param rect make the selection rectangular since j edit 3 2pre1 public void resize selection int offset int end int extra end virt boolean rect selection s get selection at offset offset if s null invalidate line range s start line s end line selection remove element s boolean reversed false if end offset int tmp offset offset end end tmp reversed true selection new sel if rect selection rect rect sel new selection rect offset end if reversed rect sel extra start virt extra end virt else rect sel extra end virt extra end virt new sel rect sel else new sel new selection range offset end addtoselection new sel fire caret event resizeselection extraendvirt jedit resizeselection extraendvirt getselectionatoffset invalidatelinerange startline endline removeelement newsel rectsel rectsel extrastartvirt extraendvirt rectsel extraendvirt extraendvirt newsel rectsel newsel _addtoselection newsel firecaretevent extend selection method extends the selection at the specified offset or creates a new one if there is no selection at the specified offset this is different from resizing in that the new chunk is added to the selection in question instead of replacing it param offset the offset param end the new selection end since j edit 3 2pre1 public void extend selection int offset int end extend selection offset end 0 0 extendselection jedit extendselection extendselection extend selection method extends the selection at the specified offset or creates a new one if there is no selection at the specified offset this is different from resizing in that the new chunk is added to the selection in question instead of replacing it param offset the offset param end the new selection end param extra start virt extra virtual space at the start param extra end virt extra virtual space at the end since j edit 4 2pre1 public void extend selection int offset int end int extra start virt int extra end virt selection s get selection at offset offset if s null invalidate line range s start line s end line selection remove element s if offset s start offset end end s end else if offset s end offset s start if end offset int tmp end end offset offset tmp if rectangular selection mode s new selection rect offset end selection rect s extra start virt extra start virt selection rect s extra end virt extra end virt else s new selection range offset end addtoselection s fire caret event if rectangular selection mode extra end virt 0 int line get line of offset end scroll to line get line length line extra end virt false extendselection extrastartvirt extraendvirt jedit extendselection extrastartvirt extraendvirt getselectionatoffset invalidatelinerange startline endline removeelement rectangularselectionmode extrastartvirt extrastartvirt extraendvirt extraendvirt _addtoselection firecaretevent rectangularselectionmode extraendvirt getlineofoffset scrollto getlinelength extraendvirt get selected text method returns the text in the specified selection param s the selection since j edit 3 2pre1 public string get selected text selection s string buffer buf new string buffer s get text buffer buf return buf to string getselectedtext jedit getselectedtext stringbuffer stringbuffer gettext tostring get selected text method returns the text in all active selections param separator the string to insert between each text chunk for example a newline since j edit 3 2pre1 public string get selected text string separator if selection size 0 return null string buffer buf new string buffer for int i 0 i selection size i if i 0 buf append separator selection selection element at i get text buffer buf return buf to string getselectedtext jedit getselectedtext stringbuffer stringbuffer elementat gettext tostring get selected text method returns the text in all active selections with a newline between each text chunk public string get selected text return get selected text n getselectedtext getselectedtext getselectedtext set selected text method replaces the selection with the specified text param s the selection param selected text the new text since j edit 3 2pre1 public void set selected text selection s string selected text if is editable throw new internal error text component read only try buffer begin compound edit move caret position s set text buffer selected text no matter what happends stops us from leaving buffer in a bad state finally buffer end compound edit no no no select none setselectedtext selectedtext jedit setselectedtext selectedtext iseditable internalerror begincompoundedit movecaretposition settext selectedtext endcompoundedit selectnone set selected text method replaces the selection at the caret with the specified text if there is no selection at the caret the text is inserted at the caret position public void set selected text string selected text set selected text selected text true setselectedtext setselectedtext selectedtext setselectedtext selectedtext set selected text method replaces the selection at the caret with the specified text if there is no selection at the caret the text is inserted at the caret position param selected text the new selection param move caret move caret to insertion location if necessary since j edit 4 2pre5 public void set selected text string selected text boolean move caret if is editable throw new internal error text component read only selection selection get selection if selection length 0 for compatibility with older j edit versions buffer insert caret selected text else try int new caret 1 buffer begin compound edit for int i 0 i selection length i new caret selection i set text buffer selected text if move caret move caret position new caret finally buffer end compound edit select none setselectedtext selectedtext movecaret jedit setselectedtext selectedtext movecaret iseditable internalerror getselection jedit selectedtext newcaret begincompoundedit newcaret settext selectedtext movecaret movecaretposition newcaret endcompoundedit selectnone get selected lines method returns a sorted array of line numbers on which a selection or selections are present p this method is the most convenient way to iterate through selected lines in a buffer the line numbers in the array returned by this method can be passed as a parameter to such methods as link org gjt sp jedit buffer get line text int since j edit 3 2pre1 public int get selected lines if selection size 0 return new int caret line integer line set set new tree set for int i 0 i selection size i selection s selection selection element at i int end line s end get line start offset s end line s end line 1 s end line for int j s start line j end line j line new integer j set add line int return value new int set size int i 0 iterator iter set iterator while iter has next line integer iter next return value i line int value return return value getselectedlines getlinetext jedit getselectedlines caretline treeset elementat endline getlinestartoffset endline endline endline startline endline returnvalue hasnext returnvalue intvalue returnvalue show select line range dialog method displays the select line range dialog box and selects the specified range of lines since j edit 2 7pre2 public void show select line range dialog new select line range view showselectlinerangedialog jedit showselectlinerangedialog selectlinerange add structure matcher method adds a structure matcher since j edit 4 2pre3 public void add structure matcher structure matcher matcher structure matchers add matcher addstructurematcher jedit addstructurematcher structurematcher structurematchers remove structure matcher method removes a structure matcher since j edit 4 2pre3 public void remove structure matcher structure matcher matcher structure matchers remove matcher removestructurematcher jedit removestructurematcher structurematcher structurematchers get structure match method returns the structure element bracket or xml tag etc matching the one before the caret since j edit 4 2pre3 public structure matcher match get structure match return match getstructurematch jedit structurematcher getstructurematch blink caret method blinks the caret public final void blink caret if caret blinks blink blink invalidate line caret line else blink true blinkcaret blinkcaret caretblinks invalidateline caretline center caret method centers the caret on the screen since j edit 2 7pre2 public void center caret int offset get screen line start offset visible lines 2 if offset 1 get toolkit beep else set caret position offset centercaret jedit centercaret getscreenlinestartoffset visiblelines gettoolkit setcaretposition set caret position method sets the caret position and deactivates the selection param new caret the caret position public void set caret position int new caret invalidate selected lines selection remove all elements move caret position new caret true setcaretposition newcaret setcaretposition newcaret invalidateselectedlines removeallelements movecaretposition newcaret set caret position method sets the caret position and deactivates the selection param new caret the caret position param do electric scroll do electric scrolling public void set caret position int new caret boolean do electric scroll invalidate selected lines selection remove all elements move caret position new caret do electric scroll setcaretposition newcaret doelectricscroll setcaretposition newcaret doelectricscroll invalidateselectedlines removeallelements movecaretposition newcaret doelectricscroll move caret position method sets the caret position without deactivating the selection param new caret the caret position public void move caret position int new caret move caret position new caret true movecaretposition newcaret movecaretposition newcaret movecaretposition newcaret move caret position method sets the caret position without deactivating the selection param new caret the caret position param do electric scroll do electric scrolling public void move caret position int new caret boolean do electric scroll move caret position new caret do electric scroll electric scroll normal scroll movecaretposition newcaret doelectricscroll movecaretposition newcaret doelectricscroll movecaretposition newcaret doelectricscroll electric_scroll normal_scroll public static int electric scroll 2 sets the caret position without deactivating the selection param new caret the caret position param scroll mode the scroll mode no scroll normal scroll or electric scroll since j edit 4 2pre1 public void move caret position int new caret int scroll mode if new caret 0 new caret buffer get length throw new illegal argument exception caret out of bounds new caret if match null if caret line match start line invalidate line range caret line match end line else invalidate line range match start line caret line match null if caret new caret if scroll mode normal scroll finish caret update false false else if scroll mode electric scroll finish caret update true false else int new caret line get line of offset new caret magic caret 1 if caret line new caret line if caret screen line 1 invalidate screen line range caret screen line caret screen line else int new caret screen line chunk cache get screen line of offset new caret line new caret buffer get line start offset new caret line if caret screen line 1 invalidate screen line range new caret screen line new caret screen line else invalidate screen line range caret screen line new caret screen line caret screen line new caret screen line caret new caret caret line new caret line if scroll mode normal scroll finish caret update false true else if scroll mode electric scroll finish caret update true true electric_scroll newcaret scrollmode no_scroll normal_scroll electric_scroll jedit movecaretposition newcaret scrollmode newcaret newcaret getlength illegalargumentexception newcaret caretline startline invalidatelinerange caretline endline invalidatelinerange startline caretline newcaret scrollmode normal_scroll finishcaretupdate scrollmode electric_scroll finishcaretupdate newcaretline getlineofoffset newcaret magiccaret caretline newcaretline caretscreenline invalidatescreenlinerange caretscreenline caretscreenline newcaretscreenline chunkcache getscreenlineofoffset newcaretline newcaret getlinestartoffset newcaretline caretscreenline invalidatescreenlinerange newcaretscreenline newcaretscreenline invalidatescreenlinerange caretscreenline newcaretscreenline caretscreenline newcaretscreenline newcaret caretline newcaretline scrollmode normal_scroll finishcaretupdate scrollmode electric_scroll finishcaretupdate get caret position method returns a zero based index of the caret position public int get caret position return caret getcaretposition getcaretposition get caret line method returns the line number containing the caret public int get caret line return caret line getcaretline getcaretline caretline get magic caret position method returns an internal position used to keep the caret in one column while moving around lines of varying lengths since j edit 4 2pre1 public int get magic caret position if magic caret 1 magic caret chunk cache subregion offset tox caret line caret get line start offset caret line return magic caret getmagiccaretposition jedit getmagiccaretposition magiccaret magiccaret chunkcache subregionoffsettox caretline getlinestartoffset caretline magiccaret set magic caret position method sets the magic caret position this can be used to preserve the column position when moving up and down lines param magic caret the magic caret position since j edit 4 2pre1 public void set magic caret position int magic caret this magic caret magic caret setmagiccaretposition magiccaret jedit setmagiccaretposition magiccaret magiccaret magiccaret add caret listener method adds a caret change listener to this text area param listener the listener public final void add caret listener caret listener listener listener list add caret listener class listener addcaretlistener addcaretlistener caretlistener listenerlist caretlistener remove caret listener method removes a caret change listener from this text area param listener the listener public final void remove caret listener caret listener listener listener list remove caret listener class listener removecaretlistener removecaretlistener caretlistener listenerlist caretlistener go to next bracket method moves the caret to the next closing bracket since j edit 2 7pre2 public void go to next bracket boolean select int new caret 1 if caret buffer get length string text get text caret buffer get length caret 1 loop for int i 0 i text length i switch text char at i case case case new caret caret i 1 break loop if new caret 1 get toolkit beep else if select extend selection caret new caret else if multi select none move caret position new caret gotonextbracket jedit gotonextbracket newcaret getlength gettext getlength charat newcaret newcaret gettoolkit extendselection newcaret selectnone movecaretposition newcaret go to next character method moves the caret to the next character since j edit 2 7pre2 public void go to next character boolean select selection s get selection at offset caret if select s instanceof selection range if multi if caret s end move caret position s end return else set caret position s end return int extra start virt extra end virt if s instanceof selection rect extra start virt selection rect s extra start virt extra end virt selection rect s extra end virt else extra start virt 0 extra end virt 0 int new caret caret if caret buffer get length if select rectangular selection mode s instanceof selection rect if s null caret s start extra start virt else extra end virt else get toolkit beep return else if caret get line end offset caret line 1 if select rectangular selection mode s instanceof selection rect if s null caret s start extra start virt else extra end virt else int line display manager get next visible line caret line if line 1 get toolkit beep return else new caret get line start offset line else new caret caret 1 if select extend selection caret new caret extra start virt extra end virt else if multi select none move caret position new caret gotonextcharacter jedit gotonextcharacter getselectionatoffset movecaretposition setcaretposition extrastartvirt extraendvirt extrastartvirt extrastartvirt extraendvirt extraendvirt extrastartvirt extraendvirt newcaret getlength rectangularselectionmode extrastartvirt extraendvirt gettoolkit getlineendoffset caretline rectangularselectionmode extrastartvirt extraendvirt displaymanager getnextvisibleline caretline gettoolkit newcaret getlinestartoffset newcaret extendselection newcaret extrastartvirt extraendvirt selectnone movecaretposition newcaret go to next line method move the caret to the next line since j edit 2 7pre2 public void go to next line boolean select selection s get selection at offset caret boolean rect select s null rectangular selection mode s instanceof selection rect int magic get magic caret position int new caret chunk cache get below position caret line caret buffer get line start offset caret line magic 1 rect select select if new caret 1 int end get line end offset caret line 1 if caret end get toolkit beep return else new caret end if select rect params params get rect params caret new caret int extra start virt int extra end virt if params null extra start virt 0 extra end virt 0 else extra start virt params extra start virt extra end virt params extra end virt new caret params new caret extend selection caret new caret extra start virt extra end virt else if multi select none move caret position new caret set magic caret position magic gotonextline jedit gotonextline getselectionatoffset rectselect rectangularselectionmode getmagiccaretposition newcaret chunkcache getbelowposition caretline getlinestartoffset caretline rectselect newcaret getlineendoffset caretline gettoolkit newcaret rectparams getrectparams newcaret extrastartvirt extraendvirt extrastartvirt extraendvirt extrastartvirt extrastartvirt extraendvirt extraendvirt newcaret newcaret extendselection newcaret extrastartvirt extraendvirt selectnone movecaretposition newcaret setmagiccaretposition go to next marker method moves the caret to the next marker since j edit 2 7pre2 public void go to next marker boolean select vector markers buffer get markers if markers size 0 get toolkit beep return marker marker null for int i 0 i markers size i marker marker marker markers get i if marker get position caret marker marker break if marker null marker marker markers get 0 if select extend selection caret marker get position else if multi select none move caret position marker get position gotonextmarker jedit gotonextmarker getmarkers gettoolkit _marker _marker getposition _marker extendselection getposition selectnone movecaretposition getposition go to next page method moves the caret to the next screenful since j edit 2 7pre2 public void go to next page boolean select scroll to caret false int magic get magic caret position if caret line display manager get first visible line caret line display manager get next visible line caret line int new caret if get first line get visible lines display manager get scroll line count int last visible line display manager get last visible line new caret get line end offset last visible line 1 else int caret screen line get screen line of offset caret scroll down page new caret x to screen line offset caret screen line magic true if select extend selection caret new caret else if multi select none move caret position new caret false set magic caret position magic gotonextpage jedit gotonextpage scrolltocaret getmagiccaretposition caretline displaymanager getfirstvisibleline caretline displaymanager getnextvisibleline caretline newcaret getfirstline getvisiblelines displaymanager getscrolllinecount lastvisibleline displaymanager getlastvisibleline newcaret getlineendoffset lastvisibleline caretscreenline getscreenlineofoffset scrolldownpage newcaret xtoscreenlineoffset caretscreenline extendselection newcaret selectnone movecaretposition newcaret setmagiccaretposition go to next paragraph method moves the caret to the start of the next paragraph since j edit 2 7pre2 public void go to next paragraph boolean select int line no get caret line int new caret get buffer length boolean found blank false loop for int i line no 1 i get line count i if display manager is line visible i continue get line text i line segment for int j 0 j line segment count j switch line segment array line segment offset j case case t break default if found blank new caret get line start offset i break loop else continue loop found blank true if select extend selection caret new caret else if multi select none move caret position new caret gotonextparagraph jedit gotonextparagraph lineno getcaretline newcaret getbufferlength foundblank lineno getlinecount displaymanager islinevisible getlinetext linesegment linesegment linesegment linesegment foundblank newcaret getlinestartoffset foundblank extendselection newcaret selectnone movecaretposition newcaret go to next word method moves the caret to the start of the next word note that if the view eat whitespace boolean propery is false this method moves the caret to the end of the current word instead since j edit 2 7pre2 public void go to next word boolean select go to next word select false gotonextword eatwhitespace jedit gotonextword gotonextword go to next word method moves the caret to the start of the next word since j edit 4 1pre5 public void go to next word boolean select boolean eat whitespace int line start get line start offset caret line int new caret caret line start string line text get line text caret line if new caret line text length int next line display manager get next visible line caret line if next line 1 get toolkit beep return new caret get line start offset next line else string no word sep buffer get string property no word sep new caret text utilities find word end line text new caret 1 no word sep true eat whitespace new caret line start if select extend selection caret new caret else if multi select none move caret position new caret gotonextword jedit gotonextword eatwhitespace linestart getlinestartoffset caretline newcaret linestart linetext getlinetext caretline newcaret linetext nextline displaymanager getnextvisibleline caretline nextline gettoolkit newcaret getlinestartoffset nextline nowordsep getstringproperty nowordsep newcaret textutilities findwordend linetext newcaret nowordsep eatwhitespace newcaret linestart extendselection newcaret selectnone movecaretposition newcaret go to prev bracket method moves the caret to the previous bracket since j edit 2 7pre2 public void go to prev bracket boolean select string text get text 0 caret int new caret 1 loop for int i get caret position 1 i 0 i switch text char at i case case case new caret i break loop if new caret 1 get toolkit beep else if select extend selection caret new caret else if multi select none move caret position new caret gotoprevbracket jedit gotoprevbracket gettext newcaret getcaretposition charat newcaret newcaret gettoolkit extendselection newcaret selectnone movecaretposition newcaret go to prev character method moves the caret to the previous character since j edit 2 7pre2 public void go to prev character boolean select selection s get selection at offset caret if select s instanceof selection range if multi if caret s start move caret position s start return else set caret position s start return int extra start virt 0 int extra end virt 0 int new caret caret if select caret get line end offset caret line 1 if s instanceof selection rect extra start virt selection rect s extra start virt extra end virt selection rect s extra end virt if caret s start if extra start virt 0 new caret caret 1 else extra start virt else if extra end virt 0 new caret caret 1 else extra end virt else new caret caret 1 else if caret get line start offset caret line int line display manager get prev visible line caret line if line 1 get toolkit beep return new caret get line end offset line 1 else new caret caret 1 if select extend selection caret new caret extra start virt extra end virt else if multi select none move caret position new caret gotoprevcharacter jedit gotoprevcharacter getselectionatoffset movecaretposition setcaretposition extrastartvirt extraendvirt newcaret getlineendoffset caretline extrastartvirt extrastartvirt extraendvirt extraendvirt extrastartvirt newcaret extrastartvirt extraendvirt newcaret extraendvirt newcaret getlinestartoffset caretline displaymanager getprevvisibleline caretline gettoolkit newcaret getlineendoffset newcaret extendselection newcaret extrastartvirt extraendvirt selectnone movecaretposition newcaret go to prev line method moves the caret to the previous line since j edit 2 7pre2 public void go to prev line boolean select selection s get selection at offset caret boolean rect select s null rectangular selection mode s instanceof selection rect int magic get magic caret position int new caret chunk cache get above position caret line caret buffer get line start offset caret line magic 1 rect select select if new caret 1 int start get line start offset caret line if caret start get toolkit beep return else new caret start if select rect params params get rect params caret new caret int extra start virt int extra end virt if params null extra start virt 0 extra end virt 0 else extra start virt params extra start virt extra end virt params extra end virt new caret params new caret extend selection caret new caret extra start virt extra end virt else if multi select none move caret position new caret set magic caret position magic gotoprevline jedit gotoprevline getselectionatoffset rectselect rectangularselectionmode getmagiccaretposition newcaret chunkcache getaboveposition caretline getlinestartoffset caretline rectselect newcaret getlinestartoffset caretline gettoolkit newcaret rectparams getrectparams newcaret extrastartvirt extraendvirt extrastartvirt extraendvirt extrastartvirt extrastartvirt extraendvirt extraendvirt newcaret newcaret extendselection newcaret extrastartvirt extraendvirt selectnone movecaretposition newcaret setmagiccaretposition go to prev marker method moves the caret to the previous marker since j edit 2 7pre2 public void go to prev marker boolean select vector markers buffer get markers if markers size 0 get toolkit beep return marker marker null for int i markers size 1 i 0 i marker marker marker markers element at i if marker get position caret marker marker break if marker null marker marker markers get markers size 1 if select extend selection caret marker get position else if multi select none move caret position marker get position gotoprevmarker jedit gotoprevmarker getmarkers gettoolkit _marker elementat _marker getposition _marker extendselection getposition selectnone movecaretposition getposition go to prev page method moves the caret to the previous screenful since j edit 2 7pre2 public void go to prev page boolean select scroll to caret false int magic get magic caret position if caret line display manager get first visible line caret line display manager get next visible line caret line int new caret if get first line 0 int first visible line display manager get first visible line new caret get line start offset first visible line else int caret screen line get screen line of offset caret scroll up page new caret x to screen line offset caret screen line magic true if select extend selection caret new caret else if multi select none move caret position new caret false set magic caret position magic gotoprevpage jedit gotoprevpage scrolltocaret getmagiccaretposition caretline displaymanager getfirstvisibleline caretline displaymanager getnextvisibleline caretline newcaret getfirstline firstvisibleline displaymanager getfirstvisibleline newcaret getlinestartoffset firstvisibleline caretscreenline getscreenlineofoffset scrolluppage newcaret xtoscreenlineoffset caretscreenline extendselection newcaret selectnone movecaretposition newcaret setmagiccaretposition go to prev paragraph method moves the caret to the start of the previous paragraph since j edit 2 7pre2 public void go to prev paragraph boolean select int line no caret line int new caret 0 boolean found blank false loop for int i line no 1 i 0 i if display manager is line visible i continue get line text i line segment for int j 0 j line segment count j switch line segment array line segment offset j case case t break default if found blank new caret get line end offset i 1 break loop else continue loop found blank true if select extend selection caret new caret else if multi select none move caret position new caret gotoprevparagraph jedit gotoprevparagraph lineno caretline newcaret foundblank lineno displaymanager islinevisible getlinetext linesegment linesegment linesegment linesegment foundblank newcaret getlineendoffset foundblank extendselection newcaret selectnone movecaretposition newcaret go to prev word method moves the caret to the start of the previous word since j edit 2 7pre2 public void go to prev word boolean select go to prev word select false gotoprevword jedit gotoprevword gotoprevword go to prev word method moves the caret to the start of the previous word since j edit 4 1pre5 public void go to prev word boolean select boolean eat whitespace int line start get line start offset caret line int new caret caret line start string line text get line text caret line if new caret 0 if line start 0 get toolkit beep return else int prev line display manager get prev visible line caret line if prev line 1 get toolkit beep return new caret get line end offset prev line 1 else string no word sep buffer get string property no word sep new caret text utilities find word start line text new caret 1 no word sep true eat whitespace new caret line start if select extend selection caret new caret else if multi select none move caret position new caret gotoprevword jedit gotoprevword eatwhitespace linestart getlinestartoffset caretline newcaret linestart linetext getlinetext caretline newcaret linestart gettoolkit prevline displaymanager getprevvisibleline caretline prevline gettoolkit newcaret getlineendoffset prevline nowordsep getstringproperty nowordsep newcaret textutilities findwordstart linetext newcaret nowordsep eatwhitespace newcaret linestart extendselection newcaret selectnone movecaretposition newcaret smart home method on subsequent invocations first moves the caret to the first non whitespace character of the line then the beginning of the line then to the first visible line since j edit 2 7pre2 public void smart home boolean select macros recorder recorder view get macro recorder switch view get input handler get last action count case 1 if recorder null recorder record text area go to start of white space select go to start of white space select break case 2 if recorder null recorder record text area go to start of line select go to start of line select break default case 3 if recorder null recorder record text area go to first visible line select go to first visible line select break smarthome jedit smarthome getmacrorecorder getinputhandler getlastactioncount textarea gotostartofwhitespace gotostartofwhitespace textarea gotostartofline gotostartofline textarea gotofirstvisibleline gotofirstvisibleline smart end method on subsequent invocations first moves the caret to the last non whitespace character of the line then the end of the line then to the last visible line since j edit 2 7pre2 public void smart end boolean select macros recorder recorder view get macro recorder switch view get input handler get last action count case 1 if recorder null recorder record text area go to end of white space select go to end of white space select break case 2 if recorder null recorder record text area go to end of line select go to end of line select break default case 3 if recorder null recorder record text area go to last visible line select go to last visible line select break smartend jedit smartend getmacrorecorder getinputhandler getlastactioncount textarea gotoendofwhitespace gotoendofwhitespace textarea gotoendofline gotoendofline textarea gotolastvisibleline gotolastvisibleline go to start of line method moves the caret to the beginning of the current line since j edit 2 7pre2 public void go to start of line boolean select selection s get selection at offset caret int line select s null caret line s start line int new caret get line start offset line if select extend selection caret new caret else if multi select none move caret position new caret gotostartofline jedit gotostartofline getselectionatoffset caretline startline newcaret getlinestartoffset extendselection newcaret selectnone movecaretposition newcaret go to end of line method moves the caret to the end of the current line since j edit 2 7pre2 public void go to end of line boolean select selection s get selection at offset caret int line select s null caret line s end line int new caret get line end offset line 1 if select extend selection caret new caret else if multi select none move caret position new caret so that end followed by up arrow will always put caret at the end of the previous line for example set magic caret position integer max value gotoendofline jedit gotoendofline getselectionatoffset caretline endline newcaret getlineendoffset extendselection newcaret selectnone movecaretposition newcaret setmagiccaretposition max_value go to start of white space method moves the caret to the first non whitespace character of the current line since j edit 2 7pre2 public void go to start of white space boolean select selection s get selection at offset caret int line offset if select s null line caret line offset caret buffer get line start offset line else line s start line offset s start buffer get line start offset line int first indent chunk cache get subregion start offset line offset if first indent get line start offset line first indent misc utilities get leading white space get line text line if first indent get line length line first indent 0 first indent get line start offset line if select extend selection caret first indent else if multi select none move caret position first indent gotostartofwhitespace jedit gotostartofwhitespace getselectionatoffset caretline getlinestartoffset startline getlinestartoffset firstindent chunkcache getsubregionstartoffset firstindent getlinestartoffset firstindent miscutilities getleadingwhitespace getlinetext firstindent getlinelength firstindent firstindent getlinestartoffset extendselection firstindent selectnone movecaretposition firstindent go to end of white space method moves the caret to the last non whitespace character of the current line since j edit 2 7pre2 public void go to end of white space boolean select selection s get selection at offset caret int line offset if select s null line caret line offset caret get line start offset line else line s end line offset s end get line start offset line int last indent chunk cache get subregion end offset line offset if last indent get line end offset line last indent get line length line misc utilities get trailing white space get line text line if last indent 0 last indent get line length line last indent get line start offset line else last indent if select extend selection caret last indent else if multi select none move caret position last indent gotoendofwhitespace jedit gotoendofwhitespace getselectionatoffset caretline getlinestartoffset endline getlinestartoffset lastindent chunkcache getsubregionendoffset lastindent getlineendoffset lastindent getlinelength miscutilities gettrailingwhitespace getlinetext lastindent lastindent getlinelength lastindent getlinestartoffset lastindent extendselection lastindent selectnone movecaretposition lastindent go to first visible line method moves the caret to the first visible line since j edit 2 7pre2 public void go to first visible line boolean select int first visible line get first line 0 0 electric scroll int first visible get screen line start offset first visible line if first visible 1 first visible get line start offset display manager get first visible line if select extend selection caret first visible else if multi select none move caret position first visible gotofirstvisibleline jedit gotofirstvisibleline firstvisibleline getfirstline electricscroll firstvisible getscreenlinestartoffset firstvisibleline firstvisible firstvisible getlinestartoffset displaymanager getfirstvisibleline extendselection firstvisible selectnone movecaretposition firstvisible go to last visible line method moves the caret to the last visible line since j edit 2 7pre2 public void go to last visible line boolean select int last visible if get first line visible lines display manager get scroll line count last visible get line end offset display manager get last visible line 1 else last visible visible lines electric scroll 1 if last line partial last visible if last visible 0 last visible 0 last visible get screen line end offset last visible 1 if last visible 1 last visible get line end offset display manager get last visible line 1 if select extend selection caret last visible else if multi select none move caret position last visible gotolastvisibleline jedit gotolastvisibleline lastvisible getfirstline visiblelines displaymanager getscrolllinecount lastvisible getlineendoffset displaymanager getlastvisibleline lastvisible visiblelines electricscroll lastlinepartial lastvisible lastvisible lastvisible lastvisible getscreenlineendoffset lastvisible lastvisible lastvisible getlineendoffset displaymanager getlastvisibleline extendselection lastvisible selectnone movecaretposition lastvisible go to buffer start method moves the caret to the beginning of the buffer since j edit 4 0pre3 public void go to buffer start boolean select int start buffer get line start offset display manager get first visible line if select extend selection caret start else if multi select none move caret position start gotobufferstart jedit gotobufferstart getlinestartoffset displaymanager getfirstvisibleline extendselection selectnone movecaretposition go to buffer end method moves the caret to the end of the buffer since j edit 4 0pre3 public void go to buffer end boolean select int end buffer get line end offset display manager get last visible line 1 if select extend selection caret end else if multi select none move caret position end gotobufferend jedit gotobufferend getlineendoffset displaymanager getlastvisibleline extendselection selectnone movecaretposition go to matching bracket method moves the caret to the bracket matching the one before the caret since j edit 2 7pre3 public void go to matching bracket if get line length caret line 0 int dot caret get line start offset caret line int bracket text utilities find matching bracket buffer caret line math max 0 dot 1 if bracket 1 select none move caret position bracket 1 false return get toolkit beep gotomatchingbracket jedit gotomatchingbracket getlinelength caretline getlinestartoffset caretline textutilities findmatchingbracket caretline selectnone movecaretposition gettoolkit show go to line dialog method displays the go to line dialog box and moves the caret to the specified line number since j edit 2 7pre2 public void show go to line dialog string line gui utilities input view goto line null if line null return try int line number integer parse int line 1 set caret position get line start offset line number catch exception e get toolkit beep showgotolinedialog jedit showgotolinedialog guiutilities linenumber parseint setcaretposition getlinestartoffset linenumber gettoolkit user input method handles the insertion of the specified character it performs the following operations above and beyond simply inserting the text ul li inserting a tab with a selection will shift to the right li inserting a space with automatic abbrev expansion enabled will try to expand the abbrev li inserting an indent open close bracket will re indent the current line as necessary ul param ch the character see set selected text string see is overwrite enabled since j edit 2 7pre3 public void user input char ch if is editable get toolkit beep return if ch abbrevs get expand on input abbrevs expand abbrev view false return else if ch t if selection size 1 selection sel selection selection element at 0 if sel instanceof selection rect sel start line sel end line sel start buffer get line start offset sel start line sel end buffer get line end offset sel start line 1 insert tab else shift indent right else if selection size 0 shift indent right else insert tab return else boolean indent check if the user entered a bracket string indent open brackets string buffer get property indent open brackets string indent close brackets string buffer get property indent close brackets if indent close brackets null indent close brackets index of ch 1 indent open brackets null indent open brackets index of ch 1 indent true else indent false string str string value of ch selection selection get selection if selection length 0 for int i 0 i selection length i selection s selection i set selected text s str if s instanceof selection rect add to selection new selection rect s start 1 s end 1 return if ch if do word wrap true return else do word wrap false try don t overstrike if we re on the end of the line if overwrite indent buffer begin compound edit if overwrite int caret line end get line end offset caret line if caret line end caret 1 buffer remove caret 1 buffer insert caret str if indent buffer indent line caret line true finally if overwrite indent buffer end compound edit userinput setselectedtext isoverwriteenabled jedit userinput iseditable gettoolkit getexpandoninput expandabbrev elementat startline endline getlinestartoffset startline getlineendoffset startline inserttab shiftindentright shiftindentright inserttab indentopenbrackets getproperty indentopenbrackets indentclosebrackets getproperty indentclosebrackets indentclosebrackets indentclosebrackets indexof indentopenbrackets indentopenbrackets indexof valueof getselection setselectedtext addtoselection dowordwrap dowordwrap begincompoundedit caretlineend getlineendoffset caretline caretlineend indentline caretline endcompoundedit is overwrite enabled method returns true if overwrite mode is enabled false otherwise public final boolean is overwrite enabled return overwrite isoverwriteenabled isoverwriteenabled set overwrite enabled method sets overwrite mode public final void set overwrite enabled boolean overwrite blink true caret timer restart this overwrite overwrite invalidate line caret line if view get status null view get status update misc status setoverwriteenabled setoverwriteenabled carettimer invalidateline caretline getstatus getstatus updatemiscstatus toggle overwrite enabled method toggles overwrite mode since j edit 2 7pre2 public final void toggle overwrite enabled set overwrite enabled overwrite if view get status null view get status set message and clear j edit get property view status overwrite changed new integer new integer overwrite 1 0 toggleoverwriteenabled jedit toggleoverwriteenabled setoverwriteenabled getstatus getstatus setmessageandclear jedit getproperty backspace method deletes the character before the caret or the selection if one is active since j edit 2 7pre2 public void backspace delete false jedit backspace word method deletes the word before the caret since j edit 2 7pre2 public void backspace word backspace word false backspaceword jedit backspaceword backspaceword backspace word method deletes the word before the caret param eat whitespace if true will eat whitespace since j edit 4 2pre5 public void backspace word boolean eat whitespace if buffer is editable get toolkit beep return if selection size 0 set selected text return int line start get line start offset caret line int caret caret line start string line text get line text caret line if caret 0 if line start 0 get toolkit beep return caret else string no word sep buffer get string property no word sep caret text utilities find word start line text caret 1 no word sep true eat whitespace buffer remove caret line start caret caret line start backspaceword eatwhitespace jedit backspaceword eatwhitespace iseditable gettoolkit setselectedtext linestart getlinestartoffset caretline _caret linestart linetext getlinetext caretline _caret linestart gettoolkit _caret nowordsep getstringproperty nowordsep _caret textutilities findwordstart linetext _caret nowordsep eatwhitespace _caret linestart _caret linestart delete method deletes the character after the caret since j edit 2 7pre2 public void delete delete true jedit delete to end of line method deletes from the caret to the end of the current line since j edit 2 7pre2 public void delete to end of line if buffer is editable get toolkit beep return buffer remove caret get line end offset caret line caret 1 deletetoendofline jedit deletetoendofline iseditable gettoolkit getlineendoffset caretline delete line method deletes the line containing the caret since j edit 2 7pre2 public void delete line if buffer is editable get toolkit beep return int start get line start offset caret line int end get line end offset caret line int x chunk cache subregion offset tox caret line caret start otherwise a bunch of consecutive c d s would be merged into one edit try if end buffer get length if start 0 start end buffer begin compound edit buffer remove start end start finally buffer end compound edit int last line display manager get last visible line if caret line last line int offset chunk cache x to subregion offset last line 0 x true set caret position buffer get line start offset last line offset else int offset chunk cache x to subregion offset caret line 0 x true set caret position start offset deleteline jedit deleteline iseditable gettoolkit getlinestartoffset caretline getlineendoffset caretline chunkcache subregionoffsettox caretline getlength begincompoundedit endcompoundedit lastline displaymanager getlastvisibleline caretline lastline chunkcache xtosubregionoffset lastline setcaretposition getlinestartoffset lastline chunkcache xtosubregionoffset caretline setcaretposition delete paragraph method deletes the paragraph containing the caret since j edit 2 7pre2 public void delete paragraph if buffer is editable get toolkit beep return int start 0 end buffer get length loop for int i caret line 1 i 0 i if display manager is line visible i continue loop get line text i line segment for int j 0 j line segment count j switch line segment array line segment offset j case case t break default continue loop start get line start offset i break loop loop for int i caret line 1 i get line count i if display manager is line visible i continue loop get line text i line segment for int j 0 j line segment count j switch line segment array line segment offset j case case t break default continue loop end get line end offset i 1 break loop buffer remove start end start deleteparagraph jedit deleteparagraph iseditable gettoolkit getlength caretline displaymanager islinevisible getlinetext linesegment linesegment linesegment linesegment getlinestartoffset caretline getlinecount displaymanager islinevisible getlinetext linesegment linesegment linesegment linesegment getlineendoffset delete to start of line method deletes from the caret to the beginning of the current line since j edit 2 7pre2 public void delete to start of line if buffer is editable get toolkit beep return buffer remove get line start offset caret line caret get line start offset caret line deletetostartofline jedit deletetostartofline iseditable gettoolkit getlinestartoffset caretline getlinestartoffset caretline delete word method deletes the word in front of the caret since j edit 2 7pre2 public void delete word delete word false deleteword jedit deleteword deleteword delete word method deletes the word in front of the caret param eat whitespace if true will eat whitespace since j edit 4 2pre5 public void delete word boolean eat whitespace if buffer is editable get toolkit beep return if selection size 0 set selected text return int line start get line start offset caret line int caret caret line start string line text get line text caret line if caret line text length if line start caret buffer get length get toolkit beep return caret else string no word sep buffer get string property no word sep caret text utilities find word end line text caret 1 no word sep true eat whitespace buffer remove caret caret line start caret deleteword eatwhitespace jedit deleteword eatwhitespace iseditable gettoolkit setselectedtext linestart getlinestartoffset caretline _caret linestart linetext getlinetext caretline _caret linetext linestart _caret getlength gettoolkit _caret nowordsep getstringproperty nowordsep _caret textutilities findwordend linetext _caret nowordsep eatwhitespace _caret linestart is multiple selection enabled method returns if multiple selection is enabled since j edit 3 2pre1 public final boolean is multiple selection enabled return multi ismultipleselectionenabled jedit ismultipleselectionenabled toggle multiple selection enabled method toggles multiple selection since j edit 3 2pre1 public final void toggle multiple selection enabled set multiple selection enabled multi if view get status null view get status set message and clear j edit get property view status multi changed new integer new integer multi 1 0 togglemultipleselectionenabled jedit togglemultipleselectionenabled setmultipleselectionenabled getstatus getstatus setmessageandclear jedit getproperty set multiple selection enabled method set multiple selection on or off according to the value of code multi code this only affects the ability to make multiple selections in the user interface macros and plugins can manipulate them regardless of the setting of this flag in fact in most cases calling this method should not be necessary param multi should multiple selection be enabled since j edit 3 2pre1 public final void set multiple selection enabled boolean multi this multi multi if view get status null view get status update misc status painter repaint setmultipleselectionenabled jedit setmultipleselectionenabled getstatus getstatus updatemiscstatus is rectangular selection enabled method returns if rectangular selection is enabled since j edit 4 2pre1 public final boolean is rectangular selection enabled return rectangular selection mode isrectangularselectionenabled jedit isrectangularselectionenabled rectangularselectionmode toggle rectangular selection enabled method toggles rectangular selection since j edit 4 2pre1 public final void toggle rectangular selection enabled set rectangular selection enabled rectangular selection mode if view get status null view get status set message and clear j edit get property view status rect select changed new integer new integer rectangular selection mode 1 0 togglerectangularselectionenabled jedit togglerectangularselectionenabled setrectangularselectionenabled rectangularselectionmode getstatus getstatus setmessageandclear jedit getproperty rectangularselectionmode set rectangular selection enabled method set rectangular selection on or off according to the value of code rectangular selection mode code this only affects the ability to make multiple selections from the keyboard a rectangular selection can always be created by dragging with the mouse by holding down b control b regardless of the state of this flag param rectangular selection mode should rectangular selection be enabled since j edit 4 2pre1 public final void set rectangular selection enabled boolean rectangular selection mode this rectangular selection mode rectangular selection mode if view get status null view get status update misc status painter repaint setrectangularselectionenabled rectangularselectionmode rectangularselectionmode jedit setrectangularselectionenabled rectangularselectionmode rectangularselectionmode rectangularselectionmode getstatus getstatus updatemiscstatus go to marker method moves the caret to the marker with the specified shortcut param shortcut the shortcut param select true if the selection should be extended false otherwise since j edit 3 2pre2 public void go to marker char shortcut boolean select marker marker buffer get marker shortcut if marker null get toolkit beep return int pos marker get position if select extend selection caret pos else if multi select none move caret position pos gotomarker jedit gotomarker getmarker gettoolkit getposition extendselection selectnone movecaretposition add marker method adds a marker at the caret position since j edit 3 2pre1 public void add marker always add markers on selected lines selection selection get selection for int i 0 i selection length i selection s selection i if s start line s end line if s start line caret line buffer add marker 0 s start if s end line caret line buffer add marker 0 s end toggle marker on caret line buffer add or remove marker 0 caret addmarker jedit addmarker getselection startline endline startline caretline addmarker endline caretline addmarker addorremovemarker swap marker and caret method moves the caret to the marker with the specified shortcut then sets the marker position to the former caret position param shortcut the shortcut since j edit 3 2pre2 public void swap marker and caret char shortcut marker marker buffer get marker shortcut if marker null get toolkit beep return int caret get caret position set caret position marker get position buffer add marker shortcut caret swapmarkerandcaret jedit swapmarkerandcaret getmarker gettoolkit getcaretposition setcaretposition getposition addmarker go to parent fold method moves the caret to the fold containing the one at the caret position since j edit 4 0pre3 public void go to parent fold int line 1 int level buffer get fold level caret line for int i caret line 1 i 0 i if buffer get fold level i level line i break if line 1 get toolkit beep return int magic get magic caret position int new caret buffer get line start offset line chunk cache x to subregion offset line 0 magic 1 true if multi select none move caret position new caret set magic caret position magic gotoparentfold jedit gotoparentfold getfoldlevel caretline caretline getfoldlevel gettoolkit getmagiccaretposition newcaret getlinestartoffset chunkcache xtosubregionoffset selectnone movecaretposition newcaret setmagiccaretposition go to next fold method moves the caret to the next fold since j edit 4 0pre3 public void go to next fold boolean select int next fold 1 for int i caret line 1 i buffer get line count i if buffer is fold start i display manager is line visible i next fold i break if next fold 1 get toolkit beep return int magic get magic caret position int new caret buffer get line start offset next fold chunk cache x to subregion offset next fold 0 magic 1 true if select extend selection caret new caret else if multi select none move caret position new caret set magic caret position magic gotonextfold jedit gotonextfold nextfold caretline getlinecount isfoldstart displaymanager islinevisible nextfold nextfold gettoolkit getmagiccaretposition newcaret getlinestartoffset nextfold chunkcache xtosubregionoffset nextfold extendselection newcaret selectnone movecaretposition newcaret setmagiccaretposition go to prev fold method moves the caret to the previous fold since j edit 4 0pre3 public void go to prev fold boolean select int prev fold 1 for int i caret line 1 i 0 i if buffer is fold start i display manager is line visible i prev fold i break if prev fold 1 get toolkit beep return int magic get magic caret position int new caret buffer get line start offset prev fold chunk cache x to subregion offset prev fold 0 magic 1 true if select extend selection caret new caret else if multi select none move caret position new caret set magic caret position magic gotoprevfold jedit gotoprevfold prevfold caretline isfoldstart displaymanager islinevisible prevfold prevfold gettoolkit getmagiccaretposition newcaret getlinestartoffset prevfold chunkcache xtosubregionoffset prevfold extendselection newcaret selectnone movecaretposition newcaret setmagiccaretposition collapse fold method like link display manager collapse fold int but also moves the caret to the first line of the fold since j edit 4 0pre3 public void collapse fold int x chunk cache subregion offset tox caret line caret get line start offset caret line display manager collapse fold caret line if display manager is line visible caret line return int line display manager get prev visible line caret line if multi select none move caret position buffer get line start offset line chunk cache x to subregion offset line 0 x true collapsefold displaymanager collapsefold jedit collapsefold chunkcache subregionoffsettox caretline getlinestartoffset caretline displaymanager collapsefold caretline displaymanager islinevisible caretline displaymanager getprevvisibleline caretline selectnone movecaretposition getlinestartoffset chunkcache xtosubregionoffset expand fold method like link display manager expand fold int boolean but also moves the caret to the first sub fold since j edit 4 0pre3 public void expand fold boolean fully int x chunk cache subregion offset tox caret line caret get line start offset caret line int line display manager expand fold caret line fully if fully line 1 if multi select none move caret position get line start offset line chunk cache x to subregion offset line 0 x true expandfold displaymanager expandfold jedit expandfold chunkcache subregionoffsettox caretline getlinestartoffset caretline displaymanager expandfold caretline selectnone movecaretposition getlinestartoffset chunkcache xtosubregionoffset select fold method selects the fold that contains the caret line number since j edit 3 1pre3 public void select fold select fold caret line selectfold jedit selectfold selectfold caretline select fold method selects the fold that contains the specified line number param line the line number since j edit 4 0pre1 public void select fold int line int lines buffer get fold at line line int new caret get line end offset lines 1 1 selection s new selection range get line start offset lines 0 new caret if multi add to selection s else set selection s move caret position new caret selectfold jedit selectfold getfoldatline newcaret getlineendoffset getlinestartoffset newcaret addtoselection setselection movecaretposition newcaret narrow to fold method hides all lines except those in the fold containing the caret since j edit 4 0pre1 public void narrow to fold int lines buffer get fold at line caret line if lines 0 0 lines 1 buffer get line count 1 get toolkit beep else display manager narrow lines 0 lines 1 narrowtofold jedit narrowtofold getfoldatline caretline getlinecount gettoolkit displaymanager narrow to selection method hides all lines except those in the selection since j edit 4 0pre1 public void narrow to selection if selection size 1 get toolkit beep return selection sel selection selection element at 0 display manager narrow sel get start line sel get end line select none narrowtoselection jedit narrowtoselection gettoolkit elementat displaymanager getstartline getendline selectnone add explicit fold method surrounds the selection with explicit fold markers since j edit 4 0pre3 public void add explicit fold if buffer get string property folding equals explicit gui utilities error view folding not explicit null return bug if there are multiple selections in different contexts the wrong comment strings will be inserted string line comment buffer get context sensitive property caret line comment string comment start buffer get context sensitive property caret comment start string comment end buffer get context sensitive property caret comment end string start end if line comment null start line comment n end line comment else if comment start null comment end null start comment start comment end n end comment start comment end else start n end try buffer begin compound edit if selection size 0 string line buffer get line text caret line string whitespace line substring 0 misc utilities get leading white space line int loc caret start length 1 start start whitespace buffer insert caret start stupid caret will automatically be incremented buffer insert caret end move caret position loc false else int loc 1 for int i 0 i selection size i selection s selection selection element at i string line buffer get line text s start line string whitespace line substring 0 misc utilities get leading white space line loc s start start length 1 buffer insert s start start whitespace if s end buffer get line start offset s end line buffer insert s end end else buffer insert s end end set caret position loc false finally buffer end compound edit addexplicitfold jedit addexplicitfold getstringproperty guiutilities linecomment getcontextsensitiveproperty linecomment commentstart getcontextsensitiveproperty commentstart commentend getcontextsensitiveproperty commentend linecomment linecomment linecomment commentstart commentend commentstart commentend commentstart commentend begincompoundedit getlinetext caretline miscutilities getleadingwhitespace movecaretposition elementat getlinetext startline miscutilities getleadingwhitespace getlinestartoffset endline setcaretposition endcompoundedit line comment method prepends each line of the selection with the line comment string since j edit 3 2pre1 public void line comment string comment buffer get context sensitive property caret line comment if buffer is editable comment null comment length 0 get toolkit beep return comment comment buffer begin compound edit int lines get selected lines try for int i 0 i lines length i string text get line text lines i buffer insert get line start offset lines i misc utilities get leading white space text comment finally buffer end compound edit select none linecomment jedit linecomment getcontextsensitiveproperty linecomment iseditable gettoolkit begincompoundedit getselectedlines getlinetext getlinestartoffset miscutilities getleadingwhitespace endcompoundedit selectnone range comment method adds comment start and end strings to the beginning and end of the selection since j edit 3 2pre1 public void range comment string comment start buffer get context sensitive property caret comment start string comment end buffer get context sensitive property caret comment end if buffer is editable comment start null comment end null comment start length 0 comment end length 0 get toolkit beep return comment start comment start comment end comment end try buffer begin compound edit selection selection get selection if selection length 0 int old caret caret buffer insert caret comment start buffer insert caret comment end set caret position old caret comment start length for int i 0 i selection length i selection s selection i if s instanceof selection range buffer insert s start comment start buffer insert s end comment end else if s instanceof selection rect selection rect rect selection rect s int start rect get start column buffer int end rect get end column buffer for int j s start line j s end line j buffer insert at column j end comment end buffer insert at column j start comment start select none finally buffer end compound edit rangecomment jedit rangecomment commentstart getcontextsensitiveproperty commentstart commentend getcontextsensitiveproperty commentend iseditable commentstart commentend commentstart commentend gettoolkit commentstart commentstart commentend commentend begincompoundedit getselection oldcaret commentstart commentend setcaretposition oldcaret commentstart commentstart commentend getstartcolumn getendcolumn startline endline insertatcolumn commentend insertatcolumn commentstart selectnone endcompoundedit format paragraph method formats the paragraph containing the caret since j edit 2 7pre2 public void format paragraph if buffer is editable get toolkit beep return if max line len 0 gui utilities error view format maxlinelen null return selection selection get selection if selection length 0 buffer begin compound edit for int i 0 i selection length i selection s selection i set selected text s text utilities format get selected text s max line len buffer get tab size buffer end compound edit else int line no get caret line int start 0 end buffer get length loop for int i line no 1 i 0 i get line text i line segment for int j 0 j line segment count j switch line segment array line segment offset j case case t break default continue loop start get line end offset i break loop loop for int i line no 1 i get line count i get line text i line segment for int j 0 j line segment count j switch line segment array line segment offset j case case t break default continue loop end get line start offset i 1 break loop try buffer begin compound edit string text buffer get text start end start buffer remove start end start buffer insert start text utilities format text max line len buffer get tab size finally buffer end compound edit formatparagraph jedit formatparagraph iseditable gettoolkit maxlinelen guiutilities getselection begincompoundedit setselectedtext textutilities getselectedtext maxlinelen gettabsize endcompoundedit lineno getcaretline getlength lineno getlinetext linesegment linesegment linesegment linesegment getlineendoffset lineno getlinecount getlinetext linesegment linesegment linesegment linesegment getlinestartoffset begincompoundedit gettext textutilities maxlinelen gettabsize endcompoundedit spaces to tabs method converts spaces to tabs in the selection since j edit 2 7pre2 public void spaces to tabs selection selection get selection if buffer is editable get toolkit beep return buffer begin compound edit if selection length 0 set text text utilities spaces to tabs get text buffer get tab size else for int i 0 i selection length i selection s selection i set selected text s text utilities spaces to tabs get selected text s buffer get tab size buffer end compound edit spacestotabs jedit spacestotabs getselection iseditable gettoolkit begincompoundedit settext textutilities spacestotabs gettext gettabsize setselectedtext textutilities spacestotabs getselectedtext gettabsize endcompoundedit tabs to spaces method converts tabs to spaces in the selection since j edit 2 7pre2 public void tabs to spaces selection selection get selection if buffer is editable get toolkit beep return buffer begin compound edit if selection length 0 set text text utilities tabs to spaces get text buffer get tab size else for int i 0 i selection length i selection s selection i set selected text s text utilities tabs to spaces get selected text s buffer get tab size buffer end compound edit tabstospaces jedit tabstospaces getselection iseditable gettoolkit begincompoundedit settext textutilities tabstospaces gettext gettabsize setselectedtext textutilities tabstospaces getselectedtext gettabsize endcompoundedit to upper case method converts the selected text to upper case since j edit 2 7pre2 public void to upper case selection selection get selection if buffer is editable selection length 0 get toolkit beep return buffer begin compound edit for int i 0 i selection length i selection s selection i set selected text s get selected text s to upper case buffer end compound edit touppercase jedit touppercase getselection iseditable gettoolkit begincompoundedit setselectedtext getselectedtext touppercase endcompoundedit to lower case method converts the selected text to lower case since j edit 2 7pre2 public void to lower case selection selection get selection if buffer is editable selection length 0 get toolkit beep return buffer begin compound edit for int i 0 i selection length i selection s selection i set selected text s get selected text s to lower case buffer end compound edit tolowercase jedit tolowercase getselection iseditable gettoolkit begincompoundedit setselectedtext getselectedtext tolowercase endcompoundedit remove trailing white space method removes trailing whitespace from all lines in the selection since j edit 2 7pre2 public void remove trailing white space if buffer is editable get toolkit beep else buffer remove trailing white space get selected lines removetrailingwhitespace jedit removetrailingwhitespace iseditable gettoolkit removetrailingwhitespace getselectedlines insert enter and indent method public void insert enter and indent if is editable get toolkit beep else try buffer begin compound edit set selected text n buffer indent line caret line true finally buffer end compound edit insertenterandindent insertenterandindent iseditable gettoolkit begincompoundedit setselectedtext indentline caretline endcompoundedit insert tab and indent method public void insert tab and indent if is editable get toolkit beep return if selection size 0 if caret is inside leading whitespace indent string text buffer get line text caret line int start buffer get line start offset caret line int white space misc utilities get leading white space text if caret start white space buffer indent line caret line false return user input t inserttabandindent inserttabandindent iseditable gettoolkit getlinetext caretline getlinestartoffset caretline whitespace miscutilities getleadingwhitespace whitespace indentline caretline userinput indent selected lines method indents all selected lines since j edit 3 1pre3 public void indent selected lines if buffer is editable get toolkit beep else buffer indent lines get selected lines select none indentselectedlines jedit indentselectedlines iseditable gettoolkit indentlines getselectedlines selectnone shift indent left method shifts the indent to the left since j edit 2 7pre2 public void shift indent left if buffer is editable get toolkit beep else buffer shift indent left get selected lines shiftindentleft jedit shiftindentleft iseditable gettoolkit shiftindentleft getselectedlines shift indent right method shifts the indent to the right since j edit 2 7pre2 public void shift indent right if buffer is editable get toolkit beep else buffer shift indent right get selected lines shiftindentright jedit shiftindentright iseditable gettoolkit shiftindentright getselectedlines join lines method joins the current and the next line since j edit 2 7pre2 public void join lines int end get line end offset caret line if buffer is editable end buffer get length get toolkit beep return try buffer begin compound edit buffer remove end 1 misc utilities get leading white space buffer get line text caret line 1 1 buffer insert end 1 finally buffer end compound edit set caret position end 1 joinlines jedit joinlines getlineendoffset caretline iseditable getlength gettoolkit begincompoundedit miscutilities getleadingwhitespace getlinetext caretline endcompoundedit setcaretposition show word count dialog method displays the word count dialog box since j edit 2 7pre2 public void show word count dialog string selection get selected text if selection null do word count view selection return do word count view buffer get text 0 buffer get length showwordcountdialog jedit showwordcountdialog getselectedtext dowordcount dowordcount gettext getlength is right click popup enabled method returns if the right click popup menu is enabled the gestures plugin uses this api since j edit 4 2pre13 public boolean is right click popup enabled return popup enabled isrightclickpopupenabled jedit isrightclickpopupenabled popupenabled set right click popup enabled method sets if the right click popup menu is enabled the gestures plugin uses this api since j edit 4 2pre13 public void set right click popup enabled boolean popup enabled this popup enabled popup enabled setrightclickpopupenabled jedit setrightclickpopupenabled popupenabled popupenabled popupenabled get right click popup method returns the right click popup menu public final j popup menu get right click popup return popup getrightclickpopup jpopupmenu getrightclickpopup set right click popup method sets the right click popup menu param popup the popup public final void set right click popup j popup menu popup this popup popup setrightclickpopup setrightclickpopup jpopupmenu handle popup trigger method do the same thing as right clicking on the text area the gestures plugin uses this api since j edit 4 2pre13 public void handle popup trigger mouse event evt if popup is visible popup set visible false else int x evt getx int y evt gety int drag start xy to offset x y painter is block caret enabled is overwrite enabled if get selection count 0 multi move caret position drag start false gui utilities show popup menu popup painter x y handlepopuptrigger jedit handlepopuptrigger mouseevent isvisible setvisible dragstart xytooffset isblockcaretenabled isoverwriteenabled getselectioncount movecaretposition dragstart guiutilities showpopupmenu add left of scroll bar method adds a component to the box left of the vertical scroll bar the error list plugin uses this to show a global error overview for example param comp the component since j edit 4 2pre1 public void add left of scroll bar component comp vertical box add comp vertical box get component count 1 addleftofscrollbar errorlist jedit addleftofscrollbar verticalbox verticalbox getcomponentcount remove left of scroll bar method removes a component from the box left of the vertical scroll bar param comp the component since j edit 4 2pre1 public void remove left of scroll bar component comp vertical box remove comp removeleftofscrollbar jedit removeleftofscrollbar verticalbox add notify method called by the awt when this component is added to a parent adds document listener public void add notify super add notify tool tip manager shared instance register component painter tool tip manager shared instance register component gutter recalculate visible lines if buffer is loaded recalculate last physical line properties changed addnotify addnotify addnotify tooltipmanager sharedinstance registercomponent tooltipmanager sharedinstance registercomponent recalculatevisiblelines isloaded recalculatelastphysicalline propertieschanged remove notify method called by the awt when this component is removed from it s parent this clears the pointer to the currently focused component also removes document listener public void remove notify super remove notify tool tip manager shared instance unregister component painter tool tip manager shared instance unregister component gutter if focused component this focused component null removenotify removenotify removenotify tooltipmanager sharedinstance unregistercomponent tooltipmanager sharedinstance unregistercomponent focusedcomponent focusedcomponent get focus traversal keys enabled method java 1 4 compatibility fix to make tab key work since j edit 3 2pre4 public boolean get focus traversal keys enabled return false getfocustraversalkeysenabled jedit getfocustraversalkeysenabled get focus cycle root method java 1 4 compatibility fix to make tab traversal work in a sane manner since j edit 4 2pre3 public boolean get focus cycle root return true getfocuscycleroot jedit getfocuscycleroot process key event method public void process key event key event evt view process key event evt view text area if evt is consumed super process key event evt processkeyevent processkeyevent keyevent processkeyevent text_area isconsumed processkeyevent add top component method adds a component above the gutter text area and vertical scroll bar since j edit 4 2pre3 public void add top component component comp add top comp addtopcomponent jedit addtopcomponent remove top component method removes a component from above the gutter text area and vertical scroll bar since j edit 4 2pre3 public void remove top component component comp remove comp removetopcomponent jedit removetopcomponent properties changed method called by j edit when necessary plugins should not call this method public void properties changed if buffer null return int tabsize buffer get tab size char foo new char tabsize for int i 0 i foo length i foo i tab size float painter get string width new string foo char width int math round painter get font get string bounds foo 0 1 painter get font render context get width boolean invalidate cached screen line counts false string wrap buffer get string property wrap if wrap equals this wrap this wrap wrap hard wrap wrap equals hard if display manager null buffer changing display manager first line call reset true display manager scroll line count call reset true invalidate cached screen line counts true int max line len buffer get integer property max line len 0 if max line len this max line len this max line len max line len if display manager null buffer changing display manager first line call reset true display manager scroll line count call reset true invalidate cached screen line counts true if invalidate cached screen line counts buffer invalidate cached screen line counts chunk cache invalidate all if display manager null buffer changing display manager update wrap settings display manager notifyscreenlinechanges gutter repaint painter repaint propertieschanged jedit propertieschanged _tabsize gettabsize _tabsize tabsize getstringwidth charwidth getfont getstringbounds getfontrendercontext getwidth invalidatecachedscreenlinecounts getstringproperty hardwrap displaymanager bufferchanging displaymanager firstline callreset displaymanager scrolllinecount callreset invalidatecachedscreenlinecounts maxlinelen getintegerproperty maxlinelen maxlinelen maxlinelen maxlinelen maxlinelen displaymanager bufferchanging displaymanager firstline callreset displaymanager scrolllinecount callreset invalidatecachedscreenlinecounts invalidatecachedscreenlinecounts invalidatecachedscreenlinecounts chunkcache invalidateall displaymanager bufferchanging displaymanager updatewrapsettings displaymanager _notifyscreenlinechanges get selection start method deprecated instead obtain a selection instance using any means and call its code get start code method public final int get selection start if selection size 1 return caret return selection selection element at 0 get start getselectionstart getstart getselectionstart elementat getstart get selection start method deprecated instead obtain a selection instance using any means and call its code get start int code method public int get selection start int line if selection size 1 return caret return selection selection element at 0 get start buffer line getselectionstart getstart getselectionstart elementat getstart get selection start line method deprecated instead obtain a selection instance using any means and call its code get start line code method public final int get selection start line if selection size 1 return caret return selection selection element at 0 get start line getselectionstartline getstartline getselectionstartline elementat getstartline set selection start method deprecated do not use public final void set selection start int selection start select selection start get selection end true setselectionstart setselectionstart selectionstart selectionstart getselectionend get selection end method deprecated instead obtain a selection instance using any means and call its code get end code method public final int get selection end if selection size 1 return caret return selection selection element at 0 get end getselectionend getend getselectionend elementat getend get selection end method deprecated instead obtain a selection instance using any means and call its code get end int code method public int get selection end int line if selection size 1 return caret return selection selection element at 0 get end buffer line getselectionend getend getselectionend elementat getend get selection end line method deprecated instead obtain a selection instance using any means and call its code get end line code method public final int get selection end line if selection size 1 return caret return selection selection element at 0 get end line getselectionendline getendline getselectionendline elementat getendline set selection end method deprecated do not use public final void set selection end int selection end select get selection start selection end true setselectionend setselectionend selectionend getselectionstart selectionend get mark position method deprecated do not use public final int get mark position selection s get selection at offset caret if s null return caret if s start caret return s end else if s end caret return s start else return caret getmarkposition getmarkposition getselectionatoffset get mark line method deprecated do not use public final int get mark line if selection size 1 return caret line selection s selection selection element at 0 if s start caret return s end line else if s end caret return s start line else return caret line getmarkline getmarkline caretline elementat endline startline caretline select method deprecated instead call either code add to selection code or code set selection code with a new selection instance public void select int start int end select start end true addtoselection setselection select method deprecated instead call either code add to selection code or code set selection code with a new selection instance public void select int start int end boolean do electric scroll select none int new start new end if start end new start start new end end else new start end new end start set selection new selection range new start new end move caret position end do electric scroll addtoselection setselection doelectricscroll selectnone newstart newend newstart newend newstart newend setselection newstart newend movecaretposition doelectricscroll is selection rectangular method deprecated instead check if the appropriate selection is an instance of the selection rect class public boolean is selection rectangular selection s get selection at offset caret if s null return false else return s instanceof selection rect isselectionrectangular isselectionrectangular getselectionatoffset is caret visible method returns true if the caret is visible false otherwise final boolean is caret visible return blink has focus iscaretvisible iscaretvisible hasfocus is structure highlight visible method returns true if the structure highlight is visible false otherwise since j edit 4 2pre3 final boolean is structure highlight visible return match null has focus display manager is line visible match start line display manager is line visible match end line isstructurehighlightvisible jedit isstructurehighlightvisible hasfocus displaymanager islinevisible startline displaymanager islinevisible endline update max horizontal scroll width method void update max horizontal scroll width int max chunk cache get max horizontal scroll width if max max horizontal scroll width max horizontal scroll width max horizontal set values math max 0 math min max horizontal scroll width char width painter get width horizontal offset painter get width 0 max horizontal scroll width char width updatemaxhorizontalscrollwidth updatemaxhorizontalscrollwidth chunkcache getmaxhorizontalscrollwidth maxhorizontalscrollwidth maxhorizontalscrollwidth setvalues maxhorizontalscrollwidth charwidth getwidth horizontaloffset getwidth maxhorizontalscrollwidth charwidth recalculate visible lines method void recalculate visible lines if painter null return int height painter get height int line height painter get font metrics get height if line height 0 visible lines 0 else if height 0 visible lines 0 last line partial false else visible lines height line height last line partial height line height 0 if last line partial visible lines chunk cache recalculate visible lines this does the trick to eliminate blank space at the end if display manager null buffer null buffer is loaded set first line get first line update scroll bars recalculatevisiblelines recalculatevisiblelines getheight lineheight getfontmetrics getheight lineheight visiblelines visiblelines lastlinepartial visiblelines lineheight lastlinepartial lineheight lastlinepartial visiblelines chunkcache recalculatevisiblelines displaymanager isloaded setfirstline getfirstline updatescrollbars fold structure changed method void fold structure changed chunk cache invalidate all recalculate last physical line repaint foldstructurechanged foldstructurechanged chunkcache invalidateall recalculatelastphysicalline update scroll bars method updates the state of the scroll bars this should be called if the number of lines in the buffer changes or when the size of the text are changes void update scroll bars if buffer null return if debug scroll debug log log log debug this update scroll bars slc display manager get scroll line count if vertical null visible lines 0 if debug scroll debug log log log debug this vertical ok int line count display manager get scroll line count int first line get first line int visible visible lines last line partial 1 0 vertical set values first line visible 0 line count vertical set unit increment 2 vertical set block increment visible int width painter get width if horizontal null width 0 if debug scroll debug log log log debug this horizontal ok painter repaint horizontal set value horizontal offset horizontal set unit increment painter get font metrics char width w horizontal set block increment width 2 updatescrollbars updatescrollbars scroll_debug updatescrollbars displaymanager getscrolllinecount visiblelines scroll_debug linecount displaymanager getscrolllinecount firstline getfirstline visiblelines lastlinepartial setvalues firstline linecount setunitincrement setblockincrement getwidth scroll_debug setvalue horizontaloffset setunitincrement getfontmetrics charwidth setblockincrement called by display manager buffer change handler transaction complete void finishcaretupdate if queued caret update return try when the user is typing etc we don t want the caret to blink blink true caret timer restart if display manager is line visible caret line if caret line display manager get first visible line caret line display manager get last visible line int collapse folds buffer get integer property collapse folds 0 if collapse folds 0 display manager expand folds collapse folds display manager expand fold caret line false else display manager expand all folds else display manager expand fold caret line false scroll to caret queued scroll to electric update bracket highlight with delay if queued fire caret event fire caret event in case one of the above fails we still want to clear these flags finally queued caret update queued scroll to electric queued fire caret event false displaymanager bufferchangehandler transactioncomplete _finishcaretupdate queuedcaretupdate carettimer displaymanager islinevisible caretline caretline displaymanager getfirstvisibleline caretline displaymanager getlastvisibleline collapsefolds getintegerproperty collapsefolds collapsefolds displaymanager expandfolds collapsefolds displaymanager expandfold caretline displaymanager expandallfolds displaymanager expandfold caretline scrolltocaret queuedscrolltoelectric updatebrackethighlightwithdelay queuedfirecaretevent firecaretevent queuedcaretupdate queuedscrolltoelectric queuedfirecaretevent get selection start end on line method returns the x co ordinates of the selection start and end on the given line may return null int get selection start and end int screen line int physical line selection s int start get screen line start offset screen line int end get screen line end offset screen line if end s start start s end return null int sel start screen line if display manager is line visible s start line sel start screen line get screen line of offset s start else sel start screen line 1 int sel end screen line if display manager is line visible s end line sel end screen line get screen line of offset s end else sel end screen line 1 int line start buffer get line start offset physical line int x1 x2 if s instanceof selection rect start line start end line start selection rect rect selection rect s int start rect get start column buffer int end rect get end column buffer int line len buffer get line length physical line int total new int 1 int rect start buffer get offset of virtual column physical line start total if rect start 1 x1 start total 0 char width rect start line len else x1 0 int rect end buffer get offset of virtual column physical line end total if rect end 1 x2 end total 0 char width rect end line len else x2 0 if end rect start start rect end return null x1 rect start start 0 x1 offset toxy physical line rect start return value x x2 rect end end get width x2 offset toxy physical line rect end return value x else if sel start screen line sel end screen line sel start screen line 1 x1 offset toxy physical line s start line start return value x x2 offset toxy physical line s end line start return value x else if screen line sel start screen line x1 offset toxy physical line s start line start return value x x2 get width else if screen line sel end screen line x1 0 x2 offset toxy physical line s end line start return value x else x1 0 x2 get width if x1 0 x1 0 if x2 0 x2 0 if x1 x2 x2 return new int x1 x2 getselectionstartendonline getselectionstartandend screenline physicalline getscreenlinestartoffset screenline getscreenlineendoffset screenline selstartscreenline displaymanager islinevisible startline selstartscreenline getscreenlineofoffset selstartscreenline selendscreenline displaymanager islinevisible endline selendscreenline getscreenlineofoffset selendscreenline linestart getlinestartoffset physicalline linestart linestart _start getstartcolumn _end getendcolumn linelen getlinelength physicalline rectstart getoffsetofvirtualcolumn physicalline _start rectstart _start charwidth rectstart linelen rectend getoffsetofvirtualcolumn physicalline _end rectend _end charwidth rectend linelen rectstart rectend rectstart offsettoxy physicalline rectstart returnvalue rectend getwidth offsettoxy physicalline rectend returnvalue selstartscreenline selendscreenline selstartscreenline offsettoxy physicalline linestart returnvalue offsettoxy physicalline linestart returnvalue screenline selstartscreenline offsettoxy physicalline linestart returnvalue getwidth screenline selendscreenline offsettoxy physicalline linestart returnvalue getwidth inside selection method returns if the given point is inside a selection used by drag and drop code in mouse handler below boolean inside selection int x int y int offset xy to offset x y selection s get selection at offset offset if s null return false int screen line get screen line of offset offset if screen line 1 return false int selection start and end get selection start and end screen line buffer get line of offset offset s if selection start and end null return false return x selection start and end 0 x selection start and end 1 insideselection mousehandler insideselection xytooffset getselectionatoffset screenline getscreenlineofoffset screenline selectionstartandend getselectionstartandend screenline getlineofoffset selectionstartandend selectionstartandend selectionstartandend calls dnd callback via reflection private void start drag and drop input event evt boolean copy try dnd callback invoke null new object this evt new boolean copy catch exception e log log log error this e dndcallback startdraganddrop inputevent dndcallback addtoselection method private void addtoselection selection add me if add me start add me end throw new illegal argument exception add me start add me end else if add me start add me end if add me instanceof selection range return else if add me instanceof selection rect if selection rect add me extra end virt 0 return for int i 0 i selection size i try and merge existing selections one by one with the new selection selection s selection selection element at i if s overlaps add me add me start math min s start add me start add me end math max s end add me end selection remove element s i add me start line get line of offset add me start add me end line get line of offset add me end boolean added false for int i 0 i selection size i selection s selection selection element at i if add me start s start selection insert element at add me i added true break if added selection add element add me invalidate line range add me start line add me end line _addtoselection _addtoselection addme addme addme illegalargumentexception addme addme addme addme addme addme addme extraendvirt elementat addme addme addme addme addme removeelement addme startline getlineofoffset addme addme endline getlineofoffset addme elementat addme insertelementat addme addelement addme invalidatelinerange addme startline addme endline finish caret update method the collapsing of scrolling event firing inside compound edits greatly speeds up replace all private void finish caret update boolean do electric scroll boolean fire caret event this queued scroll to electric do electric scroll this queued fire caret event fire caret event if queued caret update return queued caret update true if buffer is transaction in progress finishcaretupdate otherwise display manager buffer change handler calls finishcaretupdate finishcaretupdate doelectricscroll firecaretevent queuedscrolltoelectric doelectricscroll queuedfirecaretevent firecaretevent queuedcaretupdate queuedcaretupdate istransactioninprogress _finishcaretupdate displaymanager bufferchangehandler fire caret event method private void fire caret event object listeners listener list get listener list for int i listeners length 2 i 0 i if listeners i caret listener class try caret listener listeners i 1 caret update caret event catch throwable t log log log error this t firecaretevent firecaretevent listenerlist getlistenerlist caretlistener caretlistener caretupdate caretevent fire scroll event method private void fire scroll event boolean vertical object listeners listener list get listener list for int i listeners length 2 i 0 i if listeners i scroll listener class try if vertical scroll listener listeners i 1 scrolled vertically this else scroll listener listeners i 1 scrolled horizontally this catch throwable t log log log error this t firescrollevent firescrollevent listenerlist getlistenerlist scrolllistener scrolllistener scrolledvertically scrolllistener scrolledhorizontally insert tab method private void insert tab int tab size buffer get tab size if buffer get boolean property no tabs int line start get line start offset caret line string line get text line start caret line start int pos 0 for int i 0 i line length i switch line char at pos case t pos 0 break default if pos tab size pos 0 break set selected text misc utilities create white space tab size pos 0 else set selected text t inserttab inserttab tabsize gettabsize getbooleanproperty notabs linestart getlinestartoffset caretline gettext linestart linestart charat tabsize setselectedtext miscutilities createwhitespace tabsize setselectedtext do word wrap method does hard wrap private boolean do word wrap boolean space inserted if hard wrap max line len 0 return false buffer get line text caret line line segment int start get line start offset caret line int end get line end offset caret line int len end start 1 int caret pos caret start only wrap if we re at the end of a line or the rest of the line text is whitespace for int i caret pos i len i char ch line segment array line segment offset i if ch ch t return false int tab size buffer get tab size string word break chars buffer get string property word break chars int last in line 0 last character before wrap int logical length 0 length with tabs expanded int last word offset 1 boolean last was space true for int i 0 i caret pos i char ch line segment array line segment offset i if ch t logical length tab size logical length tab size if last was space logical length max line len last in line i last word offset i last was space true else if ch logical length if last was space logical length max line len 1 last in line i last word offset i last was space true else if word break chars null word break chars index of ch 1 logical length if last was space logical length max line len last in line i last word offset i last was space true else last in line i logical length last was space false boolean return value int insert new line at if space inserted logical length max line len last in line caret pos 1 insert new line at caret pos return value true else if logical length max line len last word offset 1 insert new line at last word offset return value false else return false try buffer begin compound edit buffer insert start insert new line at n caret line would have been incremented since insert new line at caret pos buffer indent line caret line true finally buffer end compound edit only ever return true if space was pressed with logical length max line len return return value dowordwrap dowordwrap spaceinserted hardwrap maxlinelen getlinetext caretline linesegment getlinestartoffset caretline getlineendoffset caretline caretpos caretpos linesegment linesegment tabsize gettabsize wordbreakchars getstringproperty wordbreakchars lastinline logicallength lastwordoffset lastwasspace caretpos linesegment linesegment logicallength tabsize logicallength tabsize lastwasspace logicallength maxlinelen lastinline lastwordoffset lastwasspace logicallength lastwasspace logicallength maxlinelen lastinline lastwordoffset lastwasspace wordbreakchars wordbreakchars indexof logicallength lastwasspace logicallength maxlinelen lastinline lastwordoffset lastwasspace lastinline logicallength lastwasspace returnvalue insertnewlineat spaceinserted logicallength maxlinelen lastinline caretpos insertnewlineat caretpos returnvalue logicallength maxlinelen lastwordoffset insertnewlineat lastwordoffset returnvalue begincompoundedit insertnewlineat caretline insertnewlineat caretpos indentline caretline endcompoundedit logicallength maxlinelen returnvalue do word count method private void do word count view view string text char chars text to char array int characters chars length int words if characters 0 words 0 else words 1 int lines 1 boolean word false for int i 0 i chars length i switch chars i case r case n lines case case t if word words word false break default word true break fix bug 922951 off by one error in word count if word words object args new integer characters new integer words new integer lines gui utilities message view wordcount args dowordcount dowordcount tochararray guiutilities update structure highlight with delay method private void update bracket highlight with delay structure timer stop structure timer start updatestructurehighlightwithdelay updatebrackethighlightwithdelay structuretimer structuretimer update structure highlight method private void update structure highlight if painter is structure highlight enabled gutter is structure highlight enabled return iterator iter structure matchers iterator while iter has next structure matcher matcher structure matcher iter next match matcher get match this if match null break if match null if caret line match start line invalidate line range caret line match end line else invalidate line range match start line caret line if display manager is line visible match start line chunk cache get screen line of offset match start line match start get line start offset match start line 1 show structure status message match start line caret line updatestructurehighlight updatestructurehighlight isstructurehighlightenabled isstructurehighlightenabled structurematchers hasnext structurematcher structurematcher getmatch caretline startline invalidatelinerange caretline endline invalidatelinerange startline caretline displaymanager islinevisible startline chunkcache getscreenlineofoffset startline getlinestartoffset startline showstructurestatusmessage startline caretline show structure status message method private void show structure status message boolean backward string text buffer get line text match start line trim if backward match start line 0 text length 1 switch text char at 0 case case case case case case text buffer get line text match start line 1 trim text break get rid of embedded tabs not removed by trim text text replace t view get status set message and clear j edit get property view status bracket new object new integer match start line 1 text showstructurestatusmessage showstructurestatusmessage getlinetext startline startline charat getlinetext startline getstatus setmessageandclear jedit getproperty startline recalculate last physical line method void recalculate last physical line int old screen last line screen last line for int i visible lines 1 i 0 i chunk cache line info info chunk cache get line info i if info physical line 1 phys last line info physical line screen last line i break invalidate screen line range old screen last line screen last line recalculatelastphysicalline recalculatelastphysicalline oldscreenlastline screenlastline visiblelines chunkcache lineinfo chunkcache getlineinfo physicalline physlastline physicalline screenlastline invalidatescreenlinerange oldscreenlastline screenlastline rect params int extra start virt int extra end virt int new caret this extra start virt extra start virt this extra end virt extra end virt this new caret new caret rectparams extrastartvirt extraendvirt newcaret extrastartvirt extrastartvirt extraendvirt extraendvirt newcaret newcaret used when doing s up down to simplify dealing with virtual space private rect params get rect params int caret int new caret selection s get selection at offset caret int virtual width if s instanceof selection rect if caret s end virtual width buffer get virtual width s end line s end get line start offset s end line selection rect s extra end virt else virtual width buffer get virtual width s start line s start get line start offset s start line selection rect s extra start virt else if rectangular selection mode virtual width buffer get virtual width caret line caret buffer get line start offset caret line else return null int new line get line of offset new caret int total virtual width new int 1 int new offset buffer get offset of virtual column new line virtual width total virtual width if new offset 1 int extra virt virtual width total virtual width 0 new caret get line end offset new line 1 rect params return value boolean bias if s null bias new caret caret else if s start caret bias new caret s end else if s end caret bias new caret s start else bias false if bias return value new rect params extra virt 0 new caret else return value new rect params 0 extra virt new caret return return value else return new rect params 0 0 get line start offset new line new offset rectparams getrectparams newcaret getselectionatoffset virtualwidth virtualwidth getvirtualwidth endline getlinestartoffset endline extraendvirt virtualwidth getvirtualwidth startline getlinestartoffset startline extrastartvirt rectangularselectionmode virtualwidth getvirtualwidth caretline getlinestartoffset caretline newline getlineofoffset newcaret totalvirtualwidth newoffset getoffsetofvirtualcolumn newline virtualwidth totalvirtualwidth newoffset extravirt virtualwidth totalvirtualwidth newcaret getlineendoffset newline rectparams returnvalue newcaret newcaret newcaret returnvalue rectparams extravirt newcaret returnvalue rectparams extravirt newcaret returnvalue rectparams getlinestartoffset newline newoffset delete method private void delete boolean forward if buffer is editable get toolkit beep return if selection size 0 selection selections get selection for int i 0 i selections length i selection s selections i if s instanceof selection rect selection rect r selection rect s int start column r get start column buffer if start column r get end column buffer if forward start column 0 get toolkit beep else tall caret delete r forward else set selected text s null else set selected text s null else if forward if caret buffer get length get toolkit beep return buffer remove caret 1 else if caret 0 get toolkit beep return buffer remove caret 1 1 iseditable gettoolkit getselection startcolumn getstartcolumn startcolumn getendcolumn startcolumn gettoolkit tallcaretdelete setselectedtext setselectedtext getlength gettoolkit gettoolkit tall caret delete method private void tall caret delete selection rect s boolean forward try buffer begin compound edit int width new int 1 int start col s get start column buffer int start line s start line int end line s end line for int i start line i end line i int offset buffer get offset of virtual column i start col width if offset 1 if width 0 start col offset get line length i else if i start line forward shift tall caret left s continue offset buffer get line start offset i if forward if offset buffer get line end offset i 1 buffer remove offset 1 else buffer remove offset 1 1 finally buffer end compound edit tallcaretdelete tallcaretdelete begincompoundedit startcol getstartcolumn startline startline endline endline startline endline getoffsetofvirtualcolumn startcol startcol getlinelength startline shifttallcaretleft getlinestartoffset getlineendoffset endcompoundedit shift tall caret left method private void shift tall caret left selection rect s remove from selection s add to selection new selection rect buffer s get start line s get start column buffer 1 s get end line s get end column buffer 1 shifttallcaretleft shifttallcaretleft removefromselection addtoselection getstartline getstartcolumn getendline getendcolumn paint border method public void paint border component c graphics g int x int y int width int height g translate x y g set color metal look and feel get control dark shadow g draw rect 0 0 width 2 height 2 g set color metal look and feel get control highlight g draw line width 1 1 width 1 height 1 g draw line 1 height 1 width 1 height 1 g set color metal look and feel get control g draw line width 2 2 width 2 2 g draw line 1 height 2 1 height 2 g translate x y paintborder paintborder setcolor metallookandfeel getcontroldarkshadow drawrect setcolor metallookandfeel getcontrolhighlight drawline drawline setcolor metallookandfeel getcontrol drawline drawline get border insets method public insets get border insets component c return new insets 1 1 2 2 getborderinsets getborderinsets add layout component method public void add layout component string name component comp if name equals center center comp else if name equals right right comp else if name equals left left comp else if name equals bottom bottom comp else if name equals top top comp addlayoutcomponent addlayoutcomponent remove layout component method public void remove layout component component comp if center comp center null else if right comp right null else if left comp left null else if bottom comp bottom null else if top comp top null removelayoutcomponent removelayoutcomponent preferred layout size method public dimension preferred layout size container parent dimension dim new dimension border border get border insets insets if border null insets new insets 0 0 0 0 else insets get border get border insets j edit text area this dim width insets left insets right dim height insets top insets bottom dimension left pref left get preferred size dim width left pref width dimension center pref center get preferred size dim width center pref width dim height center pref height dimension right pref right get preferred size dim width right pref width dimension bottom pref bottom get preferred size dim height bottom pref height if top null dimension top pref top get preferred size dim height top pref height return dim preferredlayoutsize preferredlayoutsize getborder getborder getborderinsets jedittextarea leftpref getpreferredsize leftpref centerpref getpreferredsize centerpref centerpref rightpref getpreferredsize rightpref bottompref getpreferredsize bottompref toppref getpreferredsize toppref minimum layout size method public dimension minimum layout size container parent dimension dim new dimension border border get border insets insets if border null insets new insets 0 0 0 0 else insets get border get border insets j edit text area this dim width insets left insets right dim height insets top insets bottom dimension left pref left get minimum size dim width left pref width dimension center pref center get minimum size dim width center pref width dim height center pref height dimension right pref right get minimum size dim width right pref width dimension bottom pref bottom get minimum size dim height bottom pref height if top null dimension top pref top get minimum size dim height top pref height return dim minimumlayoutsize minimumlayoutsize getborder getborder getborderinsets jedittextarea leftpref getminimumsize leftpref centerpref getminimumsize centerpref centerpref rightpref getminimumsize rightpref bottompref getminimumsize bottompref toppref getminimumsize toppref layout container method public void layout container container parent dimension size parent get size border border get border insets insets if border null insets new insets 0 0 0 0 else insets get border get border insets j edit text area this int itop insets top int ileft insets left int ibottom insets bottom int iright insets right int right width right get preferred size width int left width left get preferred size width int top height if top null top height top get preferred size height else top height 0 int bottom height bottom get preferred size height int center width math max 0 size width left width right width ileft iright int center height math max 0 size height top height bottom height itop ibottom left set bounds ileft itop top height left width center height center set bounds ileft left width itop top height center width center height right set bounds ileft left width center width itop top height right width center height bottom set bounds ileft itop top height center height silly that we reference the vertical scroll bar here directly we do this so that the horizontal scroll bar is flush with the vertical scroll bar math max 0 size width vertical get width ileft iright bottom height if top null top set bounds ileft itop left width center width right width top height layoutcontainer layoutcontainer getsize getborder getborder getborderinsets jedittextarea rightwidth getpreferredsize leftwidth getpreferredsize topheight topheight getpreferredsize topheight bottomheight getpreferredsize centerwidth leftwidth rightwidth centerheight topheight bottomheight setbounds topheight leftwidth centerheight setbounds leftwidth topheight centerwidth centerheight setbounds leftwidth centerwidth topheight rightwidth centerheight setbounds topheight centerheight getwidth bottomheight setbounds leftwidth centerwidth rightwidth topheight action performed method public void action performed action event evt if focused component null focused component has focus focused component blink caret actionperformed actionperformed actionevent focusedcomponent focusedcomponent hasfocus focusedcomponent blinkcaret mutable caret event constructor mutable caret event super j edit text area this mutablecaretevent mutablecaretevent jedittextarea get dot method public int get dot return get caret position getdot getdot getcaretposition get mark method public int get mark return get mark position getmark getmark getmarkposition adjustment value changed method public void adjustment value changed final adjustment event evt if scroll bars initialized return if evt get adjustable vertical set first line vertical get value else set horizontal offset horizontal get value adjustmentvaluechanged adjustmentvaluechanged adjustmentevent scrollbarsinitialized getadjustable setfirstline getvalue sethorizontaloffset getvalue focus gained method public void focus gained focus event evt if buffer changing return if match null if caret line match start line invalidate line range caret line match end line else invalidate line range match start line caret line else invalidate line caret line focused component j edit text area this focusgained focusgained focusevent bufferchanging caretline startline invalidatelinerange caretline endline invalidatelinerange startline caretline invalidateline caretline focusedcomponent jedittextarea focus lost method public void focus lost focus event evt if is showing return if match null if caret line match start line invalidate line range caret line match end line else invalidate line range match start line caret line else invalidate line caret line focuslost focuslost focusevent isshowing caretline startline invalidatelinerange caretline endline invalidatelinerange startline caretline invalidateline caretline mouse pressed method public void mouse pressed mouse event evt control operating system is macos evt is meta down operating system is macos evt is control down so that home mouse click home is not the same as pressing home twice in a row view get input handler reset last action count quick copy drag is quick copy enabled gui utilities is middle button evt get modifiers if quick copy drag request focus focused component j edit text area this if buffer is loaded return int x evt getx int y evt gety drag start xy to offset x y painter is block caret enabled is overwrite enabled drag start line get line of offset drag start drag start offset drag start get line start offset drag start line if gui utilities is popup trigger evt popup null if popup enabled handle popup trigger evt return dragged false blink true invalidate line caret line click count evt get click count if is drag enabled get drag and drop callback null inside selection x y click count 1 evt is shift down maybe drag and drop true move caret position drag start false return else maybe drag and drop false switch click count case 1 do single click evt break case 2 do double click break default case 3 do triple click break mousepressed mousepressed mouseevent operatingsystem ismacos ismetadown operatingsystem ismacos iscontroldown getinputhandler resetlastactioncount quickcopydrag isquickcopyenabled guiutilities ismiddlebutton getmodifiers quickcopydrag requestfocus focusedcomponent jedittextarea isloaded dragstart xytooffset isblockcaretenabled isoverwriteenabled dragstartline getlineofoffset dragstart dragstartoffset dragstart getlinestartoffset dragstartline guiutilities ispopuptrigger popupenabled handlepopuptrigger invalidateline caretline clickcount getclickcount isdragenabled getdraganddropcallback insideselection clickcount isshiftdown maybedraganddrop movecaretposition dragstart maybedraganddrop clickcount dosingleclick dodoubleclick dotripleclick do single click method private void do single click mouse event evt if buffer inside compound edit buffer end compound edit int x evt getx int extra end virt 0 if chunk cache get line info screen last line last subregion float drag start line width offset toxy drag start line get line length drag start line return value x if x drag start line width extra end virt int x drag start line width char width if get painter is block caret enabled is overwrite enabled x get horizontal offset char width char width 2 extra end virt if control is rectangular selection enabled int screen line evt gety get painter get font metrics get height if screen line screen last line screen line screen last line chunk cache line info info chunk cache get line info screen line if info last subregion extra end virt 0 if is editable get toolkit beep return control click in virtual space inserts whitespace and moves caret string whitespace misc utilities create white space extra end virt 0 buffer insert drag start whitespace drag start whitespace length if evt is shift down xxx get mark position deprecated resize selection get mark position drag start extra end virt is rectangular selection enabled control if quick copy drag move caret position drag start false so that shift click drag works drag start line get mark line drag start get mark position drag start offset drag start get line start offset drag start line so that quick copy works dragged true return if quick copy drag move caret position drag start false if multi quick copy drag select none dosingleclick dosingleclick mouseevent insidecompoundedit endcompoundedit extraendvirt chunkcache getlineinfo screenlastline lastsubregion dragstartlinewidth offsettoxy dragstartline getlinelength dragstartline returnvalue dragstartlinewidth extraendvirt dragstartlinewidth charwidth getpainter isblockcaretenabled isoverwriteenabled gethorizontaloffset charwidth charwidth extraendvirt isrectangularselectionenabled screenline getpainter getfontmetrics getheight screenline screenlastline screenline screenlastline chunkcache lineinfo chunkcache getlineinfo screenline lastsubregion extraendvirt iseditable gettoolkit miscutilities createwhitespace extraendvirt dragstart dragstart isshiftdown getmarkposition resizeselection getmarkposition dragstart extraendvirt isrectangularselectionenabled quickcopydrag movecaretposition dragstart dragstartline getmarkline dragstart getmarkposition dragstartoffset dragstart getlinestartoffset dragstartline quickcopydrag movecaretposition dragstart quickcopydrag selectnone do double click method private void do double click ignore empty lines if get line length drag start line 0 return string line text get line text drag start line string no word sep buffer get string property no word sep if drag start offset get line length drag start line drag start offset boolean join non word chars j edit get boolean property view join non word chars int word start text utilities find word start line text drag start offset no word sep join non word chars int word end text utilities find word end line text drag start offset 1 no word sep join non word chars int line start get line start offset drag start line selection sel new selection range line start word start line start word end if is multiple selection enabled add to selection sel else set selection sel if quick copy drag quick copy drag false move caret position line start word end false dragged true dodoubleclick dodoubleclick getlinelength dragstartline linetext getlinetext dragstartline nowordsep getstringproperty nowordsep dragstartoffset getlinelength dragstartline dragstartoffset joinnonwordchars jedit getbooleanproperty joinnonwordchars wordstart textutilities findwordstart linetext dragstartoffset nowordsep joinnonwordchars wordend textutilities findwordend linetext dragstartoffset nowordsep joinnonwordchars linestart getlinestartoffset dragstartline linestart wordstart linestart wordend ismultipleselectionenabled addtoselection setselection quickcopydrag quickcopydrag movecaretposition linestart wordend do triple click method private void do triple click int new caret get line end offset drag start line if drag start line buffer get line count 1 new caret selection sel new selection range get line start offset drag start line new caret if is multiple selection enabled add to selection sel else set selection sel if quick copy drag quick copy drag false move caret position new caret false dragged true dotripleclick dotripleclick newcaret getlineendoffset dragstartline dragstartline getlinecount newcaret getlinestartoffset dragstartline newcaret ismultipleselectionenabled addtoselection setselection quickcopydrag quickcopydrag movecaretposition newcaret mouse dragged method public void mouse dragged mouse event evt if maybe drag and drop start drag and drop evt control return if dnd in progress return if gui utilities is popup trigger evt popup null popup is visible return if buffer is loaded return if evt gety 0 int delta math min 1 evt gety painter get font metrics get height set first line get first line delta else if evt gety painter get height int delta math max 1 evt gety painter get height painter get font metrics get height if last line partial delta set first line get first line delta if quick copy drag view get status set message j edit get property view status rect quick copy clear status true switch click count case 1 do single drag evt break case 2 do double drag evt break default case 3 do triple drag evt break mousedragged mousedragged mouseevent maybedraganddrop startdraganddrop dndinprogress guiutilities ispopuptrigger isvisible isloaded getfontmetrics getheight setfirstline getfirstline getheight getheight getfontmetrics getheight lastlinepartial setfirstline getfirstline quickcopydrag getstatus setmessage jedit getproperty clearstatus clickcount dosingledrag dodoubledrag dotripledrag do single drag method private void do single drag mouse event evt dragged true int x evt getx int y evt gety if y 0 y 0 else if y painter get height y painter get height 1 int dot xy to offset x y painter is block caret enabled is overwrite enabled quick copy drag int dot line buffer get line of offset dot int extra end virt 0 if chunk cache get line info screen last line last subregion float dot line width offset toxy dot line get line length dot line return value x if x dot line width extra end virt int x dot line width char width if get painter is block caret enabled is overwrite enabled x get horizontal offset char width char width 2 extra end virt resize selection drag start dot extra end virt is rectangular selection enabled control if quick copy drag just scroll to the dragged location scroll to dot line dot buffer get line start offset dot line false else if dot caret move caret position dot false if is rectangular selection enabled extra end virt 0 scroll to dot line dot buffer get line start offset dot line extra end virt false dosingledrag dosingledrag mouseevent getheight getheight xytooffset isblockcaretenabled isoverwriteenabled quickcopydrag dotline getlineofoffset extraendvirt chunkcache getlineinfo screenlastline lastsubregion dotlinewidth offsettoxy dotline getlinelength dotline returnvalue dotlinewidth extraendvirt dotlinewidth charwidth getpainter isblockcaretenabled isoverwriteenabled gethorizontaloffset charwidth charwidth extraendvirt resizeselection dragstart extraendvirt isrectangularselectionenabled quickcopydrag scrollto dotline getlinestartoffset dotline movecaretposition isrectangularselectionenabled extraendvirt scrollto dotline getlinestartoffset dotline extraendvirt do double drag method private void do double drag mouse event evt int mark line start get line start offset drag start line int mark line length get line length drag start line int mark drag start offset int pos xy to offset evt getx math max 0 math min painter get height evt gety painter is block caret enabled is overwrite enabled int line get line of offset pos int line start get line start offset line int line length get line length line int offset pos line start string line text get line text line string mark line text get line text drag start line string no word sep buffer get string property no word sep boolean join non word chars j edit get boolean property view join non word chars if mark line start drag start offset line start offset if offset 0 offset line length offset text utilities find word start line text offset no word sep join non word chars if mark line length 0 mark text utilities find word end mark line text mark no word sep join non word chars else if offset 0 line length 0 offset text utilities find word end line text offset no word sep join non word chars if mark 0 mark mark line length mark text utilities find word start mark line text mark no word sep join non word chars if line start offset caret return resize selection mark line start mark line start offset 0 false move caret position line start offset false dragged true dodoubledrag dodoubledrag mouseevent marklinestart getlinestartoffset dragstartline marklinelength getlinelength dragstartline dragstartoffset xytooffset getheight isblockcaretenabled isoverwriteenabled getlineofoffset linestart getlinestartoffset linelength getlinelength linestart linetext getlinetext marklinetext getlinetext dragstartline nowordsep getstringproperty nowordsep joinnonwordchars jedit getbooleanproperty joinnonwordchars marklinestart dragstartoffset linestart linelength textutilities findwordstart linetext nowordsep joinnonwordchars marklinelength textutilities findwordend marklinetext nowordsep joinnonwordchars linelength textutilities findwordend linetext nowordsep joinnonwordchars marklinelength textutilities findwordstart marklinetext nowordsep joinnonwordchars linestart resizeselection marklinestart linestart movecaretposition linestart do triple drag method private void do triple drag mouse event evt int offset xy to offset evt getx math max 0 math min painter get height evt gety false int mouse line get line of offset offset int mark int mouse if drag start line mouse line mark get line end offset drag start line 1 if offset get line end offset mouse line 1 mouse offset else mouse get line start offset mouse line else mark get line start offset drag start line if offset get line start offset mouse line mouse offset else if offset get line end offset mouse line 1 mouse line get buffer get line count 1 mouse get line end offset mouse line else mouse get line end offset mouse line 1 mouse math min get buffer get length mouse if mouse caret return resize selection mark mouse 0 false move caret position mouse false dragged true dotripledrag dotripledrag mouseevent xytooffset getheight mouseline getlineofoffset dragstartline mouseline getlineendoffset dragstartline getlineendoffset mouseline getlinestartoffset mouseline getlinestartoffset dragstartline getlinestartoffset mouseline getlineendoffset mouseline mouseline getbuffer getlinecount getlineendoffset mouseline getlineendoffset mouseline getbuffer getlength resizeselection movecaretposition mouse released method public void mouse released mouse event evt middle mouse button drag inserts selection at caret position selection sel get selection at offset drag start if dragged sel null registers set register get selected text sel if quick copy drag remove from selection sel registers paste focused component sel instanceof selection rect focused component request focus else if dragged is quick copy enabled gui utilities is middle button evt get modifiers j edit text area this request focus focused component j edit text area this set caret position drag start false if is editable get toolkit beep else registers paste j edit text area this control else if maybe drag and drop is multiple selection enabled select none dragged false if clear status clear status false view get status set message null mousereleased mousereleased mouseevent getselectionatoffset dragstart setregister getselectedtext quickcopydrag removefromselection focusedcomponent focusedcomponent requestfocus isquickcopyenabled guiutilities ismiddlebutton getmodifiers jedittextarea requestfocus focusedcomponent jedittextarea setcaretposition dragstart iseditable gettoolkit jedittextarea maybedraganddrop ismultipleselectionenabled selectnone clearstatus clearstatus getstatus setmessage public void action performed action event evt if focused component null focused component update structure highlight actionperformed actionevent focusedcomponent focusedcomponent updatestructurehighlight integer array constructor public integer array this 2000 integerarray integerarray integer array constructor public integer array int initial size array new int initial size integerarray integerarray initialsize initialsize add method public void add int num if len array length int arrayn new int len 2 system arraycopy array 0 arrayn 0 len array arrayn array len num get method public final int get int index return array index get size method public final int get size return len getsize getsize set size method public final void set size int len this len len setsize setsize clear method public final void clear len 0 get array method public int get array return array getarray getarray autosave backup option pane constructor public autosave backup option pane super auto back autosavebackupoptionpane autosavebackupoptionpane init method protected void init autosave interval autosave new j text field j edit get property autosave add component j edit get property options auto back autosave autosave backup count backups new j text field j edit get property backups add component j edit get property options auto back backups backups backup directory backup directory new j text field j edit get property backup directory add component j edit get property options auto back backup directory backup directory backup filename prefix backup prefix new j text field j edit get property backup prefix add component j edit get property options auto back backup prefix backup prefix backup suffix backup suffix new j text field j edit get property backup suffix add component j edit get property options auto back backup suffix backup suffix backup on every save backup every save new j check box j edit get property options auto back backup every save backup every save set selected j edit get boolean property backup every save add component backup every save _init _init jtextfield jedit getproperty addcomponent jedit getproperty jtextfield jedit getproperty addcomponent jedit getproperty backupdirectory jtextfield jedit getproperty addcomponent jedit getproperty backupdirectory backupdirectory backupprefix jtextfield jedit getproperty addcomponent jedit getproperty backupprefix backupprefix backupsuffix jtextfield jedit getproperty addcomponent jedit getproperty backupsuffix backupsuffix backupeverysave jcheckbox jedit getproperty backupeverysave backupeverysave setselected jedit getbooleanproperty backupeverysave addcomponent backupeverysave save method protected void save j edit set property autosave autosave get text j edit set property backups backups get text j edit set property backup directory backup directory get text j edit set property backup prefix backup prefix get text j edit set property backup suffix backup suffix get text j edit set boolean property backup every save backup every save is selected _save _save jedit setproperty gettext jedit setproperty gettext jedit setproperty backupdirectory gettext jedit setproperty backupprefix gettext jedit setproperty backupsuffix gettext jedit setbooleanproperty backupeverysave backupeverysave isselected public bsh iterator get bsh iterator object obj throws illegal argument exception if obj instanceof collection obj instanceof iterator return new collection iterator obj else return new bsh collection manager basic bsh iterator obj bshiterator getbshiterator illegalargumentexception collectioniterator collectionmanager basicbshiterator public boolean is map object obj if obj instanceof map return true else return super is map obj ismap ismap public object get from map object map object key hashtable implements map return map map get key getfrommap public object put in map object map object key object value hashtable implements map return map map put key value putinmap class bsh cast expression extends simple node public bsh cast expression int id super id bshcastexpression simplenode bshcastexpression return the result of the cast public object eval call stack callstack interpreter interpreter throws eval error name space namespace callstack top class to type bsh type jjt get child 0 get type callstack interpreter simple node expression simple node jjt get child 1 evaluate the expression object from value expression eval callstack interpreter class from type from value get class try return types cast object from value to type types cast catch util eval error e throw e to eval error this callstack callstack evalerror namespace totype bshtype jjtgetchild gettype simplenode simplenode jjtgetchild fromvalue fromtype fromvalue getclass castobject fromvalue totype utilevalerror toevalerror get buffer method public buffer get buffer if buffer null buffer j edit open file null path return buffer getbuffer getbuffer jedit openfile get selection method returns an array of selection objects pointing to the occurrences of the search term on the current line the buffer must be opened first since j edit 4 2pre5 public selection get selection if buffer null return null selection return value new selection occur count occur o occur int i 0 while o null selection range s new selection range o start pos get offset o end pos get offset return value i s o o next return return value getselection jedit getselection returnvalue occurcount startpos getoffset endpos getoffset returnvalue returnvalue go to method public void go to final view view if buffer null buffer j edit open file null path if buffer null return vfs manager run inawt thread new runnable public void run selection s get selection if s null return edit pane pane view go to buffer buffer j edit text area text area pane get text area if text area is multiple selection enabled text area add to selection s else text area set selection s text area move caret position occur end pos get offset goto goto jedit openfile vfsmanager runinawtthread getselection editpane gotobuffer jedittextarea textarea gettextarea textarea ismultipleselectionenabled textarea addtoselection textarea setselection textarea movecaretposition endpos getoffset public void run selection s get selection if s null return edit pane pane view go to buffer buffer j edit text area text area pane get text area if text area is multiple selection enabled text area add to selection s else text area set selection s text area move caret position occur end pos get offset getselection editpane gotobuffer jedittextarea textarea gettextarea textarea ismultipleselectionenabled textarea addtoselection textarea setselection textarea movecaretposition endpos getoffset to string method public string to string return str tostring tostring hyper search result constructor hyper search result buffer buffer int line path buffer get path if buffer is temporary buffer opened buffer this line line str line 1 buffer get line text line replace t trim hypersearchresult hypersearchresult getpath istemporary bufferopened getlinetext buffer opened method void buffer opened buffer buffer this buffer buffer occur o occur while o null o buffer opened o o next bufferopened bufferopened bufferopened buffer closed method void buffer closed buffer null occur o occur while o null o buffer closed o o next bufferclosed bufferclosed bufferclosed add occur method void add occur int start int end occur o new occur start end o next occur occur o occur count addoccur addoccur occurcount path equals method param path a canonical path boolean path equals string path return path equals misc utilities resolve symlinks this path pathequals pathequals miscutilities resolvesymlinks occur constructor occur int start int end this start start this end end if buffer null buffer is temporary buffer opened istemporary bufferopened buffer opened method void buffer opened start pos buffer create position math min buffer get length start end pos buffer create position math min buffer get length end bufferopened bufferopened startpos createposition getlength endpos createposition getlength buffer closed method void buffer closed start start pos get offset end end pos get offset start pos end pos null bufferclosed bufferclosed startpos getoffset endpos getoffset startpos endpos abbrev editor constructor public abbrev editor grid bag layout layout new grid bag layout set layout layout grid bag constraints cons new grid bag constraints cons anchor cons west cons fill cons both cons weightx 0 0f cons gridx 1 cons gridy 1 j label label new j label j edit get property abbrev editor abbrev swing constants right label set border new empty border 0 0 0 12 layout set constraints label cons add label cons gridx cons weightx 1 0f abbrev new j text field layout set constraints abbrev cons add abbrev cons gridx 1 cons weightx 0 0f cons gridwidth 2 cons gridy label new j label j edit get property abbrev editor before label set border new empty border 6 0 3 0 layout set constraints label cons add label cons gridy cons weighty 1 0f before caret new j text area 4 40 j scroll pane scroller new j scroll pane before caret layout set constraints scroller cons add scroller cons gridy cons weighty 0 0f label new j label j edit get property abbrev editor after label set border new empty border 6 0 3 0 layout set constraints label cons add label cons gridy cons weighty 1 0f after caret new j text area 4 40 scroller new j scroll pane after caret layout set constraints scroller cons add scroller abbreveditor abbreveditor gridbaglayout gridbaglayout setlayout gridbagconstraints gridbagconstraints jlabel jlabel jedit getproperty swingconstants setborder emptyborder setconstraints jtextfield setconstraints jlabel jedit getproperty setborder emptyborder setconstraints beforecaret jtextarea jscrollpane jscrollpane beforecaret setconstraints jlabel jedit getproperty setborder emptyborder setconstraints aftercaret jtextarea jscrollpane aftercaret setconstraints get abbrev method public string get abbrev return abbrev get text getabbrev getabbrev gettext set abbrev method public void set abbrev string abbrev this abbrev set text abbrev setabbrev setabbrev settext get expansion method public string get expansion string buffer buf new string buffer string before caret text before caret get text string after caret text after caret get text for int i 0 i before caret text length i char ch before caret text char at i switch ch case n buf append n break case t buf append t break case buf append break default buf append ch break if after caret text length 0 buf append for int i 0 i after caret text length i char ch after caret text char at i switch ch case n buf append n break case t buf append t break case buf append break default buf append ch break return buf to string getexpansion getexpansion stringbuffer stringbuffer beforecarettext beforecaret gettext aftercarettext aftercaret gettext beforecarettext beforecarettext charat aftercarettext aftercarettext aftercarettext charat tostring set expansion method public void set expansion string expansion if expansion null before caret set text null after caret set text null return string before caret text null string after caret text null string buffer buf new string buffer for int i 0 i expansion length i char ch expansion char at i if ch i expansion length 1 ch expansion char at i switch ch case t buf append t break case n buf append n break case before caret text buf to string buf set length 0 break default buf append ch break else buf append ch if before caret text null before caret text buf to string else after caret text buf to string before caret set text before caret text after caret set text after caret text setexpansion setexpansion beforecaret settext aftercaret settext beforecarettext aftercarettext stringbuffer stringbuffer charat charat beforecarettext tostring setlength beforecarettext beforecarettext tostring aftercarettext tostring beforecaret settext beforecarettext aftercaret settext aftercarettext get abbrev field method public j text field get abbrev field return abbrev getabbrevfield jtextfield getabbrevfield get before caret text area method public j text area get before caret text area return before caret getbeforecarettextarea jtextarea getbeforecarettextarea beforecaret get after caret text area method public j text area get after caret text area return after caret getaftercarettextarea jtextarea getaftercarettextarea aftercaret public quick notepad tool panel quick notepad qnpad set layout new box layout this box layout x axis pad qnpad box label box new box box layout y axis label box add box create glue label new j label pad get filename label set visible j edit get property quick notepad plugin option prefix show filepath equals true label box add label label box add box create glue add label box add box create glue add make custom button quicknotepad choose file new action listener public void action performed action event evt quick notepad tool panel this pad choose file add make custom button quicknotepad save file new action listener public void action performed action event evt quick notepad tool panel this pad save file add make custom button quicknotepad copy to buffer new action listener public void action performed action event evt quick notepad tool panel this pad copy to buffer quicknotepadtoolpanel quicknotepad setlayout boxlayout boxlayout x_axis labelbox boxlayout y_axis labelbox createglue jlabel getfilename setvisible jedit getproperty quicknotepadplugin option_prefix labelbox labelbox createglue labelbox createglue makecustombutton actionlistener actionperformed actionevent quicknotepadtoolpanel choosefile makecustombutton actionlistener actionperformed actionevent quicknotepadtoolpanel savefile makecustombutton actionlistener actionperformed actionevent quicknotepadtoolpanel copytobuffer add make custom button quicknotepad choose file new action listener public void action performed action event evt quick notepad tool panel this pad choose file makecustombutton actionlistener actionperformed actionevent quicknotepadtoolpanel choosefile add make custom button quicknotepad save file new action listener public void action performed action event evt quick notepad tool panel this pad save file makecustombutton actionlistener actionperformed actionevent quicknotepadtoolpanel savefile add make custom button quicknotepad copy to buffer new action listener public void action performed action event evt quick notepad tool panel this pad copy to buffer makecustombutton actionlistener actionperformed actionevent quicknotepadtoolpanel copytobuffer void properties changed label set text pad get filename label set visible j edit get property quick notepad plugin option prefix show filepath equals true propertieschanged settext getfilename setvisible jedit getproperty quicknotepadplugin option_prefix private abstract button make custom button string name action listener listener string tool tip j edit get property name concat label abstract button b new rollover button gui utilities load icon j edit get property name icon if listener null b add action listener listener b set enabled true else b set enabled false b set tool tip text tool tip return b abstractbutton makecustombutton actionlistener tooltip jedit getproperty abstractbutton rolloverbutton guiutilities loadicon jedit getproperty addactionlistener setenabled setenabled settooltiptext tooltip public static string split string s string delim vector v new vector string tokenizer st new string tokenizer s delim while st has more tokens v add element st next token string sa new string v size v copy into sa return sa stringtokenizer stringtokenizer hasmoretokens addelement nexttoken copyinto public static string bubble sort string in vector v new vector for int i 0 i in length i v add element in i int n v size boolean swap true while swap swap false for int i 0 i n 1 i if string v element at i compare to string v element at i 1 0 string tmp string v element at i 1 v remove element at i 1 v insert element at tmp i swap true string out new string n v copy into out return out bubblesort addelement elementat compareto elementat elementat removeelementat insertelementat copyinto public static string max common prefix string one string two int i 0 while one region matches 0 two 0 i i return one substring 0 i 1 maxcommonprefix regionmatches public static string method string string name class types string buffer sb new string buffer name if types length 0 sb append for int i 0 i types length i class c types i sb append c null null c get name i types length 1 sb append return sb to string methodstring stringbuffer stringbuffer getname tostring hack the real method is in reflect java which is not public public static string normalize class name class type return reflect normalize class name type normalizeclassname normalizeclassname param package name e g com foo bar public class generator util modifiers class modifiers string class name string package name class super class class interfaces variable vars delayed eval bsh method bshmethods name space class static name space boolean is interface this class modifiers class modifiers this class name class name if package name null this fq class name package name replace class name else this fq class name class name if super class null super class object class this super class super class this super class name type get internal name super class if interfaces null interfaces new class 0 this interfaces interfaces this vars vars this class static name space class static name space this super constructors super class get declared constructors split the methods into constructors and regular method lists list consl new array list list methodsl new array list string class base name get base name class name for inner classes for int i 0 i bshmethods length i if bshmethods i get name equals class base name consl add bshmethods i else methodsl add bshmethods i this constructors delayed eval bsh method consl to array new delayed eval bsh method 0 this methods delayed eval bsh method methodsl to array new delayed eval bsh method 0 try class static name space set local variable bshconstructors constructors false strict catch util eval error e throw new interpreter error can t set cons var this is interface is interface packagename classgeneratorutil classmodifiers classname packagename superclass delayedevalbshmethod namespace classstaticnamespace isinterface classmodifiers classmodifiers classname classname packagename fqclassname packagename classname fqclassname classname superclass superclass superclass superclass superclassname getinternalname superclass classstaticnamespace classstaticnamespace superconstructors superclass getdeclaredconstructors arraylist arraylist classbasename getbasename classname getname classbasename delayedevalbshmethod toarray delayedevalbshmethod delayedevalbshmethod toarray delayedevalbshmethod classstaticnamespace setlocalvariable utilevalerror interpretererror isinterface isinterface generate the class bytecode for this class param class name should be a path style name e g test class or mypackage test class public byte generate class force the class public for now int class mods getasm modifiers class modifiers acc public if is interface class mods acc interface string interface names new string interfaces length for int i 0 i interfaces length i interface names i type get internal name interfaces i string source file bean shell generated via asm www objectweb org class writer cw new class writer false cw visit class mods fq class name super class name interface names source file if is interface generate the bsh instance this reference holder field generate field bshthis class name lbsh this acc public cw generate the static bsh static reference holder field generate field bshstatic class name lbsh this acc public acc static cw generate the fields for int i 0 i vars length i string type vars i get type descriptor don t generate private or loosely typed fields note loose types aren t currently parsed anyway if vars i has modifier private type null continue int modifiers if is interface modifiers acc public acc static acc final else modifiers getasm modifiers vars i get modifiers generate field vars i get name type modifiers cw generate the constructors boolean has constructor false for int i 0 i constructors length i don t generate private constructors if constructors i has modifier private continue int modifiers getasm modifiers constructors i get modifiers generate constructor i constructors i get param type descriptors modifiers cw has constructor true if no other constructors generate a default constructor if is interface has constructor generate constructor defaultconstructor index new string 0 acc public cw generate the delegate methods for int i 0 i methods length i string return type methods i get return type descriptor don t generate private or loosely return typed methods if methods i has modifier private return type null continue int modifiers getasm modifiers methods i get modifiers if is interface modifiers acc public acc abstract generate method class name fq class name methods i get name return type methods i get param type descriptors modifiers cw boolean is static modifiers acc static 0 boolean overridden class contains method super class methods i get name methods i get param type descriptors if is static overridden generate super delegate method super class super class name methods i get name return type methods i get param type descriptors modifiers cw return cw to byte array classname testclass testclass generateclass classmods getasmmodifiers classmodifiers acc_public isinterface classmods acc_interface interfacenames interfacenames getinternalname sourcefile beanshell classwriter classwriter classmods fqclassname superclassname interfacenames sourcefile isinterface generatefield classname acc_public generatefield classname acc_public acc_static gettypedescriptor hasmodifier isinterface acc_public acc_static acc_final getasmmodifiers getmodifiers generatefield getname hasconstructor hasmodifier getasmmodifiers getmodifiers generateconstructor getparamtypedescriptors hasconstructor isinterface hasconstructor generateconstructor acc_public returntype getreturntypedescriptor hasmodifier returntype getasmmodifiers getmodifiers isinterface acc_public acc_abstract generatemethod classname fqclassname getname returntype getparamtypedescriptors isstatic acc_static classcontainsmethod superclass getname getparamtypedescriptors isstatic generatesuperdelegatemethod superclass superclassname getname returntype getparamtypedescriptors tobytearray translate bsh modifiers into asm modifier bitflags static int getasm modifiers modifiers modifiers int mods 0 if modifiers null return mods if modifiers has modifier public mods acc public if modifiers has modifier protected mods acc protected if modifiers has modifier static mods acc static if modifiers has modifier synchronized mods acc synchronized if modifiers has modifier abstract mods acc abstract return mods getasmmodifiers hasmodifier acc_public hasmodifier acc_protected hasmodifier acc_static hasmodifier acc_synchronized hasmodifier acc_abstract generate a field static or instance static void generate field string field name string type int modifiers class writer cw cw visit field modifiers field name type null value generatefield fieldname classwriter visitfield fieldname generate a delegate method static or instance the generated code packs the method arguments into an object array wrapping primitive types in bsh primitive invokes the static or instance namespace invoke method method and then unwraps returns the result static void generate method string class name string fq class name string method name string return type string param types int modifiers class writer cw string exceptions null boolean is static modifiers acc static 0 if return type null map loose return type to object return type object string method descriptor get method descriptor return type param types generate method body code visitor cv cw visit method modifiers method name method descriptor exceptions if modifiers acc abstract 0 return generate code to push the bshthis or bshstatic field if is static cv visit field insn getstatic fq class name bshstatic class name lbsh this else push this cv visit var insn aload 0 get the instance field cv visit field insn getfield fq class name bshthis class name lbsh this push the name of the method as a constant cv visit ldc insn method name generate code to push arguments as an object array generate parameter reifier code param types is static cv push nulls for various args of invoke method cv visit insn aconst null interpreter cv visit insn aconst null callstack cv visit insn aconst null callerinfo push the boolean constant true for declared only cv visit insn iconst 1 invoke the method this invoke method name class sig boolean cv visit method insn invokevirtual bsh this invoke method type get method descriptor type get type object class new type type get type string class type get type object class type get type interpreter class type get type call stack class type get type simple node class type get type boolean type generate code to unwrap bsh primitive types cv visit method insn invokestatic bsh primitive unwrap ljava lang object ljava lang object generate code to return the value generate return code return type cv need to calculate this just fudging here for now cv visit maxs 20 20 invokemethod generatemethod classname fqclassname methodname returntype paramtypes classwriter isstatic acc_static returntype returntype methoddescriptor getmethoddescriptor returntype paramtypes codevisitor visitmethod methodname methoddescriptor acc_abstract isstatic visitfieldinsn fqclassname classname visitvarinsn visitfieldinsn fqclassname classname visitldcinsn methodname generateparameterreifiercode paramtypes isstatic invokemethod visitinsn aconst_null visitinsn aconst_null visitinsn aconst_null declaredonly visitinsn iconst_1 invokemethod visitmethodinsn invokemethod getmethoddescriptor gettype gettype gettype gettype gettype callstack gettype simplenode gettype visitmethodinsn generatereturncode returntype visitmaxs generate a constructor void generate constructor int index string param types int modifiers class writer cw offset after params of the args object var final int args var param types length 1 offset after params of the constructor args var final int cons args var param types length 2 string exceptions null string method descriptor get method descriptor v param types create this constructor method code visitor cv cw visit method modifiers init method descriptor exceptions generate code to push arguments as an object array generate parameter reifier code param types false is static cv cv visit var insn astore args var generate the code implementing the alternate constructor switch generate constructor switch index args var cons args var cv generate code to invoke the class generator util init instance method push this cv visit var insn aload 0 push the class constructor name as a constant cv visit ldc insn class name push arguments as an object array cv visit var insn aload args var invoke the init instance method cv visit method insn invokestatic bsh class generator util init instance ljava lang object ljava lang string ljava lang object v cv visit insn return need to calculate this just fudging here for now cv visit maxs 20 20 generateconstructor paramtypes classwriter argsvar paramtypes constructorargs consargsvar paramtypes methoddescriptor getmethoddescriptor paramtypes codevisitor visitmethod methoddescriptor generateparameterreifiercode paramtypes isstatic visitvarinsn argsvar generateconstructorswitch argsvar consargsvar classgeneratorutil initinstance visitvarinsn visitldcinsn classname visitvarinsn argsvar initinstance visitmethodinsn classgeneratorutil initinstance visitinsn visitmaxs generate a switch with a branch for each possible alternate constructor this includes all superclass constructors and all constructors of this class the default branch of this switch is the default superclass constructor p this method also generates the code to call the static class generator util get constructor args method which inspects the scripted constructor to find the alternate constructor signature if any and evalute the arguments at runtime the get constructor args method returns the actual arguments as well as the index of the constructor to call void generate constructor switch int cons index int args var int cons args var code visitor cv label default label new label label end label new label int cases super constructors length constructors length label labels new label cases for int i 0 i cases i labels i new label generate code to call class generator util to get our switch index and give us args push super class name cv visit ldc insn super class get name use super class name var push class static this object cv visit field insn getstatic fq class name bshstatic class name lbsh this push args cv visit var insn aload args var push this constructor index number onto stack cv visit int insn bipush cons index invoke the class generator util get constructors args method cv visit method insn invokestatic bsh class generator util get constructor args ljava lang string lbsh this ljava lang object i lbsh class generator util constructor args store constructor args in cons args var cv visit var insn astore cons args var get the constructor args selector field from constructor args push constructor args cv visit var insn aload cons args var cv visit field insn getfield bsh class generator util constructor args selector i start switch cv visit table switch insn 0 min cases 1 max default label labels generate switch body int index 0 for int i 0 i super constructors length i index do switch branch index super class name get type descriptors super constructors i get parameter types end label labels cons args var cv for int i 0 i constructors length i index do switch branch index fq class name constructors i get param type descriptors end label labels cons args var cv generate the default branch of switch cv visit label default label default branch always invokes no args super cv visit var insn aload 0 push this cv visit method insn invokespecial super class name init v done with switch cv visit label end label classgeneratorutil getconstructorargs getconstructorargs generateconstructorswitch consindex argsvar consargsvar codevisitor defaultlabel endlabel superconstructors classgeneratorutil visitldcinsn superclass getname superclassname visitfieldinsn fqclassname classname visitvarinsn argsvar visitintinsn consindex classgeneratorutil getconstructorsargs visitmethodinsn classgeneratorutil getconstructorargs classgeneratorutil constructorargs constructorargs consargsvar visitvarinsn consargsvar constructorargs constructorargs constructorargs visitvarinsn consargsvar visitfieldinsn classgeneratorutil constructorargs visittableswitchinsn defaultlabel superconstructors doswitchbranch superclassname gettypedescriptors superconstructors getparametertypes endlabel consargsvar doswitchbranch fqclassname getparamtypedescriptors endlabel consargsvar visitlabel defaultlabel visitvarinsn visitmethodinsn superclassname visitlabel endlabel static void do switch branch int index string target class name string param types label end label label labels int cons args var code visitor cv cv visit label labels index cv visit line number index labels index cv visit var insn aload 0 push this before args unload the arguments from the constructor args object for int i 0 i param types length i string type param types i string method null if type equals z method get boolean else if type equals b method get byte else if type equals c method get char else if type equals s method get short else if type equals i method get int else if type equals j method get long else if type equals d method get double else if type equals f method get float else method get object invoke the iterator method on the constructor args cv visit var insn aload cons args var push the constructor args string class name bsh class generator util constructor args string ret type if method equals get object ret type object else ret type type cv visit method insn invokevirtual class name method ret type if it s an object type we must do a check cast if method equals get object cv visit type insn checkcast descriptor to class name type invoke the constructor for this branch string descriptor get method descriptor v param types cv visit method insn invokespecial target class name init descriptor cv visit jump insn goto end label doswitchbranch targetclassname paramtypes endlabel consargsvar codevisitor visitlabel visitlinenumber visitvarinsn constructorargs paramtypes paramtypes getboolean getbyte getchar getshort getint getlong getdouble getfloat getobject constructorargs visitvarinsn consargsvar constructorargs classname classgeneratorutil constructorargs rettype getobject rettype rettype visitmethodinsn classname rettype getobject visittypeinsn descriptortoclassname getmethoddescriptor paramtypes visitmethodinsn targetclassname visitjumpinsn endlabel static string get method descriptor string return type string param types string buffer sb new string buffer for int i 0 i param types length i sb append param types i sb append return type return sb to string getmethoddescriptor returntype paramtypes stringbuffer stringbuffer paramtypes paramtypes returntype tostring generate a superclass method delegate accessor method these methods are specially named methods which allow access to overridden methods of the superclass which the java reflection api normally does not allow maybe combine this with generate method static void generate super delegate method class super class string super class name string method name string return type string param types int modifiers class writer cw string exceptions null if return type null map loose return to object return type object string method descriptor get method descriptor return type param types add method body code visitor cv cw visit method modifiers bshsuper method name method descriptor exceptions cv visit var insn aload 0 push vars int local var index 1 for int i 0 i param types length i if is primitive param types i cv visit var insn iload local var index else cv visit var insn aload local var index local var index param types i equals d param types i equals j 2 1 cv visit method insn invokespecial super class name method name method descriptor generate plain return code return type cv need to calculate this just fudging here for now cv visit maxs 20 20 generatemethod generatesuperdelegatemethod superclass superclassname methodname returntype paramtypes classwriter returntype returntype methoddescriptor getmethoddescriptor returntype paramtypes codevisitor visitmethod _bshsuper methodname methoddescriptor visitvarinsn localvarindex paramtypes isprimitive paramtypes visitvarinsn localvarindex visitvarinsn localvarindex localvarindex paramtypes paramtypes visitmethodinsn superclassname methodname methoddescriptor generateplainreturncode returntype visitmaxs boolean class contains method class clas string method name string param types while clas null method methods clas get declared methods for int i 0 i methods length i if methods i get name equals method name string method param types get type descriptors methods i get parameter types boolean found true for int j 0 j method param types length j if param types j equals method param types j found false break if found return true clas clas get superclass return false classcontainsmethod methodname paramtypes getdeclaredmethods getname methodname methodparamtypes gettypedescriptors getparametertypes methodparamtypes paramtypes methodparamtypes getsuperclass generate return code for a normal bytecode static void generate plain return code string return type code visitor cv if return type equals v cv visit insn return else if is primitive return type int opcode ireturn if return type equals d opcode dreturn else if return type equals f opcode freturn else if return type equals j long opcode lreturn cv visit insn opcode else cv visit type insn checkcast descriptor to class name return type cv visit insn areturn generateplainreturncode returntype codevisitor returntype visitinsn isprimitive returntype returntype returntype returntype visitinsn visittypeinsn descriptortoclassname returntype visitinsn generates the code to reify the arguments of the given method for a method int m int i string s this code is the bytecode corresponding to the new object new bsh primitive i s expression param cv the code visitor to be used to generate the bytecode param is static the enclosing methods is static author eric bruneton author pat niemeyer public static void generate parameter reifier code string param types boolean is static final code visitor cv cv visit int insn sipush param types length cv visit type insn anewarray java lang object int local var index is static 0 1 for int i 0 i param types length i string param param types i cv visit insn dup cv visit int insn sipush i if is primitive param int opcode iload string type bsh primitive cv visit type insn new type cv visit insn dup cv visit var insn opcode local var index string desc param ok cv visit method insn invokespecial type init desc v else technically incorrect here we need to wrap null values as bsh primitive null however the this invoke method will do that much for us we need to generate a conditional here to test for null and return primitive null cv visit var insn aload local var index cv visit insn aastore local var index param equals d param equals j 2 1 isstatic generateparameterreifiercode paramtypes isstatic codevisitor visitintinsn paramtypes visittypeinsn localvarindex isstatic paramtypes paramtypes visitinsn visitintinsn isprimitive visittypeinsn visitinsn visitvarinsn localvarindex visitmethodinsn invokemethod visitvarinsn localvarindex visitinsn localvarindex generates the code to unreify the result of the given method for a method int m int i string s this code is the bytecode corresponding to the integer int value expression param m a method object param cv the code visitor to be used to generate the bytecode author eric bruneton author pat niemeyer public static void generate return code string return type code visitor cv if return type equals v cv visit insn pop cv visit insn return else if is primitive return type int opcode ireturn string type string meth if return type equals b type java lang byte meth byte value else if return type equals i type java lang integer meth int value else if return type equals z type java lang boolean meth boolean value else if return type equals d opcode dreturn type java lang double meth double value else if return type equals f opcode freturn type java lang float meth float value else if return type equals j opcode lreturn type java lang long meth long value else if return type equals c type java lang character meth char value else if return type equals s type java lang short meth short value string desc return type cv visit type insn checkcast type type is correct here cv visit method insn invokevirtual type meth desc cv visit insn opcode else cv visit type insn checkcast descriptor to class name return type cv visit insn areturn intvalue generatereturncode returntype codevisitor returntype visitinsn visitinsn isprimitive returntype returntype bytevalue returntype intvalue returntype booleanvalue returntype doublevalue returntype floatvalue returntype longvalue returntype charvalue returntype shortvalue returntype visittypeinsn visitmethodinsn visitinsn visittypeinsn descriptortoclassname returntype visitinsn evaluate the arguments if any for the constructor specified by the constructor index return the constructor args object which contains the actual arguments to the alternate constructor and also the index of that constructor for the constructor switch param args the arguments to the constructor these are necessary in the evaluation of the alt constructor args e g foo a super a return the constructor args object containing a constructor selector and evaluated arguments for the alternate constructor public static constructor args get constructor args string super class name this class static this object cons args int index delayed eval bsh method constructors try constructors delayed eval bsh method class static this get name space get variable bshconstructors catch exception e throw new interpreter error unable to get instance initializer e if index defaultconstructor auto gen default constructor return constructor args default use default super constructor delayed eval bsh method constructor constructors index if constructor method body jjt get num children 0 return constructor args default use default super constructor determine if the constructor calls this or super string alt constructor null bsh arguments args node null simple node first statement simple node constructor method body jjt get child 0 if first statement instanceof bsh primary expression first statement simple node first statement jjt get child 0 if first statement instanceof bsh method invocation bsh method invocation method node bsh method invocation first statement bsh ambiguous name method name method node get name node if method name text equals super method name text equals this alt constructor method name text args node method node get args node if alt constructor null return constructor args default use default super constructor make a tmp namespace to hold the original constructor args for use in eval of the parameters node name space cons args name space new name space class static this get name space cons args string cons arg names constructor get parameter names class cons arg types constructor get parameter types for int i 0 i cons args length i try cons args name space set typed variable cons arg names i cons arg types i cons args i null modifiers catch util eval error e throw new interpreter error err setting local cons arg e evaluate the args call stack callstack new call stack callstack push cons args name space object args null interpreter interpreter class static this declaring interpreter try args args node get arguments callstack interpreter catch eval error e throw new interpreter error error evaluating constructor args e class arg types types get types args args primitive unwrap args class super class interpreter get class manager class for name super class name if super class null throw new interpreter error can t find superclass super class name constructor super cons super class get declared constructors find the matching super constructor for the args if alt constructor equals super int i reflect find most specific constructor index arg types super cons if i 1 throw new interpreter error can t find constructor for args return new constructor args i args find the matching this constructor for the args class candidates new class constructors length for int i 0 i candidates length i candidates i constructors i get parameter types int i reflect find most specific signature arg types candidates if i 1 throw new interpreter error can t find constructor for args 2 this constructors come after super constructors in the table int selector i super cons length int our selector index super cons length are we choosing ourselves recursively through a this reference if selector our selector throw new interpreter error recusive constructor call return new constructor args selector args constructorargs constructorargs constructorargs getconstructorargs superclassname classstaticthis consargs delayedevalbshmethod delayedevalbshmethod classstaticthis getnamespace getvariable interpretererror constructorargs delayedevalbshmethod methodbody jjtgetnumchildren constructorargs altconstructor bsharguments argsnode simplenode firststatement simplenode methodbody jjtgetchild firststatement bshprimaryexpression firststatement simplenode firststatement jjtgetchild firststatement bshmethodinvocation bshmethodinvocation methodnode bshmethodinvocation firststatement bshambiguousname methodname methodnode getnamenode methodname methodname altconstructor methodname argsnode methodnode getargsnode altconstructor constructorargs namespace consargsnamespace namespace classstaticthis getnamespace consargs consargnames getparameternames consargtypes getparametertypes consargs consargsnamespace settypedvariable consargnames consargtypes consargs utilevalerror interpretererror callstack callstack consargsnamespace classstaticthis declaringinterpreter argsnode getarguments evalerror interpretererror argtypes gettypes superclass getclassmanager classforname superclassname superclass interpretererror superclassname supercons superclass getdeclaredconstructors altconstructor findmostspecificconstructorindex argtypes supercons interpretererror constructorargs getparametertypes findmostspecificsignature argtypes interpretererror supercons ourselector supercons ourselector interpretererror constructorargs initialize an instance of the class this method is called from the generated class constructor to evaluate the instance initializer and scripted constructor in the instance namespace public static void init instance object instance string class name object args class sig types get types args call stack callstack new call stack interpreter interpreter name space instance name space check to see if the instance has already been initialized the case if using a this alternate constuctor this instance this get class instance this instance class name xxx clean up this conditional if instance this null create the instance this namespace set it on the object instance and invoke the instance initializer get the static this reference from the proto instance this class static this get class static this instance get class class name interpreter class static this declaring interpreter get the instance initializer block from the static this bsh block instance init block try instance init block bsh block class static this get name space get variable bshinit catch exception e throw new interpreter error unable to get instance initializer e create the instance namespace instance name space new name space class static this get name space class name instance name space is class true set the instance this reference on the instance instance this instance name space get this interpreter try lhs lhs reflect getlhs object field instance bshthis class name lhs assign instance this false strict catch exception e throw new interpreter error error in class gen setup e give the instance space its object import instance name space set class instance instance should use try finally here to pop ns callstack push instance name space evaluate the instance portion of the block in it try evaluate the initializer block instance init block eval block callstack interpreter true override class generator impl class node filter classinstance catch exception e throw new interpreter error error in class initialization e callstack pop else the object instance has already been initialzed by another constructor fall through to invoke the constructor body below interpreter instance this declaring interpreter instance name space instance this get name space invoke the constructor method from the instance this string constructor name get base name class name try find the constructor now in the instance namespace bsh method constructor instance name space get method constructor name sig true declared only if args we must have constructor if args length 0 constructor null throw new interpreter error can t find constructor class name evaluate the constructor if constructor null constructor invoke args interpreter callstack null caller info false override name space catch exception e if e instanceof target error e exception target error e get target if e instanceof invocation target exception e exception invocation target exception e get target exception e print stack trace system err throw new interpreter error error in class initialization e initinstance classname gettypes callstack callstack namespace instancenamespace instancethis getclassinstancethis classname instancethis classstaticthis getclassstaticthis getclass classname classstaticthis declaringinterpreter bshblock instanceinitblock instanceinitblock bshblock classstaticthis getnamespace getvariable interpretererror instancenamespace namespace classstaticthis getnamespace classname instancenamespace isclass instancethis instancenamespace getthis getlhsobjectfield classname instancethis interpretererror instancenamespace setclassinstance instancenamespace instanceinitblock evalblock classgeneratorimpl classnodefilter interpretererror instancethis declaringinterpreter instancenamespace instancethis getnamespace instancethis constructorname getbasename classname bshmethod instancenamespace getmethod constructorname declaredonly interpretererror classname callerinfo overridenamespace targeterror targeterror gettarget invocationtargetexception invocationtargetexception gettargetexception printstacktrace interpretererror get the static bsh namespace field from the class param class name may be the name of clas itself or a superclass of clas static this get class static this class clas string class name try return this reflect get static field clas bshstatic class name catch exception e throw new interpreter error unable to get class static space e classname getclassstaticthis classname getstaticfield classname interpretererror get the instance bsh namespace field from the object instance return the class instance this object or null if the object has not been initialized static this get class instance this object instance string class name try object o reflect get object field instance bshthis class name return this primitive unwrap o unwrap primitive null to null catch exception e throw new interpreter error generated class error getting this e getclassinstancethis classname getobjectfield classname interpretererror does the type descriptor string describe a primitive type private static boolean is primitive string type descriptor return type descriptor length 1 right isprimitive typedescriptor typedescriptor static string get type descriptors class cparams string sa new string cparams length for int i 0 i sa length i sa i bsh type get type descriptor cparams i return sa gettypedescriptors bshtype gettypedescriptor if a non array object type remove the prefix l and suffix can this be factored out should be be adding the l here instead private static string descriptor to class name string s if s starts with s starts with l return s return s substring 1 s length 1 descriptortoclassname startswith startswith private static string get base name string class name int i class name index of if i 1 return class name return class name substring i 1 getbasename classname classname indexof classname classname int arg 0 the index of the constructor to call constructor args constructor args int selector object args this selector selector this args args constructorargs constructorargs object next return args arg object next return args arg public boolean get boolean return boolean next boolean value getboolean booleanvalue public boolean get boolean return boolean next boolean value public byte get byte return byte next byte value getboolean booleanvalue getbyte bytevalue public boolean get boolean return boolean next boolean value public byte get byte return byte next byte value public char get char return character next char value getboolean booleanvalue getbyte bytevalue getchar charvalue public byte get byte return byte next byte value public char get char return character next char value public short get short return short next short value getbyte bytevalue getchar charvalue getshort shortvalue public char get char return character next char value public short get short return short next short value public int get int return integer next int value getchar charvalue getshort shortvalue getint intvalue public short get short return short next short value public int get int return integer next int value public long get long return long next long value getshort shortvalue getint intvalue getlong longvalue public int get int return integer next int value public long get long return long next long value public double get double return double next double value getint intvalue getlong longvalue getdouble doublevalue public long get long return long next long value public double get double return double next double value public float get float return float next float value getlong longvalue getdouble doublevalue getfloat floatvalue public double get double return double next double value public float get float return float next float value public object get object return next getdouble doublevalue getfloat floatvalue getobject segment buffer constructor public segment buffer int capacity ensure capacity capacity segmentbuffer segmentbuffer ensurecapacity append method public void append char ch ensure capacity count 1 array offset count ch count ensurecapacity append method public void append char text int off int len ensure capacity count len system arraycopy text off array count len count len ensurecapacity ensure capacity method private void ensure capacity int capacity if array null array new char capacity else if capacity array length char arrayn new char capacity 2 system arraycopy array 0 arrayn 0 count array arrayn ensurecapacity ensurecapacity file rootsvfs constructor public file rootsvfs super roots low latency cap new string ea type jdk 1 4 adds methods to obtain a drive letter label and list the desktop on windows if operating system has java14 try get system display name file system view class get method get system display name new class java io file class get roots file system view class get method get roots new class 0 is file system root file system view class get method is file system root new class java io file class is floppy drive file system view class get method is floppy drive new class java io file class is drive file system view class get method is drive new class java io file class fs view file system view get file system view log log log debug this java 1 4 file system view detected catch exception e log log log debug this java 1 4 file system view not detected filerootsvfs filerootsvfs low_latency_cap ea_type operatingsystem hasjava14 getsystemdisplayname filesystemview getmethod getsystemdisplayname getroots filesystemview getmethod getroots isfilesystemroot filesystemview getmethod isfilesystemroot isfloppydrive filesystemview getmethod isfloppydrive isdrive filesystemview getmethod isdrive fsview filesystemview getfilesystemview filesystemview filesystemview get parent of path method public string get parent of path string path return protocol getparentofpath getparentofpath listdirectory method public vfs directory entry listdirectory object session string url component comp file roots list roots if roots null return null vfs directory entry rootde new vfs directory entry roots length for int i 0 i roots length i rootde i new roots entry roots i return rootde _listdirectory directoryentry _listdirectory listroots directoryentry directoryentry rootsentry getdirectoryentry method public directory entry getdirectoryentry object session string path component comp return new roots entry new file path _getdirectoryentry directoryentry _getdirectoryentry rootsentry list roots method private static file list roots if operating system is macos nasty hardcoded values file volumes new file volumes list files linked list roots new linked list roots add new file for int i 0 i volumes length i make sure people don t do stupid things like putting files in volumes if volumes i is directory roots add volumes i return file roots to array new file 0 else file roots file list roots file desktop null if get roots null try desktop file get roots invoke fs view new object 0 catch exception e log log log error file rootsvfs class error getting desktop e get message desktop null if desktop null return roots file roots plus new file roots length desktop length system arraycopy desktop 0 roots plus 0 desktop length system arraycopy roots 0 roots plus 1 roots length return roots plus listroots listroots operatingsystem ismacos listfiles linkedlist linkedlist isdirectory toarray listroots getroots getroots fsview filerootsvfs getmessage rootsplus rootsplus rootsplus rootsplus roots entry file file remind calling is directory on a floppy drive displays stupid i o error dialog box on windows this path this delete path this symlink path file get path if is floppy file type vfs directory entry filesystem name path else if is drive file type vfs directory entry filesystem if get system display name null try name path string get system display name invoke fs view new object file catch exception e log log log error this e name path else if file is directory type vfs directory entry filesystem if is file system root null try if boolean false equals is file system root invoke fs view new object file type vfs directory entry directory catch exception e if operating system is macos name misc utilities get file name path else name path else type vfs directory entry file rootsentry isdirectory deletepath symlinkpath getpath isfloppy directoryentry isdrive directoryentry getsystemdisplayname getsystemdisplayname fsview isdirectory directoryentry isfilesystemroot isfilesystemroot fsview directoryentry operatingsystem ismacos miscutilities getfilename directoryentry public string get extended attribute string name if name equals ea type return super get extended attribute name else don t want it to show 0 bytes for size etc return null getextendedattribute ea_type getextendedattribute private boolean is floppy file file to prevent windows looking for a disk in the floppy drive if is floppy drive null try return boolean true equals is floppy drive invoke fs view new object file catch exception e log log log error this e return false else return path starts with a path starts with b isfloppy isfloppydrive isfloppydrive fsview startswith startswith private boolean is drive file file so an empty cd drive is not reported as a file if is drive null try return boolean true equals is drive invoke fs view new object file catch exception e log log log error this e return false else return true isdrive isdrive isdrive fsview public variable grid layout int mode int size int hgap int vgap if mode fixed num rows mode fixed num columns throw new illegal argument exception illegal mode value is mode if size 0 throw new illegal argument exception size cannot be zero or less value is size if hgap 0 throw new illegal argument exception hgap cannot be negative value is hgap if vgap 0 throw new illegal argument exception vgap cannot be negative value is vgap this mode mode this size size this hgap hgap this vgap vgap variablegridlayout fixed_num_rows fixed_num_columns illegalargumentexception illegalargumentexception illegalargumentexception illegalargumentexception creates a variable grid layout manager with the specified mode and zero horizontal and vertical gap public variable grid layout int mode int size this mode size 0 0 variablegridlayout creates a variable grid layout manager with mode fixed num rows number of rows 1 and zero horizontal and vertical gap public variable grid layout this fixed num rows 1 0 0 fixed_num_rows variablegridlayout fixed_num_rows not used in this class public void add layout component string name component component addlayoutcomponent not used in this class public void add layout component component component object constraints addlayoutcomponent not used in this class public void remove layout component component component removelayoutcomponent always returns 0 5 public float get layout alignmentx container container return 0 5f getlayoutalignmentx always returns 0 5 public float get layout alignmenty container container return 0 5f getlayoutalignmenty public dimension preferred layout size container parent return get layout size parent 2 preferredlayoutsize getlayoutsize public dimension minimum layout size container parent return get layout size parent 0 minimumlayoutsize getlayoutsize public dimension maximum layout size container parent return get layout size parent 1 maximumlayoutsize getlayoutsize public void layout container container parent synchronized parent get tree lock update parent int ncomponents parent get component count if ncomponents 0 return pass 1 compute preferred row heights column widths int total height 0 for int r 0 i 0 r nrows r for int c 0 c ncols c i if i ncomponents dimension d parent get component i get preferred size row heights r math max row heights r d height col widths c math max col widths c d width else break total height row heights r int total width 0 for int c 0 c ncols c total width col widths c pass 2 redistribute free space dimension parent size parent get size insets insets parent get insets int free height parent size height insets top insets bottom nrows 1 vgap int free width parent size width insets left insets right ncols 1 hgap if total height free height double dy double free height double total height for int r 0 r nrows r row heights r int double row heights r dy if total width free width double dx double free width double total width for int c 0 c ncols c col widths c int double col widths c dx pass 3 layout components for int r 0 y insets top i 0 r nrows y row heights r vgap r for int c 0 x insets left c ncols x col widths c hgap c i if i ncomponents parent get component i set bounds x y col widths c row heights r synchronized layoutcontainer gettreelock getcomponentcount total_height getcomponent getpreferredsize row_heights row_heights col_widths col_widths total_height row_heights total_width total_width col_widths parent_size getsize getinsets free_height parent_size free_width parent_size total_height free_height free_height total_height row_heights row_heights total_width free_width free_width total_width col_widths col_widths row_heights col_widths getcomponent setbounds col_widths row_heights public void invalidate layout container container invalidatelayout returns the string representation of this variable grid layout s values return a string representation of this variable grid layout public string to string return get class get name mode mode size size hgap hgap vgap vgap tostring getclass getname param which if 0 compute minimum layout size if 1 compute maximum layout size otherwise compute preferred layout size private dimension get layout size container parent int which synchronized parent get tree lock update parent int ncomponents parent get component count int h 0 int w 0 for int r 0 i 0 r nrows r int row height 0 for int c 0 c ncols c i if i ncomponents switch which case 0 row height math max row height parent get component i get minimum size height break case 1 row height math max row height parent get component i get maximum size height break default row height math max row height parent get component i get preferred size height break else break h row height for int c 0 c ncols c int col width 0 for int r 0 r nrows r int i r ncols c if i ncomponents switch which case 0 col width math max col width parent get component i get minimum size width break case 1 col width math max col width parent get component i get maximum size width break default col width math max col width parent get component i get preferred size width break else break w col width insets insets parent get insets return new dimension w insets left insets right ncols 1 hgap h insets top insets bottom nrows 1 vgap getlayoutsize gettreelock getcomponentcount row_height row_height row_height getcomponent getminimumsize row_height row_height getcomponent getmaximumsize row_height row_height getcomponent getpreferredsize row_height col_width col_width col_width getcomponent getminimumsize col_width col_width getcomponent getmaximumsize col_width col_width getcomponent getpreferredsize col_width getinsets private void update container container int ncomponents container get component count int old nrows nrows int old ncols ncols if this mode fixed num rows nrows this size ncols ncomponents nrows 1 nrows else ncols this size nrows ncomponents ncols 1 ncols if old nrows nrows row heights new int nrows if old ncols ncols col widths new int ncols getcomponentcount old_nrows old_ncols fixed_num_rows old_nrows row_heights old_ncols col_widths public return control int kind object value simple node return point this kind kind this value value this return point return point returncontrol simplenode returnpoint returnpoint returnpoint class clas public class identifier class clas this clas clas classidentifier can t call it get class public class get target class return clas getclass gettargetclass public string to string return class identifier clas get name tostring getname mirror list constructor public mirror list throws exception mirrors new array list mirror none new mirror none id mirror none none description none location none country none continent mirrors add none string path j edit get property plugin manager mirror url mirror list handler handler new mirror list handler this path xml parser parser new xml parser parser set handler handler reader in new buffered reader new input stream reader new url path open stream try parser parse null null in finally in close mirrorlist mirrorlist arraylist jedit getproperty mirrorlisthandler mirrorlisthandler xmlparser xmlparser sethandler bufferedreader inputstreamreader openstream add method void add mirror mirror mirrors add mirror finished method void finished collections sort mirrors new mirror compare mirrorcompare public int compare object o1 object o2 mirror m1 mirror o1 mirror m2 mirror o2 int result if result m1 continent compare to ignore case m2 continent 0 if result m1 country compare to ignore case m2 country 0 if result m1 location compare to ignore case m2 location 0 return m1 description compare to ignore case m2 description return result comparetoignorecase comparetoignorecase comparetoignorecase comparetoignorecase public boolean equals object obj return obj instanceof mirror compare mirrorcompare public void set maximum int max setmaximum public void advance int value public void done system out println installation complete public void error string message system err println an error occurred message abstract option pane constructor creates a new option pane param name the internal name the option pane s label is set to the value of the property named code options i name i label code public abstract option pane string name this name name set layout grid bag new grid bag layout abstractoptionpane abstractoptionpane setlayout gridbag gridbaglayout get name method returns the internal name of this option pane the option pane s label is set to the value of the property named code options i name i label code public string get name return name getname getname get component method returns the component that should be displayed for this option pane because this class extends component it simply returns this public component get component return this getcomponent getcomponent init method do not override this method override link init instead final in 4 2 public void init if initialized initialized true init _init _init save method do not override this method override link save instead final in 4 2 public void save if initialized save _save _save add component method adds a labeled component to the option pane components are added in a vertical fashion one per row the label is displayed to the left of the component param label the label param comp the component public void add component string label component comp j label l new j label label l set border new empty border 0 0 0 12 add component l comp grid bag constraints both addcomponent addcomponent jlabel jlabel setborder emptyborder addcomponent gridbagconstraints add component method adds a labeled component to the option pane components are added in a vertical fashion one per row the label is displayed to the left of the component param label the label param comp the component param fill fill parameter to grid bag constraints for the right component public void add component string label component comp int fill j label l new j label label l set border new empty border 0 0 0 12 add component l comp fill addcomponent gridbagconstraints addcomponent jlabel jlabel setborder emptyborder addcomponent add component method adds a labeled component to the option pane components are added in a vertical fashion one per row the label is displayed to the left of the component param comp1 the label param comp2 the component since j edit 4 1pre3 public void add component component comp1 component comp2 add component comp1 comp2 grid bag constraints both addcomponent jedit addcomponent addcomponent gridbagconstraints add component method adds a labeled component to the option pane components are added in a vertical fashion one per row the label is displayed to the left of the component param comp1 the label param comp2 the component param fill fill parameter to grid bag constraints for the right component since j edit 4 1pre3 public void add component component comp1 component comp2 int fill grid bag constraints cons new grid bag constraints cons gridy y cons gridheight 1 cons gridwidth 1 cons weightx 0 0f cons insets new insets 1 0 1 0 cons fill grid bag constraints both grid bag set constraints comp1 cons add comp1 cons fill fill cons gridx 1 cons weightx 1 0f grid bag set constraints comp2 cons add comp2 addcomponent gridbagconstraints jedit addcomponent gridbagconstraints gridbagconstraints gridbagconstraints gridbag setconstraints gridbag setconstraints add component method adds a component to the option pane components are added in a vertical fashion one per row param comp the component public void add component component comp grid bag constraints cons new grid bag constraints cons gridy y cons gridheight 1 cons gridwidth cons remainder cons fill grid bag constraints none cons anchor grid bag constraints west cons weightx 1 0f cons insets new insets 1 0 1 0 grid bag set constraints comp cons add comp addcomponent addcomponent gridbagconstraints gridbagconstraints gridbagconstraints gridbagconstraints gridbag setconstraints add component method adds a component to the option pane components are added in a vertical fashion one per row param comp the component param fill fill parameter to grid bag constraints since j edit 4 2pre2 public void add component component comp int fill grid bag constraints cons new grid bag constraints cons gridy y cons gridheight 1 cons gridwidth cons remainder cons fill fill cons anchor grid bag constraints west cons weightx 1 0f cons insets new insets 1 0 1 0 grid bag set constraints comp cons add comp addcomponent gridbagconstraints jedit addcomponent gridbagconstraints gridbagconstraints gridbagconstraints gridbag setconstraints add separator method adds a separator component since j edit 4 1pre7 public void add separator add component box create vertical strut 6 j separator sep new j separator j separator horizontal grid bag constraints cons new grid bag constraints cons gridy y cons gridheight 1 cons gridwidth cons remainder cons fill grid bag constraints both cons anchor grid bag constraints west cons weightx 1 0f cons insets new insets 1 0 1 0 grid bag set constraints sep cons add sep add component box create vertical strut 6 addseparator jedit addseparator addcomponent createverticalstrut jseparator jseparator jseparator gridbagconstraints gridbagconstraints gridbagconstraints gridbagconstraints gridbag setconstraints addcomponent createverticalstrut add separator method adds a separator component param label the separator label property since j edit 2 6pre2 public void add separator string label if y 0 add component box create vertical strut 6 box box new box box layout x axis box box2 new box box layout y axis box2 add box create glue box2 add new j separator j separator horizontal box2 add box create glue box add box2 j label l new j label j edit get property label l set maximum size l get preferred size box add l box box3 new box box layout y axis box3 add box create glue box3 add new j separator j separator horizontal box3 add box create glue box add box3 grid bag constraints cons new grid bag constraints cons gridy y cons gridheight 1 cons gridwidth cons remainder cons fill grid bag constraints both cons anchor grid bag constraints west cons weightx 1 0f cons insets new insets 1 0 1 0 grid bag set constraints box cons add box addseparator jedit addseparator addcomponent createverticalstrut boxlayout x_axis boxlayout y_axis createglue jseparator jseparator createglue jlabel jlabel jedit getproperty setmaximumsize getpreferredsize boxlayout y_axis createglue jseparator jseparator createglue gridbagconstraints gridbagconstraints gridbagconstraints gridbagconstraints gridbag setconstraints this method should create and arrange the components of the option pane and initialize the option data displayed to the user this method is called when the option pane is first displayed and is not called again for the lifetime of the object called when the options dialog s ok button is clicked this should save any properties being edited in this option pane about dialog constructor public about dialog view view super view j edit get property about title true j panel content new j panel new border layout content set border new empty border 12 12 12 12 set content pane content content add border layout center new about panel j panel button panel new j panel button panel set layout new box layout button panel box layout x axis button panel set border new empty border 12 0 0 0 button panel add box create glue close new j button j edit get property common close close add action listener new action handler get root pane set default button close button panel add close button panel add box create glue content add border layout south button panel pack set resizable false set location relative to view set visible true aboutdialog aboutdialog jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane borderlayout aboutpanel jpanel buttonpanel jpanel buttonpanel setlayout boxlayout buttonpanel boxlayout x_axis buttonpanel setborder emptyborder buttonpanel createglue jbutton jedit getproperty addactionlistener actionhandler getrootpane setdefaultbutton buttonpanel buttonpanel createglue borderlayout buttonpanel setresizable setlocationrelativeto setvisible ok method public void ok dispose cancel method public void cancel dispose class action handler implements action listener public void action performed action event evt dispose actionhandler actionlistener actionperformed actionevent about panel set font ui manager get font label font fm get font metrics get font set foreground new color 96 96 96 image new image icon get class get resource org gjt sp jedit icons about png set border new matte border 1 1 1 1 color gray text new vector 50 string tokenizer st new string tokenizer j edit get property about text n while st has more tokens string line st next token text add element line max width math max max width fm string width line 10 scroll position 250 thread new animation thread aboutpanel setfont uimanager getfont getfontmetrics getfont setforeground imageicon getclass getresource setborder matteborder stringtokenizer stringtokenizer jedit getproperty hasmoretokens nexttoken addelement maxwidth maxwidth stringwidth scrollposition animationthread public void paint component graphics g g set color new color 96 96 96 image paint icon this g 1 1 font metrics fm g get font metrics string args j edit get version string version j edit get property about version args g draw string version get width fm string width version 2 get height 5 g g create get width max width 2 top max width get height top bottom int height fm get height int first line scroll position height int first line offset height scroll position height int lines get height top bottom height int y first line offset for int i 0 i lines i if i first line 0 i first line text size string line string text get i first line g draw string line max width fm string width line 2 y y fm get height paintcomponent setcolor painticon fontmetrics getfontmetrics jedit getversion jedit getproperty drawstring getwidth stringwidth getheight getwidth maxwidth maxwidth getheight getheight firstline scrollposition firstlineoffset scrollposition getheight firstlineoffset firstline firstline firstline drawstring maxwidth stringwidth getheight public dimension get preferred size return new dimension 1 image get icon width 1 image get icon height getpreferredsize geticonwidth geticonheight public void add notify super add notify thread start addnotify addnotify public void remove notify super remove notify thread kill removenotify removenotify animation thread super about box animation thread set priority thread min priority animationthread setpriority min_priority public void kill running false public void run font metrics fm get font metrics get font int max text size fm get height while running scroll position 2 if scroll position max scroll position 250 if last 0 long frame delay system current time millis last try thread sleep 75 frame delay catch exception e last system current time millis repaint get width 2 max width top max width 2 get height top bottom fontmetrics getfontmetrics getfont getheight scrollposition scrollposition scrollposition framedelay currenttimemillis framedelay currenttimemillis getwidth maxwidth maxwidth getheight public class util eval error extends exception protected util eval error utilevalerror utilevalerror public util eval error string s super s utilevalerror re throw as an eval error prefixing msg to the message and specifying the node if a node already exists the add node is ignored see set node bsh simple node p param msg may be null for no additional message public eval error to eval error string msg simple node node call stack callstack if interpreter debug print stack trace if msg null msg else msg msg return new eval error msg get message node callstack addnode setnode simplenode evalerror toevalerror simplenode callstack printstacktrace evalerror getmessage public eval error to eval error simple node node call stack callstack return to eval error null node callstack evalerror toevalerror simplenode callstack toevalerror file cell renderer constructor public file cell renderer plain font ui manager get font tree font if plain font null plain font j edit get font property metal secondary font bold font plain font derive font font bold filecellrenderer filecellrenderer plainfont uimanager getfont plainfont plainfont jedit getfontproperty boldfont plainfont derivefont get table cell renderer component method public component get table cell renderer component j table table object value boolean is selected boolean has focus int row int column super get table cell renderer component table value is selected has focus row column if value instanceof vfs directory entry table model entry vfs directory entry table model entry entry vfs directory entry table model entry value vfs directory entry file entry dir entry set font file type vfs directory entry file plain font bold font this is selected is selected this file file if column 0 while its broken to have a null symlink path some older plugins might string path if file symlink path null path file path else path file symlink path open buffer j edit getbuffer path null set icon show icons get icon for file file entry expanded open buffer null set text file name int state if file type vfs directory entry file state expansion toggle border state none else if entry expanded state expansion toggle border state expanded else state expansion toggle border state collapsed set border new expansion toggle border state entry level else vfs directory entry table model model vfs directory entry table model table get model string ext attr model get extended attribute column 1 open buffer false set icon null set text file get extended attribute ext attr set border new empty border 1 1 1 1 return this gettablecellrenderercomponent gettablecellrenderercomponent jtable isselected hasfocus gettablecellrenderercomponent isselected hasfocus vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel directoryentry direntry setfont directoryentry plainfont boldfont isselected isselected symlinkpath symlinkpath symlinkpath openbuffer jedit _getbuffer seticon showicons geticonforfile openbuffer settext directoryentry expansiontoggleborder state_none expansiontoggleborder state_expanded expansiontoggleborder state_collapsed setborder expansiontoggleborder vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel getmodel extattr getextendedattribute openbuffer seticon settext getextendedattribute extattr setborder emptyborder paint component method public void paint component graphics g if is selected color color file get color set foreground color null ui manager get color tree foreground color super paint component g if open buffer font font get font font metrics fm get font metrics font int x y if get icon null x 0 y fm get ascent 2 else x get icon get icon width get icon text gap y math max fm get ascent 2 16 insets border get border get border insets this x border left g set color get foreground g draw line x y x fm string width get text y paintcomponent paintcomponent isselected getcolor setforeground uimanager getcolor paintcomponent openbuffer getfont fontmetrics getfontmetrics geticon getascent geticon geticonwidth geticontextgap getascent getborder getborderinsets setcolor getforeground drawline stringwidth gettext get icon for file method since j edit 4 2pre7 public static icon get icon for file vfs directory entry file boolean expanded return get icon for file file expanded j edit getbuffer file symlink path null geticonforfile jedit geticonforfile directoryentry geticonforfile jedit _getbuffer symlinkpath get icon for file method public static icon get icon for file vfs directory entry file boolean expanded boolean open buffer if file type vfs directory entry directory return expanded open dir icon dir icon else if file type vfs directory entry filesystem return filesystem icon else if open buffer return open file icon else return file icon geticonforfile geticonforfile directoryentry openbuffer directoryentry opendiricon diricon directoryentry filesystemicon openbuffer openfileicon fileicon properties changed method void properties changed show icons j edit get boolean property vfs browser show icons propertieschanged propertieschanged showicons jedit getbooleanproperty showicons get entry width method int get entry width vfs directory entry table model entry entry font font font render context font render context string name entry dir entry name int width int font get string bounds name font render context get width width expansion toggle border icon width entry level expansion toggle border level width 3 if show icons width file icon get icon width width get icon text gap return width getentrywidth getentrywidth vfsdirectoryentrytablemodel fontrendercontext fontrendercontext direntry getstringbounds fontrendercontext getwidth expansiontoggleborder icon_width expansiontoggleborder level_width showicons fileicon geticonwidth geticontextgap expansion toggle border constructor public expansion toggle border int state int level this state state this level level expansiontoggleborder expansiontoggleborder paint border method public void paint border component c graphics g int x int y int width int height switch state case state collapsed collapsed icon paint icon c g x level level width 2 y height collapsed icon get icon height 2 break case state expanded expanded icon paint icon c g x level level width 2 y 2 height expanded icon get icon height 2 break paintborder paintborder state_collapsed collapsed_icon painticon level_width collapsed_icon geticonheight state_expanded expanded_icon painticon level_width expanded_icon geticonheight get border insets method public insets get border insets component c return new insets 1 level level width icon width 4 1 1 getborderinsets getborderinsets level_width icon_width is border opaque method public boolean is border opaque return false isborderopaque isborderopaque is expansion toggle method public static boolean is expansion toggle int level int x return x level level width x level level width icon width isexpansiontoggle isexpansiontoggle level_width level_width icon_width string to token method converts a token type string to a token type constant param value the token type since j edit 4 1pre1 public static byte string to token string value try field f token class get field value return byte f get byte null catch exception e return 1 stringtotoken jedit stringtotoken getfield getbyte token to string method converts a token type constant to a token type string since j edit 4 2pre1 public static string token to string byte token return token types token tokentostring jedit tokentostring token_types token constructor creates a new token param id the id of the token param offset the start offset of the token param length the length of the token param rules the parser rule set that generated this token public token byte id int offset int length parser rule set rules this id id this offset offset this length length this rules rules parserruleset to string method returns a string representation of this token public string to string return id id offset offset length length tostring tostring public console install installer new install string app name installer get property app name string app version installer get property app version buffered reader in new buffered reader new input stream reader system in system out println app name app version installer operating system os operating system get operating system string install dir os get install directory app name app version system out print installation directory install dir system out flush string installdir read line in if installdir length 0 install dir installdir operating system os task os tasks os getos tasks installer for int i 0 i os tasks length i operating system os task os task os tasks i string label os task get label label null means no configurable options if label null string dir os task get directory system out print label dir system out flush dir read line in os task set enabled true if dir length 0 if dir equals off os task set enabled false else os task set directory dir int comp count installer get integer property comp count vector components new vector comp count system out println program components to install for int i 0 i comp count i string fileset installer get property comp i fileset string os dep installer get property comp i os if os dep null if os get class get name ends with os dep continue system out print install installer get property comp i name installer get property comp i disk size kb y n string line read line in if line length 0 line char at 0 y line char at 0 y components add element fileset system out println starting installation console progress progress new console progress install thread thread new install thread installer progress install dir os tasks 0 xxx components thread start consoleinstall appname getproperty appversion getproperty bufferedreader bufferedreader inputstreamreader appname appversion operatingsystem operatingsystem getoperatingsystem installdir getinstalldirectory appname appversion installdir _installdir readline _installdir installdir _installdir operatingsystem ostask ostasks getostasks ostasks operatingsystem ostask ostask ostasks ostask getlabel ostask getdirectory readline ostask setenabled ostask setenabled ostask setdirectory compcount getintegerproperty compcount compcount getproperty osdep getproperty osdep getclass getname endswith osdep getproperty getproperty readline charat charat addelement consoleprogress consoleprogress installthread installthread installdir ostasks private string read line buffered reader in try string line in read line if line null system err println neof in input system exit 1 can t happen throw new internal error return line catch io exception io system err println ni o error io system exit 1 can t happen throw new internal error readline bufferedreader readline internalerror ioexception internalerror public object clone try re match copy re match super clone copy next null copy start int start clone copy end int end clone return copy catch clone not supported exception e throw new error doesn t happen rematch rematch clonenotsupportedexception void assign from re match other start other start end other end index other index need to deep clone next other next assignfrom rematch re match int subs int anchor int eflags start new int subs 1 end new int subs 1 this anchor anchor this eflags eflags clear anchor rematch void finish char indexed text start 0 0 string buffer sb new string buffer int i for i 0 i end 0 i sb append text char at i matched text sb to string for i 0 i start length i if any subexpressions didn t terminate they don t count todo check if this code ever gets hit if start i 1 end i 1 start i 1 end i 1 next null cut off alternates charindexed stringbuffer stringbuffer charat matchedtext tostring clears the current match and moves the offset to the new index void clear int index offset index this index 0 for int i 0 i start length i start i end i 1 next null cut off alternates returns the string matching the pattern this makes it convenient to write code like the following p code re match my match my expression get match my string br if my match null system out println regexp found my match code public string to string return matched text rematch mymatch myexpression getmatch mystring mymatch mymatch tostring matchedtext returns the index within the input text where the match in its entirety began public int get start index return offset start 0 getstartindex returns the index within the input string where the match in its entirety ends the return value is the next position after the end of the string therefore a match created by the following call p code re match my match my expression get match my string code p can be viewed given that my match is not null by creating p code string the match my string substring my match get start index my match get end index code p but you can save yourself that work since the code to string code method above does exactly that for you public int get end index return offset end 0 rematch mymatch myexpression getmatch mystring mymatch thematch mystring mymatch getstartindex mymatch getendindex tostring getendindex returns the string matching the given subexpression the subexpressions are indexed starting with one not zero that is the subexpression identified by the first set of parentheses in a regular expression could be retrieved from an re match by calling match to string 1 param sub index of the subexpression public string to string int sub if sub start length start sub 1 return return matched text substring start sub end sub rematch tostring tostring matchedtext returns the index within the input string used to generate this match where subexpression number i sub i begins or code 1 code if the subexpression does not exist the initial position is zero param sub subexpression index deprecated use get start index int instead public int get sub start index int sub if sub start length return 1 int x start sub return x 1 x offset x getstartindex getsubstartindex returns the index within the input string used to generate this match where subexpression number i sub i begins or code 1 code if the subexpression does not exist the initial position is zero param sub subexpression index since gnu regexp 1 1 0 public int get start index int sub if sub start length return 1 int x start sub return x 1 x offset x getstartindex returns the index within the input string used to generate this match where subexpression number i sub i ends or code 1 code if the subexpression does not exist the initial position is zero param sub subexpression index deprecated use get end index int instead public int get sub end index int sub if sub start length return 1 int x end sub return x 1 x offset x getendindex getsubendindex returns the index within the input string used to generate this match where subexpression number i sub i ends or code 1 code if the subexpression does not exist the initial position is zero param sub subexpression index public int get end index int sub if sub start length return 1 int x end sub return x 1 x offset x getendindex substitute the results of this match to create a new string this is patterned after perl so the tokens to watch out for are code 0 code through code 9 code code 0 code matches the full substring matched code i n i code matches subexpression number i n i param input a string consisting of literals and code i n i code tokens public string substitute into string input a la perl 0 is whole thing 1 9 are subexpressions string buffer output new string buffer int pos for pos 0 pos input length 1 pos if input char at pos character is digit input char at pos 1 int val character digit input char at pos 10 if val start length output append to string val else output append input char at pos if pos input length output append input char at pos return output to string substituteinto stringbuffer stringbuffer charat isdigit charat charat tostring charat charat tostring handle token method called by the token marker when a syntax token has been parsed param seg the segment containing the text param id the token type one of the constants in the link token class param offset the start offset of the token param length the number of characters in the token param context the line context since j edit 4 2pre3 public void handle token segment seg byte id int offset int length handletoken jedit handletoken set line context method the token handler can compare this object with the object previously given for this line to see if the token type at the end of the line has changed meaning subsequent lines might need to be retokenized since j edit 4 2pre6 public void set line context token marker line context line context setlinecontext jedit setlinecontext tokenmarker linecontext linecontext class bsh primary expression extends simple node bsh primary expression int id super id bshprimaryexpression simplenode bshprimaryexpression evaluate to a value object public object eval call stack callstack interpreter interpreter throws eval error return eval false callstack interpreter callstack evalerror evaluate to a value object public lhs tolhs call stack callstack interpreter interpreter throws eval error object obj eval true callstack interpreter if obj instanceof lhs throw new eval error can t assign to this callstack else return lhs obj callstack evalerror evalerror private object eval boolean tolhs call stack callstack interpreter interpreter throws eval error object obj jjt get child 0 int num children jjt get num children for int i 1 i num children i obj bsh primary suffix jjt get child i do suffix obj tolhs callstack interpreter if the result is a node eval it to an object or lhs as determined by tolhs if obj instanceof simple node if obj instanceof bsh ambiguous name if tolhs obj bsh ambiguous name obj tolhs callstack interpreter else obj bsh ambiguous name obj to object callstack interpreter else some arbitrary kind of node if tolhs is this right throw new eval error can t assign to prefix this callstack else obj simple node obj eval callstack interpreter return lhs or value object as determined by tolhs if obj instanceof lhs if tolhs return obj else try return lhs obj get value catch util eval error e throw e to eval error this callstack else return obj callstack evalerror jjtgetchild numchildren jjtgetnumchildren numchildren bshprimarysuffix jjtgetchild dosuffix simplenode bshambiguousname bshambiguousname bshambiguousname toobject evalerror simplenode getvalue utilevalerror toevalerror plugin options constructor public plugin options frame frame super frame plugin options j edit get property plugin options last pluginoptions pluginoptions jedit getproperty plugin options constructor public plugin options frame frame string pane super frame plugin options pane pluginoptions pluginoptions plugin options constructor public plugin options dialog dialog super dialog plugin options j edit get property plugin options last pluginoptions pluginoptions jedit getproperty plugin options constructor public plugin options dialog dialog string pane super dialog plugin options pane pluginoptions pluginoptions create option tree model method protected option tree model create option tree model option tree model pane tree model new option tree model option group root group option group pane tree model get root initialize the plugins branch of the options tree plugins group new option group plugins plugins group set sort true query plugins for option panes edit plugin plugins j edit get plugins for int i 0 i plugins length i edit plugin ep plugins i if ep instanceof edit plugin broken continue string class name ep get class name if j edit get property plugin class name activate null old api try ep create option panes this catch throwable t log log log error ep error creating option pane log log log error ep t else string option pane j edit get property plugin class name option pane if option pane null plugins group add option pane option pane else string options j edit get property plugin class name option group if options null plugins group add option group new option group plugin class name j edit get property plugin class name name options only add the plugins branch if there are option panes if plugins group get member count 0 plugins group add option pane new no plugins pane root group add option group plugins group return pane tree model createoptiontreemodel optiontreemodel createoptiontreemodel optiontreemodel panetreemodel optiontreemodel optiongroup rootgroup optiongroup panetreemodel getroot pluginsgroup optiongroup pluginsgroup setsort editplugin jedit getplugins editplugin editplugin classname getclassname jedit getproperty classname createoptionpanes optionpane jedit getproperty classname optionpane pluginsgroup addoptionpane optionpane jedit getproperty classname pluginsgroup addoptiongroup optiongroup classname jedit getproperty classname optionpanes pluginsgroup getmembercount pluginsgroup addoptionpane nopluginspane rootgroup addoptiongroup pluginsgroup panetreemodel get default group method protected option group get default group return plugins group getdefaultgroup optiongroup getdefaultgroup pluginsgroup static class no plugins pane extends abstract option pane public no plugins pane super no plugins nopluginspane abstractoptionpane nopluginspane public static final int reg no interpolate 128 returns a string representing the version of the gnu regexp package public static final string version return version reg_no_interpolate retrieves a message from the resource bundle static final string get localized message string key return messages get string key resourcebundle getlocalizedmessage getstring constructs a regular expression pattern buffer without any compilation flags set and using the default syntax re syntax re syntax perl5 param pattern a regular expression pattern in the form of a string string buffer or char other input types will be converted to strings using the to string method exception re exception the input pattern could not be parsed exception null pointer exception the pattern was null public re object pattern throws re exception this pattern 0 re syntax re syntax perl5 0 0 resyntax re_syntax_perl5 stringbuffer tostring reexception nullpointerexception reexception resyntax re_syntax_perl5 constructs a regular expression pattern buffer using the specified compilation flags and the default syntax re syntax re syntax perl5 param pattern a regular expression pattern in the form of a string string buffer or char other input types will be converted to strings using the to string method param cflags the logical or of any combination of the compilation flags listed above exception re exception the input pattern could not be parsed exception null pointer exception the pattern was null public re object pattern int cflags throws re exception this pattern cflags re syntax re syntax perl5 0 0 resyntax re_syntax_perl5 stringbuffer tostring reexception nullpointerexception reexception resyntax re_syntax_perl5 constructs a regular expression pattern buffer using the specified compilation flags and regular expression syntax param pattern a regular expression pattern in the form of a string string buffer or char other input types will be converted to strings using the to string method param cflags the logical or of any combination of the compilation flags listed above param syntax the type of regular expression syntax to use exception re exception the input pattern could not be parsed exception null pointer exception the pattern was null public re object pattern int cflags re syntax syntax throws re exception this pattern cflags syntax 0 0 stringbuffer tostring reexception nullpointerexception resyntax reexception internal constructor used for alternation private re re token first re token last int subs int sub index int min length super sub index first token first last token last num subs subs minimum length min length add token new re token end sub sub index retoken retoken subindex minlength subindex firsttoken lasttoken numsubs minimumlength minlength addtoken retokenendsub subindex private re object pattern obj int cflags re syntax syntax int my index int next sub throws re exception super my index subexpression index of this token initialize pattern obj cflags syntax my index next sub patternobj resyntax myindex nextsub reexception myindex patternobj myindex nextsub for use by subclasses protected re super 0 the meat of construction protected void initialize object pattern obj int cflags re syntax syntax int my index int next sub throws re exception char pattern if pattern obj instanceof string pattern string pattern obj to char array else if pattern obj instanceof char pattern char pattern obj else if pattern obj instanceof string buffer pattern new char string buffer pattern obj length string buffer pattern obj get chars 0 pattern length pattern 0 else pattern pattern obj to string to char array int p length pattern length num subs 0 number of subexpressions in this token vector branches null linked list of tokens sort of some closed loops can exist first token last token null precalculate these so we don t pay for the math every time we need to access them boolean insens cflags reg icase 0 parse pattern into tokens does anyone know if it s more efficient to use char than a string char at i m assuming so index tracks the position in the char array int index 0 this will be the current parse character pattern index char unit unit new char unit this is used for x y calculations int pair min max new int pair buffer a token so we can create a token repeated etc re token current token null char ch while index p length read the next character unit including backslash escapes index get char unit pattern index unit alternation operator or if re no bk vbar or newline if re newline alt not available if re limited ops is set todo the n literal here should be a test against re token newline which unfortunately may be more than a single character if unit ch syntax get re syntax re no bk vbar unit bk syntax get re syntax re newline alt unit ch n unit bk syntax get re syntax re limited ops make everything up to here be a branch create vector if nec add token current token re the branch new re first token last token num subs sub index minimum length minimum length 0 if branches null branches new vector branches add element the branch first token last token current token null interval operator x x x y re intervals re no bk braces x x x y re intervals re no bk braces open question what is proper interpretation of at start of string else if unit ch syntax get re syntax re intervals syntax get re syntax re no bk braces unit bk int new index get min max pattern index min max syntax if new index index if min max first min max second throw new re exception get localized message interval order re exception reg badrpt new index if current token null throw new re exception get localized message repeat no token re exception reg badrpt new index if current token instanceof re token repeated throw new re exception get localized message repeat chained re exception reg badrpt new index if current token instanceof re token word boundary current token instanceof re token word boundary throw new re exception get localized message repeat assertion re exception reg badrpt new index if current token get minimum length 0 min max second integer max value throw new re exception get localized message repeat empty token re exception reg badrpt new index index new index current token set repeated current token min max first min max second index else add token current token current token new re token char sub index unit ch insens list operator else if unit ch unit bk vector options new vector boolean negative false char last char 0 if index p length throw new re exception get localized message unmatched bracket re exception reg ebrack index check for initial caret negation if ch pattern index negative true if index p length throw new re exception get localized message class no end re exception reg ebrack index ch pattern index check for leading right bracket literal if ch last char ch if index p length throw new re exception get localized message class no end re exception reg ebrack index while ch pattern index if ch last char 0 if index p length throw new re exception get localized message class no end re exception reg ebrack index if ch pattern index options add element new re token char sub index last char insens last char else options add element new re token range sub index last char ch insens last char 0 index else if ch syntax get re syntax re backslash escape in lists if index p length throw new re exception get localized message class no end re exception reg ebrack index int posixid 1 boolean negate false char ascii esc 0 if dswdsw index of pattern index 1 syntax get re syntax re char class esc in lists switch pattern index case d negate true case d posixid re tokenposix digit break case s negate true case s posixid re tokenposix space break case w negate true case w posixid re tokenposix alnum break else if nrt index of pattern index 1 switch pattern index case n ascii esc n break case t ascii esc t break case r ascii esc r break if last char 0 options add element new re token char sub index last char insens if posixid 1 options add element new re tokenposix sub index posixid insens negate else if ascii esc 0 last char ascii esc else last char pattern index index else if ch syntax get re syntax re char classes index p length pattern index string buffer posix set new string buffer index get posix set pattern index 1 posix set int posix id re tokenposix int value posix set to string if posix id 1 options add element new re tokenposix sub index posix id insens false else if last char 0 options add element new re token char sub index last char insens last char ch if index p length throw new re exception get localized message class no end re exception reg ebrack index while in list out of list index is one past if last char 0 options add element new re token char sub index last char insens create a new re token one of add token current token options trim to size current token new re token one of sub index options negative subexpressions depending on re no bk parens else if unit ch syntax get re syntax re no bk parens unit bk boolean pure false boolean comment false boolean look ahead false boolean negativelh false if index 1 p length pattern index switch pattern index 1 case if syntax get re syntax re lookahead pure true negativelh true look ahead true index 2 break case if syntax get re syntax re lookahead pure true look ahead true index 2 break case if syntax get re syntax re pure grouping pure true index 2 break case if syntax get re syntax re comments comment true break default throw new re exception get localized message repeat no token re exception reg badrpt index if index p length throw new re exception get localized message unmatched paren re exception reg esubreg index find end of subexpression int end index index int next index index int nested 0 while next index get char unit pattern end index unit 0 nested 0 unit ch syntax get re syntax re no bk parens unit bk if end index next index p length throw new re exception get localized message subexpr no end re exception reg esubreg next index else if unit ch syntax get re syntax re no bk parens unit bk nested else if unit ch syntax get re syntax re no bk parens unit bk nested end index is now position at a next index is end of string or position after or if comment index next index else not a comment create re subexpression as token add token current token if pure num subs int use index pure look ahead 0 next sub num subs current token new re string value of pattern index end index index to char array cflags syntax use index next sub num subs num subs re curr patternobj resyntax myindex nextsub reexception patternobj patternobj tochararray patternobj patternobj patternobj stringbuffer stringbuffer patternobj stringbuffer patternobj getchars patternobj tostring tochararray plength numsubs firsttoken lasttoken reg_icase charat charunit charunit intpair minmax intpair tokenrepeated retoken currenttoken plength getcharunit re_no_bk_vbar re_newline_alt re_limited_ops retoken resyntax re_no_bk_vbar resyntax re_newline_alt resyntax re_limited_ops addtoken currenttoken thebranch firsttoken lasttoken numsubs subindex minimumlength minimumlength addelement thebranch firsttoken lasttoken currenttoken re_intervals re_no_bk_braces re_intervals re_no_bk_braces resyntax re_intervals resyntax re_no_bk_braces newindex getminmax minmax newindex minmax minmax reexception getlocalizedmessage reexception reg_badrpt newindex currenttoken reexception getlocalizedmessage reexception reg_badrpt newindex currenttoken retokenrepeated reexception getlocalizedmessage reexception reg_badrpt newindex currenttoken retokenwordboundary currenttoken retokenwordboundary reexception getlocalizedmessage reexception reg_badrpt newindex currenttoken getminimumlength minmax max_value reexception getlocalizedmessage reexception reg_badrpt newindex newindex currenttoken setrepeated currenttoken minmax minmax addtoken currenttoken currenttoken retokenchar subindex lastchar plength reexception getlocalizedmessage reexception reg_ebrack plength reexception getlocalizedmessage reexception reg_ebrack lastchar plength reexception getlocalizedmessage reexception reg_ebrack lastchar plength reexception getlocalizedmessage reexception reg_ebrack addelement retokenchar subindex lastchar lastchar addelement retokenrange subindex lastchar lastchar resyntax re_backslash_escape_in_lists plength reexception getlocalizedmessage reexception reg_ebrack asciiesc indexof resyntax re_char_class_esc_in_lists retokenposix retokenposix retokenposix indexof asciiesc asciiesc asciiesc lastchar addelement retokenchar subindex lastchar addelement retokenposix subindex asciiesc lastchar asciiesc lastchar resyntax re_char_classes plength stringbuffer posixset stringbuffer getposixset posixset posixid retokenposix intvalue posixset tostring posixid addelement retokenposix subindex posixid lastchar addelement retokenchar subindex lastchar lastchar plength reexception getlocalizedmessage reexception reg_ebrack lastchar addelement retokenchar subindex lastchar retokenoneof addtoken currenttoken trimtosize currenttoken retokenoneof subindex re_no_bk_parens resyntax re_no_bk_parens lookahead plength resyntax re_lookahead lookahead resyntax re_lookahead lookahead resyntax re_pure_grouping resyntax re_comments reexception getlocalizedmessage reexception reg_badrpt plength reexception getlocalizedmessage reexception reg_esubreg endindex nextindex nextindex getcharunit endindex resyntax re_no_bk_parens endindex nextindex plength reexception getlocalizedmessage reexception reg_esubreg nextindex resyntax re_no_bk_parens resyntax re_no_bk_parens endindex nextindex nextindex addtoken currenttoken numsubs useindex lookahead nextsub numsubs currenttoken valueof endindex tochararray useindex nextsub numsubs numsubs private static int get char unit char input int index char unit unit throws re exception unit ch input index if unit bk unit ch if index input length unit ch input index else throw new re exception get localized message ends with backslash re exception reg escape index return index getcharunit charunit reexception reexception getlocalizedmessage reexception reg_escape checks if the regular expression matches the input in its entirety param input the input text public boolean is match object input return is match input 0 0 ismatch ismatch checks if the input string starting from index is an exact match of this regular expression param input the input text param index the offset index at which the search should be begin public boolean is match object input int index return is match input index 0 ismatch ismatch checks if the input starting from index and using the specified execution flags is an exact match of this regular expression param input the input text param index the offset index at which the search should be begin param eflags the logical or of any execution flags above public boolean is match object input int index int eflags return is match impl make char indexed input index index eflags ismatch ismatchimpl makecharindexed private boolean is match impl char indexed input int index int eflags if first token null trivial case return input char at 0 char indexed out of bounds re match m new re match num subs index eflags if first token match input m while m null if input char at m index char indexed out of bounds return true m m next return false ismatchimpl charindexed firsttoken charat charindexed out_of_bounds rematch rematch numsubs firsttoken charat charindexed out_of_bounds returns the maximum number of subexpressions in this regular expression if the expression contains branches the value returned will be the maximum subexpressions in any of the branches public int get num subs return num subs getnumsubs numsubs overrides re token set uncle void set uncle re token uncle if last token null last token set uncle uncle else super set uncle uncle to deal with empty subexpressions retoken setuncle setuncle retoken lasttoken lasttoken setuncle setuncle boolean chain re token next super chain next set uncle next return true retoken setuncle returns the minimum number of characters that could possibly constitute a match of this regular expression public int get minimum length return minimum length getminimumlength minimumlength returns an array of all matches found in the input if the regular expression allows the empty string to match it will substitute matches at all positions except the end of the input param input the input text return a non null but possibly zero length array of matches public re match get all matches object input return get all matches input 0 0 rematch getallmatches getallmatches returns an array of all matches found in the input beginning at the specified index position if the regular expression allows the empty string to match it will substitute matches at all positions except the end of the input param input the input text param index the offset index at which the search should be begin return a non null but possibly zero length array of matches public re match get all matches object input int index return get all matches input index 0 rematch getallmatches getallmatches returns an array of all matches found in the input string beginning at the specified index position and using the specified execution flags if the regular expression allows the empty string to match it will substitute matches at all positions except the end of the input param input the input text param index the offset index at which the search should be begin param eflags the logical or of any execution flags above return a non null but possibly zero length array of matches public re match get all matches object input int index int eflags return get all matches impl make char indexed input index index eflags rematch getallmatches getallmatchesimpl makecharindexed this has been changed since 1 03 to be non overlapping matches private re match get all matches impl char indexed input int index int eflags vector all new vector re match m null while m get match impl input index eflags null null all add element m index m get end index if m end 0 0 handle pathological case of zero length match index input move 1 else input move m end 0 if input is valid break re match mset new re match all size all copy into mset return mset rematch getallmatchesimpl charindexed rematch getmatchimpl addelement getendindex isvalid rematch rematch copyinto implements abstract method re token match boolean match char indexed input re match mymatch if first token null return next input mymatch note the start of this subexpression mymatch start sub index mymatch index return first token match input mymatch retoken charindexed rematch firsttoken subindex firsttoken returns the first match found in the input if no match is found null is returned param input the input text return an re match instance referencing the match or null if none public re match get match object input return get match input 0 0 rematch rematch getmatch getmatch returns the first match found in the input beginning the search at the specified index if no match is found returns null param input the input text param index the offset within the text to begin looking for a match return an re match instance referencing the match or null if none public re match get match object input int index return get match input index 0 rematch rematch getmatch getmatch returns the first match found in the input beginning the search at the specified index and using the specified execution flags if no match is found returns null param input the input text param index the offset index at which the search should be begin param eflags the logical or of any execution flags above return an re match instance referencing the match or null if none public re match get match object input int index int eflags return get match input index eflags null rematch rematch getmatch getmatch returns the first match found in the input beginning the search at the specified index and using the specified execution flags if no match is found returns null if a string buffer is provided and is non null the contents of the input text from the index to the beginning of the match or to the end of the input if there is no match are appended to the string buffer param input the input text param index the offset index at which the search should be begin param eflags the logical or of any execution flags above param buffer the string buffer to save pre match text in return an re match instance referencing the match or null if none public re match get match object input int index int eflags string buffer buffer return get match impl make char indexed input index index eflags buffer stringbuffer stringbuffer stringbuffer rematch rematch getmatch stringbuffer getmatchimpl makecharindexed re match get match impl char indexed input int anchor int eflags string buffer buffer create a new re match to hold results re match mymatch new re match num subs anchor eflags do optimization check if anchor minimum length length if minimum length 0 input char at minimum length 1 char indexed out of bounds if match input mymatch find longest match of them all to observe leftmost longest re match longest mymatch while mymatch mymatch next null if mymatch index longest index longest mymatch longest end 0 longest index longest finish input return longest mymatch clear anchor append character to buffer if needed if buffer null input char at 0 char indexed out of bounds buffer append input char at 0 while input move 1 special handling at end of input for e g if minimum length 0 if match input mymatch mymatch finish input return mymatch return null rematch getmatchimpl charindexed stringbuffer rematch rematch rematch numsubs minimumlength minimumlength charat minimumlength charindexed out_of_bounds rematch charat charindexed out_of_bounds charat minimumlength returns an re match enumeration that can be used to iterate over the matches found in the input text param input the input text return a non null re match enumeration instance public re match enumeration get match enumeration object input return get match enumeration input 0 0 rematchenumeration rematchenumeration rematchenumeration getmatchenumeration getmatchenumeration returns an re match enumeration that can be used to iterate over the matches found in the input text param input the input text param index the offset index at which the search should be begin return a non null re match enumeration instance with its input cursor set to the index position specified public re match enumeration get match enumeration object input int index return get match enumeration input index 0 rematchenumeration rematchenumeration rematchenumeration getmatchenumeration getmatchenumeration returns an re match enumeration that can be used to iterate over the matches found in the input text param input the input text param index the offset index at which the search should be begin param eflags the logical or of any execution flags above return a non null re match enumeration instance with its input cursor set to the index position specified public re match enumeration get match enumeration object input int index int eflags return new re match enumeration this make char indexed input index index eflags rematchenumeration rematchenumeration rematchenumeration getmatchenumeration rematchenumeration makecharindexed substitutes the replacement text for the first match found in the input param input the input text param replace the replacement text which may contain x metacharacters see re match substitute into return a string interpolating the substituted text see re match substitute into public string substitute object input string replace return substitute input replace 0 0 rematch substituteinto rematch substituteinto substitutes the replacement text for the first match found in the input beginning at the specified index position specifying an index effectively causes the regular expression engine to throw away the specified number of characters param input the input text param replace the replacement text which may contain x metacharacters see re match substitute into param index the offset index at which the search should be begin return a string containing the substring of the input starting at the index position and interpolating the substituted text see re match substitute into public string substitute object input string replace int index return substitute input replace index 0 rematch substituteinto rematch substituteinto substitutes the replacement text for the first match found in the input string beginning at the specified index position and using the specified execution flags param input the input text param replace the replacement text which may contain x metacharacters see re match substitute into param index the offset index at which the search should be begin param eflags the logical or of any execution flags above return a string containing the substring of the input starting at the index position and interpolating the substituted text see re match substitute into public string substitute object input string replace int index int eflags return substitute impl make char indexed input index replace index eflags rematch substituteinto rematch substituteinto substituteimpl makecharindexed private string substitute impl char indexed input string replace int index int eflags string buffer buffer new string buffer re match m get match impl input index eflags buffer if m null return buffer to string buffer append eflags reg no interpolate 0 replace m substitute into replace if input move m end 0 do buffer append input char at 0 while input move 1 return buffer to string substituteimpl charindexed stringbuffer stringbuffer rematch getmatchimpl tostring reg_no_interpolate substituteinto charat tostring substitutes the replacement text for each non overlapping match found in the input text param input the input text param replace the replacement text which may contain x metacharacters see re match substitute into return a string interpolating the substituted text see re match substitute into public string substitute all object input string replace return substitute all input replace 0 0 rematch substituteinto rematch substituteinto substituteall substituteall substitutes the replacement text for each non overlapping match found in the input text starting at the specified index if the regular expression allows the empty string to match it will substitute matches at all positions except the end of the input param input the input text param replace the replacement text which may contain x metacharacters see re match substitute into param index the offset index at which the search should be begin return a string containing the substring of the input starting at the index position and interpolating the substituted text see re match substitute into public string substitute all object input string replace int index return substitute all input replace index 0 rematch substituteinto rematch substituteinto substituteall substituteall substitutes the replacement text for each non overlapping match found in the input text starting at the specified index and using the specified execution flags param input the input text param replace the replacement text which may contain x metacharacters see re match substitute into param index the offset index at which the search should be begin param eflags the logical or of any execution flags above return a string containing the substring of the input starting at the index position and interpolating the substituted text see re match substitute into public string substitute all object input string replace int index int eflags return substitute all impl make char indexed input index replace index eflags rematch substituteinto rematch substituteinto substituteall substituteallimpl makecharindexed private string substitute all impl char indexed input string replace int index int eflags string buffer buffer new string buffer re match m while m get match impl input index eflags buffer null buffer append eflags reg no interpolate 0 replace m substitute into replace index m get end index if m end 0 0 char ch input char at 0 if ch char indexed out of bounds buffer append ch input move 1 else input move m end 0 if input is valid break return buffer to string substituteallimpl charindexed stringbuffer stringbuffer rematch getmatchimpl reg_no_interpolate substituteinto getendindex charat charindexed out_of_bounds isvalid tostring helper function for constructor private void add token re token next if next null return minimum length next get minimum length if first token null last token first token next else if chain returns false it rejected the token due to an optimization and next was combined with last token if last token chain next last token next addtoken retoken minimumlength getminimumlength firsttoken lasttoken firsttoken lasttoken lasttoken lasttoken private static re token set repeated re token current int min int max int index throws re exception if current null throw new re exception get localized message repeat no token re exception reg badrpt index return new re token repeated current sub index current min max retoken setrepeated retoken reexception reexception getlocalizedmessage reexception reg_badrpt retokenrepeated subindex private static int get posix set char pattern int index string buffer buf precondition pattern index 1 we will return pos of closing int i for i index i pattern length 1 i if pattern i pattern i 1 return i 2 buf append pattern i return index didn t match up getposixset stringbuffer private int get min max char input int index int pair min max re syntax syntax throws re exception precondition input index 1 min max null boolean must match syntax get re syntax re no bk braces int start index index if index input length if must match throw new re exception get localized message unmatched brace re exception reg ebrace index else return start index int min max 0 char unit unit new char unit string buffer buf new string buffer read string of digits do index get char unit input index unit if character is digit unit ch buf append unit ch while index input length character is digit unit ch check for tomfoolery if buf length 0 if must match throw new re exception get localized message interval error re exception reg ebrace index else return start index min integer parse int buf to string if unit ch syntax get re syntax re no bk braces unit bk max min else if index input length if must match throw new re exception get localized message interval no end re exception reg ebrace index else return start index else if unit ch unit bk buf new string buffer read string of digits while index get char unit input index unit input length character is digit unit ch buf append unit ch if unit ch syntax get re syntax re no bk braces unit bk if must match throw new re exception get localized message interval error re exception reg ebrace index else return start index this is the case of x if buf length 0 max integer max value else max integer parse int buf to string else if must match throw new re exception get localized message interval error re exception reg ebrace index else return start index we know min and max now and they are valid min max first min min max second max return the index following the return index getminmax intpair minmax resyntax reexception minmax mustmatch resyntax re_no_bk_braces startindex mustmatch reexception getlocalizedmessage reexception reg_ebrace startindex charunit charunit stringbuffer stringbuffer getcharunit isdigit isdigit mustmatch reexception getlocalizedmessage reexception reg_ebrace startindex parseint tostring resyntax re_no_bk_braces mustmatch reexception getlocalizedmessage reexception reg_ebrace startindex stringbuffer getcharunit isdigit resyntax re_no_bk_braces mustmatch reexception getlocalizedmessage reexception reg_ebrace startindex max_value parseint tostring mustmatch reexception getlocalizedmessage reexception reg_ebrace startindex minmax minmax return a human readable form of the compiled regular expression useful for debugging public string to string string buffer sb new string buffer dump sb return sb to string tostring stringbuffer stringbuffer tostring void dump string buffer os os append if sub index 0 os append if first token null first token dump all os os append stringbuffer subindex firsttoken firsttoken dumpall cast input appropriately or throw exception private static char indexed make char indexed object input int index we could let a string fall through to final input but since it s the most likely input type we check it first if input instanceof string return new char indexed string string input index else if input instanceof char return new char indexed char array char input index else if input instanceof string buffer return new char indexed string buffer string buffer input index else if input instanceof input stream return new char indexed input stream input stream input index else if input instanceof reader return new char indexed reader reader input index else if input instanceof char indexed return char indexed input do we lose index info else return new char indexed string input to string index charindexed makecharindexed charindexedstring charindexedchararray stringbuffer charindexedstringbuffer stringbuffer inputstream charindexedinputstream inputstream charindexedreader charindexed charindexed charindexedstring tostring paste from list dialog constructor public paste from list dialog string name view view list model model super view j edit get property name title true this view view j panel content new j panel new border layout content set border new empty border 12 12 12 12 set content pane content j panel center new j panel new grid layout 2 1 2 12 clips new j list model clips set cell renderer new renderer clips set visible row count 12 clips add mouse listener new mouse handler clips add list selection listener new list handler insert new j button j edit get property common insert cancel new j button j edit get property common cancel j label label new j label j edit get property name caption label set border new empty border 0 0 6 0 content add border layout north label j scroll pane scroller new j scroll pane clips scroller set preferred size new dimension 500 150 center add scroller clip text new j text area clip text set editable false scroller new j scroll pane clip text scroller set preferred size new dimension 500 150 center add scroller content add center border layout center j panel panel new j panel panel set layout new box layout panel box layout x axis panel set border new empty border 12 0 0 0 panel add box create glue panel add insert panel add box create horizontal strut 6 panel add cancel panel add box create glue content add panel border layout south if model get size 1 clips set selected index 0 update buttons get root pane set default button insert insert add action listener new action handler cancel add action listener new action handler gui utilities request focus this clips pack set location relative to view set visible true pastefromlistdialog pastefromlistdialog listmodel jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane jpanel jpanel gridlayout jlist setcellrenderer setvisiblerowcount addmouselistener mousehandler addlistselectionlistener listhandler jbutton jedit getproperty jbutton jedit getproperty jlabel jlabel jedit getproperty setborder emptyborder borderlayout jscrollpane jscrollpane setpreferredsize cliptext jtextarea cliptext seteditable jscrollpane cliptext setpreferredsize borderlayout jpanel jpanel setlayout boxlayout boxlayout x_axis setborder emptyborder createglue createhorizontalstrut createglue borderlayout getsize setselectedindex updatebuttons getrootpane setdefaultbutton addactionlistener actionhandler addactionlistener actionhandler guiutilities requestfocus setlocationrelativeto setvisible ok method public void ok object selected clips get selected values if selected null selected length 0 get toolkit beep return view get text area set selected text get selected clip text dispose getselectedvalues gettoolkit gettextarea setselectedtext getselectedcliptext cancel method public void cancel dispose get selected clip text private string get selected clip text object selected clips get selected values string buffer clip new string buffer for int i 0 i selected length i if i 0 clip append n clip append selected i return clip to string getselectedcliptext getselectedcliptext getselectedvalues stringbuffer stringbuffer tostring update buttons method private void update buttons int selected clips get selected index insert set enabled selected 1 updatebuttons updatebuttons getselectedindex setenabled show clip text method private void show clip text object selected clips get selected values if selected null selected length 0 clip text set text else clip text set text get selected clip text clip text set caret position 0 showcliptext showcliptext getselectedvalues cliptext settext cliptext settext getselectedcliptext cliptext setcaretposition string shorten string item string buffer buf new string buffer workaround for swing rendering labels starting with html using the html engine if item to lower case starts with html buf append boolean ws true for int i 0 i item length i char ch item char at i if character is whitespace ch if ws do nothing else buf append ws true else ws false buf append ch if buf length 0 return j edit get property paste from list whitespace return buf to string stringbuffer stringbuffer tolowercase startswith charat iswhitespace jedit getproperty tostring public component get list cell renderer component j list list object value int index boolean is selected boolean cell has focus super get list cell renderer component list value index is selected cell has focus set text shorten value to string return this getlistcellrenderercomponent jlist isselected cellhasfocus getlistcellrenderercomponent isselected cellhasfocus settext tostring public void action performed action event evt object source evt get source if source insert ok else if source cancel cancel actionperformed actionevent getsource value changed method public void value changed list selection event evt show clip text update buttons valuechanged valuechanged listselectionevent showcliptext updatebuttons public void mouse clicked mouse event evt if evt get click count 2 ok mouseclicked mouseevent getclickcount public int kind bsh return statement int id super id bshreturnstatement public object eval call stack callstack interpreter interpreter throws eval error object value if jjt get num children 0 value simple node jjt get child 0 eval callstack interpreter else value primitive void return new return control kind value this callstack evalerror jjtgetnumchildren simplenode jjtgetchild returncontrol constructor public plugin manager option pane super plugin manager pluginmanageroptionpane init method protected void init set layout new border layout location label new j label j edit get property options plugin manager location mirror label new j label j edit get property options plugin manager mirror if j edit get settings directory null settings dir new j radio button j edit get property options plugin manager settings dir settings dir set tool tip text misc utilities construct path j edit get settings directory jars app dir new j radio button j edit get property options plugin manager app dir app dir set tool tip text misc utilities construct path j edit getj edit home jars mira list new j list mira model new mirror model mira list set selection model new single selection model download mirror add border layout north mirror label add border layout center new j scroll pane mira list j panel button panel new j panel button panel set layout new box layout button panel box layout y axis button panel add box create vertical strut 6 update mirror list j button update mirrors new j button j edit get property options plugin manager update mirrors update mirrors add action listener new action handler button panel add update mirrors button panel add box create vertical strut 6 download source download source new j check box j edit get property options plugin manager download source download source set selected j edit get boolean property plugin manager download source button panel add download source button panel add box create vertical strut 6 delete downloaded files delete downloads new j check box j edit get property options plugin manager delete downloads delete downloads set selected j edit get boolean property plugin manager delete downloads button panel add delete downloads button panel add box create vertical strut 6 install location loc grp new button group if j edit get settings directory null loc grp add settings dir loc grp add app dir j panel loc panel new j panel loc panel set border new empty border 3 12 0 0 loc panel set layout new box layout loc panel box layout y axis if j edit get settings directory null loc panel add settings dir loc panel add box create vertical strut 3 loc panel add app dir button panel add location label button panel add loc panel button panel add box create glue add border layout south button panel if j edit get boolean property plugin manager install user j edit get settings directory null settings dir set selected true else app dir set selected true _init _init setlayout borderlayout locationlabel jlabel jedit getproperty mirrorlabel jlabel jedit getproperty jedit getsettingsdirectory settingsdir jradiobutton jedit getproperty settingsdir settooltiptext miscutilities constructpath jedit getsettingsdirectory appdir jradiobutton jedit getproperty appdir settooltiptext miscutilities constructpath jedit getjedithome miralist jlist miramodel mirrormodel miralist setselectionmodel singleselectionmodel borderlayout mirrorlabel borderlayout jscrollpane miralist jpanel buttonpanel jpanel buttonpanel setlayout boxlayout buttonpanel boxlayout y_axis buttonpanel createverticalstrut jbutton updatemirrors jbutton jedit getproperty updatemirrors updatemirrors addactionlistener actionhandler buttonpanel updatemirrors buttonpanel createverticalstrut downloadsource jcheckbox jedit getproperty downloadsource downloadsource setselected jedit getbooleanproperty downloadsource buttonpanel downloadsource buttonpanel createverticalstrut deletedownloads jcheckbox jedit getproperty deletedownloads deletedownloads setselected jedit getbooleanproperty deletedownloads buttonpanel deletedownloads buttonpanel createverticalstrut locgrp buttongroup jedit getsettingsdirectory locgrp settingsdir locgrp appdir jpanel locpanel jpanel locpanel setborder emptyborder locpanel setlayout boxlayout locpanel boxlayout y_axis jedit getsettingsdirectory locpanel settingsdir locpanel createverticalstrut locpanel appdir buttonpanel locationlabel buttonpanel locpanel buttonpanel createglue borderlayout buttonpanel jedit getbooleanproperty installuser jedit getsettingsdirectory settingsdir setselected appdir setselected save method protected void save j edit set boolean property plugin manager install user settings dir null settings dir is selected j edit set boolean property plugin manager download source download source is selected j edit set boolean property plugin manager delete downloads delete downloads is selected if mira list get selected index 1 string current mirror mira model getid mira list get selected index string previous mirror j edit get property plugin manager mirror id if previous mirror equals current mirror j edit set property plugin manager mirror id current mirror insert code to update the plugin managers list here later _save _save jedit setbooleanproperty installuser settingsdir settingsdir isselected jedit setbooleanproperty downloadsource downloadsource isselected jedit setbooleanproperty deletedownloads deletedownloads isselected miralist getselectedindex currentmirror miramodel miralist getselectedindex previousmirror jedit getproperty previousmirror currentmirror jedit setproperty currentmirror private array list mirrors public mirror model mirrors new array list arraylist mirrormodel arraylist public string getid int index return mirror list mirror mirrors get index id mirrorlist public int get size return mirrors size getsize public object get element at int index mirror list mirror mirror mirror list mirror mirrors get index if mirror id equals mirror list mirror none return j edit get property options plugin manager none else return mirror continent mirror description mirror location getelementat mirrorlist mirrorlist mirrorlist jedit getproperty public void set list array list mirrors this mirrors mirrors fire contents changed this 0 mirrors size 1 setlist arraylist firecontentschanged public single selection model super set selection mode single selection singleselectionmodel setselectionmode single_selection public void remove selection interval int index0 int index1 removeselectioninterval class action handler implements action listener public void action performed action event evt vfs manager run in work thread new download mirrors thread actionhandler actionlistener actionperformed actionevent vfsmanager runinworkthread downloadmirrorsthread public void run set status j edit get property options plugin manager workthread set progress maximum 1 set progress value 0 final array list mirrors new array list try mirrors add all new mirror list mirrors catch exception ex log log log error this ex gui utilities error plugin manager option pane this ioerror new string ex to string swing utilities invoke later new runnable public void run mira model set list mirrors string id j edit get property plugin manager mirror id int size mira model get size for int i 0 i size i if size 1 mira model getid i equals id mira list set selected index i break set progress value 1 setstatus jedit getproperty setprogressmaximum setprogressvalue arraylist arraylist addall mirrorlist guiutilities pluginmanageroptionpane tostring swingutilities invokelater miramodel setlist jedit getproperty miramodel getsize miramodel miralist setselectedindex setprogressvalue public void run mira model set list mirrors string id j edit get property plugin manager mirror id int size mira model get size for int i 0 i size i if size 1 mira model getid i equals id mira list set selected index i break miramodel setlist jedit getproperty miramodel getsize miramodel miralist setselectedindex may jun jul aug sep oct nov dec public static string usage return usage dir string dir n dir implement dir command public static void invoke interpreter env call stack callstack string dir invoke env callstack dir callstack implement dir string directory command public static void invoke interpreter env call stack callstack string dir file file try file env path to file dir catch io exception e env println error reading path e return if file exists file can read env println can t read file return if file is directory env println dir is not a directory string files file list files string util bubble sort files for int i 0 i files length i file f new file dir file separator files i string buffer sb new string buffer sb append f can read r sb append f can write w sb append sb append date d new date f last modified gregorian calendar c new gregorian calendar c set time d int day c get calendar day of month sb append months c get calendar month day if day 10 sb append sb append hack to get fixed length length field int fieldlen 8 string buffer len new string buffer for int j 0 j fieldlen j len append len insert 0 f length len set length fieldlen hack to move the spaces to the front int si len to string index of if si 1 string pad len to string substring si len set length si len insert 0 pad sb append len to string sb append f get name if f is directory sb append env println sb to string callstack pathtofile ioexception canread isdirectory stringutil bubblesort stringbuffer stringbuffer canread canwrite _ lastmodified gregoriancalendar gregoriancalendar settime day_of_month stringbuffer stringbuffer setlength tostring indexof tostring setlength tostring getname isdirectory tostring private void reset eval name value eval base object null callstack depth 0 evalname evalbaseobject callstackdepth this constructor should not be used in general use name space get name resolver which supports caching see name space get name resolver i wish i could make this friendly to only name space name name space namespace string s this namespace namespace value s namespace getnameresolver namespace getnameresolver namespace namespace resolve possibly complex name to an object value throws eval error on various failures a null object value is indicated by a primitive null a return type of primitive void comes from attempting to access an undefined variable some cases my variable my variable foo my variable foo bar java awt grid bag constraints both my package stuff my class some field some field interpreter reference is necessary to allow resolution of this interpreter magic field call stack reference is necessary to allow resolution of this caller magic field this callstack magic field public object to object call stack callstack interpreter interpreter throws util eval error return to object callstack interpreter false evalerror myvariable myvariable myvariable gridbagconstraints myclass somefield somefield callstack toobject callstack utilevalerror toobject see to object param force class if true then resolution will only produce a class this is necessary to disambiguate in cases where the grammar knows that we want a class where in general the var path may be taken synchronized public object to object call stack callstack interpreter interpreter boolean force class throws util eval error reset object obj null while eval name null obj consume next object field callstack interpreter force class false autoalloc if obj null throw new interpreter error null value in to object return obj toobject forceclass toobject callstack forceclass utilevalerror evalname consumenextobjectfield forceclass interpretererror toobject private object complete round string last eval name string next eval name object return object if return object null throw new interpreter error last eval name last eval name this last eval name last eval name this eval name next eval name this eval base object return object return return object completeround lastevalname nextevalname returnobject returnobject interpretererror lastevalname lastevalname lastevalname lastevalname evalname nextevalname evalbaseobject returnobject returnobject get the next object by consuming one or more components of eval name often this consumes just one component but if the name is a classname it will consume all of the components necessary to make the class identifier private object consume next object field call stack callstack interpreter interpreter boolean force class boolean auto allocate this throws util eval error is it a simple variable name doing this first gives the correct java precedence for vars vs imported class names at least in the simple case see tests precedence1 bsh it should also speed things up a bit if eval base object null is compound eval name force class object obj resolve this field reference callstack namespace interpreter eval name false if obj primitive void return complete round eval name finished obj is it a bsh script variable reference if we re just starting the eval of name no base object or we re evaluating relative to a this type reference check string var name prefix eval name 1 if eval base object null eval base object instanceof this force class if interpreter debug interpreter debug trying to resolve variable var name object obj switch namespace and special var visibility if eval base object null obj resolve this field reference callstack namespace interpreter var name false else obj resolve this field reference callstack this eval base object namespace interpreter var name true if obj primitive void resolved the variable if interpreter debug interpreter debug resolved variable var name in namespace namespace return complete round var name suffix eval name obj is it a class name if we re just starting eval of name try to make it else fail if eval base object null if interpreter debug interpreter debug trying class eval name keep adding parts until we have a class class clas null int i 1 string class name null for i count parts eval name i class name prefix eval name i if clas namespace get class class name null break if clas null return complete round class name suffix eval name count parts eval name i new class identifier clas not a class or variable per above if interpreter debug interpreter debug not a class trying var prefix eval name no variable or class found in this type ref if auto allocate this then create one a child this if eval base object null eval base object instanceof this force class auto allocate this name space target name space eval base object null namespace this eval base object namespace object obj new name space target name space auto var name get this interpreter target name space set variable var name obj false return complete round var name suffix eval name obj if we didn t find a class or variable name or prefix above there are two possibilities if we are a simple name then we can pass as a void variable reference if we are compound then we must fail at this point if eval base object null if is compound eval name return complete round eval name finished primitive void else throw new util eval error class or variable not found eval name after this point we re definitely evaluating relative to a base object do some basic validity checks if eval base object primitive null previous round produced null throw new util target error new null pointer exception null pointer while evaluating value if eval base object primitive void previous round produced void throw new util eval error undefined variable or class name while evaluating value if eval base object instanceof primitive throw new util eval error can t treat primitive like an object error while evaluating value resolve relative to a class type static field inner class if eval base object instanceof class identifier class clas class identifier eval base object get target class string field prefix eval name 1 class qualified this reference from inner class e g my outer class this if field equals this find the enclosing class instance space of the class name name space ns namespace while ns null get class instance throws exception if not there if ns class instance null ns class instance get class clas return complete round field suffix eval name ns class instance ns ns get parent throw new util eval error can t find enclosing this instance of class clas object obj null static field try if interpreter debug interpreter debug name call to get static field class clas field field obj reflect get static field clas field catch reflect error e if interpreter debug interpreter debug field reflect error e inner class if obj null string iclass clas get name field class c namespace get class iclass if c null obj new class identifier c if obj null throw new util eval error no static field or inner class field of clas return complete round field suffix eval name obj if we ve fallen through here we are no longer resolving to a class type if force class throw new util eval error value does not resolve to a class name some kind of field access string field prefix eval name 1 length access on array if field equals length eval base object get class is array object obj new primitive array get length eval base object return complete round field suffix eval name obj check for field on object note could eliminate throwing the exception somehow try object obj reflect get object field eval base object field return complete round field suffix eval name obj catch reflect error e not a field if we get here we have failed throw new util eval error cannot access field field on object eval base object evalname consumenextobjectfield callstack forceclass autoallocatethis utilevalerror evalbaseobject iscompound evalname forceclass resolvethisfieldreference evalname completeround evalname varname evalname evalbaseobject evalbaseobject forceclass varname evalbaseobject resolvethisfieldreference varname resolvethisfieldreference evalbaseobject varname varname completeround varname evalname evalbaseobject evalname classname countparts evalname classname evalname getclass classname completeround classname evalname countparts evalname classidentifier evalname autoallocatethis evalbaseobject evalbaseobject forceclass autoallocatethis namespace targetnamespace evalbaseobject evalbaseobject namespace targetnamespace varname getthis targetnamespace setvariable varname completeround varname evalname evalbaseobject iscompound evalname completeround evalname utilevalerror evalname evalbaseobject utiltargeterror nullpointerexception evalbaseobject utilevalerror evalbaseobject utilevalerror evalbaseobject classidentifier classidentifier evalbaseobject gettargetclass evalname myouterclass namespace getclassinstance classinstance classinstance getclass completeround evalname classinstance getparent utilevalerror getstaticfield getstaticfield reflecterror getname getclass classidentifier utilevalerror completeround evalname forceclass utilevalerror evalname evalbaseobject getclass isarray getlength evalbaseobject completeround evalname getobjectfield evalbaseobject completeround evalname reflecterror utilevalerror evalbaseobject resolve a variable relative to a this reference this is the general variable resolution method accomodating special fields from the this context together the namespace and interpreter comprise the this context the callstack if available allows for the this caller construct optionally interpret special magic field names e g interpreter p param callstack may be null but this is only legitimate in special cases where we are sure resolution will not involve this caller param namespace the namespace of the this reference should be the same as the top of the stack object resolve this field reference call stack callstack name space this name space interpreter interpreter string var name boolean special fields visible throws util eval error if var name equals this somewhat of a hack if the special fields are visible we re operating relative to a this type already dissallow further this references to prevent user from skipping to things like super this caller if special fields visible throw new util eval error redundant to call this on this type allow get this to work through block name space to the method namespace xxx re eval this do we need it this ths this name space get this interpreter this name space ths get name space object result ths name space class name space get class name space this name space if class name space null if is compound eval name result class name space get this interpreter else result class name space get class instance return result some duplication for super see notes for this above if we re in an enclsing class instance and have a superclass instance our super is the superclass instance if var name equals super if special fields visible throw new util eval error redundant to call this on this type allow get super to through block name space to the method s super this ths this name space get super interpreter this name space ths get name space super is now the closure s super or class instance xxxx re evaluate this can get super work by itself now if we re a class instance and the parent is also a class instance then super means our parent if this name space get parent null this name space get parent is class ths this name space get parent get this interpreter return ths object obj null if var name equals global obj this name space get global interpreter if obj null special fields visible if var name equals namespace obj this name space else if var name equals variables obj this name space get variable names else if var name equals methods obj this name space get method names else if var name equals interpreter if last eval name equals this obj interpreter else throw new util eval error can only call interpreter on literal this if obj null special fields visible var name equals caller if last eval name equals this last eval name equals caller get the previous context see notes for this class if callstack null throw new interpreter error no callstack obj callstack get callstack depth get this interpreter else throw new util eval error can only call caller on literal this or literal caller early return return obj if obj null special fields visible var name equals callstack if last eval name equals this get the previous context see notes for this class if callstack null throw new interpreter error no callstack obj callstack else throw new util eval error can only call callstack on literal this if obj null obj this name space get variable var name if obj null throw new interpreter error null this field ref var name return obj resolvethisfieldreference callstack namespace thisnamespace varname specialfieldsvisible utilevalerror varname specialfieldsvisible utilevalerror getthis blocknamespace thisnamespace getthis thisnamespace getnamespace namespace classnamespace getclassnamespace thisnamespace classnamespace iscompound evalname classnamespace getthis classnamespace getclassinstance varname specialfieldsvisible utilevalerror getsuper blocknamespace thisnamespace getsuper thisnamespace getnamespace getsuper thisnamespace getparent thisnamespace getparent isclass thisnamespace getparent getthis varname thisnamespace getglobal specialfieldsvisible varname thisnamespace varname thisnamespace getvariablenames varname thisnamespace getmethodnames varname lastevalname utilevalerror specialfieldsvisible varname lastevalname lastevalname interpretererror callstackdepth getthis utilevalerror specialfieldsvisible varname lastevalname interpretererror utilevalerror thisnamespace getvariable varname interpretererror varname return the enclosing class body namespace or null if not in a class static name space get class name space name space this name space name space class name space null is a class instance if this name space class instance null if this name space is class return this name space if this name space is method this name space get parent null this name space get parent class instance null this name space get parent is class return this name space get parent return null namespace getclassnamespace namespace thisnamespace namespace classnamespace thisnamespace classinstance thisnamespace isclass thisnamespace thisnamespace ismethod thisnamespace getparent thisnamespace getparent classinstance thisnamespace getparent isclass thisnamespace getparent check the cache else use to object to try to resolve to a class identifier throws class not found exception on class not found throws class path exception type of eval error on special case of ambiguous unqualified name after super import synchronized public class to class throws class not found exception util eval error if as class null return as class reset var means untyped return null class if eval name equals var return as class null try straightforward class name first class clas namespace get class eval name if clas null try to object which knows how to work through inner classes and see what we end up with object obj null try null interpreter and callstack references class only resolution should not require them obj to object null null true catch util eval error e couldn t resolve it if obj instanceof class identifier clas class identifier obj get target class if clas null throw new class not found exception class value not found in namespace as class clas return as class toobject classnotfoundexception classpathexception evalerror toclass classnotfoundexception utilevalerror asclass asclass evalname asclass getclass evalname toobject toobject utilevalerror classidentifier classidentifier gettargetclass classnotfoundexception asclass asclass synchronized public lhs tolhs call stack callstack interpreter interpreter throws util eval error should clean this up to a single return statement reset lhs lhs simple non compound variable assignment e g x 5 if is compound eval name if eval name equals this throw new util eval error can t assign to this interpreter debug simple var lhs lhs new lhs namespace eval name false bubble up if allowed return lhs field e g foo bar 5 object obj null try while eval name null is compound eval name obj consume next object field callstack interpreter false forcclass true autoallocthis catch util eval error e throw new util eval error lhs evaluation e get message finished eval and its a class if eval name null obj instanceof class identifier throw new util eval error can t assign to class value if obj null throw new util eval error error in lhs value e g this x 5 or some this type x 5 if obj instanceof this dissallow assignment to magic fields if eval name equals namespace eval name equals variables eval name equals methods eval name equals caller throw new util eval error can t assign to special variable eval name interpreter debug found this reference evaluating lhs if this was a literal super reference then we allow recursion in setting the variable to get the normal effect of finding the nearest definition starting at the super scope on any other resolution qualified by a this type reference we want to set the variable directly in that scope e g this x 5 or some this type x 5 in the old scoping rules super didn t do this boolean local var last eval name equals super return new lhs this obj namespace eval name local var if eval name null try if obj instanceof class identifier class clas class identifier obj get target class lhs reflect getlhs static field clas eval name return lhs else lhs reflect getlhs object field obj eval name return lhs catch reflect error e throw new util eval error field access e throw new interpreter error internal error in lhs callstack utilevalerror iscompound evalname evalname utilevalerror evalname evalname iscompound evalname consumenextobjectfield utilevalerror utilevalerror getmessage evalname classidentifier utilevalerror utilevalerror somethistype evalname evalname evalname evalname utilevalerror evalname somethistype localvar lastevalname evalname localvar evalname classidentifier classidentifier gettargetclass getlhsstaticfield evalname getlhsobjectfield evalname reflecterror utilevalerror interpretererror invoke the method identified by this name performs caching of method resolution using signature key p name contains a wholely unqualfied messy name resolve it to object static prefix method name and invoke p the interpreter is necessary to support this interpreter references in the called code e g debug p pre some cases dynamic local my variable foo my variable bar blah foo static java lang integer get integer foo pre public object invoke method interpreter interpreter object args call stack callstack simple node caller info throws util eval error eval error reflect error invocation target exception string method name name suffix value 1 bsh class manager bcm interpreter get class manager name space namespace callstack top optimization if class of static method is set then we have already been here and determined that this is a static method invocation note maybe factor this out with path below clean up if class of static method null return reflect invoke static method bcm class of static method method name args if name is compound value return invoke local method interpreter args callstack caller info note if we want methods declared inside blocks to be accessible via this methodname inside the block we could handle it here as a special case see also resolve this field reference special handling for block name space case they currently work via the direct name e g method name string prefix name prefix value superclass method invocation e g super foo if prefix equals super name count parts value 2 name space class name space get class name space namespace if class name space null object instance class name space get class instance return class generator get class generator invoke superclass method bcm instance method name args find target object or class identifier name target name namespace get name resolver prefix object obj target name to object callstack interpreter if obj primitive void throw new util eval error attempt to resolve method method name on undefined variable or class name target name if we ve got an object resolve the method if obj instanceof class identifier if obj instanceof primitive if obj primitive null throw new util target error new null pointer exception null pointer in method invocation some other primitive should avoid calling methods on primitive as we do in name can t treat primitive like an object message but the hole is useful right now if interpreter debug interpreter debug attempt to access method on primitive allowing bsh primitive to peek through for debugging found an object and it s not an undefined variable return reflect invoke object method obj method name args interpreter callstack caller info it s a class try static method if interpreter debug interpreter debug invoke method trying static target name class clas class identifier obj get target class cache the fact that this is a static method invocation on this class class of static method clas if clas null return reflect invoke static method bcm clas method name args return null throw new util eval error invoke method unknown target target name signaturekey myvariable myvariable getinteger invokemethod callstack simplenode callerinfo utilevalerror evalerror reflecterror invocationtargetexception methodname bshclassmanager getclassmanager namespace classofstaticmethod classofstaticmethod invokestaticmethod classofstaticmethod methodname iscompound invokelocalmethod callerinfo resolvethisfieldreference blocknamespace methodname countparts namespace classnamespace getclassnamespace classnamespace classnamespace getclassinstance classgenerator getclassgenerator invokesuperclassmethod methodname targetname getnameresolver targetname toobject utilevalerror methodname targetname classidentifier utiltargeterror nullpointerexception invokeobjectmethod methodname callerinfo invokemethod targetname classidentifier gettargetclass classofstaticmethod invokestaticmethod methodname utilevalerror invokemethod targetname invoke a locally declared method or a bsh command if the method is not already declared in the namespace then try to load it as a resource from the imported command path e g bsh commands note the bsh command code should probably not be here we need to scope it by the namespace that imported the command so it probably needs to be integrated into name space private object invoke local method interpreter interpreter object args call stack callstack simple node caller info throws eval error reflect error invocation target exception if interpreter debug interpreter debug invoke local method value if interpreter null throw new interpreter error invoke local method interpreter null string command name value class arg types types get types args check for existing method bsh method meth null try meth namespace get method command name arg types catch util eval error e throw e to eval error local method invocation caller info callstack if defined invoke it if meth null return meth invoke args interpreter callstack caller info bsh class manager bcm interpreter get class manager look for a bean shell command object command object try command object namespace get command command name arg types interpreter catch util eval error e throw e to eval error error loading command caller info callstack should try to print usage here if nothing found if command object null look for a default invoke handler method in the namespace note this code duplicates that in this java should it call on this can never be a command bsh method invoke method null try invoke method namespace get method invoke new class null null catch util eval error e throw e to eval error local method invocation caller info callstack if invoke method null return invoke method invoke new object command name args interpreter callstack caller info throw new eval error command not found string util method string command name arg types caller info callstack if command object instanceof bsh method return bsh method command object invoke args interpreter callstack caller info if command object instanceof class try return reflect invoke compiled command class command object args interpreter callstack catch util eval error e throw e to eval error error invoking compiled command caller info callstack throw new interpreter error invalid command type namespace invokelocalmethod callstack simplenode callerinfo evalerror reflecterror invocationtargetexception invokelocalmethod interpretererror invokelocalmethod commandname argtypes gettypes bshmethod getmethod commandname argtypes utilevalerror toevalerror callerinfo callerinfo bshclassmanager getclassmanager beanshell commandobject commandobject getcommand commandname argtypes utilevalerror toevalerror callerinfo commandobject bshmethod invokemethod invokemethod getmethod utilevalerror toevalerror callerinfo invokemethod invokemethod commandname callerinfo evalerror stringutil methodstring commandname argtypes callerinfo commandobject bshmethod bshmethod commandobject callerinfo commandobject invokecompiledcommand commandobject utilevalerror toevalerror callerinfo interpretererror public static boolean is compound string value return value index of 1 return count parts value 1 iscompound indexof countparts static int count parts string value if value null return 0 int count 0 int index 1 while index value index of index 1 1 count return count 1 countparts indexof static string prefix string value if is compound value return null return prefix value count parts value 1 iscompound countparts static string prefix string value int parts if parts 1 return null int count 0 int index 1 while index value index of index 1 1 count parts return index 1 value value substring 0 index indexof static string suffix string name if is compound name return null return suffix name count parts name 1 iscompound countparts public static string suffix string value int parts if parts 1 return null int count 0 int index value length 1 while index value last index of index 1 1 count parts return index 1 value value substring index 1 lastindexof public string to string return value tostring mouse actions constructor mouse actions string name this name name mouseactions mouseactions get action for event method string get action for event mouse event evt string variant string mod str default input handler get modifier string evt if mod str null return j edit get property view name variant click else return j edit get property view name default input handler get modifier string evt variant click getactionforevent getactionforevent mouseevent modstr defaultinputhandler getmodifierstring modstr jedit getproperty jedit getproperty defaultinputhandler getmodifierstring chunk cache constructor chunk cache j edit text area text area this text area text area out new array list token handler new display token handler chunkcache chunkcache jedittextarea textarea textarea textarea arraylist tokenhandler displaytokenhandler get max horizontal scroll width method int get max horizontal scroll width int max 0 for int i 0 i first invalid line i line info info line info i if info width max max info width return max getmaxhorizontalscrollwidth getmaxhorizontalscrollwidth firstinvalidline lineinfo lineinfo get screen line of offset method int get screen line of offset int line int offset if line info length 0 return 1 if line text area get first physical line return 1 else if line text area get first physical line offset get line info 0 offset return 1 else if line text area get last physical line return 1 else int screen line if line last screen linep line info last get line info last screen line if offset last offset offset last offset last length return last screen line screen line 1 find the screen line containing this offset for int i 0 i text area get visible lines i line info info get line info i if info physical line line line is invisible return i 1 return 1 else if info physical line line if offset info offset offset info offset info length screen line i break if screen line 1 return 1 else last screen linep line last screen line screen line return screen line getscreenlineofoffset getscreenlineofoffset lineinfo textarea getfirstphysicalline textarea getfirstphysicalline getlineinfo textarea getlastphysicalline screenline lastscreenlinep lineinfo getlineinfo lastscreenline lastscreenline screenline textarea getvisiblelines lineinfo getlineinfo physicalline physicalline screenline screenline lastscreenlinep lastscreenline screenline screenline recalculate visible lines method void recalculate visible lines line info new line info new line info text area get visible lines int start if line info null start 0 else start math min line info length new line info length system arraycopy line info 0 new line info 0 start for int i start i new line info length i new line info i new line info line info new line info last screen line last screen linep 1 recalculatevisiblelines recalculatevisiblelines lineinfo newlineinfo lineinfo textarea getvisiblelines lineinfo lineinfo newlineinfo lineinfo newlineinfo newlineinfo newlineinfo lineinfo lineinfo newlineinfo lastscreenline lastscreenlinep set buffer method void set buffer buffer buffer this buffer buffer last screen line last screen linep 1 setbuffer setbuffer lastscreenline lastscreenlinep scroll down method void scroll down int amount int visible lines text area get visible lines system arraycopy line info amount line info 0 visible lines amount for int i visible lines amount i visible lines i line info i new line info first invalid line amount if first invalid line 0 first invalid line 0 if debug chunk cache debug system err println f t f only amount need updates last screen line last screen linep 1 scrolldown scrolldown visiblelines textarea getvisiblelines lineinfo lineinfo visiblelines visiblelines visiblelines lineinfo lineinfo firstinvalidline firstinvalidline firstinvalidline chunk_cache_debug lastscreenline lastscreenlinep scroll up method void scroll up int amount system arraycopy line info 0 line info amount text area get visible lines amount for int i 0 i amount i line info i new line info don t try this at home int old first invalid line first invalid line first invalid line 0 update chunks up to amount first invalid line old first invalid line amount if first invalid line text area get visible lines first invalid line text area get visible lines if debug chunk cache debug log log log debug this f t f only amount need updates last screen line last screen linep 1 scrollup scrollup lineinfo lineinfo textarea getvisiblelines lineinfo lineinfo oldfirstinvalidline firstinvalidline firstinvalidline updatechunksupto firstinvalidline oldfirstinvalidline firstinvalidline textarea getvisiblelines firstinvalidline textarea getvisiblelines chunk_cache_debug lastscreenline lastscreenlinep invalidate all method void invalidate all first invalid line 0 last screen line last screen linep 1 invalidateall invalidateall firstinvalidline lastscreenline lastscreenlinep invalidate chunks from method void invalidate chunks from int screen line if debug chunk cache debug log log log debug this invalidate from screen line first invalid line math min screen line first invalid line if screen line last screen line last screen line last screen linep 1 invalidatechunksfrom invalidatechunksfrom screenline chunk_cache_debug screenline firstinvalidline screenline firstinvalidline screenline lastscreenline lastscreenline lastscreenlinep invalidate chunks from phys method void invalidate chunks from phys int physical line for int i 0 i first invalid line i line info info line info i if info physical line 1 info physical line physical line first invalid line i if i last screen line last screen line last screen linep 1 break invalidatechunksfromphys invalidatechunksfromphys physicalline firstinvalidline lineinfo lineinfo physicalline physicalline physicalline firstinvalidline lastscreenline lastscreenline lastscreenlinep get line info method line info get line info int screen line update chunks up to screen line return line info screen line getlineinfo lineinfo getlineinfo screenline updatechunksupto screenline lineinfo screenline get line subregion count method int get line subregion count int physical line if text area display manager soft wrap return 1 out clear line to chunk list physical line out int size out size if size 0 return 1 else return size getlinesubregioncount getlinesubregioncount physicalline textarea displaymanager softwrap linetochunklist physicalline get subregion of offset method returns the subregion containing the specified offset a subregion is a subset of a physical line each screen line corresponds to one subregion unlike the link get screen line of offset method this method works with non visible lines too int get subregion of offset int offset line info line infos for int i 0 i line infos length i line info info line infos i if offset info offset offset info offset info length return i return 1 getsubregionofoffset getscreenlineofoffset getsubregionofoffset lineinfo lineinfos lineinfos lineinfo lineinfos x to subregion offset method converts an x co ordinate within a subregion into an offset from the start of that subregion param physical line the physical line number param subregion the subregion if 1 then this is the last subregion param x the x co ordinate param round round up to next character if x is past the middle of a character int x to subregion offset int physical line int subregion int x boolean round line info infos get line infos for physical line physical line if subregion 1 subregion infos length return x to subregion offset infos subregion x round xtosubregionoffset physicalline xtosubregionoffset physicalline lineinfo getlineinfosforphysicalline physicalline xtosubregionoffset x to subregion offset method converts an x co ordinate within a subregion into an offset from the start of that subregion param info the line info object param x the x co ordinate param round round up to next character if x is past the middle of a character int x to subregion offset line info info int x boolean round int offset chunk x to offset info chunks x round if offset 1 offset info offset info length offset info offset info length 1 return offset xtosubregionoffset xtosubregionoffset lineinfo xtooffset subregion offset tox method converts an offset within a subregion into an x co ordinate param physical line the physical line param offset the offset int subregion offset tox int physical line int offset line info infos get line infos for physical line physical line line info info infos get subregion of offset offset infos return subregion offset tox info offset subregionoffsettox physicalline subregionoffsettox physicalline lineinfo getlineinfosforphysicalline physicalline lineinfo getsubregionofoffset subregionoffsettox subregion offset tox method converts an offset within a subregion into an x co ordinate param info the line info object param offset the offset int subregion offset tox line info info int offset return int chunk offset tox info chunks offset subregionoffsettox subregionoffsettox lineinfo offsettox get subregion start offset method returns the start offset of the specified subregion of the specified physical line param line the physical line number param offset an offset int get subregion start offset int line int offset line info line infos get line infos for physical line line line info info line infos get subregion of offset offset line infos return text area get line start offset info physical line info offset getsubregionstartoffset getsubregionstartoffset lineinfo lineinfos getlineinfosforphysicalline lineinfo lineinfos getsubregionofoffset lineinfos textarea getlinestartoffset physicalline get subregion end offset method returns the end offset of the specified subregion of the specified physical line param line the physical line number param offset an offset int get subregion end offset int line int offset line info line infos get line infos for physical line line line info info line infos get subregion of offset offset line infos return text area get line start offset info physical line info offset info length getsubregionendoffset getsubregionendoffset lineinfo lineinfos getlineinfosforphysicalline lineinfo lineinfos getsubregionofoffset lineinfos textarea getlinestartoffset physicalline get below position method param physical line the physical line number param offset the offset param x the location param ignore wrap if true behave as if soft wrap is off even if it is on int get below position int physical line int offset int x boolean ignore wrap line info line infos get line infos for physical line physical line int subregion get subregion of offset offset line infos if subregion line infos length 1 ignore wrap return text area get line start offset physical line x to subregion offset line infos subregion 1 x true else int next line text area display manager get next visible line physical line if next line 1 return 1 else return text area get line start offset next line x to subregion offset next line 0 x true getbelowposition physicalline ignorewrap getbelowposition physicalline ignorewrap lineinfo lineinfos getlineinfosforphysicalline physicalline getsubregionofoffset lineinfos lineinfos ignorewrap textarea getlinestartoffset physicalline xtosubregionoffset lineinfos nextline textarea displaymanager getnextvisibleline physicalline nextline textarea getlinestartoffset nextline xtosubregionoffset nextline get above position method param physical line the physical line number param offset the offset param x the location param ignore wrap if true behave as if soft wrap is off even if it is on int get above position int physical line int offset int x boolean ignore wrap line info line infos get line infos for physical line physical line int subregion get subregion of offset offset line infos if subregion 0 ignore wrap return text area get line start offset physical line x to subregion offset line infos subregion 1 x true else int prev line text area display manager get prev visible line physical line if prev line 1 return 1 else return text area get line start offset prev line x to subregion offset prev line 1 x true getaboveposition physicalline ignorewrap getaboveposition physicalline ignorewrap lineinfo lineinfos getlineinfosforphysicalline physicalline getsubregionofoffset lineinfos ignorewrap textarea getlinestartoffset physicalline xtosubregionoffset lineinfos prevline textarea displaymanager getprevvisibleline physicalline prevline textarea getlinestartoffset prevline xtosubregionoffset prevline need full repaint method the need full repaint variable becomes true when the number of screen lines in a physical line changes boolean need full repaint boolean ret val need full repaint need full repaint false return ret val needfullrepaint needfullrepaint needfullrepaint retval needfullrepaint needfullrepaint retval get line infos for physical line method line info get line infos for physical line int physical line out clear if buffer is loaded line to chunk list physical line out if out size 0 out add null array list return value new array list out size get line infos for physical line physical line return value return line info return value to array new line info out size getlineinfosforphysicalline lineinfo getlineinfosforphysicalline physicalline isloaded linetochunklist physicalline arraylist returnvalue arraylist getlineinfosforphysicalline physicalline returnvalue lineinfo returnvalue toarray lineinfo get line infos for physical line method private void get line infos for physical line int physical line list list for int i 0 i out size i chunk chunks chunk out get i line info info new line info info physical line physical line if i 0 info first subregion true info offset 0 else info offset chunks offset if i out size 1 info last subregion true info length text area get line length physical line info offset 1 else info length chunk out get i 1 offset info offset info chunks chunks list add info getlineinfosforphysicalline getlineinfosforphysicalline physicalline lineinfo lineinfo physicalline physicalline firstsubregion lastsubregion textarea getlinelength physicalline update chunks up to method private void update chunks up to int last screen line this method is a nightmare if last screen line line info length throw new array index out of bounds exception last screen line if one line s chunks are invalid remaining lines are also invalid if last screen line first invalid line return find a valid line closest to the last screen line int first screen line 0 for int i first invalid line 1 i 0 i if line info i last subregion first screen line i 1 break int physical line for the first line displayed take its physical line to be the text area s first physical line if first screen line 0 physical line text area get first physical line otherwise determine the next visible line else int prev phys line line info first screen line 1 physical line if 1 the empty space at the end of the text area when the buffer has less lines than are visible if prev phys line 1 physical line 1 else physical line text area display manager get next visible line prev phys line if debug chunk cache debug log log log debug this updating chunks from first screen line to last screen line note that we rely on the fact that when a physical line is invalidated all screen lines subregions of that line are invalidated as well see below comment for code that tries to uphold this assumption out clear int offset 0 int length 0 for int i first screen line i last screen line i line info info line info i chunk chunks get another line of chunks if out size 0 unless this is the first time increment the line number if physical line 1 i first screen line physical line text area display manager get next visible line physical line empty space if physical line 1 info chunks null info physical line 1 fix the bug where the horiz scroll bar was not updated after creating a new file info width 0 continue chunk the line line to chunk list physical line out info first subregion true if the line has no text out size 0 if out size 0 text area display manager set screen line count physical line 1 if i 0 if text area display manager first line skew 0 log log log error this bug skew text area display manager first line skew out size out size text area display manager first line skew 0 need full repaint true last screen line line info length 1 chunks null offset 0 length 1 otherwise the number of subregions else text area display manager set screen line count physical line out size if i 0 int skew text area display manager first line skew if skew out size log log log error this bug skew skew out size out size skew 0 need full repaint true last screen line line info length 1 else if skew 0 info first subregion false for int j 0 j skew j out remove 0 chunks chunk out get 0 out remove 0 offset chunks offset if out size 0 length chunk out get 0 offset offset else length text area get line length physical line offset 1 else info first subregion false chunks chunk out get 0 out remove 0 offset chunks offset if out size 0 length chunk out get 0 offset offset else length text area get line length physical line offset 1 boolean last subregion out size 0 if i last screen line last screen line line info length 1 if the user changes the syntax token at the end of a line need to do a full repaint if token handler get line context info line context last screen line need full repaint true if this line has become longer or shorter in which case the new physical line number is different from the cached one we need to continue updating past the last line advise the text area to repaint on the other hand if the line wraps beyond last screen line we need to keep updating the chunk list to ensure proper alignment of invalidation flags see start of method else if info physical line physical line info last subregion last subregion last screen line need full repaint true we only cache entire physical lines at once don t want to split a physical line into screen lines and only have some valid else if out size 0 last screen line info physical line physical line info last subregion last subregion info offset offset info length length info chunks chunks info line context token handler get line context first invalid line math max last screen line 1 first invalid line updatechunksupto updatechunksupto lastscreenline lastscreenline lineinfo arrayindexoutofboundsexception lastscreenline lastscreenline firstinvalidline firstscreenline firstinvalidline lineinfo lastsubregion firstscreenline physicalline firstscreenline physicalline textarea getfirstphysicalline prevphysline lineinfo firstscreenline physicalline prevphysline physicalline physicalline textarea displaymanager getnextvisibleline prevphysline chunk_cache_debug firstscreenline lastscreenline firstscreenline lastscreenline lineinfo lineinfo physicalline firstscreenline physicalline textarea displaymanager getnextvisibleline physicalline physicalline physicalline linetochunklist physicalline firstsubregion textarea displaymanager setscreenlinecount physicalline textarea displaymanager firstline textarea displaymanager firstline textarea displaymanager firstline needfullrepaint lastscreenline lineinfo textarea displaymanager setscreenlinecount physicalline textarea displaymanager firstline needfullrepaint lastscreenline lineinfo firstsubregion textarea getlinelength physicalline firstsubregion textarea getlinelength physicalline lastsubregion lastscreenline lastscreenline lineinfo tokenhandler getlinecontext linecontext lastscreenline needfullrepaint lastscreenline physicalline physicalline lastsubregion lastsubregion lastscreenline needfullrepaint lastscreenline physicalline physicalline lastsubregion lastsubregion linecontext tokenhandler getlinecontext firstinvalidline lastscreenline firstinvalidline line to chunk list method private void line to chunk list int physical line list out text area painter painter text area get painter token handler init painter get styles painter get font render context painter out text area display manager soft wrap text area display manager wrap margin 0 0f buffer mark tokens physical line token handler linetochunklist linetochunklist physicalline textareapainter textarea getpainter tokenhandler getstyles getfontrendercontext textarea displaymanager softwrap textarea displaymanager wrapmargin marktokens physicalline tokenhandler appearance option pane constructor public appearance option pane super appearance appearanceoptionpane appearanceoptionpane init method protected void init look and feel add component new j label j edit get property options appearance lf note lfs ui manager get installed look and feels string names new string lfs length string lf ui manager get look and feel get class get name int index 0 for int i 0 i names length i names i lfs i get name if lf equals lfs i get class name index i look and feel new j combo box names look and feel set selected index index look and feel add action listener new action listener public void action performed action event evt update enabled add component j edit get property options appearance lf look and feel primary metal l f font primary font new font selector j edit get font property metal primary font add component j edit get property options appearance primary font primary font secondary metal l f font secondary font new font selector j edit get font property metal secondary font add component j edit get property options appearance secondary font secondary font update enabled history count history new j text field j edit get property history add component j edit get property options appearance history history menu spillover count menu spillover new j text field j edit get property menu spillover add component j edit get property options appearance menu spillover menu spillover add separator options appearance startup label show splash screen show splash new j check box j edit get property options appearance show splash string settings directory j edit get settings directory if settings directory null show splash set selected true else show splash set selected new file settings directory nosplash exists add component show splash show tip of the day show tips new j check box j edit get property options appearance show tips show tips set selected j edit get boolean property tip show add component show tips add separator options appearance experimental label add component gui utilities create multiline label j edit get property options appearance experimental caption use j edit colors in all text components text colors new j check box j edit get property options appearance text colors text colors set selected j edit get boolean property text colors add component text colors decorate frames with look and feel jdk 1 4 only decorate frames new j check box j edit get property options appearance decorate frames decorate frames set selected j edit get boolean property decorate frames decorate dialogs with look and feel jdk 1 4 only decorate dialogs new j check box j edit get property options appearance decorate dialogs decorate dialogs set selected j edit get boolean property decorate dialogs if operating system has java14 add component decorate frames add component decorate dialogs _init _init addcomponent jlabel jedit getproperty uimanager getinstalledlookandfeels uimanager getlookandfeel getclass getname getname getclassname lookandfeel jcombobox lookandfeel setselectedindex lookandfeel addactionlistener actionlistener actionperformed actionevent updateenabled addcomponent jedit getproperty lookandfeel primaryfont fontselector jedit getfontproperty addcomponent jedit getproperty primaryfont primaryfont secondaryfont fontselector jedit getfontproperty addcomponent jedit getproperty secondaryfont secondaryfont updateenabled jtextfield jedit getproperty addcomponent jedit getproperty menuspillover jtextfield jedit getproperty addcomponent jedit getproperty menuspillover menuspillover addseparator showsplash jcheckbox jedit getproperty showsplash settingsdirectory jedit getsettingsdirectory settingsdirectory showsplash setselected showsplash setselected settingsdirectory addcomponent showsplash showtips jcheckbox jedit getproperty showtips showtips setselected jedit getbooleanproperty addcomponent showtips addseparator addcomponent guiutilities createmultilinelabel jedit getproperty jedit textcolors jcheckbox jedit getproperty textcolors textcolors setselected jedit getbooleanproperty textcolors addcomponent textcolors decorateframes jcheckbox jedit getproperty decorateframes decorateframes setselected jedit getbooleanproperty decoratedialogs jcheckbox jedit getproperty decoratedialogs decoratedialogs setselected jedit getbooleanproperty operatingsystem hasjava14 addcomponent decorateframes addcomponent decoratedialogs look and feel add action listener new action listener public void action performed action event evt update enabled lookandfeel addactionlistener actionlistener actionperformed actionevent updateenabled save method protected void save string lf lfs look and feel get selected index get class name j edit set property look and feel lf j edit set font property metal primary font primary font get font j edit set font property metal secondary font secondary font get font j edit set property history history get text j edit set property menu spillover menu spillover get text j edit set boolean property tip show show tips is selected this is handled a little differently from other j edit settings as the splash screen flag needs to be known very early in the startup sequence before the user properties have been loaded string settings directory j edit get settings directory if settings directory null file file new file settings directory nosplash if show splash is selected file delete else file output stream out null try out new file output stream file out write n out close catch io exception io log log log error this io finally try if out null out close catch io exception e j edit set boolean property text colors text colors is selected j edit set boolean property decorate frames decorate frames is selected j edit set boolean property decorate dialogs decorate dialogs is selected _save _save lookandfeel getselectedindex getclassname jedit setproperty lookandfeel jedit setfontproperty primaryfont getfont jedit setfontproperty secondaryfont getfont jedit setproperty gettext jedit setproperty menuspillover gettext jedit setbooleanproperty showtips isselected jedit settingsdirectory jedit getsettingsdirectory settingsdirectory settingsdirectory showsplash isselected fileoutputstream fileoutputstream ioexception ioexception jedit setbooleanproperty textcolors textcolors isselected jedit setbooleanproperty decorateframes isselected jedit setbooleanproperty decoratedialogs isselected update enabled method private void update enabled string class name lfs look and feel get selected index get class name if class name equals javax swing plaf metal metal look and feel class name equals com incors plaf kunststoff kunststoff look and feel primary font set enabled true secondary font set enabled true else primary font set enabled false secondary font set enabled false updateenabled updateenabled classname lookandfeel getselectedindex getclassname classname metallookandfeel classname kunststofflookandfeel primaryfont setenabled secondaryfont setenabled primaryfont setenabled secondaryfont setenabled creates a vfs update message param path the path in question public vfs update string path super null if path null throw new null pointer exception path must be non null this path path vfsupdate nullpointerexception returns the path that changed public string get path return path getpath public string param string return path path super param string paramstring paramstring files changed dialog constructor public files changed dialog view view int states boolean already reloaded super view j edit get property files changed title false this view view j panel content new j panel new border layout 12 12 content set border new empty border 12 12 12 12 set content pane content box icon box new box box layout y axis icon box add new j label ui manager get icon option pane warning icon icon box add box create glue content add border layout west icon box j panel center panel new j panel new border layout j label label new j label j edit get property files changed caption label set border new empty border 0 0 6 0 center panel add border layout north label default mutable tree node deleted new default mutable tree node j edit get property files changed deleted true default mutable tree node changed new default mutable tree node j edit get property files changed changed already reloaded auto true default mutable tree node changed dirty new default mutable tree node j edit get property files changed changed dirty already reloaded auto true buffer buffers j edit get buffers for int i 0 i states length i buffer buffer buffers i default mutable tree node add to switch states i case buffer file deleted add to deleted break case buffer file changed add to buffer is dirty changed dirty changed break default add to null break if add to null add to add new default mutable tree node buffer get path root new default mutable tree node true if deleted get child count 0 root add deleted if changed get child count 0 root add changed if changed dirty get child count 0 root add changed dirty buffer tree model new default tree model root buffer tree new j tree buffer tree model buffer tree set root visible false buffer tree set visible row count 10 buffer tree set cell renderer new renderer buffer tree get selection model add tree selection listener new tree handler buffer tree get selection model set selection mode tree selection model discontiguous tree selection center panel add border layout center new j scroll pane buffer tree content add border layout center center panel box buttons new box box layout x axis buttons add box create glue if already reloaded select all new j button j edit get property files changed select all select all set mnemonic j edit get property files changed select all mnemonic char at 0 buttons add select all select all add action listener new action handler buttons add box create horizontal strut 12 reload new j button j edit get property files changed reload reload set mnemonic j edit get property files changed reload mnemonic char at 0 buttons add reload reload add action listener new action handler buttons add box create horizontal strut 12 close new j button j edit get property common close get root pane set default button close buttons add close close add action listener new action handler buttons add box create glue content add border layout south buttons buffer tree expand path new tree path new object root deleted buffer tree expand path new tree path new object root changed buffer tree expand path new tree path new object root changed dirty gui utilities request focus this buffer tree update enabled pack set location relative to view set visible true fileschangeddialog fileschangeddialog alreadyreloaded jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane iconbox boxlayout y_axis iconbox jlabel uimanager geticon optionpane warningicon iconbox createglue borderlayout iconbox jpanel centerpanel jpanel borderlayout jlabel jlabel jedit getproperty setborder emptyborder centerpanel borderlayout defaultmutabletreenode defaultmutabletreenode jedit getproperty defaultmutabletreenode defaultmutabletreenode jedit getproperty alreadyreloaded defaultmutabletreenode changeddirty defaultmutabletreenode jedit getproperty alreadyreloaded jedit getbuffers defaultmutabletreenode addto file_deleted addto file_changed addto isdirty changeddirty addto addto addto defaultmutabletreenode getpath defaultmutabletreenode getchildcount getchildcount changeddirty getchildcount changeddirty buffertreemodel defaulttreemodel buffertree jtree buffertreemodel buffertree setrootvisible buffertree setvisiblerowcount buffertree setcellrenderer buffertree getselectionmodel addtreeselectionlistener treehandler buffertree getselectionmodel setselectionmode treeselectionmodel discontiguous_tree_selection centerpanel borderlayout jscrollpane buffertree borderlayout centerpanel boxlayout x_axis createglue alreadyreloaded selectall jbutton jedit getproperty selectall setmnemonic jedit getproperty charat selectall selectall addactionlistener actionhandler createhorizontalstrut jbutton jedit getproperty setmnemonic jedit getproperty charat addactionlistener actionhandler createhorizontalstrut jbutton jedit getproperty getrootpane setdefaultbutton addactionlistener actionhandler createglue borderlayout buffertree expandpath treepath buffertree expandpath treepath buffertree expandpath treepath changeddirty guiutilities requestfocus buffertree updateenabled setlocationrelativeto setvisible ok method public void ok dispose cancel method public void cancel dispose update enabled method private void update enabled tree path paths buffer tree get selection paths boolean enabled false if paths null for int i 0 i paths length i object path paths i get path if path length 3 enabled true if reload null reload set enabled enabled updateenabled updateenabled treepath buffertree getselectionpaths getpath setenabled select all method private void select all select all in progress true tree node path new tree node 3 path 0 root for int i 0 i root get child count i default mutable tree node node default mutable tree node root get child at i path 1 node for int j 0 j node get child count j default mutable tree node node2 default mutable tree node node get child at j path 2 node2 buffer tree get selection model add selection path new tree path path select all in progress false update enabled selectall selectall selectallinprogress treenode treenode getchildcount defaultmutabletreenode defaultmutabletreenode getchildat getchildcount defaultmutabletreenode defaultmutabletreenode getchildat buffertree getselectionmodel addselectionpath treepath selectallinprogress updateenabled reload method private void reload tree path paths buffer tree get selection paths if paths null paths length 0 return int row buffer tree get row for path paths 0 for int i 0 i paths length i tree path path paths i is it a header if path get path count 2 continue default mutable tree node node default mutable tree node path get last path component if node get user object instanceof string return buffer buffer j edit get buffer string node get user object if buffer null return buffer reload view default mutable tree node parent default mutable tree node node get parent parent remove node buffer tree model reload root we expand those that are non empty and remove those that are empty tree node nodes root null remove empty category branches for int j 0 j root get child count j default mutable tree node node default mutable tree node root get child at j if root get child at j get child count 0 root remove j j else nodes 1 node buffer tree expand path new tree path nodes if root get child count 0 dispose else if row buffer tree get row count row buffer tree get row count 1 tree path path buffer tree get path for row row if path get path count 2 selected a header skip to the next row buffer tree set selection row row 1 else buffer tree set selection path path treepath buffertree getselectionpaths buffertree getrowforpath treepath getpathcount defaultmutabletreenode defaultmutabletreenode getlastpathcomponent getuserobject jedit getbuffer getuserobject defaultmutabletreenode defaultmutabletreenode getparent buffertreemodel treenode getchildcount defaultmutabletreenode defaultmutabletreenode getchildat getchildat getchildcount buffertree expandpath treepath getchildcount buffertree getrowcount buffertree getrowcount treepath buffertree getpathforrow getpathcount buffertree setselectionrow buffertree setselectionpath public void action performed action event evt object source evt get source if source select all select all else if source reload reload else if source close dispose actionperformed actionevent getsource selectall selectall public void value changed tree selection event evt if select all in progress return update enabled tree path paths buffer tree get selection paths if paths null paths length 0 return tree path path paths paths length 1 default mutable tree node node default mutable tree node path get last path component if node get user object instanceof string buffer buffer j edit get buffer string node get user object if buffer null view go to buffer buffer valuechanged treeselectionevent selectallinprogress updateenabled treepath buffertree getselectionpaths treepath defaultmutabletreenode defaultmutabletreenode getlastpathcomponent getuserobject jedit getbuffer getuserobject gotobuffer public renderer entry font ui manager get font tree font if entry font null entry font j edit get font property metal secondary font group font entry font derive font font bold entryfont uimanager getfont entryfont entryfont jedit getfontproperty groupfont entryfont derivefont public component get tree cell renderer component j tree tree object value boolean selected boolean expanded boolean leaf int row boolean has focus super get tree cell renderer component tree value selected expanded leaf row has focus default mutable tree node node default mutable tree node value if node get parent tree get model get root this set font group font else this set font entry font set icon null return this gettreecellrenderercomponent jtree hasfocus gettreecellrenderercomponent hasfocus defaultmutabletreenode defaultmutabletreenode getparent getmodel getroot setfont groupfont setfont entryfont seticon re token repeated int sub index re token token int min int max super sub index this token token this min min this max max retokenrepeated subindex retoken subindex sets the minimal matching mode to true void make stingy stingy true makestingy queries if this token has minimal matching enabled boolean is stingy return stingy isstingy the minimum length of a repeated token is the minimum length of the token multiplied by the minimum number of times it must match int get minimum length return min token get minimum length getminimumlength getminimumlength boolean match char indexed input re match mymatch number of times we ve matched so far int num repeats 0 possible positions for the next repeat to match at re match new match mymatch re match last null re match current add the 0 repeats index positions element at z position in input after z matches vector positions new vector positions add element new match declare variables used in loop re match doables re match doables last re match recurrent do check for stingy match for each possibility if stingy num repeats min re match result match rest input new match if result null mymatch assign from result return true doables null doables last null try next repeat at all possible positions for current new match current null current current next recurrent re match current clone if token match input recurrent add all items in current to doables array if doables null doables recurrent doables last recurrent else order these from longest to shortest start by assuming longest more repeats doables last next recurrent find new doables last while doables last next null doables last doables last next if none of the possibilities worked out break out of do while if doables null break reassign where the next repeat can match new match doables increment how many repeats we ve successfully found num repeats positions add element new match while num repeats max if there aren t enough repeats then fail if num repeats min return false we re greedy but ease off until a true match is found int pos index positions size at this point we ve either got too many or just the right amount see if this num repeats works with the rest of the regexp re match all results null re match all results last null re match results null while pos index min new match re match positions element at pos index results match rest input new match if results null if all results null all results results all results last results else order these from longest to shortest start by assuming longest more repeats all results last next results find new doables last while all results last next null all results last all results last next else did not match rest of the tokens try again on smaller sample if all results null mymatch assign from all results does this get all return true if we fall out no matches return false charindexed rematch numrepeats rematch newmatch rematch rematch elementat addelement newmatch rematch rematch doableslast rematch numrepeats rematch matchrest newmatch assignfrom doableslast newmatch rematch doableslast doableslast doableslast doableslast doableslast doableslast newmatch numrepeats addelement newmatch numrepeats numrepeats posindex numrepeats rematch allresults rematch allresultslast rematch posindex newmatch rematch elementat posindex matchrest newmatch allresults allresults allresultslast allresultslast doableslast allresultslast allresultslast allresultslast allresults assignfrom allresults private re match match rest char indexed input final re match new match re match current single re match done index null re match done index last null test all possible matches for this number of repeats for current new match current null current current next clone separates a single match from the chain single re match current clone if next input single chain results to done index if done index null done index single done index last single else done index last next single find new done index last while done index last next null done index last done index last next return done index rematch matchrest charindexed rematch newmatch rematch rematch doneindex rematch doneindexlast newmatch rematch doneindex doneindex doneindex doneindexlast doneindexlast doneindexlast doneindexlast doneindexlast doneindexlast doneindex void dump string buffer os os append token dump all os os append if max integer max value min 1 os append min 0 else if min 0 max 1 os append else os append append min if max min os append if max integer max value os append max os append if stingy os append stringbuffer dumpall max_value max_value boolean is interface bsh class declaration int id super id isinterface bshclassdeclaration public object eval call stack callstack interpreter interpreter throws eval error int child 0 resolve superclass if any class super class null if extend bsh ambiguous name super node bsh ambiguous name jjt get child child super class super node to class callstack interpreter get interfaces class interfaces new class num interfaces for int i 0 i num interfaces i bsh ambiguous name node bsh ambiguous name jjt get child child interfaces i node to class callstack interpreter if interfaces i is interface throw new eval error type node text is not an interface this callstack bsh block block get the class body bsh block if child jjt get num children block bsh block jjt get child child else block new bsh block parser tree constants jjtblock try return class generator get class generator generate class name modifiers interfaces super class block is interface callstack interpreter catch util eval error e throw e to eval error this callstack callstack evalerror superclass bshambiguousname supernode bshambiguousname jjtgetchild superclass supernode toclass numinterfaces numinterfaces bshambiguousname bshambiguousname jjtgetchild toclass isinterface evalerror bshblock bshblock jjtgetnumchildren bshblock jjtgetchild bshblock parsertreeconstants classgenerator getclassgenerator generateclass superclass isinterface utilevalerror toevalerror public string to string return class declaration name tostring classdeclaration private boolean parsed bsh for statement int id super id bshforstatement public object eval call stack callstack interpreter interpreter throws eval error int i 0 if has for init for init simple node jjt get child i if has expression expression simple node jjt get child i if has for update for update simple node jjt get child i if i jjt get num children should normally be statement simple node jjt get child i name space enclosing name space callstack top block name space for name space new block name space enclosing name space note some interesting things are going on here 1 we swap instead of push the primary mode of operation acts like we are in the enclosing namespace super must be preserved etc 2 we do not call the body block eval with the namespace override instead we allow it to create a second subordinate block name space child of the for name space variable propogation still works through the chain but the block s child cleans the state between iteration which is correct java behavior see forscope4 bsh put for name space it on the top of the stack note it s important that there is only one exit point from this method so that we can swap back the namespace callstack swap for name space do the for init if has for init for init eval callstack interpreter object return control primitive void while true if has expression boolean cond bsh if statement evaluate condition expression callstack interpreter if cond break boolean breakout false switch eats a multi level break here if statement null not empty statement do not invoke special override for block see above object ret statement eval callstack interpreter if ret instanceof return control switch return control ret kind case return return control ret breakout true break case continue break case break breakout true break if breakout break if has for update for update eval callstack interpreter callstack swap enclosing name space put it back return return control callstack evalerror hasforinit forinit simplenode jjtgetchild hasexpression simplenode jjtgetchild hasforupdate forupdate simplenode jjtgetchild jjtgetnumchildren simplenode jjtgetchild namespace enclosingnamespace blocknamespace fornamespace blocknamespace enclosingnamespace blocknamespace fornamespace fornamespace fornamespace hasforinit forinit returncontrol hasexpression bshifstatement evaluatecondition returncontrol returncontrol returncontrol hasforupdate forupdate enclosingnamespace returncontrol public object value bsh literal int id super id bshliteral public object eval call stack callstack interpreter interpreter throws eval error if value null throw new interpreter error null in bsh literal value return value callstack evalerror interpretererror private char get escape char char ch switch ch case b ch b break case t ch t break case n ch n break case f ch f break case r ch r break do nothing ch already contains correct character case case case break return ch getescapechar public void char setup string str char ch str char at 0 if ch get next character ch str char at 1 if character is digit ch ch char integer parse int str substring 1 8 else ch get escape char ch value new primitive new character ch char value charsetup charat charat isdigit parseint getescapechar charvalue void string setup string str string buffer buffer new string buffer for int i 0 i str length i char ch str char at i if ch get next character ch str char at i if character is digit ch int end pos i check the next two characters while end pos i 2 if character is digit str char at end pos 1 end pos else break ch char integer parse int str substring i end pos 1 8 i end pos else ch get escape char ch buffer append ch value buffer to string stringsetup stringbuffer stringbuffer charat charat isdigit endpos endpos isdigit charat endpos endpos parseint endpos endpos getescapechar tostring re token one of int sub index string options str boolean negative boolean insens super sub index options new vector this negative negative for int i 0 i options str length i options add element new re token char sub index options str char at i insens retokenoneof subindex optionsstr subindex optionsstr addelement retokenchar subindex optionsstr charat re token one of int sub index vector options boolean negative super sub index this options options this negative negative retokenoneof subindex subindex int get minimum length int min integer max value int x for int i 0 i options size i if x re token options element at i get minimum length min min x return min getminimumlength max_value retoken elementat getminimumlength boolean match char indexed input re match mymatch if negative input char at mymatch index char indexed out of bounds return false re match new match null re match last null re token tk boolean is match for int i 0 i options size i tk re token options element at i re match try match re match mymatch clone if tk match input try match match was successful if negative return false if next input try match add try match to list of possibilities if last null new match try match last try match else last next try match last try match next succeeds is a match try next option if new match null if negative return false else set contents of mymatch equal to new match try each one that matched mymatch assign from new match return true else if negative mymatch index return next input mymatch else return false index 1 works for abc lists not for generic lookahead index charindexed rematch charat charindexed out_of_bounds rematch newmatch rematch retoken ismatch retoken elementat rematch trymatch rematch trymatch trymatch trymatch newmatch trymatch trymatch trymatch trymatch newmatch newmatch assignfrom newmatch void dump string buffer os os append negative for int i 0 i options size i if negative i 0 os append re token options element at i dump all os os append negative stringbuffer retoken elementat dumpall docking option pane constructor public docking option pane super docking dockingoptionpane dockingoptionpane init method public void init set layout new border layout add border layout center create window table scroller _init _init setlayout borderlayout borderlayout createwindowtablescroller save method public void save window model save _save _save windowmodel create window table scroller method private j scroll pane create window table scroller window model create window model window table new j table window model window table get table header set reordering allowed false window table set column selection allowed false window table set row selection allowed false window table set cell selection enabled false dock position cell renderer combo box new dock position cell renderer window table set row height combo box get preferred size height table column column window table get column model get column 1 column set cell renderer combo box column set cell editor new default cell editor new dock position cell renderer dimension d window table get preferred size d height math min d height 50 j scroll pane scroller new j scroll pane window table scroller set preferred size d return scroller createwindowtablescroller jscrollpane createwindowtablescroller windowmodel createwindowmodel windowtable jtable windowmodel windowtable gettableheader setreorderingallowed windowtable setcolumnselectionallowed windowtable setrowselectionallowed windowtable setcellselectionenabled dockpositioncellrenderer combobox dockpositioncellrenderer windowtable setrowheight combobox getpreferredsize tablecolumn windowtable getcolumnmodel getcolumn setcellrenderer combobox setcelleditor defaultcelleditor dockpositioncellrenderer windowtable getpreferredsize jscrollpane jscrollpane windowtable setpreferredsize create window model method private window table model create window model return new window table model createwindowmodel windowtablemodel createwindowmodel windowtablemodel dock position cell renderer super new string dockable window manager floating dockable window manager top dockable window manager left dockable window manager bottom dockable window manager right dock position cell renderer this set request focus enabled false dockpositioncellrenderer dockablewindowmanager dockablewindowmanager dockablewindowmanager dockablewindowmanager dockablewindowmanager dockpositioncellrenderer setrequestfocusenabled public component get table cell renderer component j table table object value boolean is selected boolean has focus int row int column set selected item value return this gettablecellrenderercomponent jtable isselected hasfocus setselecteditem window table model constructor window table model windows new vector string dockables dockable window manager get registered dockable windows for int i 0 i dockables length i windows add element new entry dockables i sort windowtablemodel windowtablemodel dockablewindowmanager getregistereddockablewindows addelement sort method public void sort misc utilities quicksort windows new window compare fire table data changed miscutilities windowcompare firetabledatachanged get column count method public int get column count return 2 getcolumncount getcolumncount get row count method public int get row count return windows size getrowcount getrowcount get column class method public class get column class int col switch col case 0 case 1 return string class default throw new internal error getcolumnclass getcolumnclass internalerror get value at method public object get value at int row int col entry window entry windows element at row switch col case 0 return window title case 1 return window dock position default throw new internal error getvalueat getvalueat elementat dockposition internalerror is cell editable method public boolean is cell editable int row int col return col 0 iscelleditable iscelleditable set value at method public void set value at object value int row int col if col 0 return entry window entry windows element at row switch col case 1 window dock position string value break default throw new internal error fire table rows updated row row setvalueat setvalueat elementat dockposition internalerror firetablerowsupdated get column name method public string get column name int index switch index case 0 return j edit get property options docking title case 1 return j edit get property options docking dock position default throw new internal error getcolumnname getcolumnname jedit getproperty jedit getproperty dockposition internalerror save method public void save for int i 0 i windows size i entry windows element at i save elementat entry string name this name name title j edit get property name title if title null title name dock position j edit get property name dock position if dock position null dock position dockable window manager floating jedit getproperty dockposition jedit getproperty dockposition dockposition dockablewindowmanager void save j edit set property name dock position dock position jedit setproperty dockposition public int compare object obj1 object obj2 entry e1 entry obj1 entry e2 entry obj2 return misc utilities compare strings e1 title e2 title true miscutilities comparestrings get name method returns the internal name of this fold handler return the internal name of this fold handler since j edit 4 0pre6 public string get name return name getname foldhandler foldhandler jedit getname get fold level method returns the fold level of the specified line param buffer the buffer in question param line index the line index param seg a segment the fold handler can use to obtain any text from the buffer if necessary return the fold level of the specified line since j edit 4 0pre1 getfoldlevel lineindex jedit equals method returns if the specified fold handler is equal to this one param o the object public boolean equals object o default implementation subclasses can extend this if o null return false else return get class o get class getclass getclass hash code method public int hash code return get class hash code hashcode hashcode getclass hashcode register fold handler method deprecated write a code services xml code file instead see link org gjt sp jedit service manager public static void register fold handler fold handler handler if get fold handler handler get name null log log log error fold handler class cannot register more than one fold handler with the same name return fold handlers add handler registerfoldhandler servicemanager registerfoldhandler foldhandler getfoldhandler getname foldhandler foldhandlers unregister fold handler method deprecated write a code services xml code file instead see link org gjt sp jedit service manager public static void unregister fold handler fold handler handler fold handlers remove handler unregisterfoldhandler servicemanager unregisterfoldhandler foldhandler foldhandlers get fold handlers method deprecated call code service manager get service names org gjt sp jedit buffer fold handler code instead see link org gjt sp jedit service manager public static fold handler get fold handlers fold handler handlers new fold handler fold handlers size return fold handler fold handlers to array handlers getfoldhandlers servicemanager getservicenames foldhandler servicemanager foldhandler getfoldhandlers foldhandler foldhandler foldhandlers foldhandler foldhandlers toarray get fold handler method returns the fold handler with the specified name or null if there is no registered handler with that name param name the name of the desired fold handler since j edit 4 0pre6 public static fold handler get fold handler string name fold handler handler fold handler service manager get service service name if handler null return handler iterator i fold handlers iterator while i has next handler fold handler i next if name equals handler get name return handler return null getfoldhandler jedit foldhandler getfoldhandler foldhandler foldhandler servicemanager getservice foldhandlers hasnext foldhandler getname get fold modes method returns an array containing the names of all registered fold handlers since j edit 4 0pre6 public static string get fold modes fold handler handlers get fold handlers string new api service manager get service names service string fold modes new string handlers length new api length system arraycopy new api 0 fold modes 0 new api length for int i 0 i handlers length i fold modes i new api length handlers i get name arrays sort fold modes new misc utilities string compare return fold modes getfoldmodes jedit getfoldmodes foldhandler getfoldhandlers newapi servicemanager getservicenames foldmodes newapi newapi foldmodes newapi foldmodes newapi getname foldmodes miscutilities stringcompare foldmodes fold handler constructor protected fold handler string name this name name foldhandler foldhandler to string method public string to string return name tostring tostring get entry method public static entry get entry string path iterator iter history iterator while iter has next entry entry entry iter next if paths case insensitive if entry path equals ignore case path return entry else if entry path equals path return entry return null getentry getentry hasnext pathscaseinsensitive equalsignorecase set entry method public static void set entry string path int caret selection selection string encoding remove entry path add entry new entry path caret selection to string selection encoding edit bus send new dynamic menu changed recent files setentry setentry removeentry addentry selectiontostring editbus dynamicmenuchanged get history method since j edit 4 2pre2 public static list get history return history gethistory jedit gethistory get buffer history method deprecated call link get history instead public static vector get buffer history vector ret val new vector history size iterator iter history iterator while iter has next ret val add iter next return ret val getbufferhistory gethistory getbufferhistory retval hasnext retval retval load method public static void load string settings directory j edit get settings directory if settings directory null return file recent new file misc utilities construct path settings directory recent xml if recent exists return recent mod time recent last modified log log log message buffer history class loading recent xml recent handler handler new recent handler xml parser parser new xml parser reader in null parser set handler handler try in new buffered reader new file reader recent parser parse null null in catch xml exception xe int line xe get line string message xe get message log log log error buffer history class recent line message catch file not found exception fnf log log log debug buffer history class fnf catch exception e log log log error buffer history class e finally try if in null in close catch io exception io log log log error buffer history class io settingsdirectory jedit getsettingsdirectory settingsdirectory miscutilities constructpath settingsdirectory recentmodtime lastmodified bufferhistory recenthandler recenthandler xmlparser xmlparser sethandler bufferedreader filereader xmlexception getline getmessage bufferhistory filenotfoundexception bufferhistory bufferhistory ioexception bufferhistory save method public static void save string settings directory j edit get settings directory if settings directory null return file file1 new file misc utilities construct path settings directory recent xml save file file2 new file misc utilities construct path settings directory recent xml if file2 exists file2 last modified recent mod time log log log warning buffer history class file2 changed on disk will not save recent files return j edit backup settings file file2 log log log message buffer history class saving file1 string line sep system get property line separator boolean ok false buffered writer out null try out new buffered writer new file writer file1 out write xml version 1 0 out write line sep out write doctype recent system recent dtd out write line sep out write recent out write line sep iterator iter history iterator while iter has next out write entry out write line sep entry entry entry iter next out write path out write misc utilities chars to entities entry path out write path out write line sep out write caret out write string value of entry caret out write caret out write line sep if entry selection null entry selection length 0 out write selection out write entry selection out write selection out write line sep if entry encoding null out write encoding out write entry encoding out write encoding out write line sep out write entry out write line sep out write recent out write line sep out close ok true catch exception e log log log error buffer history class e finally try if out null out close catch io exception e if ok to avoid data loss only do this if the above completed successfully file2 delete file1 rename to file2 recent mod time file2 last modified settingsdirectory jedit getsettingsdirectory settingsdirectory miscutilities constructpath settingsdirectory miscutilities constructpath settingsdirectory lastmodified recentmodtime bufferhistory jedit backupsettingsfile bufferhistory linesep getproperty bufferedwriter bufferedwriter filewriter linesep linesep linesep hasnext linesep miscutilities charstoentities linesep valueof linesep linesep linesep linesep linesep bufferhistory ioexception renameto recentmodtime lastmodified add entry method private static void add entry entry entry history add first entry int max j edit get integer property recent files 50 while history size max history remove last addentry addentry addfirst jedit getintegerproperty recentfiles removelast remove entry method private static void remove entry string path iterator iter history iterator while iter has next entry entry entry iter next if paths case insensitive if entry path equals ignore case path iter remove return else if entry path equals path iter remove return removeentry removeentry hasnext pathscaseinsensitive equalsignorecase selection to string method private static string selection to string selection s if s null return null string buffer buf new string buffer for int i 0 i s length i if i 0 buf append selection sel s i if sel instanceof selection range buf append range else if sel instanceof selection rect buf append rect buf append sel get start buf append buf append sel get end return buf to string selectiontostring selectiontostring stringbuffer stringbuffer getstart getend tostring string to selection method private static selection string to selection string s if s null return null vector selection new vector string tokenizer st new string tokenizer s while st has more tokens string type st next token int start integer parse int st next token int end integer parse int st next token if end start i m not sure when this can happen but it does sometimes witness the j edit bug tracker continue selection sel if type equals range sel new selection range start end else if type equals rect sel new selection rect start end selection add element sel selection return value new selection selection size selection copy into return value return return value stringtoselection stringtoselection stringtokenizer stringtokenizer hasmoretokens nexttoken parseint nexttoken parseint nexttoken jedit addelement returnvalue copyinto returnvalue returnvalue public string encoding public selection get selection return string to selection selection getselection stringtoselection public entry string path int caret string selection string encoding this path path this caret caret this selection selection this encoding encoding public string to string return path caret tostring public void end document throws java lang exception int max j edit get integer property recent files 50 while history size max history remove last enddocument jedit getintegerproperty recentfiles removelast public object resolve entity string public id string system id if recent dtd equals system id this will result in a slight speed up since we don t need to read the dtd anyway as a elfred is non validating return new string reader try return new buffered reader new input stream reader get class get resource as stream recent dtd catch exception e log log log error this error while opening recent dtd log log log error this e return null resolveentity publicid systemid systemid aelfred stringreader bufferedreader inputstreamreader getclass getresourceasstream public void doctype decl string name string public id string system id throws exception if recent equals name return log log log error this recent xml doctype must be recent doctypedecl publicid systemid public void end element string name if name equals entry history add last new entry path caret selection encoding path null caret 0 selection null encoding null else if name equals path path char data else if name equals caret caret integer parse int char data else if name equals selection selection char data else if name equals encoding encoding char data endelement addlast chardata parseint chardata chardata chardata public void char data char ch int start int length char data new string ch start length chardata chardata view option pane constructor public view option pane super view viewoptionpane viewoptionpane init method protected void init view dock layout layout icon1 gui utilities load icon dock layout1 png layout icon2 gui utilities load icon dock layout2 png layout icon3 gui utilities load icon dock layout3 png layout icon4 gui utilities load icon dock layout4 png j panel layout panel new j panel new border layout 12 12 if j edit get boolean property view docking alternate layout layout new j label j edit get boolean property view toolbar alternate layout layout icon4 layout icon2 else layout new j label j edit get boolean property view toolbar alternate layout layout icon3 layout icon1 layout set border new empty border 12 12 12 12 layout panel add border layout center layout j panel buttons new j panel new grid layout 2 1 12 12 buttons set border new empty border 0 12 12 12 buttons add alternate docking layout new j button j edit get property options view alternate docking layout alternate docking layout add action listener new action handler buttons add alternate tool bar layout new j button j edit get property options view alternate tool bar layout alternate tool bar layout add action listener new action handler layout panel add border layout south buttons titled border border new titled border j edit get property options view view layout border set title justification titled border center layout panel set border border add component layout panel show full path show full path new j check box j edit get property options view show full path show full path set selected j edit get boolean property view show full path add component show full path show search bar show searchbar new j check box j edit get property options view show searchbar show searchbar set selected j edit get boolean property view show searchbar add component show searchbar beep on search auto wrap beep on search auto wrap new j check box j edit get property options view beep on search auto wrap beep on search auto wrap set selected j edit get boolean property search beep on search auto wrap add component beep on search auto wrap show buffer switcher show buffer switcher new j check box j edit get property options view show buffer switcher show buffer switcher set selected j edit get boolean property view show buffer switcher add component show buffer switcher _init _init layouticon1 guiutilities loadicon dock_layout1 layouticon2 guiutilities loadicon dock_layout2 layouticon3 guiutilities loadicon dock_layout3 layouticon4 guiutilities loadicon dock_layout4 jpanel layoutpanel jpanel borderlayout jedit getbooleanproperty alternatelayout jlabel jedit getbooleanproperty alternatelayout layouticon4 layouticon2 jlabel jedit getbooleanproperty alternatelayout layouticon3 layouticon1 setborder emptyborder layoutpanel borderlayout jpanel jpanel gridlayout setborder emptyborder alternatedockinglayout jbutton jedit getproperty alternatedockinglayout alternatedockinglayout addactionlistener actionhandler alternatetoolbarlayout jbutton jedit getproperty alternatetoolbarlayout alternatetoolbarlayout addactionlistener actionhandler layoutpanel borderlayout titledborder titledborder jedit getproperty viewlayout settitlejustification titledborder layoutpanel setborder addcomponent layoutpanel showfullpath jcheckbox jedit getproperty showfullpath showfullpath setselected jedit getbooleanproperty showfullpath addcomponent showfullpath showsearchbar jcheckbox jedit getproperty showsearchbar showsearchbar setselected jedit getbooleanproperty showsearchbar addcomponent showsearchbar beeponsearchautowrap jcheckbox jedit getproperty beeponsearchautowrap beeponsearchautowrap setselected jedit getbooleanproperty beeponsearchautowrap addcomponent beeponsearchautowrap showbufferswitcher jcheckbox jedit getproperty showbufferswitcher showbufferswitcher setselected jedit getbooleanproperty showbufferswitcher addcomponent showbufferswitcher save method protected void save j edit set boolean property view docking alternate layout layout get icon layout icon2 layout get icon layout icon4 j edit set boolean property view toolbar alternate layout layout get icon layout icon3 layout get icon layout icon4 j edit set boolean property view show full path show full path is selected j edit set boolean property view show searchbar show searchbar is selected j edit set boolean property search beep on search auto wrap beep on search auto wrap is selected j edit set boolean property view show buffer switcher show buffer switcher is selected _save _save jedit setbooleanproperty alternatelayout geticon layouticon2 geticon layouticon4 jedit setbooleanproperty alternatelayout geticon layouticon3 geticon layouticon4 jedit setbooleanproperty showfullpath showfullpath isselected jedit setbooleanproperty showsearchbar showsearchbar isselected jedit setbooleanproperty beeponsearchautowrap beeponsearchautowrap isselected jedit setbooleanproperty showbufferswitcher showbufferswitcher isselected public void action performed action event evt if evt get source alternate docking layout if layout get icon layout icon1 layout set icon layout icon2 else if layout get icon layout icon2 layout set icon layout icon1 else if layout get icon layout icon3 layout set icon layout icon4 else if layout get icon layout icon4 layout set icon layout icon3 else if evt get source alternate tool bar layout if layout get icon layout icon1 layout set icon layout icon3 else if layout get icon layout icon3 layout set icon layout icon1 else if layout get icon layout icon2 layout set icon layout icon4 else if layout get icon layout icon4 layout set icon layout icon2 actionperformed actionevent getsource alternatedockinglayout geticon layouticon1 seticon layouticon2 geticon layouticon2 seticon layouticon1 geticon layouticon3 seticon layouticon4 geticon layouticon4 seticon layouticon3 getsource alternatetoolbarlayout geticon layouticon1 seticon layouticon3 geticon layouticon3 seticon layouticon1 geticon layouticon2 seticon layouticon4 geticon layouticon4 seticon layouticon2 line element constructor public line element buffer buffer int line this buffer buffer this line line lineelement lineelement get document method public document get document return null getdocument getdocument get parent element method public element get parent element return null getparentelement getparentelement get name method public string get name return null getname getname get attributes method public attribute set get attributes return null getattributes attributeset getattributes get start offset method public int get start offset return buffer get line start offset line getstartoffset getstartoffset getlinestartoffset get end offset method public int get end offset return buffer get line end offset line getendoffset getendoffset getlineendoffset get element index method public int get element index int offset return 0 getelementindex getelementindex get element count method public int get element count return 0 getelementcount getelementcount get element method public element get element int line return null getelement getelement is leaf method public boolean is leaf return true isleaf isleaf rollover button constructor setup the border invisible initially public rollover button if operating system has java15 set content area filled false if method null try method invoke this new boolean boolean true catch exception e log log log error this e else add mouse listener new mouse over handler rolloverbutton rolloverbutton operatingsystem hasjava15 setcontentareafilled addmouselistener mouseoverhandler rollover button constructor setup the border invisible initially public rollover button icon icon this set icon icon rolloverbutton rolloverbutton seticon updateui method public void updateui if operating system is windows workaround for uncooperative windows l f setui new basic buttonui else super updateui set border new etched border set border painted false set margin new insets 1 1 1 1 set request focus enabled false operatingsystem iswindows basicbuttonui setborder etchedborder setborderpainted setmargin setrequestfocusenabled is opaque method public boolean is opaque return false isopaque isopaque set enabled method public void set enabled boolean b super set enabled b if method null set border painted false repaint setenabled setenabled setenabled setborderpainted set border painted method public void set border painted boolean b try revalidate blocked true super set border painted b finally revalidate blocked false setborderpainted setborderpainted revalidateblocked setborderpainted revalidateblocked revalidate method we block calls to revalidate from a set border painted for performance reasons public void revalidate if revalidate blocked super revalidate setborderpainted revalidateblocked paint method public void paint graphics g if method null is enabled super paint g else graphics2d g2 graphics2d g g2 set composite c super paint g2 isenabled setcomposite public void mouse entered mouse event e if is enabled set border painted true mouseentered mouseevent isenabled setborderpainted public void mouse exited mouse event e set border painted false mouseexited mouseevent setborderpainted help viewer constructor creates a new help viewer with the default help page since j edit 4 0pre4 public help viewer this welcome html helpviewer jedit helpviewer help viewer constructor creates a new help viewer for the specified url param url the url public help viewer url url this url to string helpviewer helpviewer tostring help viewer constructor creates a new help viewer for the specified url param url the url public help viewer string url super j edit get property helpviewer title set icon image gui utilities get editor icon try baseurl new file misc utilities construct path j edit getj edit home doc tourl to string catch malformedurl exception mu log log log error this mu what to do history new string 25 action handler action listener new action handler j tabbed pane tabs new j tabbed pane tabs add tab j edit get property helpviewer toc label toc new helptoc panel this tabs add tab j edit get property helpviewer search label new help search panel this tabs set minimum size new dimension 0 0 j panel right panel new j panel new border layout j tool bar tool bar new j tool bar tool bar set floatable false tool bar add title new j label tool bar add box create glue j panel buttons new j panel buttons set layout new box layout buttons box layout x axis buttons set border new empty border 0 12 0 0 back new rollover button gui utilities load icon j edit get property helpviewer back icon back set tool tip text j edit get property helpviewer back label back add action listener action listener tool bar add back forward new rollover button gui utilities load icon j edit get property helpviewer forward icon forward add action listener action listener forward set tool tip text j edit get property helpviewer forward label tool bar add forward back set preferred size forward get preferred size right panel add border layout north tool bar viewer new j editor pane viewer set editable false viewer add hyperlink listener new link handler viewer set font new font monospaced font plain 12 viewer add property change listener new property change handler right panel add border layout center new j scroll pane viewer splitter new j split pane j split pane horizontal split tabs right panel splitter set border null get content pane add border layout center splitter gotourl url true set default close operation dispose on close get root pane set preferred size new dimension 750 500 pack gui utilities load geometry this helpviewer edit bus add to bus this set visible true swing utilities invoke later new runnable public void run splitter set divider location j edit get integer property helpviewer splitter 250 viewer request focus helpviewer helpviewer jedit getproperty seticonimage guiutilities geteditoricon miscutilities constructpath jedit getjedithome tostring malformedurlexception actionhandler actionlistener actionhandler jtabbedpane jtabbedpane addtab jedit getproperty helptocpanel addtab jedit getproperty helpsearchpanel setminimumsize jpanel rightpanel jpanel borderlayout jtoolbar toolbar jtoolbar toolbar setfloatable toolbar jlabel toolbar createglue jpanel jpanel setlayout boxlayout boxlayout x_axis setborder emptyborder rolloverbutton guiutilities loadicon jedit getproperty settooltiptext jedit getproperty addactionlistener actionlistener toolbar rolloverbutton guiutilities loadicon jedit getproperty addactionlistener actionlistener settooltiptext jedit getproperty toolbar setpreferredsize getpreferredsize rightpanel borderlayout toolbar jeditorpane seteditable addhyperlinklistener linkhandler setfont addpropertychangelistener propertychangehandler rightpanel borderlayout jscrollpane jsplitpane jsplitpane horizontal_split rightpanel setborder getcontentpane borderlayout setdefaultcloseoperation dispose_on_close getrootpane setpreferredsize guiutilities loadgeometry editbus addtobus setvisible swingutilities invokelater setdividerlocation jedit getintegerproperty requestfocus public void run splitter set divider location j edit get integer property helpviewer splitter 250 viewer request focus setdividerlocation jedit getintegerproperty requestfocus gotourl method displays the specified url in the html component param url the url param add to history should the url be added to the back forward history public void gotourl string url boolean add to history the toc pane looks up user s guide ur ls relative to the doc directory string shorturl if misc utilities isurl url if url starts with baseurl shorturl url substring baseurl length if shorturl starts with shorturl shorturl substring 1 else shorturl url else shorturl url if baseurl ends with url baseurl url else url baseurl url reset default cursor so that the hand cursor doesn t stick around viewer set cursor cursor get default cursor url url null try url new url url if url equals viewer get page title set text j edit get property helpviewer loading else don t show loading msg because we won t receive a property changed viewer set page url if add to history history history pos url if history pos 1 history length system arraycopy history 1 history 0 history length 1 history history pos null else history pos catch malformedurl exception mf log log log error this mf string args url mf get message gui utilities error this badurl args return catch io exception io log log log error this io string args url io to string gui utilities error this read error args return this shorturl shorturl select the appropriate tree node if shorturl null toc select node shorturl addtohistory addtohistory urls miscutilities startswith startswith endswith setcursor getdefaultcursor _url _url _url getpage settext jedit getproperty propertychanged setpage _url addtohistory historypos historypos historypos historypos malformedurlexception getmessage guiutilities ioexception tostring guiutilities selectnode dispose method public void dispose edit bus remove from bus this j edit set integer property helpviewer splitter splitter get divider location gui utilities save geometry this helpviewer super dispose editbus removefrombus jedit setintegerproperty getdividerlocation guiutilities savegeometry handle message method public void handle message eb message msg if msg instanceof plugin update plugin update pmsg plugin update msg if pmsg get what plugin update loaded pmsg get what plugin update unloaded if pmsg is exiting if queuedtoc reload queuetoc reload queuedtoc reload true handlemessage handlemessage ebmessage pluginupdate pluginupdate pluginupdate getwhat pluginupdate getwhat pluginupdate isexiting queuedtocreload queuetocreload queuedtocreload get baseurl method public string get baseurl return baseurl getbaseurl getbaseurl get shorturl method string get shorturl return shorturl getshorturl getshorturl queuetoc reload method public void queuetoc reload swing utilities invoke later new runnable public void run queuedtoc reload false toc load queuetocreload queuetocreload swingutilities invokelater queuedtocreload public void run queuedtoc reload false toc load queuedtocreload action performed class public void action performed action event evt object source evt get source if source back if history pos 1 get toolkit beep else string url history history pos 1 gotourl url false else if source forward if history length history pos 1 get toolkit beep else string url history history pos if url null get toolkit beep else history pos gotourl url false actionperformed actionperformed actionevent getsource historypos gettoolkit historypos historypos gettoolkit historypos gettoolkit historypos hyperlink update method public void hyperlink update hyperlink event evt if evt get event type hyperlink event event type activated if evt instanceof html frame hyperlink event html document viewer get document processhtml frame hyperlink event html frame hyperlink event evt else url url evt geturl if url null gotourl url to string true else if evt get event type hyperlink event event type entered viewer set cursor cursor get predefined cursor cursor hand cursor else if evt get event type hyperlink event event type exited viewer set cursor cursor get default cursor hyperlinkupdate hyperlinkupdate hyperlinkevent geteventtype hyperlinkevent eventtype htmlframehyperlinkevent htmldocument getdocument processhtmlframehyperlinkevent htmlframehyperlinkevent tostring geteventtype hyperlinkevent eventtype setcursor getpredefinedcursor hand_cursor geteventtype hyperlinkevent eventtype setcursor getdefaultcursor public void property change property change event evt if page equals evt get property name string title str string viewer get document get property title if title str null title str misc utilities get file name viewer get page to string title set text title str propertychange propertychangeevent getpropertyname titlestr getdocument getproperty titlestr titlestr miscutilities getfilename getpage tostring settext titlestr public install thread install installer progress progress string install dir operating system os task os tasks int size vector components super install thread this installer installer this progress progress this install dir install dir this os tasks os tasks this size size this components components installthread installdir operatingsystem ostask ostasks installdir installdir ostasks ostasks public void run progress set maximum size 1024 try install user selected packages for int i 0 i components size i string comp string components element at i system err println installing comp install component comp do operating system specific stuff creating startup scripts installing man pages etc for int i 0 i os tasks length i system err println performing task os tasks i get name os tasks i perform install dir components catch file not found exception fnf progress error the installer could not create the destination directory n maybe you do not have write permission return catch io exception io progress error io to string return progress done setmaximum elementat installcomponent ostasks ostasks getname ostasks installdir filenotfoundexception ioexception tostring private void install component string name throws io exception input stream in new buffered input stream get class get resource as stream name tar bz2 skip header bytes maybe should check if they re valid or not in read in read tar input stream tar input new tar input stream new cb zip2 input stream in tar entry entry while entry tar input get next entry null if entry is directory continue string file name entry get name system err println file name string outfile install dir file separator char file name replace file separator char installer copy tar input outfile progress tar input close installcomponent ioexception inputstream bufferedinputstream getclass getresourceasstream tarinputstream tarinput tarinputstream cbzip2inputstream tarentry tarinput getnextentry isdirectory filename getname filename installdir separatorchar filename separatorchar tarinput tarinput private int anchor char indexed string buffer string buffer str int index s str anchor index charindexedstringbuffer stringbuffer public char char at int index int pos anchor index return pos s length pos 0 s char at pos out of bounds charat charat out_of_bounds public boolean is valid return anchor s length isvalid public boolean move int index return anchor index s length action set constructor creates a new action set since j edit 4 0pre1 public action set actions new hashtable loaded true label no label set plugin bug actionset jedit actionset action set constructor creates a new action set param plugin the plugin param cached action names the list of cached action names param cached action toggle flags the list of cached action toggle flags param uri the actions xml uri since j edit 4 2pre2 public action set pluginjar plugin string cached action names boolean cached action toggle flags url uri this this plugin plugin this uri uri if cached action names null for int i 0 i cached action names length i actions put cached action names i placeholder j edit set temporary property cached action names i toggle cached action toggle flags i true false loaded false actionset cachedactionnames cachedactiontoggleflags jedit actionset cachedactionnames cachedactiontoggleflags cachedactionnames cachedactionnames cachedactionnames jedit settemporaryproperty cachedactionnames cachedactiontoggleflags action set constructor creates a new action set param label the label shown in the shortcuts option pane since j edit 4 0pre1 public action set string label this set label label actionset jedit actionset setlabel get label method return the action source label since j edit 4 0pre1 public string get label return label getlabel jedit getlabel set label method sets the action source label param label the label since j edit 4 0pre1 public void set label string label if label null throw new null pointer exception this label label setlabel jedit setlabel nullpointerexception get pluginjar method return the plugin this action set was loaded from or null since j edit 4 2pre13 public pluginjar get pluginjar return plugin getpluginjar jedit getpluginjar add action method adds an action to the action set param action the action since j edit 4 0pre1 public void add action edit action action actions put action get name action if context null context action names null context action hash put action get name this addaction jedit addaction editaction getname actionnames actionhash getname remove action method removes an action from the action set param name the action name since j edit 4 0pre1 public void remove action string name actions remove name if context null context action names null context action hash remove name removeaction jedit removeaction actionnames actionhash remove all actions method removes all actions from the action set since j edit 4 0pre1 public void remove all actions if context null context action names null string actions get action names for int i 0 i actions length i context action hash remove actions i this actions clear removeallactions jedit removeallactions actionnames getactionnames actionhash get action method returns an action with the specified name p b deferred loading b this will load the action set if necessary param name the action name since j edit 4 0pre1 public edit action get action string name object obj actions get name if obj placeholder load obj actions get name if obj placeholder log log log warning this outdated cache obj null return edit action obj getaction jedit editaction getaction editaction get action count method returns the number of actions in the set since j edit 4 0pre1 public int get action count return actions size getactioncount jedit getactioncount get action names method returns an array of all action names in this action set since j edit 4 2pre1 public string get action names string ret val new string actions size enumeration e actions keys int i 0 while e has more elements ret val i string e next element return ret val getactionnames jedit getactionnames retval hasmoreelements retval nextelement retval get cacheable action names method returns an array of all action names in this action set that should be cached namely code bean shell action code s since j edit 4 2pre1 public string get cacheable action names linked list ret val new linked list enumeration e actions elements while e has more elements object obj e next element if obj placeholder this should only be called with fully loaded action set log log log warning this action set not up to date else if obj instanceof bean shell action ret val add bean shell action obj get name return string ret val to array new string ret val size getcacheableactionnames beanshellaction jedit getcacheableactionnames linkedlist retval linkedlist hasmoreelements nextelement beanshellaction retval beanshellaction getname retval toarray retval get actions method returns an array of all actions in this action set p b deferred loading b this will load the action set if necessary since j edit 4 0pre1 public edit action get actions load edit action ret val new edit action actions size enumeration e actions elements int i 0 while e has more elements ret val i edit action e next element return ret val getactions jedit editaction getactions editaction retval editaction hasmoreelements retval editaction nextelement retval contains method returns if this action set contains the specified action param action the action since j edit 4 2pre1 public boolean contains string action return actions contains key action jedit containskey size method returns the number of actions in this action set since j edit 4 2pre2 public int size return actions size jedit to string method public string to string return label tostring tostring init key bindings method initializes the action set s key bindings j edit calls this method for all registered action sets when the user changes key bindings in the b global options b dialog box p note if your plugin adds a custom action set to j edit s collection it must also call this method on the action set after adding it since j edit 4 2pre1 public void init key bindings input handler input handler j edit get input handler iterator iter actions entry set iterator while iter has next map entry entry map entry iter next string name string entry get key string shortcut1 j edit get property name shortcut if shortcut1 null input handler add key binding shortcut1 name string shortcut2 j edit get property name shortcut2 if shortcut2 null input handler add key binding shortcut2 name initkeybindings jedit jedit jedit initkeybindings inputhandler inputhandler jedit getinputhandler entryset hasnext getkey jedit getproperty inputhandler addkeybinding jedit getproperty inputhandler addkeybinding load method forces the action set to be loaded plugins and macros should not call this method since j edit 4 2pre1 public void load if loaded return loaded true actions clear reader stream null try log log log debug this loading actions from uri action list handler ah new action list handler uri to string this stream new buffered reader new input stream reader uri open stream xml parser parser new xml parser parser set handler ah parser parse null null stream catch xml exception xe int line xe get line string message xe get message log log log error this uri line message catch exception e log log log error uri e finally try if stream null stream close catch io exception io log log log error this io jedit actionlisthandler actionlisthandler tostring bufferedreader inputstreamreader openstream xmlparser xmlparser sethandler xmlexception getline getmessage ioexception get action names method void get action names list vec enumeration e actions keys while e has more elements vec add e next element getactionnames getactionnames hasmoreelements nextelement public string text bsh ambiguous name int id super id bshambiguousname bsh ambiguous name int id super id public name get name name space namespace return namespace get name resolver text bshambiguousname getname namespace getnameresolver public object to object call stack callstack interpreter interpreter throws eval error return to object callstack interpreter false toobject callstack evalerror toobject object to object call stack callstack interpreter interpreter boolean force class throws eval error try return get name callstack top to object callstack interpreter force class catch util eval error e e print stack trace throw e to eval error this callstack toobject callstack forceclass evalerror getname toobject forceclass utilevalerror printstacktrace toevalerror public class to class call stack callstack interpreter interpreter throws eval error try return get name callstack top to class catch class not found exception e throw new eval error e get message this callstack catch util eval error e2 class path exception is a type of util eval error throw e2 to eval error this callstack toclass callstack evalerror getname toclass classnotfoundexception evalerror getmessage utilevalerror classpathexception utilevalerror toevalerror public lhs tolhs call stack callstack interpreter interpreter throws eval error try return get name callstack top tolhs callstack interpreter catch util eval error e throw e to eval error this callstack callstack evalerror getname utilevalerror toevalerror public object eval call stack callstack interpreter interpreter throws eval error throw new interpreter error don t know how to eval an ambiguous name use to object if you want an object callstack evalerror interpretererror toobject public string to string return ambigous name text tostring ambigousname construct an entry with only a name this allows the programmer to construct the entry s header by hand file is set to null public tar entry string name this initialize this name tar header this header name tarentry nametarheader construct an entry for a file file is set to file and the header is constructed from information from the file param file the file that the entry represents public tar entry file file throws invalid header exception this initialize this get file tar header this header file tarentry invalidheaderexception getfiletarheader construct an entry from an archive s header bytes file is set to null param header buf the header bytes from a tar archive entry public tar entry byte header buf throws invalid header exception this initialize this parse tar header this header header buf headerbuf tarentry headerbuf invalidheaderexception parsetarheader headerbuf initialization code common to all constructors private void initialize this file null this header new tar header tarheader determine if the two entries are equal equality is determined by the header names being equal return it entry to be checked for equality return true if the entries are equal public boolean equals tar entry it return this header name to string equals it header name to string tarentry tostring tostring determine if the given entry is a descendant of this entry descendancy is determined by the name of the descendant starting with this entry s name param desc entry to be checked as a descendent of this return true if entry is a descendant of this public boolean is descendent tar entry desc return desc header name to string starts with this header name to string isdescendent tarentry tostring startswith tostring get this entry s header return this entry s tar header public tar header get header return this header tarheader tarheader getheader get this entry s name return this entry s name public string get name return this header name to string getname tostring set this entry s name param name this entry s new name public void set name string name this header name new string buffer name setname stringbuffer get this entry s user id return this entry s user id public int get user id return this header user id getuserid userid set this entry s user id param user id this entry s new user id public void set user id int user id this header user id user id userid setuserid userid userid userid get this entry s group id return this entry s group id public int get group id return this header group id getgroupid groupid set this entry s group id param group id this entry s new group id public void set group id int group id this header group id group id groupid setgroupid groupid groupid groupid get this entry s user name return this entry s user name public string get user name return this header user name to string getusername username tostring set this entry s user name param user name this entry s new user name public void set user name string user name this header user name new string buffer user name username setusername username username stringbuffer username get this entry s group name return this entry s group name public string get group name return this header group name to string getgroupname groupname tostring set this entry s group name param group name this entry s new group name public void set group name string group name this header group name new string buffer group name groupname setgroupname groupname groupname stringbuffer groupname convenience method to set this entry s group and user ids param user id this entry s new user id param group id this entry s new group id public void set ids int user id int group id this set user id user id this set group id group id userid groupid setids userid groupid setuserid userid setgroupid groupid convenience method to set this entry s group and user names param user name this entry s new user name param group name this entry s new group name public void set names string user name string group name this set user name user name this set group name group name username groupname setnames username groupname setusername username setgroupname groupname set this entry s modification time the parameter passed to this method is in java time param time this entry s new modification time public void set mod time long time this header mod time time 1000 setmodtime modtime set this entry s modification time param time this entry s new modification time public void set mod time date time this header mod time time get time 1000 setmodtime modtime gettime set this entry s modification time param time this entry s new modification time public date get mod time return new date this header mod time 1000 getmodtime modtime get this entry s file return this entry s file public file get file return this file getfile get this entry s file size return this entry s file size public long get size return this header size getsize set this entry s file size param size this entry s new file size public void set size long size this header size size setsize convenience method that will modify an entry s name directly in place in an entry header buffer byte array param outbuf the buffer containing the entry header to modify param new name the new name to place into the header buffer public void adjust entry name byte outbuf string new name int offset 0 offset tar header get name bytes new string buffer new name outbuf offset tar header namelen newname adjustentryname newname tarheader getnamebytes stringbuffer newname tarheader return whether or not this entry represents a directory return true if this entry is a directory public boolean is directory if this file null return this file is directory if this header null if this header link flag tar header lf dir return true if this header name to string ends with return true return false isdirectory isdirectory linkflag tarheader lf_dir tostring endswith fill in a tar header with information from a file param hdr the tar header to fill in param file the file from which to get the header information public void get file tar header tar header hdr file file throws invalid header exception this file file string name file get path string osname system get property os name if osname null strip off drive letters review would a better check be file separator string win32 prefix windows string prefix osname substring 0 win32 prefix length if prefix equals ignore case win32 prefix if file separator char per patrick beard string win32 prefix windows if osname to lower case starts with win32 prefix if name length 2 char ch1 name char at 0 char ch2 name char at 1 if ch2 ch1 a ch1 z ch1 a ch1 z name name substring 2 name name replace file separator char no absolute pathnames windows and posix paths can start with network drive so we loop on starting s for name starts with name name substring 1 hdr link name new string buffer hdr name new string buffer name if file is directory hdr mode 040755 hdr link flag tar header lf dir if hdr name char at hdr name length 1 hdr name append else hdr mode 0100644 hdr link flag tar header lf normal undone when file lets us get the user name use it hdr size file length hdr mod time file last modified 1000 hdr check sum 0 hdr dev major 0 hdr dev minor 0 tarheader tarheader getfiletarheader tarheader invalidheaderexception getpath getproperty win32prefix win32prefix equalsignorecase win32prefix separatorchar win32prefix tolowercase startswith win32prefix charat charat separatorchar networkdrive startswith linkname stringbuffer stringbuffer isdirectory linkflag tarheader lf_dir charat linkflag tarheader lf_normal username modtime lastmodified checksum devmajor devminor if this entry represents a file and the file is a directory return an array of tar entries for this entry s children return an array of tar entry s for this entry s children public tar entry get directory entries throws invalid header exception if this file null this file is directory return new tar entry 0 string list this file list tar entry result new tar entry list length for int i 0 i list length i result i new tar entry new file this file list i return result tarentries tarentry tarentry getdirectoryentries invalidheaderexception isdirectory tarentry tarentry tarentry tarentry compute the checksum of a tar entry header param buf the tar entry s header buffer return the computed checksum public long compute check sum byte buf long sum 0 for int i 0 i buf length i sum 255 buf i return sum computechecksum write an entry s header information to a header buffer param outbuf the tar entry header buffer to fill in public void write entry header byte outbuf int offset 0 offset tar header get name bytes this header name outbuf offset tar header namelen offset tar header get octal bytes this header mode outbuf offset tar header modelen offset tar header get octal bytes this header user id outbuf offset tar header uidlen offset tar header get octal bytes this header group id outbuf offset tar header gidlen long size this header size offset tar header get long octal bytes size outbuf offset tar header sizelen offset tar header get long octal bytes this header mod time outbuf offset tar header modtimelen int cs offset offset for int c 0 c tar header chksumlen c outbuf offset byte outbuf offset this header link flag offset tar header get name bytes this header link name outbuf offset tar header namelen offset tar header get name bytes this header magic outbuf offset tar header magiclen offset tar header get name bytes this header user name outbuf offset tar header unamelen offset tar header get name bytes this header group name outbuf offset tar header gnamelen offset tar header get octal bytes this header dev major outbuf offset tar header devlen offset tar header get octal bytes this header dev minor outbuf offset tar header devlen for offset outbuf length outbuf offset 0 long check sum this compute check sum outbuf tar header get check sum octal bytes check sum outbuf cs offset tar header chksumlen writeentryheader tarheader getnamebytes tarheader tarheader getoctalbytes tarheader tarheader getoctalbytes userid tarheader tarheader getoctalbytes groupid tarheader tarheader getlongoctalbytes tarheader tarheader getlongoctalbytes modtime tarheader csoffset tarheader linkflag tarheader getnamebytes linkname tarheader tarheader getnamebytes tarheader tarheader getnamebytes username tarheader tarheader getnamebytes groupname tarheader tarheader getoctalbytes devmajor tarheader tarheader getoctalbytes devminor tarheader checksum computechecksum tarheader getchecksumoctalbytes checksum csoffset tarheader parse an entry s tar header information from a header buffer param hdr the tar header to fill in from the buffer information param header the tar entry header buffer to get information from public void parse tar header tar header hdr byte header throws invalid header exception int offset 0 hdr name tar header parse name header offset tar header namelen offset tar header namelen hdr mode int tar header parse octal header offset tar header modelen offset tar header modelen hdr user id int tar header parse octal header offset tar header uidlen offset tar header uidlen hdr group id int tar header parse octal header offset tar header gidlen offset tar header gidlen hdr size tar header parse octal header offset tar header sizelen offset tar header sizelen hdr mod time tar header parse octal header offset tar header modtimelen offset tar header modtimelen hdr check sum int tar header parse octal header offset tar header chksumlen offset tar header chksumlen hdr link flag header offset hdr link name tar header parse name header offset tar header namelen offset tar header namelen hdr magic tar header parse name header offset tar header magiclen offset tar header magiclen hdr user name tar header parse name header offset tar header unamelen offset tar header unamelen hdr group name tar header parse name header offset tar header gnamelen offset tar header gnamelen hdr dev major int tar header parse octal header offset tar header devlen offset tar header devlen hdr dev minor int tar header parse octal header offset tar header devlen tarheader tarheader parsetarheader tarheader invalidheaderexception tarheader parsename tarheader tarheader tarheader parseoctal tarheader tarheader userid tarheader parseoctal tarheader tarheader groupid tarheader parseoctal tarheader tarheader tarheader parseoctal tarheader tarheader modtime tarheader parseoctal tarheader tarheader checksum tarheader parseoctal tarheader tarheader linkflag linkname tarheader parsename tarheader tarheader tarheader parsename tarheader tarheader username tarheader parsename tarheader tarheader groupname tarheader parsename tarheader tarheader devmajor tarheader parseoctal tarheader tarheader devminor tarheader parseoctal tarheader fill in a tar header given only the entry s name param hdr the tar header to fill in param name the tar entry name public void name tar header tar header hdr string name boolean is dir name ends with hdr check sum 0 hdr dev major 0 hdr dev minor 0 hdr name new string buffer name hdr mode is dir 040755 0100644 hdr user id 0 hdr group id 0 hdr size 0 hdr check sum 0 hdr mod time new java util date get time 1000 hdr link flag is dir tar header lf dir tar header lf normal hdr link name new string buffer hdr user name new string buffer hdr group name new string buffer hdr dev major 0 hdr dev minor 0 tarheader tarheader nametarheader tarheader isdir endswith checksum devmajor devminor stringbuffer isdir userid groupid checksum modtime gettime linkflag isdir tarheader lf_dir tarheader lf_normal linkname stringbuffer username stringbuffer groupname stringbuffer devmajor devminor region matches method checks if a subregion of a code segment code is equal to a character array param ignore case true if case should be ignored false otherwise param text the segment param offset the offset into the segment param match the character array to match since j edit 4 2pre1 public static boolean region matches boolean ignore case segment text int offset char match int length offset match length if length text offset text count return false char text array text array for int i offset j 0 i length i j char c1 text array i char c2 match j if ignore case c1 character to upper case c1 c2 character to upper case c2 if c1 c2 return false return true regionmatches ignorecase jedit regionmatches ignorecase textarray textarray ignorecase touppercase touppercase construct a new syntax object with all bits turned off this is equivalent to re syntax emacs public re syntax bits new bit set bit total re_syntax_emacs resyntax bitset bit_total called internally when constructing predefined syntaxes so their interpretation cannot vary conceivably useful for your syntaxes as well causes illegal access error to be thrown if any attempt to modify the syntax is made return this object for convenient chaining public re syntax make final is final true return this illegalaccesserror resyntax makefinal isfinal construct a new syntax object with all bits set the same as the other syntax public re syntax re syntax other bits bit set other bits clone resyntax resyntax bitset check if a given bit is set in this syntax public boolean get int index return bits get index set a given bit in this syntax param index the constant re syntax re xxx bit to set return a reference to this object for easy chaining public re syntax set int index if is final throw new illegal access error syntax is final bits set index return this resyntax re_xxx resyntax isfinal illegalaccesserror syntax_is_final clear a given bit in this syntax param index the constant re syntax re xxx bit to clear return a reference to this object for easy chaining public re syntax clear int index if is final throw new illegal access error syntax is final bits clear index return this resyntax re_xxx resyntax isfinal illegalaccesserror syntax_is_final changes the line separator string for regular expressions created using this re syntax the default separator is the value returned by the system property line separator which should be correct when reading platform specific files from a filesystem however many programs may collect input from sources where the line separator is differently specified for example in the applet environment the text box widget interprets line breaks as single character newlines regardless of the host platform note that setting the line separator to a character or characters that have specific meaning within the current syntax can cause unexpected chronosynclastic infundibula return this object for convenient chaining public re syntax set line separator string a separator if is final throw new illegal access error syntax is final line separator a separator return this resyntax resyntax setlineseparator aseparator isfinal illegalaccesserror syntax_is_final lineseparator aseparator returns the currently active line separator string the default is the platform dependent system property line separator public string get line separator return line separator getlineseparator lineseparator favoritesvfs constructor public favoritesvfs super favorites delete cap low latency cap new string ea type add to favorites which is a static method for convinience needs an instance of the vfs to pass to vfs manager sendvfs update hence this hack instance this delete_cap low_latency_cap ea_type addtofavorites vfsmanager sendvfsupdate get parent of path method public string get parent of path string path return protocol getparentofpath getparentofpath listdirectory method public vfs directory entry listdirectory object session string url component comp return get favorites _listdirectory directoryentry _listdirectory getfavorites getdirectoryentry method public directory entry getdirectoryentry object session string path component comp does it matter that this doesn t set the type correctly return new favorites entry path vfs directory entry directory _getdirectoryentry directoryentry _getdirectoryentry favoritesentry directoryentry delete method public boolean delete object session string path component comp synchronized lock path path substring protocol length 1 iterator iter favorites iterator while iter has next if favorites entry iter next path equals path iter remove vfs manager sendvfs update this protocol false edit bus send new dynamic menu changed favorites return true return false _delete _delete hasnext favoritesentry vfsmanager sendvfsupdate editbus dynamicmenuchanged load favorites method public static void load favorites synchronized lock favorites new linked list string favorite int i 0 while favorite j edit get property vfs favorite i null favorites add new favorites entry favorite j edit get integer property vfs favorite i type vfs directory entry directory i loadfavorites loadfavorites linkedlist jedit getproperty favoritesentry jedit getintegerproperty directoryentry add to favorites method public static void add to favorites string path int type synchronized lock if favorites null load favorites iterator iter favorites iterator while iter has next if favorites entry iter next path equals path return favorites add new favorites entry path type vfs manager sendvfs update instance protocol false edit bus send new dynamic menu changed favorites addtofavorites addtofavorites loadfavorites hasnext favoritesentry favoritesentry vfsmanager sendvfsupdate editbus dynamicmenuchanged save favorites method public static void save favorites synchronized lock if favorites null return int i 0 iterator iter favorites iterator while iter has next favorites entry e favorites entry iter next j edit set property vfs favorite i e path j edit set integer property vfs favorite i type e type i j edit unset property vfs favorite favorites size j edit unset property vfs favorite favorites size type savefavorites savefavorites hasnext favoritesentry favoritesentry jedit setproperty jedit setintegerproperty jedit unsetproperty jedit unsetproperty get favorites method public static vfs directory entry get favorites synchronized lock if favorites null load favorites return vfs directory entry favorites to array new vfs directory entry favorites size getfavorites directoryentry getfavorites loadfavorites directoryentry toarray directoryentry static class favorites entry extends vfs directory entry favorites entry string path int type super path path protocol path type 0 false favoritesentry directoryentry favoritesentry public string get extended attribute string name if name equals ea type return super get extended attribute name else don t want it to show 0 bytes for size etc return null getextendedattribute ea_type getextendedattribute public class bean shell error dialog extends text area dialog public bean shell error dialog frame frame throwable t super frame beanshell error t beanshellerrordialog textareadialog beanshellerrordialog for abi compatibility public bean shell error dialog view view throwable t this frame view t beanshellerrordialog init method public void init syntax style styles font render context font render context tab expander expander list out float wrap margin super init x 0 0f this styles styles this font render context font render context this expander expander silly allow for anti aliased characters fuzz if wrap margin 0 0f this wrap margin wrap margin 2 0f else this wrap margin 0 0f this out out seen non whitespace false endx end of whitespace 0 0f end null syntaxstyle fontrendercontext fontrendercontext tabexpander wrapmargin fontrendercontext fontrendercontext wrapmargin wrapmargin wrapmargin wrapmargin seennonwhitespace endofwhitespace get chunk list method returns the list of chunks since j edit 4 1pre7 public list get chunk list return out getchunklist jedit getchunklist handle token method called by the token marker when a syntax token has been parsed param seg the segment containing the text param id the token type one of the constants in the link token class param offset the start offset of the token param length the number of characters in the token param context the line context since j edit 4 2pre3 public void handle token segment seg byte id int offset int length token marker line context context if id token end if first token null out add merge chunk first token seg return for int split offset 0 split offset length split offset max chunk len int split length math min length split offset max chunk len chunk chunk create chunk id offset split offset split length context add token chunk context if wrap margin 0 0f init chunk chunk seg x chunk width if character is whitespace seg array seg offset chunk offset if seen non whitespace end last token endx x else end of whitespace x else if x wrap margin end null seen non whitespace chunk next line new chunk end of whitespace end offset end length get parser rule set context init chunk next line seg next line next end next end next null if first token null out add merge chunk first token seg first token next line x x endx end of whitespace end null endx x seen non whitespace true handletoken jedit handletoken tokenmarker linecontext firsttoken firsttoken splitoffset splitoffset splitoffset max_chunk_len splitlength splitoffset max_chunk_len createchunk splitoffset splitlength addtoken wrapmargin initchunk iswhitespace seennonwhitespace lasttoken endofwhitespace wrapmargin seennonwhitespace nextline endofwhitespace getparserruleset initchunk nextline nextline firsttoken firsttoken firsttoken nextline endofwhitespace seennonwhitespace create chunk method private chunk create chunk byte id int offset int length token marker line context context return new chunk id offset length get parser rule set context styles context rules get default createchunk createchunk tokenmarker linecontext getparserruleset getdefault init chunk method protected void init chunk chunk chunk segment seg chunk init seg expander x font render context initchunk initchunk fontrendercontext merge method private chunk merge chunk first segment seg if first null return null chunk chunk first while chunk next null chunk next chunk chunk next if can merge chunk next seg in case already initialized un initialize it chunk initialized false chunk length next length chunk width next width chunk next next next else if chunk initialized init chunk chunk seg if wrap margin 0 0f x chunk width chunk next if chunk initialized init chunk chunk seg return first canmerge initchunk wrapmargin initchunk can merge method private boolean can merge chunk c1 chunk c2 segment seg if c1 accessable c2 accessable return false char ch1 seg array seg offset c1 offset char ch2 seg array seg offset c2 offset return c1 style c2 style ch1 t ch2 t c1 length c2 length max chunk len canmerge canmerge max_chunk_len creates a new search and replace settings changed message param source the message source public search settings changed eb component source super source searchsettingschanged ebcomponent abbrevs option pane constructor public abbrevs option pane super abbrevs abbrevsoptionpane abbrevsoptionpane init method protected void init set layout new border layout j panel panel new j panel new border layout 6 6 expand on input new j check box j edit get property options abbrevs expand on input abbrevs get expand on input panel add expand on input border layout north j panel panel2 new j panel panel2 set layout new box layout panel2 box layout x axis panel2 set border new empty border 0 0 6 0 panel2 add box create glue j label label new j label j edit get property options abbrevs set label set border new empty border 0 0 0 12 panel2 add label hashtable modeabbrevs abbrevs get mode abbrevs mode abbrevs new hashtable mode modes j edit get modes arrays sort modes new misc utilities stringi case compare string sets new string modes length 1 sets 0 global for int i 0 i modes length i string name modes i get name sets i 1 name mode abbrevs put name new abbrevs model hashtable modeabbrevs get name sets combo box new j combo box sets action handler action handler new action handler sets combo box add action listener action handler panel2 add sets combo box panel2 add box create glue panel add panel2 border layout south add border layout north panel global abbrevs new abbrevs model abbrevs get global abbrevs abbrevs table new j table global abbrevs abbrevs table get column model get column 1 set cell renderer new renderer abbrevs table set auto resize mode j table auto resize all columns abbrevs table get table header set reordering allowed false abbrevs table get table header add mouse listener new header mouse handler abbrevs table get selection model add list selection listener new selection handler abbrevs table get selection model set selection mode list selection model single selection abbrevs table add mouse listener new table mouse handler dimension d abbrevs table get preferred size d height math min d height 200 j scroll pane scroller new j scroll pane abbrevs table scroller set preferred size d add border layout center scroller j panel buttons new j panel buttons set layout new box layout buttons box layout x axis buttons set border new empty border 6 0 0 0 add new rollover button gui utilities load icon plus png add set tool tip text j edit get property options abbrevs add add add action listener action handler buttons add add remove new rollover button gui utilities load icon minus png remove set tool tip text j edit get property options abbrevs remove remove add action listener action handler buttons add remove edit new rollover button gui utilities load icon button properties png edit set tool tip text j edit get property options abbrevs edit edit add action listener action handler buttons add edit buttons add box create glue add border layout south buttons update enabled _init _init setlayout borderlayout jpanel jpanel borderlayout expandoninput jcheckbox jedit getproperty expandoninput getexpandoninput expandoninput borderlayout jpanel jpanel setlayout boxlayout boxlayout x_axis setborder emptyborder createglue jlabel jlabel jedit getproperty setborder emptyborder _modeabbrevs getmodeabbrevs modeabbrevs jedit getmodes miscutilities stringicasecompare getname modeabbrevs abbrevsmodel _modeabbrevs setscombobox jcombobox actionhandler actionhandler actionhandler setscombobox addactionlistener actionhandler setscombobox createglue borderlayout borderlayout globalabbrevs abbrevsmodel getglobalabbrevs abbrevstable jtable globalabbrevs abbrevstable getcolumnmodel getcolumn setcellrenderer abbrevstable setautoresizemode jtable auto_resize_all_columns abbrevstable gettableheader setreorderingallowed abbrevstable gettableheader addmouselistener headermousehandler abbrevstable getselectionmodel addlistselectionlistener selectionhandler abbrevstable getselectionmodel setselectionmode listselectionmodel single_selection abbrevstable addmouselistener tablemousehandler abbrevstable getpreferredsize jscrollpane jscrollpane abbrevstable setpreferredsize borderlayout jpanel jpanel setlayout boxlayout boxlayout x_axis setborder emptyborder rolloverbutton guiutilities loadicon settooltiptext jedit getproperty addactionlistener actionhandler rolloverbutton guiutilities loadicon settooltiptext jedit getproperty addactionlistener actionhandler rolloverbutton guiutilities loadicon buttonproperties settooltiptext jedit getproperty addactionlistener actionhandler createglue borderlayout updateenabled save method protected void save if abbrevs table get cell editor null abbrevs table get cell editor stop cell editing abbrevs set expand on input expand on input is selected abbrevs set global abbrevs global abbrevs to hashtable hashtable mode hash new hashtable enumeration keys mode abbrevs keys enumeration values mode abbrevs elements while keys has more elements mode hash put keys next element abbrevs model values next element to hashtable abbrevs set mode abbrevs mode hash _save _save abbrevstable getcelleditor abbrevstable getcelleditor stopcellediting setexpandoninput expandoninput isselected setglobalabbrevs globalabbrevs tohashtable modehash modeabbrevs modeabbrevs hasmoreelements modehash nextelement abbrevsmodel nextelement tohashtable setmodeabbrevs modehash update enabled method private void update enabled int selected row abbrevs table get selected row edit set enabled selected row 1 remove set enabled selected row 1 updateenabled updateenabled selectedrow abbrevstable getselectedrow setenabled selectedrow setenabled selectedrow edit method private void edit abbrevs model abbrevs model abbrevs model abbrevs table get model int row abbrevs table get selected row string abbrev string abbrevs model get value at row 0 string expansion string abbrevs model get value at row 1 string old abbrev abbrev edit abbrev dialog dialog new edit abbrev dialog gui utilities get parent dialog abbrevs option pane this abbrev expansion abbrevs model to hashtable abbrev dialog get abbrev expansion dialog get expansion if abbrev null expansion null for int i 0 i abbrevs model get row count i if abbrevs model get value at i 0 equals old abbrev abbrevs model remove i break add abbrevs model abbrev expansion abbrevsmodel abbrevsmodel abbrevsmodel abbrevstable getmodel abbrevstable getselectedrow abbrevsmodel getvalueat abbrevsmodel getvalueat oldabbrev editabbrevdialog editabbrevdialog guiutilities getparentdialog abbrevsoptionpane abbrevsmodel tohashtable getabbrev getexpansion abbrevsmodel getrowcount abbrevsmodel getvalueat oldabbrev abbrevsmodel abbrevsmodel add method private void add abbrevs model abbrevs model string abbrev string expansion for int i 0 i abbrevs model get row count i if abbrevs model get value at i 0 equals abbrev abbrevs model remove i break abbrevs model add abbrev expansion update enabled abbrevsmodel abbrevsmodel abbrevsmodel getrowcount abbrevsmodel getvalueat abbrevsmodel abbrevsmodel updateenabled public void mouse clicked mouse event evt switch abbrevs table get table header column at point evt get point case 0 abbrevs model abbrevs table get model sort 0 break case 1 abbrevs model abbrevs table get model sort 1 break mouseclicked mouseevent abbrevstable gettableheader columnatpoint getpoint abbrevsmodel abbrevstable getmodel abbrevsmodel abbrevstable getmodel public void mouse clicked mouse event evt if evt get click count 2 edit mouseclicked mouseevent getclickcount class selection handler implements list selection listener public void value changed list selection event evt update enabled selectionhandler listselectionlistener valuechanged listselectionevent updateenabled public void action performed action event evt abbrevs model abbrevs model abbrevs model abbrevs table get model object source evt get source if source sets combo box string selected string sets combo box get selected item if selected equals global abbrevs table set model global abbrevs else abbrevs table set model abbrevs model mode abbrevs get selected update enabled else if source add edit abbrev dialog dialog new edit abbrev dialog gui utilities get parent dialog abbrevs option pane this null null abbrevs model to hashtable string abbrev dialog get abbrev string expansion dialog get expansion if abbrev null abbrev length 0 expansion null expansion length 0 add abbrevs model abbrev expansion else if source edit edit else if source remove int selected row abbrevs table get selected row abbrevs model remove selected row update enabled actionperformed actionevent abbrevsmodel abbrevsmodel abbrevsmodel abbrevstable getmodel getsource setscombobox setscombobox getselecteditem abbrevstable setmodel globalabbrevs abbrevstable setmodel abbrevsmodel modeabbrevs updateenabled editabbrevdialog editabbrevdialog guiutilities getparentdialog abbrevsoptionpane abbrevsmodel tohashtable getabbrev getexpansion abbrevsmodel selectedrow abbrevstable getselectedrow abbrevsmodel selectedrow updateenabled public component get table cell renderer component j table table object value boolean is selected boolean cell has focus int row int col string value str value to string workaround for swing s annoying processing of labels starting with html which often breaks if value str to lower case starts with html value str value str return super get table cell renderer component table value str is selected cell has focus row col gettablecellrenderercomponent jtable isselected cellhasfocus valuestr tostring valuestr tolowercase startswith valuestr valuestr gettablecellrenderercomponent valuestr isselected cellhasfocus abbrevs model constructor abbrevs model hashtable abbrev hash abbrevs new vector if abbrev hash null enumeration abbrev enum abbrev hash keys enumeration expand enum abbrev hash elements while abbrev enum has more elements abbrevs add element new abbrev string abbrev enum next element string expand enum next element sort 0 abbrevsmodel abbrevsmodel abbrevhash abbrevhash abbrevenum abbrevhash expandenum abbrevhash abbrevenum hasmoreelements addelement abbrevenum nextelement expandenum nextelement sort method void sort int col last sort col misc utilities quicksort abbrevs new abbrev compare col fire table data changed lastsort miscutilities abbrevcompare firetabledatachanged add method void add string abbrev string expansion abbrevs add element new abbrev abbrev expansion sort last sort addelement lastsort remove method void remove int index abbrevs remove element at index fire table structure changed removeelementat firetablestructurechanged to hashtable method public hashtable to hashtable hashtable hash new hashtable for int i 0 i abbrevs size i abbrev abbrev abbrev abbrevs element at i if abbrev abbrev length 0 abbrev expand length 0 hash put abbrev abbrev abbrev expand return hash tohashtable tohashtable elementat get column count method public int get column count return 2 getcolumncount getcolumncount get row count method public int get row count return abbrevs size getrowcount getrowcount get value at method public object get value at int row int col abbrev abbrev abbrev abbrevs element at row switch col case 0 return abbrev abbrev case 1 return abbrev expand default return null getvalueat getvalueat elementat is cell editable method public boolean is cell editable int row int col return false iscelleditable iscelleditable set value at method public void set value at object value int row int col if value null value abbrev abbrev abbrev abbrevs element at row if col 0 abbrev abbrev string value else abbrev expand string value fire table rows updated row row setvalueat setvalueat elementat firetablerowsupdated get column name method public string get column name int index switch index case 0 return j edit get property options abbrevs abbrev case 1 return j edit get property options abbrevs expand default return null getcolumnname getcolumnname jedit getproperty jedit getproperty int col abbrev compare int col this col col abbrevcompare public int compare object obj1 object obj2 abbrev a1 abbrev obj1 abbrev a2 abbrev obj2 if col 0 string abbrev1 a1 abbrev to lower case string abbrev2 a2 abbrev to lower case return misc utilities compare strings abbrev1 abbrev2 true else string expand1 a1 expand to lower case string expand2 a2 expand to lower case return misc utilities compare strings expand1 expand2 true tolowercase tolowercase miscutilities comparestrings tolowercase tolowercase miscutilities comparestrings class abbrev abbrev abbrev string abbrev string expand this abbrev abbrev this expand expand j check box list constructor creates a checkbox list with the given list of objects the elements of this array can either be entry instances or other objects if the latter they will default to being unchecked public j check box list object items set model items jcheckboxlist jcheckboxlist setmodel j check box list constructor creates a checkbox list with the given list of objects the elements of this vector can either be entry instances or other objects if the latter they will default to being unchecked public j check box list vector items set model items jcheckboxlist jcheckboxlist setmodel set model method sets the model to the given list of objects the elements of this array can either be entry instances or other objects if the latter they will default to being unchecked public void set model object items set model new check box list model items init setmodel setmodel setmodel checkboxlistmodel set model method sets the model to the given list of objects the elements of this vector can either be entry instances or other objects if the latter they will default to being unchecked public void set model vector items set model new check box list model items init setmodel setmodel setmodel checkboxlistmodel get checked values method public object get checked values vector values new vector check box list model model check box list model get model for int i 0 i model items size i entry entry entry model items element at i if entry checked entry caption values add element entry value object ret val new object values size values copy into ret val return ret val getcheckedvalues getcheckedvalues checkboxlistmodel checkboxlistmodel getmodel elementat addelement retval copyinto retval retval select all method public void select all check box list model model check box list model get model for int i 0 i model items size i entry entry entry model items element at i if entry caption entry checked true model fire table rows updated 0 model get row count selectall selectall checkboxlistmodel checkboxlistmodel getmodel elementat firetablerowsupdated getrowcount get values method public entry get values check box list model model check box list model get model entry ret val new entry model items size model items copy into ret val return ret val getvalues getvalues checkboxlistmodel checkboxlistmodel getmodel retval copyinto retval retval get selected value method public object get selected value int row get selected row if row 1 return null else return get model get value at row 1 getselectedvalue getselectedvalue getselectedrow getmodel getvalueat get cell renderer method public table cell renderer get cell renderer int row int column if column 0 entry entry entry check box list model get model items get row if entry caption return dummy return super get cell renderer row column getcellrenderer tablecellrenderer getcellrenderer checkboxlistmodel getmodel getcellrenderer init method private void init dummy new dummy renderer get selection model set selection mode list selection model single selection set show grid false set auto resize mode j table auto resize last column table column column get column model get column 0 int check box width new j check box get preferred size width column set preferred width check box width column set min width check box width column set width check box width column set max width check box width column set resizable false column get column model get column 1 column set cell renderer new label renderer dummyrenderer getselectionmodel setselectionmode listselectionmodel single_selection setshowgrid setautoresizemode jtable auto_resize_last_column tablecolumn getcolumnmodel getcolumn checkboxwidth jcheckbox getpreferredsize setpreferredwidth checkboxwidth setminwidth checkboxwidth setwidth checkboxwidth setmaxwidth checkboxwidth setresizable getcolumnmodel getcolumn setcellrenderer labelrenderer public entry object value this caption true this value value public entry boolean checked object value this checked checked this value value public boolean is checked return checked ischecked public object get value return value getvalue public component get table cell renderer component j table table object value boolean is selected boolean has focus int row int column return super get table cell renderer component table null value is selected false has focus row column gettablecellrenderercomponent jtable isselected hasfocus gettablecellrenderercomponent isselected hasfocus label renderer plain font ui manager get font tree font bold font plain font derive font font bold labelrenderer plainfont uimanager getfont boldfont plainfont derivefont public component get table cell renderer component j table table object value boolean is selected boolean has focus int row int column super get table cell renderer component table value is selected has focus row column entry entry entry check box list model get model items get row if entry caption set font bold font else set font plain font return this gettablecellrenderercomponent jtable isselected hasfocus gettablecellrenderercomponent isselected hasfocus checkboxlistmodel getmodel setfont boldfont setfont plainfont check box list model vector items items new vector items size for int i 0 i items size i items add element create entry items element at i checkboxlistmodel _items _items _items addelement createentry _items elementat check box list model object items items new vector items length for int i 0 i items length i items add element create entry items i checkboxlistmodel _items _items _items addelement createentry _items private j check box list entry create entry object obj if obj instanceof j check box list entry return j check box list entry obj else return new j check box list entry false obj jcheckboxlist createentry jcheckboxlist jcheckboxlist jcheckboxlist public int get row count return items size getrowcount public int get column count return 2 getcolumncount public string get column name int col return null getcolumnname public object get value at int row int col j check box list entry entry j check box list entry items element at row switch col case 0 return new boolean entry checked case 1 return entry value default throw new internal error getvalueat jcheckboxlist jcheckboxlist elementat internalerror public class get column class int col switch col case 0 return boolean class case 1 return string class default throw new internal error getcolumnclass internalerror public boolean is cell editable int row int col j check box list entry entry j check box list entry items element at row return col 0 entry caption iscelleditable jcheckboxlist jcheckboxlist elementat public void set value at object value int row int col if col 0 j check box list entry entry j check box list entry items element at row if entry caption entry checked value equals boolean true fire table rows updated row row setvalueat jcheckboxlist jcheckboxlist elementat firetablerowsupdated browser commands menu constructor public browser commands menu vfs browser browser vfs directory entry files this browser browser if files null vfs vfs vfs manager getvfs for path files 0 delete path int type files 0 type boolean file open j edit get buffer files 0 path null boolean delete file open vfs get capabilities vfs delete cap 0 boolean rename file open vfs get capabilities vfs rename cap 0 for int i 1 i files length i vfs directory entry file files i vfs vfs vfs manager getvfs for path file delete path delete vfs vfs vfs get capabilities vfs delete cap 0 if type file type all good else this will disable most operations if files of multiple types are selected type 1 set rename to false if 1 file selected rename false show close item if at least one selected file is currently open if j edit get buffer file path null file open true if type vfs directory entry directory type vfs directory entry filesystem if files length 1 add create menu item browse if browser get mode vfs browser browser add create menu item browse window else if type vfs directory entry file browser get mode vfs browser browser browser get mode vfs browser browser dialog add create menu item open add gui utilities load menu vfs browser get action context vfs browser open in add create menu item insert if file open add create menu item close else if type 1 add create menu item open if rename add create menu item rename if delete add create menu item delete add create menu item copy path add separator add create menu item up add create menu item reload add create menu item roots add create menu item home add create menu item synchronize add separator if browser get mode vfs browser browser add create menu item new file add create menu item new directory if browser get mode vfs browser browser add separator add create menu item search directory add separator add create menu item show hidden files if browser get mode vfs browser browser browser get mode vfs browser browser dialog add separator add create encoding menu update browsercommandsmenu browsercommandsmenu vfsbrowser directoryentry vfsmanager getvfsforpath deletepath fileopen jedit getbuffer fileopen getcapabilities delete_cap fileopen getcapabilities rename_cap directoryentry _vfs vfsmanager getvfsforpath deletepath _vfs _vfs getcapabilities delete_cap jedit getbuffer fileopen directoryentry directoryentry createmenuitem getmode vfsbrowser createmenuitem directoryentry getmode vfsbrowser getmode vfsbrowser browser_dialog createmenuitem guiutilities loadmenu vfsbrowser getactioncontext createmenuitem fileopen createmenuitem createmenuitem createmenuitem createmenuitem createmenuitem addseparator createmenuitem createmenuitem createmenuitem createmenuitem createmenuitem addseparator getmode vfsbrowser createmenuitem createmenuitem getmode vfsbrowser addseparator createmenuitem addseparator createmenuitem getmode vfsbrowser getmode vfsbrowser browser_dialog addseparator createencodingmenu update method public void update if encoding menu items null j radio button menu item mi j radio button menu item encoding menu items get browser current encoding if mi null mi set selected true other encoding set text j edit get property vfs browser other encoding label else other encoding set selected true other encoding set text j edit get property vfs browser other encoding 2 label new string browser current encoding encodingmenuitems jradiobuttonmenuitem jradiobuttonmenuitem encodingmenuitems currentencoding setselected otherencoding settext jedit getproperty otherencoding setselected otherencoding settext jedit getproperty currentencoding create menu item method private j menu item create menu item string name return gui utilities load menu item vfs browser get action context vfs browser name false createmenuitem jmenuitem createmenuitem guiutilities loadmenuitem vfsbrowser getactioncontext create encoding menu method private j menu create encoding menu action handler action handler new action handler encoding menu items new hash map j menu encoding menu new j menu j edit get property vfs browser commands encoding label j menu menu encoding menu auto detect new j check box menu item j edit get property vfs browser commands encoding auto detect auto detect set selected browser auto detect encoding auto detect set action command auto detect auto detect add action listener action handler menu add auto detect menu add separator button group grp new button group list encoding menu item list new array list string encodings misc utilities get encodings for int i 0 i encodings length i string encoding encodings i j radio button menu item mi new j radio button menu item encoding mi set action command encoding encoding mi add action listener action handler grp add mi encoding menu items put encoding mi encoding menu item list add mi string system encoding system get property file encoding if encoding menu items get system encoding null j radio button menu item mi new j radio button menu item system encoding mi set action command encoding system encoding mi add action listener action handler grp add mi encoding menu items put system encoding mi encoding menu item list add mi collections sort encoding menu item list new misc utilities menu item compare iterator iter encoding menu item list iterator while iter has next j radio button menu item mi j radio button menu item iter next if menu get menu component count 20 j menu new menu new j menu j edit get property common more menu add new menu menu new menu menu add mi menu add separator other encoding new j radio button menu item other encoding set action command other encoding other encoding add action listener action handler grp add other encoding menu add other encoding return encoding menu createencodingmenu jmenu createencodingmenu actionhandler actionhandler actionhandler encodingmenuitems hashmap jmenu encodingmenu jmenu jedit getproperty jmenu encodingmenu autodetect jcheckboxmenuitem jedit getproperty autodetect setselected autodetectencoding autodetect setactioncommand autodetect addactionlistener actionhandler autodetect addseparator buttongroup buttongroup encodingmenuitemlist arraylist miscutilities getencodings jradiobuttonmenuitem jradiobuttonmenuitem setactioncommand addactionlistener actionhandler encodingmenuitems encodingmenuitemlist systemencoding getproperty encodingmenuitems systemencoding jradiobuttonmenuitem jradiobuttonmenuitem systemencoding setactioncommand systemencoding addactionlistener actionhandler encodingmenuitems systemencoding encodingmenuitemlist encodingmenuitemlist miscutilities menuitemcompare encodingmenuitemlist hasnext jradiobuttonmenuitem jradiobuttonmenuitem getmenucomponentcount jmenu newmenu jmenu jedit getproperty newmenu newmenu addseparator otherencoding jradiobuttonmenuitem otherencoding setactioncommand otherencoding addactionlistener actionhandler otherencoding otherencoding encodingmenu public void action performed action event evt string action command evt get action command if action command equals auto detect browser auto detect encoding auto detect is selected else if action command equals other encoding string encoding gui utilities input browser encoding prompt null j edit get property buffer encoding system get property file encoding if encoding null return browser current encoding encoding else if action command starts with encoding browser current encoding action command substring 9 actionperformed actionevent actioncommand getactioncommand actioncommand autodetectencoding autodetect isselected actioncommand guiutilities jedit getproperty getproperty currentencoding actioncommand startswith currentencoding actioncommand view update constructor creates a new view update message param view the view param what what happened public view update view view object what super view if what null throw new null pointer exception what must be non null this what what viewupdate viewupdate nullpointerexception get what method returns what caused this view update public object get what return what getwhat getwhat get view method returns the view involved public view get view return view get source getview getview getsource param string method public string param string return what what super param string paramstring paramstring paramstring browser colors option pane constructor public browser colors option pane super browser colors browsercolorsoptionpane browsercolorsoptionpane init method protected void init set layout new border layout colors model new browser colors model colors table new j table colors model colors table set auto resize mode j table auto resize all columns colors table get table header set reordering allowed false colors table add mouse listener new mouse handler colors table get selection model add list selection listener new selection handler table column model tcm colors table get column model tcm get column 1 set cell renderer new browser colors model color renderer dimension d colors table get preferred size d height math min d height 200 j scroll pane scroller new j scroll pane colors table scroller set preferred size d add border layout center scroller j panel buttons new j panel buttons set border new empty border 3 0 0 0 buttons set layout new box layout buttons box layout x axis action handler action handler new action handler add new rollover button gui utilities load icon plus png add set tool tip text j edit get property common add add add action listener action handler buttons add add buttons add box create horizontal strut 6 remove new rollover button gui utilities load icon minus png remove set tool tip text j edit get property common remove remove add action listener action handler buttons add remove buttons add box create horizontal strut 6 move up new rollover button gui utilities load icon arrowu png move up set tool tip text j edit get property common move up move up add action listener action handler buttons add move up buttons add box create horizontal strut 6 move down new rollover button gui utilities load icon arrowd png move down set tool tip text j edit get property common move down move down add action listener action handler buttons add move down buttons add box create glue add border layout south buttons update enabled _init _init setlayout borderlayout colorsmodel browsercolorsmodel colorstable jtable colorsmodel colorstable setautoresizemode jtable auto_resize_all_columns colorstable gettableheader setreorderingallowed colorstable addmouselistener mousehandler colorstable getselectionmodel addlistselectionlistener selectionhandler tablecolumnmodel colorstable getcolumnmodel getcolumn setcellrenderer browsercolorsmodel colorrenderer colorstable getpreferredsize jscrollpane jscrollpane colorstable setpreferredsize borderlayout jpanel jpanel setborder emptyborder setlayout boxlayout boxlayout x_axis actionhandler actionhandler actionhandler rolloverbutton guiutilities loadicon settooltiptext jedit getproperty addactionlistener actionhandler createhorizontalstrut rolloverbutton guiutilities loadicon settooltiptext jedit getproperty addactionlistener actionhandler createhorizontalstrut moveup rolloverbutton guiutilities loadicon moveup settooltiptext jedit getproperty moveup moveup addactionlistener actionhandler moveup createhorizontalstrut movedown rolloverbutton guiutilities loadicon movedown settooltiptext jedit getproperty movedown movedown addactionlistener actionhandler movedown createglue borderlayout updateenabled save method protected void save colors model save _save _save colorsmodel update enabled method private void update enabled int selected row colors table get selected row remove set enabled selected row 1 move up set enabled selected row 0 move up set enabled selected row 1 selected row colors model get row count updateenabled updateenabled selectedrow colorstable getselectedrow setenabled selectedrow moveup setenabled selectedrow moveup setenabled selectedrow selectedrow colorsmodel getrowcount set selected row method private void set selected row int row colors table get selection model set selection interval row row colors table scroll rect to visible colors table get cell rect row 0 true setselectedrow setselectedrow colorstable getselectionmodel setselectioninterval colorstable scrollrecttovisible colorstable getcellrect class selection handler implements list selection listener public void value changed list selection event evt update enabled selectionhandler listselectionlistener valuechanged listselectionevent updateenabled public void action performed action event evt object source evt get source if source add colors model add else if source remove int selected row colors table get selected row colors model remove selected row update enabled else if source move up int selected row colors table get selected row if selected row 0 colors model move up selected row set selected row selected row 1 update enabled else if source move down int selected row colors table get selected row if selected row colors table get row count 1 colors model move down selected row set selected row selected row 1 update enabled actionperformed actionevent getsource colorsmodel selectedrow colorstable getselectedrow colorsmodel selectedrow updateenabled moveup selectedrow colorstable getselectedrow selectedrow colorsmodel moveup selectedrow setselectedrow selectedrow updateenabled movedown selectedrow colorstable getselectedrow selectedrow colorstable getrowcount colorsmodel movedown selectedrow setselectedrow selectedrow updateenabled public void mouse clicked mouse event evt point p evt get point int row colors table row at point p int column colors table column at point p if row 1 column 1 return color color j color chooser show dialog browser colors option pane this j edit get property color chooser title color colors model get value at row 1 if color null colors model set value at color row 1 mouseclicked mouseevent getpoint colorstable rowatpoint colorstable columnatpoint jcolorchooser showdialog browsercolorsoptionpane jedit getproperty colorchooser colorsmodel getvalueat colorsmodel setvalueat browser colors model constructor browser colors model entries new array list int i 0 string glob while glob j edit get property vfs browser colors i glob null entries add new entry glob j edit get color property vfs browser colors i color color black i browsercolorsmodel browsercolorsmodel arraylist jedit getproperty jedit getcolorproperty add method void add entries add new entry ui manager get color tree foreground fire table rows inserted entries size 1 entries size 1 uimanager getcolor firetablerowsinserted remove method void remove int index entries remove index fire table rows deleted entries size entries size firetablerowsdeleted move up method public void move up int index object obj entries get index entries remove index entries add index 1 obj fire table rows updated index 1 index moveup moveup firetablerowsupdated move down method public void move down int index object obj entries get index entries remove index entries add index 1 obj fire table rows updated index index 1 movedown movedown firetablerowsupdated save method void save int i for i 0 i entries size i entry entry entry entries get i j edit set property vfs browser colors i glob entry glob j edit set color property vfs browser colors i color entry color j edit unset property vfs browser colors i glob j edit unset property vfs browser colors i color jedit setproperty jedit setcolorproperty jedit unsetproperty jedit unsetproperty get column count method public int get column count return 2 getcolumncount getcolumncount get row count method public int get row count return entries size getrowcount getrowcount get value at method public object get value at int row int col entry entry entry entries get row switch col case 0 return entry glob case 1 return entry color default return null getvalueat getvalueat is cell editable method public boolean is cell editable int row int col return col 0 iscelleditable iscelleditable set value at method public void set value at object value int row int col entry entry entry entries get row if col 0 entry glob string value else entry color color value fire table rows updated row row setvalueat setvalueat firetablerowsupdated get column name method public string get column name int index switch index case 0 return j edit get property options browser colors glob case 1 return j edit get property options browser colors color default return null getcolumnname getcolumnname jedit getproperty jedit getproperty get column class method public class get column class int col switch col case 0 return string class case 1 return color class default throw new internal error getcolumnclass getcolumnclass internalerror entry string glob color color this glob glob this color color color renderer constructor public color renderer set opaque true set border syntax hilite option pane no focus border colorrenderer colorrenderer setopaque setborder syntaxhiliteoptionpane nofocusborder get table cell renderer component method public component get table cell renderer component j table table object value boolean is selected boolean cell has focus int row int col if is selected set background table get selection background set foreground table get selection foreground else set background table get background set foreground table get foreground if value null set background color value set border cell has focus ui manager get border table focus cell highlight border syntax hilite option pane no focus border return this gettablecellrenderercomponent gettablecellrenderercomponent jtable isselected cellhasfocus isselected setbackground getselectionbackground setforeground getselectionforeground setbackground getbackground setforeground getforeground setbackground setborder cellhasfocus uimanager getborder focuscellhighlightborder syntaxhiliteoptionpane nofocusborder panel window container constructor public panel window container dockable window manager wm string position int dimension this wm wm this position position button box setup button panel new j panel new button layout button panel set border new empty border 1 1 1 1 close box new j button gui utilities load icon closebox gif close box set request focus enabled false close box set tool tip text j edit get property view docking close tooltip if operating system is macoslf close box put client property j button button type toolbar close box set margin new insets 0 0 0 0 close box add action listener new action handler menu btn new j button gui utilities load icon toolbar menu gif menu btn set request focus enabled false menu btn set tool tip text j edit get property view docking menu tooltip if operating system is macoslf menu btn put client property j button button type toolbar menu btn set margin new insets 0 0 0 0 menu btn add mouse listener new menu mouse handler button group new button group jdk 1 4 workaround button group add null button new j toggle button dockables new array list buttons new array list dockable panel new dockable panel this dimension dimension panelwindowcontainer panelwindowcontainer dockablewindowmanager buttonpanel jpanel buttonlayout buttonpanel setborder emptyborder closebox jbutton guiutilities loadicon closebox setrequestfocusenabled closebox settooltiptext jedit getproperty operatingsystem ismacoslf closebox putclientproperty jbutton buttontype closebox setmargin closebox addactionlistener actionhandler menubtn jbutton guiutilities loadicon toolbarmenu menubtn setrequestfocusenabled menubtn settooltiptext jedit getproperty operatingsystem ismacoslf menubtn putclientproperty jbutton buttontype menubtn setmargin menubtn addmouselistener menumousehandler buttongroup buttongroup buttongroup nullbutton jtogglebutton arraylist arraylist dockablepanel dockablepanel register method public void register final dockable window manager entry entry dockables add entry create button int rotation if position equals dockable window manager top position equals dockable window manager bottom rotation rotated text icon none else if position equals dockable window manager left rotation rotated text icon ccw else if position equals dockable window manager right rotation rotated text icon cw else throw new internal error invalid position position j toggle button button new j toggle button button set margin new insets 1 1 1 1 button set request focus enabled false button set icon new rotated text icon rotation button get font entry title button set action command entry factory name button add action listener new action handler button add mouse listener new menu mouse handler if operating system is macoslf button put client property j button button type toolbar button group add button buttons add button entry btn button wm revalidate dockablewindowmanager dockablewindowmanager dockablewindowmanager rotatedtexticon dockablewindowmanager rotatedtexticon dockablewindowmanager rotatedtexticon internalerror jtogglebutton jtogglebutton setmargin setrequestfocusenabled seticon rotatedtexticon getfont setactioncommand addactionlistener actionhandler addmouselistener menumousehandler operatingsystem ismacoslf putclientproperty jbutton buttontype buttongroup unregister method public void unregister dockable window manager entry entry if entry factory name equals most recent most recent null button panel remove entry btn buttons remove entry btn entry btn null dockables remove entry if entry win null dockable panel remove entry win if current entry current null show null else wm revalidate dockable panel repaint button panel repaint dockablewindowmanager mostrecent mostrecent buttonpanel dockablepanel dockablepanel buttonpanel remove method public void remove final dockable window manager entry entry if entry factory name equals most recent most recent null if entry win null dockable panel remove entry win entry win null if current entry current null show null else wm revalidate dockable panel repaint dockablewindowmanager mostrecent mostrecent dockablepanel dockablepanel show most recent method public void show most recent if dockables size 0 toolkit get default toolkit beep return if most recent null most recent dockable window manager entry dockables get 0 factory name wm show dockable window most recent showmostrecent showmostrecent getdefaulttoolkit mostrecent mostrecent dockablewindowmanager showdockablewindow mostrecent show method public void show final dockable window manager entry entry if current entry if entry null if entry win instanceof default focus component default focus component entry win focus on default component else entry win request default focus return if entry null if current null we didn t have a component previously so create a border dockable panel set border new dock border position most recent entry factory name this current entry if entry win get parent dockable panel dockable panel add entry factory name entry win dockable panel show dockable entry factory name entry btn set selected true if entry win instanceof default focus component default focus component entry win focus on default component else entry win request default focus else current null null button set selected true removing last component so remove border dockable panel set border null wm get view get text area request focus wm revalidate dockable panel repaint dockablewindowmanager defaultfocuscomponent defaultfocuscomponent focusondefaultcomponent requestdefaultfocus dockablepanel setborder dockborder mostrecent getparent dockablepanel dockablepanel dockablepanel showdockable setselected defaultfocuscomponent defaultfocuscomponent focusondefaultcomponent requestdefaultfocus nullbutton setselected dockablepanel setborder getview gettextarea requestfocus dockablepanel is visible method public boolean is visible dockable window manager entry entry return current entry isvisible isvisible dockablewindowmanager get current method returns the name of the dockable in this container since j edit 4 2pre1 public string get current if current null return null else return current factory name getcurrent jedit getcurrent get dimension method returns the width or height depending on position of the dockable window container since j edit 4 2pre1 public int get dimension return dimension getdimension jedit getdimension get dockables method public string get dockables string ret val new string dockables size for int i 0 i dockables size i dockable window manager entry entry dockable window manager entry dockables get i ret val i entry factory name return ret val getdockables getdockables retval dockablewindowmanager dockablewindowmanager retval retval save method void save j edit set integer property view dock position dimension dimension if current null j edit unset property view dock position last else j edit set property view dock position last current factory name jedit setintegerproperty jedit unsetproperty jedit setproperty set dimension method void set dimension int dimension if dimension 0 this dimension dimension splitter width setdimension setdimension splitter_width sort dockables method void sort dockables button panel remove all button panel add close box button panel add menu btn collections sort buttons new dockable window compare for int i 0 i buttons size i button panel add abstract button buttons get i sortdockables sortdockables buttonpanel removeall buttonpanel closebox buttonpanel menubtn dockablewindowcompare buttonpanel abstractbutton get wrapped dimension method returns the width or height of wrapped rows or columns int get wrapped dimension int dimension return button layout button panel get layout get wrapped dimension button panel dimension getwrappeddimension getwrappeddimension buttonlayout buttonpanel getlayout getwrappeddimension buttonpanel public int compare object o1 object o2 string name1 abstract button o1 get action command string name2 abstract button o2 get action command return misc utilities compare strings j edit get property name1 title j edit get property name2 title true abstractbutton getactioncommand abstractbutton getactioncommand miscutilities comparestrings jedit getproperty jedit getproperty public void action performed action event evt if popup null popup is visible popup set visible false if evt get source close box show null else if wm is dockable window visible evt get action command show null else wm show dockable window evt get action command actionperformed actionevent isvisible setvisible getsource closebox isdockablewindowvisible getactioncommand showdockablewindow getactioncommand public void mouse pressed mouse event evt if popup null popup is visible popup set visible false return component comp component evt get source string dockable if comp instanceof j toggle button dockable j toggle button comp get action command else dockable get current if comp menu btn gui utilities is popup trigger evt if dockable null popup wm create popup menu panel window container this null false else popup wm create popup menu panel window container this dockable false int x y boolean point if comp menu btn x 0 y menu btn get height point false else x evt getx y evt gety point true gui utilities show popup menu popup comp x y point mousepressed mouseevent isvisible setvisible getsource jtogglebutton jtogglebutton getactioncommand getcurrent menubtn guiutilities ispopuptrigger createpopupmenu panelwindowcontainer createpopupmenu panelwindowcontainer menubtn menubtn getheight guiutilities showpopupmenu dock border constructor dock border string position this position position insets new insets position equals dockable window manager bottom splitter width 0 position equals dockable window manager right splitter width 0 position equals dockable window manager top splitter width 0 position equals dockable window manager left splitter width 0 dockborder dockborder dockablewindowmanager splitter_width dockablewindowmanager splitter_width dockablewindowmanager splitter_width dockablewindowmanager splitter_width paint border method public void paint border component c graphics g int x int y int width int height update colors if color1 null color2 null color3 null return if position equals dockable window manager bottom paint horiz border g x y width else if position equals dockable window manager right paint vert border g x y height else if position equals dockable window manager top paint horiz border g x y height splitter width width else if position equals dockable window manager left paint vert border g x width splitter width y height paintborder paintborder updatecolors dockablewindowmanager painthorizborder dockablewindowmanager paintvertborder dockablewindowmanager painthorizborder splitter_width dockablewindowmanager paintvertborder splitter_width get border insets method public insets get border insets component c return insets getborderinsets getborderinsets is border opaque method public boolean is border opaque return false isborderopaque isborderopaque paint horiz border method private void paint horiz border graphics g int x int y int width g set color color3 g fill rect x y width splitter width for int i 0 i width 4 1 i g set color color1 g draw line x i 4 2 y 3 x i 4 2 y 3 g set color color2 g draw line x i 4 3 y 4 x i 4 3 y 4 g set color color1 g draw line x i 4 4 y 5 x i 4 4 y 5 g set color color2 g draw line x i 4 5 y 6 x i 4 5 y 6 painthorizborder painthorizborder setcolor fillrect splitter_width setcolor drawline setcolor drawline setcolor drawline setcolor drawline paint vert border method private void paint vert border graphics g int x int y int height g set color color3 g fill rect x y splitter width height for int i 0 i height 4 1 i g set color color1 g draw line x 3 y i 4 2 x 3 y i 4 2 g set color color2 g draw line x 4 y i 4 3 x 4 y i 4 3 g set color color1 g draw line x 5 y i 4 4 x 5 y i 4 4 g set color color2 g draw line x 6 y i 4 5 x 6 y i 4 5 paintvertborder paintvertborder setcolor fillrect splitter_width setcolor drawline setcolor drawline setcolor drawline setcolor drawline update colors method private void update colors if ui manager get look and feel instanceof metal look and feel color1 metal look and feel get control highlight color2 metal look and feel get control dark shadow color3 metal look and feel get control else color1 color2 color3 null updatecolors updatecolors uimanager getlookandfeel metallookandfeel metallookandfeel getcontrolhighlight metallookandfeel getcontroldarkshadow metallookandfeel getcontrol rotated text icon constructor public rotated text icon int rotate font font string text this rotate rotate this font font font render context font render context new font render context null true true this text text glyphs font create glyph vector font render context text width int glyphs get logical bounds get width 4 height int glyphs get logical bounds get height line metrics line metrics font get line metrics text font render context ascent line metrics get ascent height int line metrics get height render hints new rendering hints rendering hints key antialiasing rendering hints value antialias on render hints put rendering hints key fractionalmetrics rendering hints value fractionalmetrics on render hints put rendering hints key rendering rendering hints value render quality rotatedtexticon rotatedtexticon fontrendercontext fontrendercontext fontrendercontext createglyphvector fontrendercontext getlogicalbounds getwidth getlogicalbounds getheight linemetrics linemetrics getlinemetrics fontrendercontext linemetrics getascent linemetrics getheight renderhints renderinghints renderinghints key_antialiasing renderinghints value_antialias_on renderhints renderinghints key_fractionalmetrics renderinghints value_fractionalmetrics_on renderhints renderinghints key_rendering renderinghints value_render_quality get icon width method public int get icon width return int rotate rotated text icon cw rotate rotated text icon ccw height width geticonwidth geticonwidth rotatedtexticon rotatedtexticon get icon height method public int get icon height return int rotate rotated text icon cw rotate rotated text icon ccw width height geticonheight geticonheight rotatedtexticon rotatedtexticon paint icon method public void paint icon component c graphics g int x int y graphics2d g2d graphics2d g g2d set font font affine transform old transform g2d get transform rendering hints old hints g2d get rendering hints g2d set rendering hints render hints g2d set color c get foreground no rotation if rotate rotated text icon none g2d draw glyph vector glyphs x 2 y ascent clockwise rotation else if rotate rotated text icon cw affine transform trans new affine transform trans concatenate old transform trans translate x y 2 trans rotate math pi 2 height 2 width 2 g2d set transform trans g2d draw glyph vector glyphs height width 2 width height 2 ascent counterclockwise rotation else if rotate rotated text icon ccw affine transform trans new affine transform trans concatenate old transform trans translate x y 2 trans rotate math pi 3 2 height 2 width 2 g2d set transform trans g2d draw glyph vector glyphs height width 2 width height 2 ascent g2d set transform old transform g2d set rendering hints old hints painticon painticon setfont affinetransform oldtransform gettransform renderinghints oldhints getrenderinghints setrenderinghints renderhints setcolor getforeground rotatedtexticon drawglyphvector rotatedtexticon affinetransform affinetransform oldtransform settransform drawglyphvector rotatedtexticon affinetransform affinetransform oldtransform settransform drawglyphvector settransform oldtransform setrenderinghints oldhints add layout component method public void add layout component string name component comp addlayoutcomponent addlayoutcomponent remove layout component method public void remove layout component component comp removelayoutcomponent removelayoutcomponent get wrapped dimension method returns the width or height of wrapped rows or columns int get wrapped dimension j component parent int dimension insets insets j component parent get border get border insets j component parent component comp parent get components if comp length 2 return 0 dimension dim comp 2 get preferred size if position equals dockable window manager top position equals dockable window manager bottom int width dimension insets right int row height math max dim height close box get preferred size width int x row height 2 insets left dimension return value new dimension 0 row height insets top insets bottom for int i 2 i comp length i int btn width comp i get preferred size width if btn width x width return value height row height x insets left x btn width return return value height else int height dimension insets bottom int col width math max dim width close box get preferred size height int y col width 2 insets top dimension return value new dimension col width insets left insets right 0 for int i 2 i comp length i int btn height comp i get preferred size height if btn height y height return value width col width y insets top y btn height return return value width getwrappeddimension getwrappeddimension jcomponent jcomponent getborder getborderinsets jcomponent getcomponents getpreferredsize dockablewindowmanager dockablewindowmanager rowheight closebox getpreferredsize rowheight returnvalue rowheight btnwidth getpreferredsize btnwidth returnvalue rowheight btnwidth returnvalue colwidth closebox getpreferredsize colwidth returnvalue colwidth btnheight getpreferredsize btnheight returnvalue colwidth btnheight returnvalue preferred layout size method public dimension preferred layout size container parent insets insets j component parent get border get border insets j component parent component comp parent get components if comp length 2 nothing cept close box return new dimension 0 0 dimension dim comp 2 get preferred size if position equals dockable window manager top position equals dockable window manager bottom int width parent get width insets right int row height math max dim height close box get preferred size width int x row height 2 insets left dimension return value new dimension 0 row height insets top insets bottom for int i 2 i comp length i int btn width comp i get preferred size width if btn width x width return value height row height x insets left x btn width return return value else int height parent get height insets bottom int col width math max dim width close box get preferred size height int y col width 2 insets top dimension return value new dimension col width insets left insets right 0 for int i 2 i comp length i int btn height comp i get preferred size height if btn height y height return value width col width y insets top y btn height return return value preferredlayoutsize preferredlayoutsize jcomponent getborder getborderinsets jcomponent getcomponents getpreferredsize dockablewindowmanager dockablewindowmanager getwidth rowheight closebox getpreferredsize rowheight returnvalue rowheight btnwidth getpreferredsize btnwidth returnvalue rowheight btnwidth returnvalue getheight colwidth closebox getpreferredsize colwidth returnvalue colwidth btnheight getpreferredsize btnheight returnvalue colwidth btnheight returnvalue minimum layout size method public dimension minimum layout size container parent return preferred layout size parent minimumlayoutsize minimumlayoutsize preferredlayoutsize layout container method public void layout container container parent insets insets j component parent get border get border insets j component parent component comp parent get components if comp length 2 for int i 0 i comp length i comp i set visible false return comp 0 set visible true comp 1 set visible true dimension dim comp 2 get preferred size if position equals dockable window manager top position equals dockable window manager bottom int width parent get width insets right int row height math max dim height close box get preferred size width int x row height 2 insets left int y insets top close box set bounds insets left insets top row height row height menu btn set bounds insets left row height insets top row height row height for int i 2 i comp length i int btn width comp i get preferred size width if btn width x width x insets left y row height comp i set bounds x y btn width row height x btn width if y row height parent get height parent set size parent get width y row height j component parent revalidate else int height parent get height insets bottom int col width math max dim width close box get preferred size height int x insets left int y col width 2 insets top close box set bounds insets left insets top col width col width menu btn set bounds insets left insets top col width col width col width for int i 2 i comp length i int btn height comp i get preferred size height if btn height y height x col width y insets top comp i set bounds x y col width btn height y btn height if x col width parent get width parent set size x col width parent get height j component parent revalidate layoutcontainer layoutcontainer jcomponent getborder getborderinsets jcomponent getcomponents setvisible setvisible setvisible getpreferredsize dockablewindowmanager dockablewindowmanager getwidth rowheight closebox getpreferredsize rowheight closebox setbounds rowheight rowheight menubtn setbounds rowheight rowheight rowheight btnwidth getpreferredsize btnwidth rowheight setbounds btnwidth rowheight btnwidth rowheight getheight setsize getwidth rowheight jcomponent getheight colwidth closebox getpreferredsize colwidth closebox setbounds colwidth colwidth menubtn setbounds colwidth colwidth colwidth btnheight getpreferredsize btnheight colwidth setbounds colwidth btnheight btnheight colwidth getwidth setsize colwidth getheight jcomponent dockable panel constructor dockable panel super new card layout resize mouse handler resize mouse handler new resize mouse handler add mouse listener resize mouse handler add mouse motion listener resize mouse handler dockablepanel dockablepanel cardlayout resizemousehandler resizemousehandler resizemousehandler addmouselistener resizemousehandler addmousemotionlistener resizemousehandler get window container method panel window container get window container return panel window container this getwindowcontainer panelwindowcontainer getwindowcontainer panelwindowcontainer show dockable method void show dockable string name card layout get layout show this name showdockable showdockable cardlayout getlayout get minimum size method public dimension get minimum size return new dimension 0 0 getminimumsize getminimumsize get preferred size method public dimension get preferred size if current null return new dimension 0 0 else if position equals dockable window manager top position equals dockable window manager bottom if dimension 0 int height super get preferred size height dimension height splitter width return new dimension 0 dimension splitter width else if dimension 0 int width super get preferred size width dimension width splitter width return new dimension dimension splitter width 0 getpreferredsize getpreferredsize dockablewindowmanager dockablewindowmanager getpreferredsize splitter_width splitter_width getpreferredsize splitter_width splitter_width set bounds method public void set bounds int x int y int width int height if position equals dockable window manager top position equals dockable window manager bottom if dimension 0 height splitter width panel window container this show null else dimension height splitter width else if dimension 0 width splitter width panel window container this show null else dimension width splitter width super set bounds x y width height setbounds setbounds dockablewindowmanager dockablewindowmanager splitter_width panelwindowcontainer splitter_width splitter_width panelwindowcontainer splitter_width setbounds mouse pressed method public void mouse pressed mouse event evt if can drag wm set resize pos dimension panel window container this drag start evt get point mousepressed mousepressed mouseevent candrag setresizepos panelwindowcontainer dragstart getpoint mouse released method public void mouse released mouse event evt if can drag dimension wm resize pos wm finish resizing drag start null wm revalidate mousereleased mousereleased mouseevent candrag resizepos finishresizing dragstart mouse moved method public void mouse moved mouse event evt border border get border if border null collapsed return insets insets border get border insets dockable panel this can drag false top if position equals dockable window manager top if evt gety get height insets bottom can drag true left else if position equals dockable window manager left if evt getx get width insets right can drag true bottom else if position equals dockable window manager bottom if evt gety insets top can drag true right else if position equals dockable window manager right if evt getx insets left can drag true if can drag wm set cursor cursor get predefined cursor get appropriate cursor else wm set cursor cursor get predefined cursor cursor default cursor mousemoved mousemoved mouseevent getborder getborderinsets dockablepanel candrag dockablewindowmanager getheight candrag dockablewindowmanager getwidth candrag dockablewindowmanager candrag dockablewindowmanager candrag candrag setcursor getpredefinedcursor getappropriatecursor setcursor getpredefinedcursor default_cursor mouse dragged method public void mouse dragged mouse event evt if can drag return if drag start null can t happen return wm set cursor cursor get predefined cursor get appropriate cursor top if position equals dockable window manager top wm set resize pos evt gety drag start y dimension panel window container this left else if position equals dockable window manager left wm set resize pos evt getx drag start x dimension panel window container this bottom else if position equals dockable window manager bottom wm set resize pos dimension evt gety drag start y panel window container this right else if position equals dockable window manager right wm set resize pos dimension evt getx drag start x panel window container this mousedragged mousedragged mouseevent candrag dragstart setcursor getpredefinedcursor getappropriatecursor dockablewindowmanager setresizepos dragstart panelwindowcontainer dockablewindowmanager setresizepos dragstart panelwindowcontainer dockablewindowmanager setresizepos dragstart panelwindowcontainer dockablewindowmanager setresizepos dragstart panelwindowcontainer mouse exited method public void mouse exited mouse event evt wm set cursor cursor get predefined cursor cursor default cursor mouseexited mouseexited mouseevent setcursor getpredefinedcursor default_cursor get cursor method private int get appropriate cursor if position equals dockable window manager top return cursor n resize cursor else if position equals dockable window manager left return cursor w resize cursor else if position equals dockable window manager bottom return cursor s resize cursor else if position equals dockable window manager right return cursor e resize cursor else throw new internal error getcursor getappropriatecursor dockablewindowmanager n_resize_cursor dockablewindowmanager w_resize_cursor dockablewindowmanager s_resize_cursor dockablewindowmanager e_resize_cursor internalerror roster constructor roster operations new array list to load new array list arraylist toload arraylist add remove method void add remove string plugin add operation new remove plugin addremove addremove addoperation add install method void add install string installed string url string install directory int size add operation new install installed url install directory size addinstall addinstall installdirectory addoperation installdirectory get operation method public operation get operation int i return operation operations get i getoperation getoperation get operation count method int get operation count return operations size getoperationcount getoperationcount is empty method boolean is empty return operations size 0 isempty isempty perform operations in work thread method void perform operations in work thread plugin manager progress progress for int i 0 i operations size i operation op operation operations get i op run in work thread progress progress done if thread interrupted return performoperationsinworkthread performoperationsinworkthread pluginmanagerprogress runinworkthread perform operations inawt thread method void perform operations inawt thread component comp for int i 0 i operations size i operation op operation operations get i op run inawt thread comp add the ja rs before checking deps since dep check might require all ja rs to be present for int i 0 i to load size i string plugin name string to load get i if j edit get pluginjar plugin name null log log log warning this already loaded plugin name else j edit add pluginjar plugin name for int i 0 i to load size i string plugin name string to load get i pluginjar plugin j edit get pluginjar plugin name if plugin null plugin check dependencies now activate the plugins for int i 0 i to load size i string plugin name string to load get i pluginjar plugin j edit get pluginjar plugin name if plugin null plugin activate plugin if necessary performoperationsinawtthread performoperationsinawtthread runinawtthread jars jars toload pluginname toload jedit getpluginjar pluginname pluginname jedit addpluginjar pluginname toload pluginname toload jedit getpluginjar pluginname checkdependencies toload pluginname toload jedit getpluginjar pluginname activatepluginifnecessary add operation method private void add operation operation op for int i 0 i operations size i if operations get i equals op return operations add op addoperation addoperation get download dir method private static string get download dir if download dir null string settings j edit get settings directory if settings null settings system get property user home download dir new file misc utilities construct path settings plugin manager download download dir mkdirs return download dir get path getdownloaddir getdownloaddir downloaddir jedit getsettingsdirectory getproperty downloaddir miscutilities constructpath pluginmanager downloaddir downloaddir getpath static abstract class operation public void run in work thread plugin manager progress progress runinworkthread pluginmanagerprogress public void run inawt thread component comp runinawtthread public int get maximum return 0 getmaximum remove constructor remove string plugin this plugin plugin run inawt thread method public void run inawt thread component comp close jar file and all ja rs that depend on this pluginjar jar j edit get pluginjar plugin if jar null unload pluginjar jar string cache path jar get cache path if cache path null new file cache path delete to load remove plugin remove cache file move jar first file jar file new file plugin file src file new file plugin substring 0 plugin length 4 log log log notice this deleting jar file boolean ok jar file delete if src file exists ok delete recursively src file if ok string args plugin gui utilities error comp plugin manager remove failed args runinawtthread runinawtthread jars jedit getpluginjar unloadpluginjar cachepath getcachepath cachepath cachepath toload jarfile srcfile jarfile jarfile srcfile deleterecursively srcfile guiutilities unload pluginjar method this should go into a public method somewhere private void unload pluginjar pluginjar jar string dependents jar get dependent plugins for int i 0 i dependents length i pluginjar jar j edit get pluginjar dependents i if jar null to load add dependents i unload pluginjar jar j edit remove pluginjar jar false unloadpluginjar unloadpluginjar getdependentplugins _jar jedit getpluginjar _jar toload unloadpluginjar _jar jedit removepluginjar equals method public boolean equals object o if o instanceof remove remove o plugin equals plugin return true else return false private boolean delete recursively file file log log log notice this deleting file recursively boolean ok true if file is directory string path file get path string children file list for int i 0 i children length i ok delete recursively new file path children i ok file delete return ok deleterecursively isdirectory getpath deleterecursively install constructor install string installed string url string install directory int size catch those hooligans passing null urls if url null throw new null pointer exception this installed installed this url url this install directory install directory this size size installdirectory nullpointerexception installdirectory installdirectory get maximum method public int get maximum return size getmaximum getmaximum run in work thread method public void run in work thread plugin manager progress progress string file name misc utilities get file name url path download progress file name url runinworkthread runinworkthread pluginmanagerprogress filename miscutilities getfilename filename run inawt thread method public void run inawt thread component comp check if download failed if path null return if download ok remove existing version if installed null new remove installed run inawt thread comp zip file zip file null try zip file new zip file path enumeration e zip file entries while e has more elements zip entry entry zip entry e next element string name entry get name replace file separator char file file new file install directory name if entry is directory file mkdirs else new file file get parent mkdirs copy null zip file get input stream entry new file output stream file false if file get name to lower case ends with jar to load add file get path catch interruptedio exception iio catch final io exception io log log log error this io string args io get message gui utilities error null ioerror args catch exception e log log log error this e finally try if zip file null zip file close catch io exception io log log log error this io if j edit get boolean property plugin manager delete downloads new file path delete runinawtthread runinawtthread runinawtthread zipfile zipfile zipfile zipfile zipfile hasmoreelements zipentry zipentry nextelement getname separatorchar installdirectory isdirectory getparent zipfile getinputstream fileoutputstream getname tolowercase endswith toload getpath interruptedioexception ioexception getmessage guiutilities zipfile zipfile ioexception jedit getbooleanproperty deletedownloads equals method public boolean equals object o if o instanceof install install o url equals url even if install directory is different return true else return false installdirectory download method private string download plugin manager progress progress string file name string url try url connection conn new url url open connection string path misc utilities construct path get download dir file name if copy progress conn get input stream new file output stream path true return null return path catch interruptedio exception iio do nothing user clicked stop return null catch final io exception io log log log error this io swing utilities invoke later new runnable public void run string args io get message gui utilities error null ioerror args return null catch exception e log log log error this e return null pluginmanagerprogress filename urlconnection openconnection miscutilities constructpath getdownloaddir filename getinputstream fileoutputstream interruptedioexception ioexception swingutilities invokelater getmessage guiutilities public void run string args io get message gui utilities error null ioerror args getmessage guiutilities copy method private boolean copy plugin manager progress progress input stream in output stream out boolean can stop throws exception in new buffered input stream in out new buffered output stream out try byte buf new byte 4096 int copied 0 loop for int count in read buf 0 buf length if count 1 break loop copied count if progress null progress set value copied out write buf 0 count if can stop thread interrupted in close out close return false finally in close out close return true pluginmanagerprogress inputstream outputstream canstop bufferedinputstream bufferedoutputstream setvalue canstop the re constructor uses this to look up the constant for a string static int int value string key for int i 0 i s nametable length i if s nametable i equals key return i return 1 intvalue s_nametable s_nametable re tokenposix int sub index int type boolean insens boolean negated super sub index this type type this insens insens this negated negated retokenposix subindex subindex int get minimum length return 1 getminimumlength boolean match char indexed input re match mymatch char ch input char at mymatch index if ch char indexed out of bounds return false boolean retval false switch type case alnum note that there is some debate over whether should be included retval character is letter or digit ch ch break case alpha retval character is letter ch break case blank retval ch ch t break case cntrl retval character isiso control ch break case digit retval character is digit ch break case graph retval character is whitespace ch character isiso control ch break case lower retval insens character is letter ch character is lower case ch break case print retval character is whitespace ch character isiso control ch ch break case punct this feels sloppy especially for non u s locales retval index of ch 1 break case space retval character is whitespace ch break case upper retval insens character is letter ch character is upper case ch break case xdigit retval character is digit ch abcdefabcdef index of ch 1 break if negated retval retval if retval mymatch index return next input mymatch else return false charindexed rematch charat charindexed out_of_bounds _ isletterordigit _ isletter isisocontrol isdigit iswhitespace isisocontrol isletter islowercase iswhitespace isisocontrol _ indexof iswhitespace isletter isuppercase isdigit indexof void dump string buffer os if negated os append os append s nametable type stringbuffer s_nametable creates an re filter input stream when reading from this stream occurrences of patterns matching the supplied regular expression will be replaced with the supplied replacement text the metacharacters 0 through 9 may be used to refer to the full match or subexpression matches param stream the input stream to be filtered param expr the regular expression to search for param replace the text pattern to replace matches with public re filter input stream input stream stream re expr string replace super stream this stream new char indexed input stream stream 0 this expr expr this replace replace refilterinputstream inputstream refilterinputstream inputstream charindexedinputstream reads the next byte from the stream per the general contract of input stream read returns 1 on error or end of stream public int read if we have buffered replace data use it if buffer null bufpos buffer length return int buffer char at bufpos check if input is at a valid position if stream is valid return 1 re match mymatch new re match expr get num subs offset 0 if expr match stream mymatch mymatch end 0 mymatch index mymatch finish stream stream move mymatch to string length offset mymatch to string length buffer mymatch substitute into replace bufpos 1 this is prone to infinite loops if replace string turns out empty if buffer length 0 return buffer char at 0 char ch stream char at 0 if ch char indexed out of bounds return 1 stream move 1 offset return ch inputstream charat isvalid rematch rematch getnumsubs tostring tostring substituteinto charat charat charindexed out_of_bounds returns false re filter input stream does not support mark and reset methods public boolean mark supported return false refilterinputstream marksupported reads from the stream into the provided array public int read byte b int off int len int i int ok 0 while len 0 i read if i 1 return ok 0 1 ok b off byte i ok return ok reads from the stream into the provided array public int read byte b return read b 0 b length copy method copies the text selected in the text area into the specified register this will replace the existing contents of the designated register param text area the text area param register the register since j edit 2 7pre2 public static void copy j edit text area text area char register string selection text area get selected text if selection null return set register register selection history model get model clipboard add item selection textarea jedit jedittextarea textarea textarea getselectedtext setregister historymodel getmodel additem cut method copies the text selected in the text area into the specified register and then removes it from the buffer param text area the text area param register the register since j edit 2 7pre2 public static void cut j edit text area text area char register if text area is editable string selection text area get selected text if selection null return set register register selection history model get model clipboard add item selection text area set selected text else text area get toolkit beep textarea jedit jedittextarea textarea textarea iseditable textarea getselectedtext setregister historymodel getmodel additem textarea setselectedtext textarea gettoolkit append method appends the text selected in the text area to the specified register with a newline between the old and new text param text area the text area param register the register public static void append j edit text area text area char register append text area register n false textarea jedittextarea textarea textarea append method appends the text selected in the text area to the specified register param text area the text area param register the register param separator the separator to insert between the old and new text public static void append j edit text area text area char register string separator append text area register separator false textarea jedittextarea textarea textarea append method appends the text selected in the text area to the specified register param text area the text area param register the register param separator the text to insert between the old and new text param cut should the current selection be removed since j edit 3 2pre1 public static void append j edit text area text area char register string separator boolean cut if cut text area is editable text area get toolkit beep return string selection text area get selected text if selection null return register reg get register register if reg null string register contents reg to string if register contents null if register contents ends with separator selection register contents selection else selection register contents separator selection set register register selection history model get model clipboard add item selection if cut text area set selected text textarea jedit jedittextarea textarea textarea iseditable textarea gettoolkit textarea getselectedtext getregister registercontents tostring registercontents registercontents endswith registercontents registercontents setregister historymodel getmodel additem textarea setselectedtext paste method insets the contents of the specified register into the text area param text area the text area param register the register since j edit 2 7pre2 public static void paste j edit text area text area char register paste text area register false textarea jedit jedittextarea textarea textarea paste method inserts the contents of the specified register into the text area param text area the text area param register the register param vertical vertical columnar paste since j edit 4 1pre1 public static void paste j edit text area text area char register boolean vertical if text area is editable text area get toolkit beep return register reg get register register if reg null text area get toolkit beep return else string selection reg to string if selection null text area get toolkit beep return if vertical text area get selection count 0 buffer buffer text area get buffer try buffer begin compound edit int caret text area get caret position int caret line text area get caret line selection rect rect new selection rect caret line caret caret line caret text area set selected text rect selection caret line text area get caret line if caret line text area get line count 1 int start column rect get start column buffer int offset buffer get offset of virtual column caret line 1 start column null if offset 1 buffer insert at column caret line 1 start column text area set caret position buffer get line end offset caret line 1 1 else text area set caret position buffer get line start offset caret line 1 offset finally buffer end compound edit else text area set selected text selection history model get model clipboard add item selection textarea jedit jedittextarea textarea textarea iseditable textarea gettoolkit getregister textarea gettoolkit tostring textarea gettoolkit textarea getselectioncount textarea getbuffer begincompoundedit textarea getcaretposition caretline textarea getcaretline caretline caretline textarea setselectedtext caretline textarea getcaretline caretline textarea getlinecount startcolumn getstartcolumn getoffsetofvirtualcolumn caretline startcolumn insertatcolumn caretline startcolumn textarea setcaretposition getlineendoffset caretline textarea setcaretposition getlinestartoffset caretline endcompoundedit textarea setselectedtext historymodel getmodel additem get register method returns the specified register param name the name public static register get register char name if name name if loaded load registers if registers null name registers length return null else return registers name getregister getregister loadregisters set register method sets the specified register param name the name param new register the new value public static void set register char name register new register if name name if loaded load registers if loading modified true if name registers length register new registers new register math min 1 16 name 2 system arraycopy registers 0 new registers 0 registers length registers new registers registers name new register setregister newregister setregister newregister loadregisters newregisters newregisters newregisters newregister set register method sets the specified register param name the name param value the new value public static void set register char name string value register register get register name if register null register set value value else set register name new string register value setregister setregister getregister setvalue setregister stringregister clear register method sets the value of the specified register to code null code param name the register name public static void clear register char name if name registers length return register register registers name if name name register set value else registers name null clearregister clearregister setvalue get registers method returns an array of all available registers some of the elements of this array might be code null code public static register get registers if loaded load registers return registers getregisters getregisters loadregisters get register status prompt method returns the status prompt for the given register action only intended to be called from code actions xml code since j edit 4 2pre2 public static string get register status prompt string action return j edit get property view status action new string get register name string getregisterstatusprompt jedit getregisterstatusprompt jedit getproperty getregisternamestring get register name string method returns a string of all defined registers used by the status bar eg a b since j edit 4 2pre2 public static string get register name string if loaded load registers string buffer buf new string buffer for int i 0 i registers length i if registers i null if buf length 0 buf append buf append char i if buf length 0 return j edit get property view status no registers else return buf to string getregisternamestring jedit getregisternamestring loadregisters stringbuffer stringbuffer jedit getproperty tostring save registers method public static void save registers if loaded modified return log log log message registers class saving registers xml file file1 new file misc utilities construct path j edit get settings directory registers xml save file file2 new file misc utilities construct path j edit get settings directory registers xml if file2 exists file2 last modified registers mod time log log log warning registers class file2 changed on disk will not save registers return j edit backup settings file file2 string line sep system get property line separator buffered writer out null boolean ok false try out new buffered writer new file writer file1 out write xml version 1 0 out write line sep out write doctype registers system registers dtd out write line sep out write registers out write line sep register registers get registers for int i 0 i registers length i register register registers i if register null i i continue out write register name if i out write quot else out write char i out write out write misc utilities chars to entities register to string out write register out write line sep out write registers out write line sep ok true catch exception e log log log error registers class e finally try if out null out close catch io exception e if ok to avoid data loss only do this if the above completed successfully file2 delete file1 rename to file2 registers mod time file2 last modified modified false saveregisters saveregisters miscutilities constructpath jedit getsettingsdirectory miscutilities constructpath jedit getsettingsdirectory lastmodified registersmodtime jedit backupsettingsfile linesep getproperty bufferedwriter bufferedwriter filewriter linesep linesep linesep getregisters miscutilities charstoentities tostring linesep linesep ioexception renameto registersmodtime lastmodified private static boolean loaded loading modified private registers load registers method private static void load registers string settings directory j edit get settings directory if settings directory null return file register file new file misc utilities construct path j edit get settings directory registers xml if register file exists return registers mod time register file last modified loaded true log log log message j edit class loading registers xml registers handler handler new registers handler xml parser parser new xml parser parser set handler handler reader in null try loading true in new buffered reader new file reader register file parser parse null null in catch xml exception xe int line xe get line string message xe get message log log log error registers class register file line message catch file not found exception fnf log log log debug registers class fnf catch exception e log log log error registers class e finally loading false try if in null in close catch io exception io log log log error registers class io loadregisters loadregisters settingsdirectory jedit getsettingsdirectory settingsdirectory registerfile miscutilities constructpath jedit getsettingsdirectory registerfile registersmodtime registerfile lastmodified jedit registershandler registershandler xmlparser xmlparser sethandler bufferedreader filereader registerfile xmlexception getline getmessage registerfile filenotfoundexception ioexception public interface register converts to a string string to string tostring string to string sets the register contents void set value string value tostring setvalue clipboard clipboard public clipboard register clipboard clipboard this clipboard clipboard clipboardregister sets the clipboard contents public void set value string value string selection selection new string selection value clipboard set contents selection null setvalue stringselection stringselection setcontents returns the clipboard contents public string to string try string selection string clipboard get contents this get transfer data data flavor string flavor boolean trailingeol selection ends with n selection ends with system get property line separator some java versions return the clipboard contents using the native line separator so have to convert it here buffered reader in new buffered reader new string reader selection string buffer buf new string buffer string line while line in read line null broken eclipse workaround 24 febuary 2004 if line ends with 0 line line substring 0 line length 1 buf append line buf append n remove trailing n if trailingeol buf length 0 buf set length buf length 1 return buf to string catch exception e log log log notice this e return null tostring getcontents gettransferdata dataflavor stringflavor endswith endswith getproperty bufferedreader bufferedreader stringreader stringbuffer stringbuffer readline endswith setlength tostring creates a new string register param value the contents public string register string value this value value stringregister sets the register contents public void set value string value this value value setvalue converts to a string public string to string return value tostring called when this register is no longer available this implementation does nothing resolve entity method public object resolve entity string public id string system id if registers dtd equals system id this will result in a slight speed up since we don t need to read the dtd anyway as a elfred is non validating return new string reader try return new buffered reader new input stream reader get class get resource as stream registers dtd catch exception e log log log error this error while opening recent dtd log log log error this e return null resolveentity resolveentity publicid systemid systemid aelfred stringreader bufferedreader inputstreamreader getclass getresourceasstream attribute method public void attribute string aname string value boolean is specified if aname equals name register name value isspecified registername doctype decl method public void doctype decl string name string public id string system id throws exception if registers equals name return log log log error this registers xml doctype must be registers doctypedecl doctypedecl publicid systemid end element method public void end element string name if name equals register if register name null register name length 1 log log log error this malformed name register name else set register register name char at 0 char data endelement endelement registername registername registername setregister registername charat chardata char data method public void char data char ch int start int length char data new string ch start length chardata chardata chardata plugin list handler plugin list plugin list string path this plugin list plugin list this path path state stack new stack pluginlisthandler pluginlist pluginlist pluginlist pluginlist statestack public object resolve entity string public id string system id if plugins dtd equals system id this will result in a slight speed up since we don t need to read the dtd anyway as a elfred is non validating return new string reader try return new buffered reader new input stream reader get class get resource as stream org gjt sp jedit pluginmgr plugins dtd catch exception e log log log error this error while opening plugins dtd log log log error this e return null resolveentity publicid systemid systemid aelfred stringreader bufferedreader inputstreamreader getclass getresourceasstream public void attribute string aname string value boolean is specified aname aname null null aname intern value value null null value intern if aname name name value else if aname jar jar value else if aname version version value else if aname date date value else if aname obsolete obsolete true equals value else if aname what dep what value else if aname from dep from value else if aname to dep to value else if aname plugin dep plugin value else if aname size size integer parse int value if size 0 log log log warning this size 0 isspecified depwhat depfrom depto depplugin parseint public void doctype decl string name string public id string system id throws exception if plugins equals name return log log log error this path doctype must be plugins doctypedecl publicid systemid public void char data char c int off int len string tag peek element string text new string c off len if tag description description text else if tag plugin set entry plugin set entry text else if tag author if author null author length 0 author author text else author text else if tag download download text else if tag download source download source text chardata peekelement plugin_set_entry pluginsetentry download_source downloadsource public void start element string tag tag push element tag if tag plugin set description null plugin set new plugin list plugin set plugin set name name else if tag plugin description null author null branch null plugin new plugin list plugin else if tag branch download null branch new plugin list branch else if tag download download size size else if tag download source download source size size startelement pushelement plugin_set pluginset pluginlist pluginset pluginset pluginlist pluginlist downloadsize download_source downloadsourcesize public void end element string tag if tag null return else tag tag intern pop element if tag plugin set plugin list add plugin set plugin set plugin set null plugin set entry null else if tag plugin set entry plugin set plugins add element plugin set entry plugin set entry null else if tag plugin plugin jar jar plugin name name plugin author author plugin description description plugin list add plugin plugin jar null name null author null else if tag branch branch version version branch date date branch download download branch download size download size branch download source download source branch download source size download source size branch obsolete obsolete plugin branches add element branch version null download null obsolete false else if tag depend plugin list dependency dep new plugin list dependency dep what dep from dep to dep plugin branch deps add element dep dep what null dep from null dep to null dep plugin null endelement popelement plugin_set pluginlist addpluginset pluginset pluginset pluginsetentry plugin_set_entry pluginset addelement pluginsetentry pluginsetentry pluginlist addplugin downloadsize downloadsize downloadsource downloadsource downloadsourcesize downloadsourcesize addelement pluginlist pluginlist depwhat depfrom depto depplugin addelement depwhat depfrom depto depplugin public void start document try push element null catch exception e e print stack trace startdocument pushelement printstacktrace public void end document plugin list finished enddocument pluginlist private string push element string name name name null null name intern state stack push name return name pushelement statestack private string peek element return string state stack peek peekelement statestack private string pop element return string state stack pop popelement statestack plugin manager progress constructor public plugin manager progress plugin manager dialog roster roster super dialog j edit get property plugin manager progress true this roster roster j panel content new j panel new border layout 12 12 content set border new empty border 12 12 12 12 set content pane content progress new j progress bar progress set string painted true progress set string j edit get property plugin manager progress int maximum 0 count roster get operation count for int i 0 i count i maximum roster get operation i get maximum progress set maximum maximum content add border layout north progress stop new j button j edit get property plugin manager progress stop stop add action listener new action handler j panel panel new j panel new flow layout flow layout center 0 0 panel add stop content add border layout center panel add window listener new window handler pack set location relative to dialog set visible true pluginmanagerprogress pluginmanagerprogress pluginmanager jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane jprogressbar setstringpainted setstring jedit getproperty getoperationcount getoperation getmaximum setmaximum borderlayout jbutton jedit getproperty addactionlistener actionhandler jpanel jpanel flowlayout flowlayout borderlayout addwindowlistener windowhandler setlocationrelativeto setvisible set value method public void set value final int value swing utilities invoke later new runnable public void run progress set value value so far value setvalue setvalue swingutilities invokelater setvalue valuesofar swing utilities invoke later new runnable public void run progress set value value so far value swingutilities invokelater setvalue valuesofar done method public void done try if done count swing utilities invoke and wait new runnable public void run dispose else swing utilities invoke and wait new runnable public void run value so far roster get operation done 1 get maximum progress set value value so far done catch exception e swingutilities invokeandwait swingutilities invokeandwait valuesofar getoperation getmaximum setvalue valuesofar swing utilities invoke and wait new runnable public void run dispose swingutilities invokeandwait public void run value so far roster get operation done 1 get maximum progress set value value so far done valuesofar getoperation getmaximum setvalue valuesofar public void action performed action event evt if evt get source stop thread stop dispose actionperformed actionevent getsource public void window opened window event evt if done return done true thread new roster thread thread start windowopened windowevent rosterthread public void window closing window event evt thread stop dispose windowclosing windowevent class roster thread extends thread roster thread super plugin manager thread rosterthread rosterthread public void run roster perform operations in work thread plugin manager progress this performoperationsinworkthread pluginmanagerprogress constructs a code writer param cw the class writer in which the method must be added param compute maxs tt true tt if the maximum stack size and number of local variables must be automatically computed protected code writer final class writer cw final boolean compute maxs if cw first method null cw first method this cw last method this else cw last method next this cw last method this this cw cw this compute maxs compute maxs if compute maxs pushes the first block onto the stack of blocks to be visited current block new label current block pushed true block stack current block codewriter computemaxs codewriter classwriter computemaxs firstmethod firstmethod lastmethod lastmethod lastmethod computemaxs computemaxs computemaxs currentblock currentblock blockstack currentblock initializes this code writer to define the bytecode of the specified method param access the method s access flags see link constants param name the method s name param desc the method s descriptor see link type type param exceptions the internal names of the method s exceptions may be tt null tt protected void init final int access final string name final string desc final string exceptions this access access this name cw newutf8 name this desc cw newutf8 desc if exceptions null exceptions length 0 exception count exceptions length this exceptions new int exception count for int i 0 i exception count i this exceptions i cw new class exceptions i index if compute maxs updates max locals int size get arguments and return sizes desc 2 if access constants acc static 0 size if size max locals max locals size codewriter exceptioncount exceptioncount exceptioncount newclass computemaxs maxlocals getargumentsandreturnsizes acc_static maxlocals maxlocals public void visit insn final int opcode if compute maxs updates current and max stack sizes int size stack size size opcode if size max stack size max stack size size stack size size if opcode athrow or xreturn ends current block no successor if opcode constants ireturn opcode constants return opcode constants athrow if current block null current block max stack size max stack size current block null adds the instruction to the bytecode of the method code put1 opcode visitinsn computemaxs stacksize maxstacksize maxstacksize stacksize currentblock currentblock maxstacksize maxstacksize currentblock public void visit int insn final int opcode final int operand if compute maxs opcode constants newarray updates current and max stack sizes only if opcode newarray stack size variation 0 for bipush or sipush int size stack size 1 if size max stack size max stack size size stack size size adds the instruction to the bytecode of the method if opcode constants sipush code put12 opcode operand else bipush or newarray code put11 opcode operand visitintinsn computemaxs stacksize maxstacksize maxstacksize stacksize public void visit var insn final int opcode final int var if compute maxs updates current and max stack sizes if opcode constants ret no stack change but end of current block no successor if current block null current block max stack size max stack size current block null else xload or xstore int size stack size size opcode if size max stack size max stack size size stack size size updates max locals int n if opcode constants lload opcode constants dload opcode constants lstore opcode constants dstore n var 2 else n var 1 if n max locals max locals n adds the instruction to the bytecode of the method if var 4 opcode constants ret int opt if opcode constants istore opt 26 iload 0 opcode constants iload 2 var else opt 59 istore 0 opcode constants istore 2 var code put1 opt else if var 256 code put1 196 wide put12 opcode var else code put11 opcode var visitvarinsn computemaxs currentblock currentblock maxstacksize maxstacksize currentblock stacksize maxstacksize maxstacksize stacksize maxlocals maxlocals iload_0 istore_0 public void visit type insn final int opcode final string desc if compute maxs opcode constants new updates current and max stack sizes only if opcode new stack size variation 0 for anewarray checkcast instanceof int size stack size 1 if size max stack size max stack size size stack size size adds the instruction to the bytecode of the method code put12 opcode cw new class desc index visittypeinsn computemaxs stacksize maxstacksize maxstacksize stacksize newclass public void visit field insn final int opcode final string owner final string name final string desc if compute maxs int size computes the stack size variation char c desc char at 0 switch opcode case constants getstatic size stack size c d c j 2 1 break case constants putstatic size stack size c d c j 2 1 break case constants getfield size stack size c d c j 1 0 break case constants putfield default size stack size c d c j 3 2 break updates current and max stack sizes if size max stack size max stack size size stack size size adds the instruction to the bytecode of the method code put12 opcode cw new field owner name desc index visitfieldinsn computemaxs charat stacksize stacksize stacksize stacksize maxstacksize maxstacksize stacksize newfield public void visit method insn final int opcode final string owner final string name final string desc item i if opcode constants invokeinterface i cw new itf method owner name desc else i cw new method owner name desc int arg size i int val if compute maxs computes the stack size variation in order not to recompute several times this variation for the same item we use the int val field of this item to store this variation once it has been computed more precisely this int val field stores the sizes of the arguments and of the return value corresponding to desc if arg size 0 the above sizes have not been computed yet so we compute them arg size get arguments and return sizes desc and we save them in order not to recompute them in the future i int val arg size int size if opcode constants invokestatic size stack size arg size 2 arg size 0x03 1 else size stack size arg size 2 arg size 0x03 updates current and max stack sizes if size max stack size max stack size size stack size size adds the instruction to the bytecode of the method if opcode constants invokeinterface if compute maxs if arg size 0 arg size get arguments and return sizes desc i int val arg size code put12 constants invokeinterface i index put11 arg size 2 0 else code put12 opcode i index visitmethodinsn newitfmethod newmethod argsize intval computemaxs intval intval argsize argsize getargumentsandreturnsizes intval argsize stacksize argsize argsize stacksize argsize argsize maxstacksize maxstacksize stacksize computemaxs argsize argsize getargumentsandreturnsizes intval argsize argsize public void visit jump insn final int opcode final label label if check if label owner null label owner this else if label owner this throw new illegal argument exception if compute maxs if opcode constants goto no stack change but end of current block with one new successor if current block null current block max stack size max stack size add successor stack size label current block null else if opcode constants jsr if current block null add successor stack size 1 label else updates current stack size max stack size unchanged because stack size variation always negative in this case stack size size opcode if current block null add successor stack size label adds the instruction to the bytecode of the method if label resolved label position code length short min value case of a backward jump with an offset 32768 in this case we automatically replace goto with goto w jsr with jsr w and i fxxx l with ifno txxx l goto w l where ifno txxx is the opposite opcode of i fxxx i e ifne for ifeq and where l designates the instruction just after the goto w if opcode constants goto code put1 200 goto w else if opcode constants jsr code put1 201 jsr w else code put1 opcode 166 opcode 1 1 1 opcode 1 code put2 8 jump offset code put1 200 goto w label put this code code length 1 true else case of a backward jump with an offset 32768 or of a forward jump with of course an unknown offset in these cases we store the offset in 2 bytes which will be increased in resize instructions if needed code put1 opcode label put this code code length 1 false visitjumpinsn illegalargumentexception computemaxs currentblock currentblock maxstacksize maxstacksize addsuccessor stacksize currentblock currentblock addsuccessor stacksize stacksize currentblock addsuccessor stacksize min_value goto_w jsr_w ifxxx ifnotxxx goto_w ifnotxxx ifxxx goto_w goto_w jsr_w goto_w resizeinstructions public void visit label final label label if check if label owner null label owner this else if label owner this throw new illegal argument exception if compute maxs if current block null ends current block with one new successor current block max stack size max stack size add successor stack size label begins a new current block resets the relative current and max stack sizes current block label stack size 0 max stack size 0 resolves previous forward references to label if any resize label resolve this code length code data visitlabel illegalargumentexception computemaxs currentblock currentblock maxstacksize maxstacksize addsuccessor stacksize currentblock stacksize maxstacksize public void visit ldc insn final object cst item i cw new cst cst if compute maxs int size computes the stack size variation if i type class writer long i type class writer double size stack size 2 else size stack size 1 updates current and max stack sizes if size max stack size max stack size size stack size size adds the instruction to the bytecode of the method int index i index if i type class writer long i type class writer double code put12 20 ldc2 w index else if index 256 code put12 19 ldc w index else code put11 constants ldc index visitldcinsn newcst computemaxs classwriter classwriter stacksize stacksize maxstacksize maxstacksize stacksize classwriter classwriter ldc2_w ldc_w public void visit iinc insn final int var final int increment if compute maxs updates max locals only no stack change int n var 1 if n max locals max locals n adds the instruction to the bytecode of the method if var 255 increment 127 increment 128 code put1 196 wide put12 constants iinc var put2 increment else code put1 constants iinc put11 var increment visitiincinsn computemaxs maxlocals maxlocals public void visit table switch insn final int min final int max final label dflt final label labels if compute maxs updates current stack size max stack size unchanged stack size ends current block with many new successors if current block null current block max stack size max stack size add successor stack size dflt for int i 0 i labels length i add successor stack size labels i current block null adds the instruction to the bytecode of the method int source code length code put1 constants tableswitch while code length 4 0 code put1 0 dflt put this code source true code put4 min put4 max for int i 0 i labels length i labels i put this code source true visittableswitchinsn computemaxs stacksize currentblock currentblock maxstacksize maxstacksize addsuccessor stacksize addsuccessor stacksize currentblock public void visit lookup switch insn final label dflt final int keys final label labels if compute maxs updates current stack size max stack size unchanged stack size ends current block with many new successors if current block null current block max stack size max stack size add successor stack size dflt for int i 0 i labels length i add successor stack size labels i current block null adds the instruction to the bytecode of the method int source code length code put1 constants lookupswitch while code length 4 0 code put1 0 dflt put this code source true code put4 labels length for int i 0 i labels length i code put4 keys i labels i put this code source true visitlookupswitchinsn computemaxs stacksize currentblock currentblock maxstacksize maxstacksize addsuccessor stacksize addsuccessor stacksize currentblock public void visit multia new array insn final string desc final int dims if compute maxs updates current stack size max stack size unchanged because stack size variation always negative or null stack size 1 dims adds the instruction to the bytecode of the method item class item cw new class desc code put12 constants multianewarray class item index put1 dims visitmultianewarrayinsn computemaxs stacksize classitem newclass classitem public void visit try catch block final label start final label end final label handler final string type if check if start owner this end owner this handler owner this throw new illegal argument exception if start resolved end resolved handler resolved throw new illegal argument exception if compute maxs pushes handler block onto the stack of blocks to be visited if handler pushed handler begin stack size 1 handler pushed true handler next block stack block stack handler catch count if catch table null catch table new byte vector catch table put2 start position catch table put2 end position catch table put2 handler position catch table put2 type null cw new class type index 0 visittrycatchblock illegalargumentexception illegalargumentexception computemaxs beginstacksize blockstack blockstack catchcount catchtable catchtable bytevector catchtable catchtable catchtable catchtable newclass public void visit maxs final int max stack final int max locals if compute maxs true non relative max stack size int max 0 control flow analysis algorithm while the block stack is not empty pop a block from this stack update the max stack size compute the true non relative begin stack size of the successors of this block and push these successors onto the stack unless they have already been pushed onto the stack note by hypothesis the link label begin stack size of the blocks in the block stack are the true non relative beginning stack sizes of these blocks label stack block stack while stack null pops a block from the stack label l stack stack stack next computes the true non relative max stack size of this block int start l begin stack size int block max start l max stack size updates the global max stack size if block max max max block max analyses the successors of the block edge b l successors while b null l b successor if this successor has not already been pushed onto the stack if l pushed computes the true beginning stack size of this successor block l begin stack size start b stack size pushes this successor onto the stack l pushed true l next stack stack l b b next this max stack max releases all the edge objects used by this code writer synchronized size appends the head tail list at the beginning of the pool list if tail null tail pool next pool pool head else this max stack max stack this max locals max locals visitmaxs maxstack maxlocals computemaxs beginstacksize blockstack beginstacksize blockmax maxstacksize blockmax blockmax beginstacksize stacksize maxstack codewriter poolnext maxstack maxstack maxlocals maxlocals public void visit local variable final string name final string desc final label start final label end final int index if check if start owner this start resolved throw new illegal argument exception if end owner this end resolved throw new illegal argument exception if local var null cw newutf8 local variable table local var new byte vector local var count local var put2 start position local var put2 end position start position local var put2 cw newutf8 name index local var put2 cw newutf8 desc index local var put2 index visitlocalvariable illegalargumentexception illegalargumentexception localvar localvariabletable localvar bytevector localvarcount localvar localvar localvar localvar localvar public void visit line number final int line final label start if check if start owner this start resolved throw new illegal argument exception if line number null cw newutf8 line number table line number new byte vector line number count line number put2 start position line number put2 line visitlinenumber illegalargumentexception linenumber linenumbertable linenumber bytevector linenumbercount linenumber linenumber computes the size of the arguments and of the return value of a method param desc the descriptor of a method return the size of the arguments of the method plus one for the implicit this argument arg size and the size of its return value ret size packed into a single int i tt arg size 2 ret size tt arg size is therefore equal to tt i 2 tt and ret size to tt i 0x03 tt private static int get arguments and return sizes final string desc int n 1 int c 1 while true char car desc char at c if car car desc char at c return n 2 car v 0 car d car j 2 1 else if car l while desc char at c n 1 else if car while car desc char at c c if car d car j n 1 else if car d car j n 2 else n 1 argsize retsize argsize retsize argsize retsize getargumentsandreturnsizes charat charat charat charat adds a successor to the link current block current block block param stack size the current relative stack size in the current block param successor the successor block to be added to the current block private void add successor final int stack size final label successor edge b creates a new edge object or reuses one from the shared pool synchronized size if pool null b new edge else b pool removes b from the pool pool pool pool next adds the previous edge to the list of edges used by this code writer if tail null tail b b pool next head head b initializes the previous edge object b stack size stack size b successor successor and adds it to the successor list of the current block block b next current block successors current block successors b currentblock currentblock stacksize addsuccessor stacksize poolnext codewriter poolnext stacksize stacksize currentblock currentblock currentblock returns the size of the bytecode of this method return the size of the bytecode of this method final int get size if resize replaces the temporary jump opcodes introduced by label resolve resize instructions new int 0 new int 0 0 int size 8 if code length 0 cw newutf8 code size 18 code length 8 catch count if local var null size 8 local var length if line number null size 8 line number length if exception count 0 cw newutf8 exceptions size 8 2 exception count if access constants acc synthetic 0 cw newutf8 synthetic size 6 if access constants acc deprecated 0 cw newutf8 deprecated size 6 return size getsize resizeinstructions catchcount localvar localvar linenumber linenumber exceptioncount exceptioncount acc_synthetic acc_deprecated puts the bytecode of this method in the given byte vector param out the byte vector into which the bytecode of this method must be copied final void put final byte vector out out put2 access put2 name index put2 desc index int attribute count 0 if code length 0 attribute count if exception count 0 attribute count if access constants acc synthetic 0 attribute count if access constants acc deprecated 0 attribute count out put2 attribute count if code length 0 int size 12 code length 8 catch count if local var null size 8 local var length if line number null size 8 line number length out put2 cw newutf8 code index put4 size out put2 max stack put2 max locals out put4 code length put byte array code data 0 code length out put2 catch count if catch count 0 out put byte array catch table data 0 catch table length attribute count 0 if local var null attribute count if line number null attribute count out put2 attribute count if local var null out put2 cw newutf8 local variable table index out put4 local var length 2 put2 local var count out put byte array local var data 0 local var length if line number null out put2 cw newutf8 line number table index out put4 line number length 2 put2 line number count out put byte array line number data 0 line number length if exception count 0 out put2 cw newutf8 exceptions index put4 2 exception count 2 out put2 exception count for int i 0 i exception count i out put2 exceptions i if access constants acc synthetic 0 out put2 cw newutf8 synthetic index put4 0 if access constants acc deprecated 0 out put2 cw newutf8 deprecated index put4 0 bytevector attributecount attributecount exceptioncount attributecount acc_synthetic attributecount acc_deprecated attributecount attributecount catchcount localvar localvar linenumber linenumber maxstack maxlocals putbytearray catchcount catchcount putbytearray catchtable catchtable attributecount localvar attributecount linenumber attributecount attributecount localvar localvariabletable localvar localvarcount putbytearray localvar localvar linenumber linenumbertable linenumber linenumbercount putbytearray linenumber linenumber exceptioncount exceptioncount exceptioncount exceptioncount acc_synthetic acc_deprecated resizes the designated instructions while keeping jump offsets and instruction addresses consistent this may require to resize other existing instructions or even to introduce new instructions for example increasing the size of an instruction by 2 at the middle of a method can increases the offset of an ifeq instruction from 32766 to 32768 in which case ifeq 32766 must be replaced with ifneq 8 goto w 32765 this in turn may require to increase the size of another jump instruction and so on all these operations are handled automatically by this method p i this method must be called after all the method that is being built has been visited i in particular the link label label objects used to construct the method are no longer valid after this method has been called param indexes current positions of the instructions to be resized each instruction must be designated by the index of its i last i byte plus one or in other words by the index of the i first i byte of the i next i instruction param sizes the number of bytes to be i added i to the above instructions more precisely for each i lt tt len tt tt sizes tt i bytes will be added at the end of the instruction designated by tt indexes tt i or if tt sizes tt i is negative the i last i tt sizes i tt bytes of the instruction will be removed the instruction size i must not i become negative or null the gaps introduced by this method must be filled in manually in the array returned by the link get code get code method param len the number of instruction to be resized must be smaller than or equal to tt indexes tt length and tt sizes tt length return the tt indexes tt array which now contains the new positions of the resized instructions designated as above protected int resize instructions final int indexes final int sizes final int len byte b code data bytecode of the method int u v label indexes in b int i j loop indexes 1st step as explained above resizing an instruction may require to resize another one which may require to resize yet another one and so on the first step of the algorithm consists in finding all the instructions that need to be resized without modifying the code this is done by the following fix point algorithm parse the code to find the jump instructions whose offset will need more than 2 bytes to be stored the future offset is computed from the current offset and from the number of bytes that will be inserted or removed between the source and target instructions for each such instruction adds an entry in a copy of the indexes and sizes arrays if this has not already been done in a previous iteration if at least one entry has been added during the previous step go back to the beginning otherwise stop in fact the real algorithm is complicated by the fact that the size of tableswitch and lookupswitch instructions depends on their position in the bytecode because of padding in order to ensure the convergence of the algorithm the number of bytes to be added or removed from these instructions is over estimated during the previous loop and computed exactly only after the loop is finished this requires another pass to parse the bytecode of the method int all indexes new int len copy of indexes int all sizes new int len copy of sizes boolean resize instructions to be resized int new offset future offset of a jump instruction system arraycopy indexes 0 all indexes 0 len system arraycopy sizes 0 all sizes 0 len resize new boolean code length int state 3 3 loop again 2 loop ended 1 last pass 0 done do if state 3 state 2 u 0 while u b length int opcode b u 0xff opcode of current instruction int insert 0 bytes to be added after this instruction switch class writer type opcode case class writer noarg insn case class writer implvar insn u 1 break case class writer label insn if opcode 201 converts temporary opcodes 202 to 217 inclusive 218 and 219 to ifeq jsr inclusive ifnull and ifnonnull opcode opcode 218 opcode 49 opcode 20 label u read unsigned short b u 1 else label u read short b u 1 new offset get new offset all indexes all sizes u label if new offset short min value new offset short max value if resize u if opcode constants goto opcode constants jsr two additional bytes will be required to replace this goto or jsr instruction with a goto w or a jsr w insert 2 else five additional bytes will be required to replace this i fxxx l instruction with ifno txxx l goto w l where ifno txxx is the opposite opcode of i fxxx i e ifne for ifeq and where l designates the instruction just after the goto w insert 5 resize u true u 3 break case class writer labelw insn u 5 break case class writer tabl insn if state 1 true number of bytes to be added or removed from this instruction future number of padding bytes current number of padding byte previously over estimated variation 3 new offset 4 3 u 4 u 4 new offset 4 u 4 u 4 new offset 3 new offset get new offset all indexes all sizes 0 u insert new offset 3 else if resize u over estimation of the number of bytes to be added to this instruction 3 current number of padding bytes 3 3 u 4 u 4 u 3 insert u 3 resize u true skips instruction u u 4 u 3 u 4 read int b u 8 read int b u 4 1 12 break case class writer look insn if state 1 like tabl insn new offset get new offset all indexes all sizes 0 u insert new offset 3 else if resize u like tabl insn insert u 3 resize u true skips instruction u u 4 u 3 u 8 read int b u 4 8 break case class writer wide insn opcode b u 1 0xff if opcode constants iinc u 6 else u 4 break case class writer var insn case class writer sbyte insn case class writer ldc insn u 2 break case class writer short insn case class writer ldcw insn case class writer fieldormeth insn case class writer type insn case class writer iinc insn u 3 break case class writer itfmeth insn u 5 break case class writer mana insn default u 4 break if insert 0 adds a new u insert entry in the all indexes and all sizes arrays int new indexes new int all indexes length 1 int new sizes new int all sizes length 1 system arraycopy all indexes 0 new indexes 0 all indexes length system arraycopy all sizes 0 new sizes 0 all sizes length new indexes all indexes length u new sizes all sizes length insert all indexes new indexes all sizes new sizes if insert 0 state 3 if state 3 state while state 0 2nd step copies the bytecode of the method into a new bytevector updates the offsets and inserts or removes bytes as requested byte vector new code new byte vector code length u 0 while u code length for i all indexes length 1 i 0 i if all indexes i u if i len if sizes i 0 new code put byte array null 0 sizes i else new code length sizes i indexes i new code length int opcode b u 0xff switch class writer type opcode case class writer noarg insn case class writer implvar insn new code put1 opcode u 1 break case class writer label insn if opcode 201 changes temporary opcodes 2 goto_w getcode getcode resizeinstructions allindexes allsizes newoffset allindexes allsizes classwriter classwriter noarg_insn classwriter implvar_insn classwriter label_insn readunsignedshort readshort newoffset getnewoffset allindexes allsizes newoffset min_value newoffset max_value goto_w jsr_w ifxxx ifnotxxx goto_w ifnotxxx ifxxx goto_w classwriter labelw_insn classwriter tabl_insn newoffset newoffset newoffset newoffset getnewoffset allindexes allsizes newoffset readint readint classwriter look_insn tabl_insn newoffset getnewoffset allindexes allsizes newoffset tabl_insn readint classwriter wide_insn classwriter var_insn classwriter sbyte_insn classwriter ldc_insn classwriter short_insn classwriter ldcw_insn classwriter fieldormeth_insn classwriter type_insn classwriter iinc_insn classwriter itfmeth_insn classwriter mana_insn allindexes allsizes newindexes allindexes newsizes allsizes allindexes newindexes allindexes allsizes newsizes allsizes newindexes allindexes newsizes allsizes allindexes newindexes allsizes newsizes bytevector newcode bytevector allindexes allindexes newcode putbytearray newcode newcode classwriter classwriter noarg_insn classwriter implvar_insn newcode classwriter label_insn reads an unsigned short value in the given byte array param b a byte array param index the start index of the value to be read return the read value static int read unsigned short final byte b final int index return b index 0xff 8 b index 1 0xff readunsignedshort reads a signed short value in the given byte array param b a byte array param index the start index of the value to be read return the read value static short read short final byte b final int index return short b index 0xff 8 b index 1 0xff readshort reads a signed int value in the given byte array param b a byte array param index the start index of the value to be read return the read value static int read int final byte b final int index return b index 0xff 24 b index 1 0xff 16 b index 2 0xff 8 b index 3 0xff readint writes a short value in the given byte array param b a byte array param index where the first byte of the short value must be written param s the value to be written in the given byte array static void write short final byte b final int index final int s b index byte s 8 b index 1 byte s writeshort computes the future value of a bytecode offset p note it is possible to have several entries for the same instruction in the tt indexes tt and tt sizes tt two entries index a size b and index a size b are equivalent to a single entry index a size b b param indexes current positions of the instructions to be resized each instruction must be designated by the index of its i last i byte plus one or in other words by the index of the i first i byte of the i next i instruction param sizes the number of bytes to be i added i to the above instructions more precisely for each i tt len tt tt sizes tt i bytes will be added at the end of the instruction designated by tt indexes tt i or if tt sizes tt i is negative the i last i tt sizes i tt bytes of the instruction will be removed the instruction size i must not i become negative or null param begin index of the first byte of the source instruction param end index of the first byte of the target instruction return the future value of the given bytecode offset static int get new offset final int indexes final int sizes final int begin final int end int offset end begin for int i 0 i indexes length i if begin indexes i indexes i end forward jump offset sizes i else if end indexes i indexes i begin backward jump offset sizes i return offset getnewoffset returns the current size of the bytecode of this method this size just includes the size of the bytecode instructions it does not include the size of the exceptions local variable table line number table synthetic and deprecated attributes if present return the current size of the bytecode of this method protected int get code size return code length localvariabletable linenumbertable getcodesize returns the current bytecode of this method this bytecode only contains the instructions it does not include the exceptions local variable table line number table synthetic and deprecated attributes if present return the current bytecode of this method the bytecode is contained between the index 0 inclusive and the index link get code size get code size exclusive protected byte get code return code data localvariabletable linenumbertable getcodesize getcodesize getcode public enhanced dialog frame parent string title boolean modal super parent title modal init enhanceddialog _init public enhanced dialog dialog parent string title boolean modal super parent title modal init enhanceddialog _init public abstract void ok public abstract void ok public abstract void cancel private void init container get layered pane add container listener new container handler get content pane add container listener new container handler key handler new key handler add key listener key handler add window listener new window handler set default close operation do nothing on close _init getlayeredpane addcontainerlistener containerhandler getcontentpane addcontainerlistener containerhandler keyhandler keyhandler addkeylistener keyhandler addwindowlistener windowhandler setdefaultcloseoperation do_nothing_on_close class container handler extends container adapter public void component added container event evt component added evt get child containerhandler containeradapter componentadded containerevent componentadded getchild public void component removed container event evt component removed evt get child componentremoved containerevent componentremoved getchild private void component added component comp comp add key listener key handler if comp instanceof container container cont container comp cont add container listener this component comps cont get components for int i 0 i comps length i component added comps i componentadded addkeylistener keyhandler addcontainerlistener getcomponents componentadded private void component removed component comp comp remove key listener key handler if comp instanceof container container cont container comp cont remove container listener this component comps cont get components for int i 0 i comps length i component removed comps i componentremoved removekeylistener keyhandler removecontainerlistener getcomponents componentremoved public void key pressed key event evt if evt is consumed return if evt get key code key event vk enter crusty workaround component comp get focus owner while comp null if comp instanceof j combo box j combo box combo j combo box comp if combo is editable object selected combo get editor get item if selected null combo set selected item selected break comp comp get parent ok evt consume else if evt get key code key event vk escape cancel evt consume keypressed keyevent isconsumed getkeycode keyevent vk_enter getfocusowner jcombobox jcombobox jcombobox iseditable geteditor getitem setselecteditem getparent getkeycode keyevent vk_escape class window handler extends window adapter public void window closing window event evt cancel windowhandler windowadapter windowclosing windowevent get token at offset method returns the token that contains the specified offset param tokens the token list param offset the offset since j edit 4 0pre3 public static token get token at offset token tokens int offset if offset 0 tokens id token end return tokens for if tokens id token end throw new array index out of bounds exception offset line length if tokens offset tokens length offset return tokens else tokens tokens next gettokenatoffset jedit gettokenatoffset arrayindexoutofboundsexception find matching bracket method returns the offset of the bracket matching the one at the specified offset of the buffer or 1 if the bracket is unmatched or if the character is not a bracket param buffer the buffer param line the line param offset the offset within that line since j edit 2 6pre1 public static int find matching bracket buffer buffer int line int offset if offset 0 offset buffer get line length line throw new array index out of bounds exception offset buffer get line length line segment line text new segment buffer get line text line line text char c line text array line text offset offset char cprime corresponding character boolean direction false backwards true forwards switch c case cprime direction true break case cprime direction false break case cprime direction true break case cprime direction false break case cprime direction true break case cprime direction false break default return 1 1 because we ve already seen the first bracket int count 1 default token handler token handler new default token handler buffer mark tokens line token handler get the syntax token at offset only tokens with the same type will be checked for the corresponding bracket byte id of bracket get token at offset token handler get tokens offset id boolean have tokens true int start line line forward search if direction offset for for int i offset i line text count i char ch line text array line text offset i if ch c if have tokens token handler init buffer mark tokens line token handler have tokens true if get token at offset token handler get tokens i id id of bracket count else if ch cprime if have tokens token handler init buffer mark tokens line token handler have tokens true if get token at offset token handler get tokens i id id of bracket count if count 0 return buffer get line start offset line i go on to next line line if line buffer get line count line start line bracket match limit break buffer get line text line line text offset 0 have tokens false backward search else offset for for int i offset i 0 i char ch line text array line text offset i if ch c if have tokens token handler init buffer mark tokens line token handler have tokens true if get token at offset token handler get tokens i id id of bracket count else if ch cprime if have tokens token handler init buffer mark tokens line token handler have tokens true if get token at offset token handler get tokens i id id of bracket count if count 0 return buffer get line start offset line i go on to previous line line if line 0 start line line bracket match limit break buffer get line text line line text offset line text count 1 have tokens false nothing found return 1 findmatchingbracket jedit findmatchingbracket getlinelength arrayindexoutofboundsexception getlinelength linetext getlinetext linetext linetext linetext defaulttokenhandler tokenhandler defaulttokenhandler marktokens tokenhandler idofbracket gettokenatoffset tokenhandler gettokens havetokens startline linetext linetext linetext havetokens tokenhandler marktokens tokenhandler havetokens gettokenatoffset tokenhandler gettokens idofbracket havetokens tokenhandler marktokens tokenhandler havetokens gettokenatoffset tokenhandler gettokens idofbracket getlinestartoffset getlinecount startline bracket_match_limit getlinetext linetext havetokens linetext linetext havetokens tokenhandler marktokens tokenhandler havetokens gettokenatoffset tokenhandler gettokens idofbracket havetokens tokenhandler marktokens tokenhandler havetokens gettokenatoffset tokenhandler gettokens idofbracket getlinestartoffset startline bracket_match_limit getlinetext linetext linetext havetokens find word start method locates the start of the word at the specified position param line the text param pos the position param no word sep characters that are non alphanumeric but should be treated as word characters anyway public static int find word start string line int pos string no word sep return find word start line pos no word sep true false findwordstart nowordsep findwordstart nowordsep findwordstart nowordsep find word start method locates the start of the word at the specified position param line the text param pos the position param no word sep characters that are non alphanumeric but should be treated as word characters anyway param join non word chars treat consecutive non alphanumeric characters as one word since j edit 4 2pre5 public static int find word start string line int pos string no word sep boolean join non word chars return find word start line pos no word sep join non word chars false findwordstart nowordsep joinnonwordchars jedit findwordstart nowordsep joinnonwordchars findwordstart nowordsep joinnonwordchars find word start method locates the start of the word at the specified position param line the text param pos the position param no word sep characters that are non alphanumeric but should be treated as word characters anyway param join non word chars treat consecutive non alphanumeric characters as one word param eat whitespace include whitespace at start of word since j edit 4 1pre2 public static int find word start string line int pos string no word sep boolean join non word chars boolean eat whitespace char ch line char at pos if no word sep null no word sep the character under the cursor changes how we behave int type if character is whitespace ch type whitespace else if character is letter or digit ch no word sep index of ch 1 type word char else type symbol loop for int i pos i 0 i ch line char at i switch type whitespace case whitespace only select other whitespace in this case if character is whitespace ch break word char or symbol stop else return i 1 word character case word char word char keep going if character is letter or digit ch no word sep index of ch 1 break whitespace include in word if eating else if character is whitespace ch eat whitespace type whitespace break else return i 1 symbol case symbol if join non word chars pos i return i 1 whitespace include in word if eating if character is whitespace ch if eat whitespace type whitespace break else return i 1 else if character is letter or digit ch no word sep index of ch 1 return i 1 else break return 0 findwordstart nowordsep joinnonwordchars eatwhitespace jedit findwordstart nowordsep joinnonwordchars eatwhitespace charat nowordsep nowordsep iswhitespace isletterordigit nowordsep indexof word_char charat iswhitespace word_char isletterordigit nowordsep indexof iswhitespace eatwhitespace joinnonwordchars iswhitespace eatwhitespace isletterordigit nowordsep indexof find word end method locates the end of the word at the specified position param line the text param pos the position param no word sep characters that are non alphanumeric but should be treated as word characters anyway public static int find word end string line int pos string no word sep return find word end line pos no word sep true findwordend nowordsep findwordend nowordsep findwordend nowordsep find word end method locates the end of the word at the specified position param line the text param pos the position param no word sep characters that are non alphanumeric but should be treated as word characters anyway param join non word chars treat consecutive non alphanumeric characters as one word since j edit 4 1pre2 public static int find word end string line int pos string no word sep boolean join non word chars return find word end line pos no word sep join non word chars false findwordend nowordsep joinnonwordchars jedit findwordend nowordsep joinnonwordchars findwordend nowordsep joinnonwordchars find word end method locates the end of the word at the specified position param line the text param pos the position param no word sep characters that are non alphanumeric but should be treated as word characters anyway param join non word chars treat consecutive non alphanumeric characters as one word param eat whitespace include whitespace at end of word since j edit 4 2pre5 public static int find word end string line int pos string no word sep boolean join non word chars boolean eat whitespace if pos 0 pos char ch line char at pos if no word sep null no word sep the character under the cursor changes how we behave int type if character is whitespace ch type whitespace else if character is letter or digit ch no word sep index of ch 1 type word char else type symbol loop for int i pos i line length i ch line char at i switch type whitespace case whitespace only select other whitespace in this case if character is whitespace ch break else return i word character case word char if character is letter or digit ch no word sep index of ch 1 break whitespace include in word if eating else if character is whitespace ch eat whitespace type whitespace break else return i symbol case symbol if join non word chars i pos return i if we see whitespace set flag if character is whitespace ch if eat whitespace type whitespace break else return i else if character is letter or digit ch no word sep index of ch 1 return i else break return line length findwordend nowordsep joinnonwordchars eatwhitespace jedit findwordend nowordsep joinnonwordchars eatwhitespace charat nowordsep nowordsep iswhitespace isletterordigit nowordsep indexof word_char charat iswhitespace word_char isletterordigit nowordsep indexof iswhitespace eatwhitespace joinnonwordchars iswhitespace eatwhitespace isletterordigit nowordsep indexof spaces to tabs method converts consecutive spaces to tabs in the specified string param in the string param tab size the tab size public static string spaces to tabs string in int tab size string buffer buf new string buffer int width 0 int whitespace 0 for int i 0 i in length i switch in char at i case whitespace width break case t int tab tab size width tab size width tab whitespace tab break case n if whitespace 0 buf append misc utilities create white space whitespace tab size width whitespace whitespace 0 width 0 buf append n break default if whitespace 0 buf append misc utilities create white space whitespace tab size width whitespace whitespace 0 buf append in char at i width break if whitespace 0 buf append misc utilities create white space whitespace tab size width whitespace return buf to string spacestotabs tabsize spacestotabs tabsize stringbuffer stringbuffer charat tabsize tabsize miscutilities createwhitespace tabsize miscutilities createwhitespace tabsize charat miscutilities createwhitespace tabsize tostring tabs to spaces method converts tabs to consecutive spaces in the specified string param in the string param tab size the tab size public static string tabs to spaces string in int tab size string buffer buf new string buffer int width 0 for int i 0 i in length i switch in char at i case t int count tab size width tab size width count while count 0 buf append break case n width 0 buf append in char at i break default width buf append in char at i break return buf to string tabstospaces tabsize tabstospaces tabsize stringbuffer stringbuffer charat tabsize tabsize charat charat tostring format method formats the specified text by merging and breaking lines to the specified width param text the text param max line length the maximum line length param tab size the tab size public static string format string text int max line length int tab size string buffer buf new string buffer int index 0 for int new index text index of n n index if new index 1 break format paragraph text substring index new index max line length tab size buf buf append n n index new index 2 if index text length format paragraph text substring index max line length tab size buf return buf to string maxlinelength tabsize maxlinelength tabsize stringbuffer stringbuffer newindex indexof newindex formatparagraph newindex maxlinelength tabsize newindex formatparagraph maxlinelength tabsize tostring returns if the specified string is all upper case all lower case or title case first letter upper case rest lower case param str the string since j edit 4 0pre1 public static int get string case string str if str length 0 return mixed int state 1 char ch str char at 0 if character is letter ch if character is upper case ch state upper case else state lower case for int i 1 i str length i ch str char at i if character is letter ch continue switch state case upper case if character is lower case ch if i 1 state title case else return mixed break case lower case case title case if character is upper case ch return mixed break return state jedit getstringcase charat isletter isuppercase upper_case lower_case charat isletter upper_case islowercase title_case lower_case title_case isuppercase to title case method converts the specified string to title case by capitalizing the first letter param str the string since j edit 4 0pre1 public static string to title case string str if str length 0 return str else return character to upper case str char at 0 str substring 1 to lower case totitlecase jedit totitlecase touppercase charat tolowercase format paragraph method private static void format paragraph string text int max line length int tab size string buffer buf align everything to paragraph s leading indent int leading whitespace count misc utilities get leading white space text string leading whitespace text substring 0 leading whitespace count int leading whitespace width misc utilities get leading white space width text tab size buf append leading whitespace int line length leading whitespace width string tokenizer st new string tokenizer text while st has more tokens string word st next token if line length leading whitespace width do nothing else if line length word length 1 max line length buf append n buf append leading whitespace line length leading whitespace width else buf append line length buf append word line length word length formatparagraph formatparagraph maxlinelength tabsize stringbuffer leadingwhitespacecount miscutilities getleadingwhitespace leadingwhitespace leadingwhitespacecount leadingwhitespacewidth miscutilities getleadingwhitespacewidth tabsize leadingwhitespace linelength leadingwhitespacewidth stringtokenizer stringtokenizer hasmoretokens nexttoken linelength leadingwhitespacewidth linelength maxlinelength leadingwhitespace linelength leadingwhitespacewidth linelength linelength update every time method public boolean update every time return false updateeverytime updateeverytime update method public void update j menu menu final view view gui utilities get view menu action listeners action listener file listener new action listener public void action performed action event evt j edit open file view evt get action command action listener dir listener new action listener public void action performed action event evt vfs browser browse directory view evt get action command vfs directory entry favorites favoritesvfs get favorites if favorites length 0 j menu item mi new j menu item j edit get property vfs browser favorites no favorites label mi set enabled false menu add mi else misc utilities quicksort favorites new vfs directory entry compare j edit get boolean property vfs browser sort mix files and dirs j edit get boolean property vfs browser sort ignore case for int i 0 i favorites length i vfs directory entry favorite favorites i j menu item mi new j menu item favorite path mi set icon file cell renderer get icon for file favorite false if favorite type vfs directory entry file mi add action listener file listener else mi add action listener dir listener menu add mi jmenu guiutilities getview actionlisteners actionlistener filelistener actionlistener actionperformed actionevent jedit openfile getactioncommand actionlistener dirlistener actionlistener actionperformed actionevent vfsbrowser browsedirectory getactioncommand directoryentry getfavorites jmenuitem jmenuitem jedit getproperty setenabled miscutilities directoryentrycompare jedit getbooleanproperty sortmixfilesanddirs jedit getbooleanproperty sortignorecase directoryentry jmenuitem jmenuitem seticon filecellrenderer geticonforfile directoryentry addactionlistener filelistener addactionlistener dirlistener action listener file listener new action listener public void action performed action event evt j edit open file view evt get action command actionlistener filelistener actionlistener actionperformed actionevent jedit openfile getactioncommand public void action performed action event evt vfs browser browse directory view evt get action command actionperformed actionevent vfsbrowser browsedirectory getactioncommand action list handler constructor action list handler string path action set action set this path path this action set action set state stack new stack actionlisthandler actionlisthandler actionset actionset actionset actionset statestack resolve entity method public object resolve entity string public id string system id if actions dtd equals system id this will result in a slight speed up since we don t need to read the dtd anyway as a elfred is non validating return new string reader try return new buffered reader new input stream reader get class get resource as stream actions dtd catch exception e log log log error this error while opening actions dtd log log log error this e return null resolveentity resolveentity publicid systemid systemid aelfred stringreader bufferedreader inputstreamreader getclass getresourceasstream attribute method public void attribute string aname string value boolean is specified aname aname null null aname intern value value null null value intern if aname name action name value else if aname no repeat no repeat value true else if aname no record no record value true else if aname no remember last no remember last value true isspecified actionname no_repeat norepeat no_record norecord no_remember_last norememberlast doctype decl method public void doctype decl string name string public id string system id throws exception if actions equals name return log log log error this path doctype must be actions doctypedecl doctypedecl publicid systemid char data method public void char data char c int off int len string tag peek element string text new string c off len if tag code code text else if tag is selected is selected text chardata chardata peekelement is_selected isselected start element method public void start element string tag tag push element tag if tag action code null is selected null startelement startelement pushelement isselected end element method public void end element string name if name null return string tag peek element if name equals tag if tag action action set add action new bean shell action action name code is selected no repeat no record no remember last no repeat no record no remember last false pop element else can t happen throw new internal error endelement endelement peekelement actionset addaction beanshellaction actionname isselected norepeat norecord norememberlast norepeat norecord norememberlast popelement internalerror start document method public void start document try push element null catch exception e e print stack trace startdocument startdocument pushelement printstacktrace push element method private string push element string name name name null null name intern state stack push name return name pushelement pushelement statestack peek element method private string peek element return string state stack peek peekelement peekelement statestack pop element method private string pop element return string state stack pop popelement popelement statestack handles a message sent on the edit bus next version remove this public void handle message eb message message edit bus remove from bus this if seen warning return seen warning true log log log warning this get class name should extend edit plugin not eb plugin since it has an empty handle message editbus handlemessage ebmessage editbus removefrombus seenwarning seenwarning getclassname editplugin ebplugin handlemessage protected members protected eb plugin ebplugin class bsh statement expression list extends simple node bsh statement expression list int id super id bshstatementexpressionlist simplenode bshstatementexpressionlist public object eval call stack callstack interpreter interpreter throws eval error int n jjt get num children for int i 0 i n i simple node node simple node jjt get child i node eval callstack interpreter return primitive void callstack evalerror jjtgetnumchildren simplenode simplenode jjtgetchild package scope constructor is used by re get match enumeration re match enumeration re expr char indexed input int index int eflags more maybe this expr expr this input input this index index this eflags eflags getmatchenumeration rematchenumeration charindexed returns true if there are more matches in the input text public boolean has more elements return has more matches null hasmoreelements hasmorematches returns true if there are more matches in the input text public boolean has more matches return has more matches null hasmorematches hasmorematches returns true if there are more matches in the input text saves the text leading up to the match or to the end of the input in the specified buffer public boolean has more matches string buffer buffer if more maybe match expr get match impl input index eflags buffer if match null input move match end 0 0 match end 0 1 index match end 0 0 match end 0 match offset index 1 more yes else more no return more yes hasmorematches stringbuffer getmatchimpl returns the next match in the input text public object next element throws no such element exception return next match nextelement nosuchelementexception nextmatch returns the next match in the input text this method is provided for convenience to avoid having to explicitly cast the return value to class re match public re match next match throws no such element exception if has more elements more input is valid maybe no return match throw new no such element exception rematch rematch nextmatch nosuchelementexception hasmoreelements isvalid nosuchelementexception private static class special implements java io serializable private special private to prevent invocation with param that isn t a primitive wrapper public primitive object value if value null throw new interpreter error use primitve null instead of primitive null if value special null value value special void type is wrapper type value get class throw new interpreter error not a wrapper type value this value value interpretererror null_value void_type iswrappertype getclass interpretererror public primitive boolean value this new boolean value public primitive boolean value this new boolean value public primitive byte value this new byte value public primitive boolean value this new boolean value public primitive byte value this new byte value public primitive short value this new short value public primitive byte value this new byte value public primitive short value this new short value public primitive char value this new character value public primitive short value this new short value public primitive char value this new character value public primitive int value this new integer value public primitive char value this new character value public primitive int value this new integer value public primitive long value this new long value public primitive int value this new integer value public primitive long value this new long value public primitive float value this new float value public primitive long value this new long value public primitive float value this new float value public primitive double value this new double value return the primitive value stored in its java lang wrapper class public object get value if value special null value return null else if value special void type throw new interpreter error attempt to unwrap void type else return value getvalue null_value void_type interpretererror public string to string if value special null value return null else if value special void type return void else return value to string tostring null_value void_type tostring get the corresponding java primitive type class for this primitive return the primitive type class type of the value or void type for primitive void or null value for type of primitive null public class get type if this primitive void return void type null return null as type we currently use null type to indicate loose typing throughout bsh if this primitive null return null return unbox type value get class gettype unboxtype getclass perform a binary operation on two primitives or wrapper types if both original args were primitives return a primitive result else it was mixed wrapper primitive return the wrapper type the exception is for boolean operations where we will return the primitive type eithe way public static object binary operation object obj1 object obj2 int kind throws util eval error special primitive types if obj1 null obj2 null throw new util eval error null value or null literal in binary operation if obj1 void obj2 void throw new util eval error undefined variable class or void literal in binary operation keep track of the original types class lhs org type obj1 get class class rhs org type obj2 get class unwrap primitives if obj1 instanceof primitive obj1 primitive obj1 get value if obj2 instanceof primitive obj2 primitive obj2 get value object operands promote primitives obj1 obj2 object lhs operands 0 object rhs operands 1 if lhs get class rhs get class throw new util eval error type mismatch in operator lhs get class cannot be used with rhs get class object result try result binary operation impl lhs rhs kind catch arithmetic exception e throw new util target error arithemetic exception in binary op e if both original args were primitives return a primitive result else it was mixed wrapper primitive return the wrapper type exception is for boolean result return the primitive if lhs org type primitive class rhs org type primitive class result instanceof boolean return new primitive result else return result binaryoperation utilevalerror utilevalerror utilevalerror lhsorgtype getclass rhsorgtype getclass getvalue getvalue promoteprimitives getclass getclass utilevalerror getclass getclass binaryoperationimpl arithmeticexception utiltargeterror lhsorgtype rhsorgtype static object binary operation impl object lhs object rhs int kind throws util eval error if lhs instanceof boolean return boolean binary operation boolean lhs boolean rhs kind else if lhs instanceof integer return int binary operation integer lhs integer rhs kind else if lhs instanceof long return long binary operation long lhs long rhs kind else if lhs instanceof float return float binary operation float lhs float rhs kind else if lhs instanceof double return double binary operation double lhs double rhs kind else throw new util eval error invalid types in binary operator binaryoperationimpl utilevalerror booleanbinaryoperation intbinaryoperation longbinaryoperation floatbinaryoperation doublebinaryoperation utilevalerror static boolean boolean binary operation boolean b1 boolean b2 int kind throws util eval error boolean lhs b1 boolean value boolean rhs b2 boolean value switch kind case eq return new boolean lhs rhs case ne return new boolean lhs rhs case bool or case bool orx return new boolean lhs rhs case bool and case bool andx return new boolean lhs rhs default throw new interpreter error unimplemented binary operator booleanbinaryoperation utilevalerror booleanvalue booleanvalue bool_or bool_orx bool_and bool_andx interpretererror returns object covering both long and boolean return types static object long binary operation long l1 long l2 int kind long lhs l1 long value long rhs l2 long value switch kind boolean case lt case ltx return new boolean lhs rhs case gt case gtx return new boolean lhs rhs case eq return new boolean lhs rhs case le case lex return new boolean lhs rhs case ge case gex return new boolean lhs rhs case ne return new boolean lhs rhs arithmetic case plus return new long lhs rhs case minus return new long lhs rhs case star return new long lhs rhs case slash return new long lhs rhs case mod return new long lhs rhs bitwise case lshift case lshiftx return new long lhs rhs case rsignedshift case rsignedshiftx return new long lhs rhs case runsignedshift case runsignedshiftx return new long lhs rhs case bit and case bit andx return new long lhs rhs case bit or case bit orx return new long lhs rhs case xor return new long lhs rhs default throw new interpreter error unimplemented binary long operator longbinaryoperation longvalue longvalue bit_and bit_andx bit_or bit_orx interpretererror returns object covering both integer and boolean return types static object int binary operation integer i1 integer i2 int kind int lhs i1 int value int rhs i2 int value switch kind boolean case lt case ltx return new boolean lhs rhs case gt case gtx return new boolean lhs rhs case eq return new boolean lhs rhs case le case lex return new boolean lhs rhs case ge case gex return new boolean lhs rhs case ne return new boolean lhs rhs arithmetic case plus return new integer lhs rhs case minus return new integer lhs rhs case star return new integer lhs rhs case slash return new integer lhs rhs case mod return new integer lhs rhs bitwise case lshift case lshiftx return new integer lhs rhs case rsignedshift case rsignedshiftx return new integer lhs rhs case runsignedshift case runsignedshiftx return new integer lhs rhs case bit and case bit andx return new integer lhs rhs case bit or case bit orx return new integer lhs rhs case xor return new integer lhs rhs default throw new interpreter error unimplemented binary integer operator intbinaryoperation intvalue intvalue bit_and bit_andx bit_or bit_orx interpretererror returns object covering both double and boolean return types static object double binary operation double d1 double d2 int kind throws util eval error double lhs d1 double value double rhs d2 double value switch kind boolean case lt case ltx return new boolean lhs rhs case gt case gtx return new boolean lhs rhs case eq return new boolean lhs rhs case le case lex return new boolean lhs rhs case ge case gex return new boolean lhs rhs case ne return new boolean lhs rhs arithmetic case plus return new double lhs rhs case minus return new double lhs rhs case star return new double lhs rhs case slash return new double lhs rhs case mod return new double lhs rhs can t shift floating point values case lshift case lshiftx case rsignedshift case rsignedshiftx case runsignedshift case runsignedshiftx throw new util eval error can t shift doubles default throw new interpreter error unimplemented binary double operator doublebinaryoperation utilevalerror doublevalue doublevalue utilevalerror interpretererror returns object covering both long and boolean return types static object float binary operation float f1 float f2 int kind throws util eval error float lhs f1 float value float rhs f2 float value switch kind boolean case lt case ltx return new boolean lhs rhs case gt case gtx return new boolean lhs rhs case eq return new boolean lhs rhs case le case lex return new boolean lhs rhs case ge case gex return new boolean lhs rhs case ne return new boolean lhs rhs arithmetic case plus return new float lhs rhs case minus return new float lhs rhs case star return new float lhs rhs case slash return new float lhs rhs case mod return new float lhs rhs can t shift floats case lshift case lshiftx case rsignedshift case rsignedshiftx case runsignedshift case runsignedshiftx throw new util eval error can t shift floats default throw new interpreter error unimplemented binary float operator floatbinaryoperation utilevalerror floatvalue floatvalue utilevalerror interpretererror promote primitive wrapper type to to integer wrapper type static object promote to integer object wrapper if wrapper instanceof character return new integer character wrapper char value else if wrapper instanceof byte wrapper instanceof short return new integer number wrapper int value return wrapper promotetointeger charvalue intvalue promote the pair of primitives to the maximum type of the two e g int long long long static object promote primitives object lhs object rhs lhs promote to integer lhs rhs promote to integer rhs if lhs instanceof number rhs instanceof number number lnum number lhs number rnum number rhs boolean b if b lnum instanceof double rnum instanceof double if b rhs new double rnum double value else lhs new double lnum double value else if b lnum instanceof float rnum instanceof float if b rhs new float rnum float value else lhs new float lnum float value else if b lnum instanceof long rnum instanceof long if b rhs new long rnum long value else lhs new long lnum long value return new object lhs rhs promoteprimitives promotetointeger promotetointeger doublevalue doublevalue floatvalue floatvalue longvalue longvalue public static primitive unary operation primitive val int kind throws util eval error if val null throw new util eval error illegal use of null object or null literal if val void throw new util eval error illegal use of undefined object or void literal class operand type val get type object operand promote to integer val get value if operand instanceof boolean return new primitive boolean unary operation boolean operand kind else if operand instanceof integer int result int unary operation integer operand kind and must be cast back the original type if kind incr kind decr if operand type byte type return new primitive byte result if operand type short type return new primitive short result if operand type character type return new primitive char result return new primitive result else if operand instanceof long return new primitive long unary operation long operand kind else if operand instanceof float return new primitive float unary operation float operand kind else if operand instanceof double return new primitive double unary operation double operand kind else throw new interpreter error an error occurred please call technical support unaryoperation utilevalerror utilevalerror utilevalerror operandtype gettype promotetointeger getvalue booleanunaryoperation intunaryoperation operandtype operandtype operandtype longunaryoperation floatunaryoperation doubleunaryoperation interpretererror static boolean boolean unary operation boolean b int kind throws util eval error boolean operand b boolean value switch kind case bang return operand default throw new util eval error operator inappropriate for boolean booleanunaryoperation utilevalerror booleanvalue utilevalerror static int int unary operation integer i int kind int operand i int value switch kind case plus return operand case minus return operand case tilde return operand case incr return operand 1 case decr return operand 1 default throw new interpreter error bad integer unary operation intunaryoperation intvalue interpretererror unaryoperation static long long unary operation long l int kind long operand l long value switch kind case plus return operand case minus return operand case tilde return operand case incr return operand 1 case decr return operand 1 default throw new interpreter error bad long unary operation longunaryoperation longvalue interpretererror unaryoperation static float float unary operation float f int kind float operand f float value switch kind case plus return operand case minus return operand default throw new interpreter error bad float unary operation floatunaryoperation floatvalue interpretererror unaryoperation static double double unary operation double d int kind double operand d double value switch kind case plus return operand case minus return operand default throw new interpreter error bad double unary operation doubleunaryoperation doublevalue interpretererror unaryoperation public int int value throws util eval error if value instanceof number return number value int value else throw new util eval error primitive not a number intvalue utilevalerror intvalue utilevalerror public boolean boolean value throws util eval error if value instanceof boolean return boolean value boolean value else throw new util eval error primitive not a boolean booleanvalue utilevalerror booleanvalue utilevalerror determine if this primitive is a numeric type i e not boolean null or void but including char public boolean is number return value instanceof boolean this null this void isnumber public number number value throws util eval error object value this value promote character to number type for these purposes if value instanceof character value new integer character value char value if value instanceof number return number value else throw new util eval error primitive not a number numbervalue utilevalerror charvalue utilevalerror primitives compare equal with other primitives containing an equal wrapped value public boolean equals object obj if obj instanceof primitive return primitive obj value equals this value else return false the hash of the primitive is tied to the hash of the wrapped value but shifted so that they are not the same public int hash code return this value hash code 21 arbitrary hashcode hashcode unwrap primitive values and map voids to nulls non primitive types remain unchanged param obj object type which may be bsh primitive return corresponding normal java type unwrapping any bsh primitive types to their wrapper types public static object unwrap object obj map voids to nulls for the outside world if obj primitive void return null unwrap primitives if obj instanceof primitive return primitive obj get value else return obj getvalue public static object unwrap object args object oa new object args length for int i 0 i args length i oa i unwrap args i return oa public static object wrap object args class param types if args null return null object oa new object args length for int i 0 i args length i oa i wrap args i param types i return oa paramtypes paramtypes wrap primitive values as indicated by type param and nulls in the primitive class values not primitive or null are left unchanged primitive values are represented by their wrapped values in param value p the value null is mapped to primitive null any value specified with type void type is mapped to primitive void public static object wrap object value class type if type void type return primitive void if value null return primitive null if type is primitive return new primitive value return value isprimitive get the appropriate default value per jls 4 5 4 public static primitive get default value class type if type null type is primitive return primitive null if type boolean type return new primitive false non boolean primitive get appropriate flavor of zero try return new primitive int 0 cast to type type types cast catch util eval error e throw new interpreter error bad cast getdefaultvalue isprimitive casttotype utilevalerror interpretererror get the corresponding java lang wrapper class for the primitive type class e g integer type integer class public static class box type class primitive type class c class primitive to wrapper get primitive type if c null return c throw new interpreter error not a primitive type primitive type boxtype primitivetype primitivetowrapper primitivetype interpretererror primitivetype get the corresponding primitive type class for the java lang wrapper class type e g integer class integer type public static class unbox type class wrapper type class c class wrapper to primitive get wrapper type if c null return c throw new interpreter error not a primitive wrapper type wrapper type unboxtype wrappertype wrappertoprimitive wrappertype interpretererror wrappertype cast this bsh primitive value to a new bsh primitive value this is usually a numeric type cast other cases include a boolean can be cast to boolen null can be cast to any object type and remains null attempting to cast a void causes an exception param to type is the java object or primitive type class public primitive cast to type class to type int operation throws util eval error return cast primitive to type get type from type this from value false check only operation totype casttotype totype utilevalerror castprimitive totype gettype fromtype fromvalue checkonly param to type is the java primitive type type of the primitive to be cast to param from type is the java primitive type type of the primitive to be cast from type should be null to indicate that the from value was null or void param from value is optionally the value to be converted if check only is true from value must be null if check only is false from value must be non null primitive null is of course valid static primitive cast primitive class to type class from type primitive from value boolean check only int operation throws util eval error lots of preconditions checked here once things are running smoothly we might comment these out that s what assertions are for if check only from value null throw new interpreter error bad cast param 1 if check only from value null throw new interpreter error bad cast param 2 if from type null from type is primitive throw new interpreter error bad from type from type if from value primitive null from type null throw new interpreter error inconsistent args 1 if from value primitive void from type void type throw new interpreter error inconsistent args 2 can t cast void to anything if from type void type if check only return types invalid cast else throw types cast error reflect normalize class name to type void value operation unwrap etc object value null if from value null value from value get value if to type is primitive trying to cast null to primitive type if from type null if check only return types invalid cast else throw types cast error primitive type to type null value operation fall through else trying to cast primitive to an object type primitive null can be cast to any object type if from type null return check only types valid cast primitive null if check only return types invalid cast else throw types cast error object type to type primitive value operation can only cast boolean to boolean if from type boolean type if to type boolean type if check only return types invalid cast else throw types cast error to type from type operation return check only types valid cast from value do numeric cast only allow legal java assignment unless we re a cast operation if operation types assignment types is java assignable to type from type if check only return types invalid cast else throw types cast error to type from type operation return check only types valid cast new primitive cast wrapper to type value totype fromtype fromtype fromvalue fromvalue checkonly fromvalue checkonly fromvalue castprimitive totype fromtype fromvalue checkonly utilevalerror checkonly fromvalue interpretererror checkonly fromvalue interpretererror fromtype fromtype isprimitive interpretererror fromtype fromtype fromvalue fromtype interpretererror fromvalue fromtype interpretererror fromtype checkonly invalid_cast casterror normalizeclassname totype fromvalue fromvalue getvalue totype isprimitive fromtype checkonly invalid_cast casterror totype fromtype checkonly valid_cast checkonly invalid_cast casterror totype fromtype totype checkonly invalid_cast casterror totype fromtype checkonly valid_cast fromvalue isjavaassignable totype fromtype checkonly invalid_cast casterror totype fromtype checkonly valid_cast castwrapper totype public static boolean is wrapper type class type return wrapper to primitive get type null iswrappertype wrappertoprimitive cast a primitive value represented by its java lang wrapper type to the specified java lang wrapper type e g byte 5 to integer 5 or integer 5 to byte 5 param to type is the java type type param value is the value in java lang wrapper value may not be null static object cast wrapper class to type object value if to type is primitive throw new interpreter error invalid type in cast wrapper to type if value null throw new interpreter error null value in cast wrapper guard if value instanceof boolean to type boolean type throw new interpreter error bad wrapper cast of boolean class from type value get class first promote char to number type to avoid duplicating code if value instanceof character value new integer character value char value if value instanceof number throw new interpreter error bad type in cast number number number value if to type byte type return new byte number byte value if to type short type return new short number short value if to type character type return new character char number int value if to type integer type return new integer number int value if to type long type return new long number long value if to type float type return new float number float value if to type double type return new double number double value throw new interpreter error error in wrapper cast totype castwrapper totype totype isprimitive interpretererror castwrapper totype interpretererror castwrapper totype interpretererror fromtype getclass charvalue interpretererror totype bytevalue totype shortvalue totype intvalue totype intvalue totype longvalue totype floatvalue totype doublevalue interpretererror mode catalog handler string directory boolean resource this directory directory this resource resource modecataloghandler public object resolve entity string public id string system id if catalog dtd equals system id this will result in a slight speed up since we don t need to read the dtd anyway as a elfred is non validating return new string reader try return new buffered reader new input stream reader get class get resource as stream catalog dtd catch exception e log log log error this error while opening catalog dtd log log log error this e return null resolveentity publicid systemid systemid aelfred stringreader bufferedreader inputstreamreader getclass getresourceasstream public void attribute string aname string value boolean is specified aname aname null null aname intern if aname name mode name value else if aname file if value null log log log error this directory catalog mode mode name doesn t have a file attribute else file value else if aname file name glob filename glob value else if aname first line glob firstline glob value isspecified modename modename file_name_glob filenameglob first_line_glob firstlineglob public void doctype decl string name string public id string system id throws exception older j edit versions used a doctype of catalog which is incorrect since the doctype must be the name of the root element which is modes so you the avid code reader should use modes as the doctype instead but we still let old catalogs through to avoid annoying users if catalog equals name modes equals name return log log log error this directory catalog doctype must be catalog doctypedecl publicid systemid jedit public void end element string name if name equals mode mode mode j edit get mode mode name if mode null mode new mode mode name j edit add mode mode object path if resource path j edit class get resource directory file else path misc utilities construct path directory file mode set property file path if filename glob null mode set property filename glob filename glob else mode unset property filename glob if firstline glob null mode set property firstline glob firstline glob else mode unset property firstline glob mode init mode name file filename glob firstline glob null endelement jedit getmode modename modename jedit addmode jedit getresource miscutilities constructpath setproperty filenameglob setproperty filenameglob filenameglob unsetproperty filenameglob firstlineglob setproperty firstlineglob firstlineglob unsetproperty firstlineglob modename filenameglob firstlineglob update every time method public boolean update every time return true updateeverytime updateeverytime update method public void update j menu menu final view view gui utilities get view menu action listener action listener action listener new action listener public void action performed action event evt vfs browser browse directory view evt get action command view get status set message null mouse listener mouse listener mouse listener new mouse adapter public void mouse entered mouse event evt view get status set message j menu item evt get source get action command public void mouse exited mouse event evt view get status set message null history model model history model get model vfs browser path if model get size 0 j menu item menu item new j menu item j edit get property no recent dirs label menu item set enabled false menu add menu item return boolean sort j edit get boolean property sort recent int max items j edit get integer property menu spillover 20 vector menu items new vector for int i 0 i model get size i string path model get item i j menu item menu item new j menu item misc utilities get file name path menu item set action command path menu item add action listener action listener menu item add mouse listener mouse listener menu item set icon file cell renderer dir icon if sort menu items add element menu item else if menu get menu component count max items i model get size 1 j menu new menu new j menu j edit get property common more menu add new menu menu new menu menu add menu item if sort misc utilities quicksort menu items new misc utilities menu item compare for int i 0 i menu items size i if menu get menu component count max items i 0 j menu new menu new j menu j edit get property common more menu add new menu menu new menu menu add j menu item menu items element at i jmenu guiutilities getview actionlistener actionlistener actionlistener actionlistener actionperformed actionevent vfsbrowser browsedirectory getactioncommand getstatus setmessage mouselistener mouselistener mouselistener mouseadapter mouseentered mouseevent getstatus setmessage jmenuitem getsource getactioncommand mouseexited mouseevent getstatus setmessage historymodel historymodel getmodel getsize jmenuitem menuitem jmenuitem jedit getproperty menuitem setenabled menuitem jedit getbooleanproperty sortrecent maxitems jedit getintegerproperty menuitems getsize getitem jmenuitem menuitem jmenuitem miscutilities getfilename menuitem setactioncommand menuitem addactionlistener actionlistener menuitem addmouselistener mouselistener menuitem seticon filecellrenderer diricon menuitems addelement menuitem getmenucomponentcount maxitems getsize jmenu newmenu jmenu jedit getproperty newmenu newmenu menuitem miscutilities menuitems miscutilities menuitemcompare menuitems getmenucomponentcount maxitems jmenu newmenu jmenu jedit getproperty newmenu newmenu jmenuitem menuitems elementat public void action performed action event evt vfs browser browse directory view evt get action command view get status set message null actionperformed actionevent vfsbrowser browsedirectory getactioncommand getstatus setmessage public void mouse entered mouse event evt view get status set message j menu item evt get source get action command mouseentered mouseevent getstatus setmessage jmenuitem getsource getactioncommand public void mouse exited mouse event evt view get status set message null mouseexited mouseevent getstatus setmessage input handler constructor creates a new input handler param view the view public input handler view view this view view repeat count 1 inputhandler inputhandler repeatcount add key binding method adds a key binding to this input handler param key binding the key binding the format of this is input handler specific param action the action addkeybinding keybinding add key binding method adds a key binding to this input handler param key binding the key binding the format of this is input handler specific param action the action addkeybinding keybinding remove key binding method removes a key binding from this input handler param key binding the key binding removekeybinding keybinding remove all key bindings method removes all key bindings from this input handler public abstract void remove all key bindings removeallkeybindings removeallkeybindings is prefix active method returns if a prefix key has been pressed public boolean is prefix active return read next char null isprefixactive isprefixactive readnextchar handle key method handles a keystroke param key stroke the key stroke since j edit 4 2pre5 handlekey keystroke jedit get repeat count method returns the number of times the next action will be repeated public int get repeat count return repeat count getrepeatcount getrepeatcount repeatcount set repeat count method sets the number of times the next action will be repeated param repeat count the repeat count public void set repeat count int repeat count int old repeat count this repeat count this repeat count repeat count if old repeat count repeat count view get status set message null setrepeatcount repeatcount setrepeatcount repeatcount oldrepeatcount repeatcount repeatcount repeatcount oldrepeatcount repeatcount getstatus setmessage get last action method returns the last executed action since j edit 2 5pre5 public edit action get last action return last action getlastaction jedit editaction getlastaction lastaction get last action count method returns the number of times the last action was executed since j edit 2 5pre5 public int get last action count return last action count getlastactioncount jedit getlastactioncount lastactioncount read next char method invokes the specified bean shell code replacing char in the code with the next input character param msg the prompt to display in the status bar param code the code since j edit 3 2pre2 public void read next char string msg string code view get status set message msg read next char code readnextchar beanshell __char__ jedit readnextchar getstatus setmessage readnextchar read next char method deprecated use the other form of this method instead public void read next char string code read next char code readnextchar readnextchar readnextchar reset last action count method resets the last action count this should be called when an editing operation that is not an action is invoked for example a mouse click since j edit 4 0pre1 public void reset last action count last action count 0 resetlastactioncount jedit resetlastactioncount lastactioncount invoke action method invokes the specified action repeating and recording it as necessary param action the action since j edit 4 2pre1 public void invoke action string action invoke action j edit get action action invokeaction jedit invokeaction invokeaction jedit getaction invoke action method invokes the specified action repeating and recording it as necessary param action the action public void invoke action edit action action buffer buffer view get buffer if buffer inside compound edit buffer end compound edit remember the last executed action if action no remember last history model get model action add item action get name if last action action last action count else last action action last action count 1 remember old values in case action changes them int repeatcount repeat count execute the action if action no repeat repeatcount 1 action invoke view else stop people doing dumb stuff like c enter 100 c n if repeatcount repeat count threshold string label action get label if label null label action get name else label gui utilities prettify menu label label object pp label new integer repeatcount if gui utilities confirm view large repeat count pp j option pane warning message j option pane yes no option j option pane yes option repeat count 1 view get status set message null return try buffer begin compound edit for int i 0 i repeatcount i action invoke view finally buffer end compound edit macros recorder recorder view get macro recorder if recorder null action no record recorder record repeatcount action get code if repeat was true originally clear it otherwise it might have been set by the action etc if repeatcount 1 first of all if this action set a read next char do not clear the repeat if read next char null return repeat count 1 view get status set message null invokeaction invokeaction editaction getbuffer insidecompoundedit endcompoundedit norememberlast historymodel getmodel additem getname lastaction lastactioncount lastaction lastactioncount _repeatcount repeatcount norepeat _repeatcount _repeatcount repeat_count_threshold getlabel getname guiutilities prettifymenulabel _repeatcount guiutilities joptionpane warning_message joptionpane yes_no_option joptionpane yes_option repeatcount getstatus setmessage begincompoundedit _repeatcount endcompoundedit getmacrorecorder norecord _repeatcount getcode _repeatcount readnextchar readnextchar repeatcount getstatus setmessage invoke last action method public void invoke last action if last action null view get toolkit beep else invoke action last action invokelastaction invokelastaction lastaction gettoolkit invokeaction lastaction user input method protected void user input char ch last action count 0 j edit text area text area view get text area buffer buffer view get buffer if buffer inside compound edit buffer begin compound edit if repeat count 1 text area user input ch else stop people doing dumb stuff like c enter 100 c n if repeat count repeat count threshold object pp string value of ch new integer repeat count if gui utilities confirm view large repeat count user input pp j option pane warning message j option pane yes no option j option pane yes option repeat count 1 view get status set message null return buffer buffer view get buffer try if repeat count 1 buffer begin compound edit for int i 0 i repeat count i text area user input ch finally if repeat count 1 buffer end compound edit macros recorder recorder view get macro recorder if recorder null recorder record input repeat count ch text area is overwrite enabled repeat count 1 userinput userinput lastactioncount jedittextarea textarea gettextarea getbuffer insidecompoundedit begincompoundedit repeatcount textarea userinput repeatcount repeat_count_threshold valueof repeatcount guiutilities joptionpane warning_message joptionpane yes_no_option joptionpane yes_option repeatcount getstatus setmessage getbuffer repeatcount begincompoundedit repeatcount textarea userinput repeatcount endcompoundedit getmacrorecorder recordinput repeatcount textarea isoverwriteenabled repeatcount invoke read next char method protected void invoke read next char char ch buffer buffer view get buffer if buffer inside compound edit buffer end compound edit string char str misc utilities chars to escapes string value of ch this might be a bit slow if char occurs a lot int index while index read next char index of char 1 read next char read next char substring 0 index char str read next char substring index 8 macros recorder recorder view get macro recorder if recorder null recorder record get repeat count read next char if get repeat count 1 try buffer begin compound edit bean shell eval view bean shell get name space for int i 1 i get repeat count i n n read next char n finally buffer end compound edit else bean shell eval view bean shell get name space read next char read next char null view get status set message null invokereadnextchar invokereadnextchar getbuffer insidecompoundedit endcompoundedit charstr miscutilities charstoescapes valueof __char__ readnextchar indexof __char__ readnextchar readnextchar charstr readnextchar getmacrorecorder getrepeatcount readnextchar getrepeatcount begincompoundedit beanshell beanshell getnamespace getrepeatcount readnextchar endcompoundedit beanshell beanshell getnamespace readnextchar readnextchar getstatus setmessage get dockable window manager method returns the dockable window manager associated with this view since j edit 2 6pre3 public dockable window manager get dockable window manager return dockable window manager getdockablewindowmanager jedit dockablewindowmanager getdockablewindowmanager dockablewindowmanager get tool bar method returns the view s tool bar since j edit 4 2pre1 public box get tool bar return tool bar gettoolbar jedit gettoolbar toolbar add tool bar method adds a tool bar to this view param tool bar the tool bar public void add tool bar component tool bar add tool bar default group default layer tool bar addtoolbar toolbar addtoolbar toolbar addtoolbar default_group default_layer toolbar add tool bar method adds a tool bar to this view param group the tool bar group to add to param tool bar the tool bar see org gjt sp jedit gui tool bar manager since j edit 4 0pre7 public void add tool bar int group component tool bar add tool bar group default layer tool bar addtoolbar toolbar toolbarmanager jedit addtoolbar toolbar addtoolbar default_layer toolbar add tool bar method adds a tool bar to this view param group the tool bar group to add to param layer the layer of the group to add to param tool bar the tool bar see org gjt sp jedit gui tool bar manager since j edit 4 0pre7 public void add tool bar int group int layer component tool bar tool bar manager add tool bar group layer tool bar get root pane revalidate addtoolbar toolbar toolbarmanager jedit addtoolbar toolbar toolbarmanager addtoolbar toolbar getrootpane remove tool bar method removes a tool bar from this view param tool bar the tool bar public void remove tool bar component tool bar tool bar manager remove tool bar tool bar get root pane revalidate removetoolbar toolbar removetoolbar toolbar toolbarmanager removetoolbar toolbar getrootpane show wait cursor method shows the wait cursor this method and link hide wait cursor are implemented using a reference count of requests for wait cursors so that nested calls work correctly however you should be careful to use these methods in tandem p to ensure that link hide wait cursor is always called after a link show wait cursor use a code try code code finally code block like this pre try view show wait cursor finally view hide wait cursor pre public synchronized void show wait cursor if wait count 0 cursor cursor cursor get predefined cursor cursor wait cursor set cursor cursor edit pane edit panes get edit panes for int i 0 i edit panes length i edit pane edit pane edit panes i edit pane get text area get painter set cursor cursor showwaitcursor hidewaitcursor hidewaitcursor showwaitcursor showwaitcursor hidewaitcursor showwaitcursor waitcount getpredefinedcursor wait_cursor setcursor editpane editpanes geteditpanes editpanes editpane editpane editpanes editpane gettextarea getpainter setcursor hide wait cursor method hides the wait cursor public synchronized void hide wait cursor if wait count 0 wait count if wait count 0 still needed even though glass pane has a wait cursor cursor cursor cursor get predefined cursor cursor default cursor set cursor cursor cursor cursor get predefined cursor cursor text cursor edit pane edit panes get edit panes for int i 0 i edit panes length i edit pane edit pane edit panes i edit pane get text area get painter set cursor cursor hidewaitcursor hidewaitcursor waitcount waitcount waitcount getpredefinedcursor default_cursor setcursor getpredefinedcursor text_cursor editpane editpanes geteditpanes editpanes editpane editpane editpanes editpane gettextarea getpainter setcursor get search bar method returns the search bar since j edit 2 4pre4 public final search bar get search bar return search bar getsearchbar jedit searchbar getsearchbar searchbar get action bar method returns the action bar since j edit 4 2pre3 public final action bar get action bar return action bar getactionbar jedit actionbar getactionbar actionbar get status method returns the status bar the link org gjt sp jedit gui status bar set message string and link org gjt sp jedit gui status bar set message and clear string methods can be called on the return value of this method to display status information to the user since j edit 3 2pre2 public status bar get status return status getstatus statusbar setmessage statusbar setmessageandclear jedit statusbar getstatus quick incremental search method quick search since j edit 4 0pre3 public void quick incremental search boolean word if search bar null search bar new search bar this true if search bar get parent null add tool bar top group search bar layer search bar search bar set hyper search false j edit text area text area get text area if word string text text area get selected text if text null text area select word text text area get selected text else if text index of n 1 text null search bar get field set text text search bar get field request focus search bar get field select all quickincrementalsearch jedit quickincrementalsearch searchbar searchbar searchbar searchbar getparent addtoolbar top_group search_bar_layer searchbar searchbar sethypersearch jedittextarea textarea gettextarea textarea getselectedtext textarea selectword textarea getselectedtext indexof searchbar getfield settext searchbar getfield requestfocus searchbar getfield selectall quick hyper search method quick hyper search since j edit 4 0pre3 public void quick hyper search boolean word j edit text area text area get text area if word string text text area get selected text if text null text area select word text text area get selected text if text null text index of n 1 history model get model find add item text search and replace set search string text search and replace set search file set new current buffer set search and replace hyper search this return if search bar null search bar new search bar this true if search bar get parent null add tool bar top group search bar layer search bar search bar set hyper search true search bar get field set text null search bar get field request focus search bar get field select all quickhypersearch hypersearch jedit quickhypersearch jedittextarea textarea gettextarea textarea getselectedtext textarea selectword textarea getselectedtext indexof historymodel getmodel additem searchandreplace setsearchstring searchandreplace setsearchfileset currentbufferset searchandreplace hypersearch searchbar searchbar searchbar searchbar getparent addtoolbar top_group search_bar_layer searchbar searchbar sethypersearch searchbar getfield settext searchbar getfield requestfocus searchbar getfield selectall action bar method shows the action bar if needed and sends keyboard focus there since j edit 4 2pre1 public void action bar if action bar null action bar new action bar this true if action bar get parent null add tool bar bottom group action bar layer action bar action bar go to action bar actionbar jedit actionbar actionbar actionbar actionbar actionbar getparent addtoolbar bottom_group action_bar_layer actionbar actionbar gotoactionbar get key event interceptor method returns the listener that will handle all key events in this view if any public key listener get key event interceptor return key event interceptor getkeyeventinterceptor keylistener getkeyeventinterceptor keyeventinterceptor set key event interceptor method sets the listener that will handle all key events in this view for example the complete word command uses this so that all key events are passed to the word list popup while it is visible param listener the key event interceptor public void set key event interceptor key listener listener this key event interceptor listener setkeyeventinterceptor setkeyeventinterceptor keylistener keyeventinterceptor get input handler method returns the input handler public input handler get input handler return input handler getinputhandler inputhandler getinputhandler inputhandler set input handler method sets the input handler param input handler the new input handler public void set input handler input handler input handler this input handler input handler setinputhandler inputhandler setinputhandler inputhandler inputhandler inputhandler inputhandler get macro recorder method returns the macro recorder public macros recorder get macro recorder return recorder getmacrorecorder getmacrorecorder set macro recorder method sets the macro recorder param recorder the macro recorder public void set macro recorder macros recorder recorder this recorder recorder setmacrorecorder setmacrorecorder process key event method forwards key events directly to the input handler this is slightly faster than using a key listener because some swing overhead is avoided public void process key event key event evt process key event evt view processkeyevent keylistener processkeyevent keyevent processkeyevent process key event method forwards key events directly to the input handler this is slightly faster than using a key listener because some swing overhead is avoided public void process key event key event evt boolean called from text area process key event evt called from text area text area view processkeyevent keylistener processkeyevent keyevent calledfromtextarea processkeyevent calledfromtextarea text_area public static final int action bar 2 forwards key events directly to the input handler this is slightly faster than using a key listener because some swing overhead is avoided public void process key event key event evt int from if debug dump key events from view log log log debug this key event grab key dialog to string evt if get text area has focus from view return evt preprocesskeyevent evt if evt null return if debug dump key events from view log log log debug this key event after workaround grab key dialog to string evt switch evt getid case key event key typed boolean focus on text area false if the user pressed eg c e n n in the search bar we want focus to go back there after the prefix is done if prefix focus owner null if prefix focus owner is showing prefix focus owner request focus focus on text area true if key event interceptor null key event interceptor key typed evt else if from action bar input handler is prefix active get text area has focus key event translator key key stroke key event translator translate key event evt if key stroke null if debug dump key events from view log log log debug this translated key stroke if input handler handle key key stroke evt consume we might have been closed as a result of the above if is closed return this is a weird hack we don t want c e a to insert a in the search bar if the search bar has focus if input handler is prefix active if get focus owner instanceof j text component prefix focus owner get focus owner get text area request focus else if focus on text area get text area request focus else prefix focus owner null else prefix focus owner null break case key event key pressed if key event interceptor null key event interceptor key pressed evt else boolean focus on text area false if prefix focus owner null if prefix focus owner is showing prefix focus owner request focus focus on text area true prefix focus owner null key event translator key key stroke key event translator translate key event evt if key stroke null if debug dump key events from view log log log debug this translated key stroke if input handler handle key key stroke evt consume we might have been closed as a result of the above if is closed return this is a weird hack we don t want c e a to insert a in the search bar if the search bar has focus if input handler is prefix active if get focus owner instanceof j text component prefix focus owner get focus owner get text area request focus else if focus on text area get text area request focus else prefix focus owner null else prefix focus owner null break case key event key released if key event interceptor null key event interceptor key released evt break if evt is consumed super process key event evt action_bar keylistener processkeyevent keyevent dump_key_events grabkeydialog tostring gettextarea hasfocus _preprocesskeyevent dump_key_events grabkeydialog tostring keyevent key_typed focusontextarea prefixfocusowner prefixfocusowner isshowing prefixfocusowner requestfocus focusontextarea keyeventinterceptor keyeventinterceptor keytyped action_bar inputhandler isprefixactive gettextarea hasfocus keyeventtranslator keystroke keyeventtranslator translatekeyevent keystroke dump_key_events keystroke inputhandler handlekey keystroke isclosed inputhandler isprefixactive getfocusowner jtextcomponent prefixfocusowner getfocusowner gettextarea requestfocus focusontextarea gettextarea requestfocus prefixfocusowner prefixfocusowner keyevent key_pressed keyeventinterceptor keyeventinterceptor keypressed focusontextarea prefixfocusowner prefixfocusowner isshowing prefixfocusowner requestfocus focusontextarea prefixfocusowner keyeventtranslator keystroke keyeventtranslator translatekeyevent keystroke dump_key_events keystroke inputhandler handlekey keystroke isclosed inputhandler isprefixactive getfocusowner jtextcomponent prefixfocusowner getfocusowner gettextarea requestfocus focusontextarea gettextarea requestfocus prefixfocusowner prefixfocusowner keyevent key_released keyeventinterceptor keyeventinterceptor keyreleased isconsumed processkeyevent split horizontally method splits the view horizontally since j edit 4 1pre2 public edit pane split horizontally return split j split pane vertical split splithorizontally jedit editpane splithorizontally jsplitpane vertical_split split vertically method splits the view vertically since j edit 4 1pre2 public edit pane split vertically return split j split pane horizontal split splitvertically jedit editpane splitvertically jsplitpane horizontal_split split method splits the view since j edit 4 1pre2 public edit pane split int orientation perspective manager set perspective dirty true edit pane save caret info edit pane old edit pane edit pane set edit pane create edit pane old edit pane get buffer edit pane load caret info j component old parent j component old edit pane get parent final j split pane new split pane new j split pane orientation new split pane set one touch expandable true new split pane set border null new split pane set minimum size new dimension 0 0 int parent size orientation j split pane vertical split old edit pane get height old edit pane get width final int divider position int double parent size new split pane get divider size 0 5 new split pane set divider location divider position if old parent instanceof j split pane j split pane old split pane j split pane old parent int divider pos old split pane get divider location component left old split pane get left component if left old edit pane old split pane set left component new split pane else old split pane set right component new split pane new split pane set left component old edit pane new split pane set right component edit pane old split pane set divider location divider pos else this split pane new split pane new split pane set left component old edit pane new split pane set right component edit pane old parent add new split pane 0 old parent revalidate swing utilities invoke later new runnable public void run new split pane set divider location divider position edit pane focus on text area return edit pane jedit editpane perspectivemanager setperspectivedirty editpane savecaretinfo editpane oldeditpane editpane seteditpane createeditpane oldeditpane getbuffer editpane loadcaretinfo jcomponent oldparent jcomponent oldeditpane getparent jsplitpane newsplitpane jsplitpane newsplitpane setonetouchexpandable newsplitpane setborder newsplitpane setminimumsize parentsize jsplitpane vertical_split oldeditpane getheight oldeditpane getwidth dividerposition parentsize newsplitpane getdividersize newsplitpane setdividerlocation dividerposition oldparent jsplitpane jsplitpane oldsplitpane jsplitpane oldparent dividerpos oldsplitpane getdividerlocation oldsplitpane getleftcomponent oldeditpane oldsplitpane setleftcomponent newsplitpane oldsplitpane setrightcomponent newsplitpane newsplitpane setleftcomponent oldeditpane newsplitpane setrightcomponent editpane oldsplitpane setdividerlocation dividerpos splitpane newsplitpane newsplitpane setleftcomponent oldeditpane newsplitpane setrightcomponent editpane oldparent newsplitpane oldparent swingutilities invokelater newsplitpane setdividerlocation dividerposition editpane focusontextarea editpane swing utilities invoke later new runnable public void run new split pane set divider location divider position swingutilities invokelater newsplitpane setdividerlocation dividerposition unsplit method unsplits the view since j edit 2 3pre2 public void unsplit if split pane null perspective manager set perspective dirty true edit pane edit panes get edit panes for int i 0 i edit panes length i edit pane editpane edit panes i if edit pane editpane editpane close j component parent j component split pane get parent parent remove split pane parent add edit pane 0 parent revalidate split pane null update title edit pane focus on text area else get toolkit beep jedit splitpane perspectivemanager setperspectivedirty editpane editpanes geteditpanes editpanes editpane _editpane editpanes editpane _editpane _editpane jcomponent jcomponent splitpane getparent splitpane editpane splitpane updatetitle editpane focusontextarea gettoolkit unsplit current method removes the current split since j edit 2 3pre2 public void unsplit current if split pane null perspective manager set perspective dirty true find first split pane parenting current edit pane component comp edit pane while comp instanceof j split pane comp comp get parent get rid of any edit pane that is a child of the current edit pane s parent splitter edit pane edit panes get edit panes for int i 0 i edit panes length i edit pane editpane edit panes i if gui utilities is ancestor of comp editpane editpane edit pane editpane close j component parent j component comp get parent if parent instanceof j split pane j split pane parent split j split pane parent int pos parent split get divider location if parent split get left component comp parent split set left component edit pane else parent split set right component edit pane parent split set divider location pos else parent remove comp parent add edit pane 0 split pane null parent revalidate update title edit pane focus on text area else get toolkit beep unsplitcurrent jedit unsplitcurrent splitpane perspectivemanager setperspectivedirty editpane jsplitpane getparent editpane editpanes geteditpanes editpanes editpane _editpane editpanes guiutilities isancestorof _editpane _editpane editpane _editpane jcomponent jcomponent getparent jsplitpane jsplitpane parentsplit jsplitpane parentsplit getdividerlocation parentsplit getleftcomponent parentsplit setleftcomponent editpane parentsplit setrightcomponent editpane parentsplit setdividerlocation editpane splitpane updatetitle editpane focusontextarea gettoolkit next text area method moves keyboard focus to the next text area since j edit 2 7pre4 public void next text area edit pane edit panes get edit panes for int i 0 i edit panes length i if edit pane edit panes i if i edit panes length 1 edit panes 0 focus on text area else edit panes i 1 focus on text area break nexttextarea jedit nexttextarea editpane editpanes geteditpanes editpanes editpane editpanes editpanes editpanes focusontextarea editpanes focusontextarea prev text area method moves keyboard focus to the previous text area since j edit 2 7pre4 public void prev text area edit pane edit panes get edit panes for int i 0 i edit panes length i if edit pane edit panes i if i 0 edit panes edit panes length 1 focus on text area else edit panes i 1 focus on text area break prevtextarea jedit prevtextarea editpane editpanes geteditpanes editpanes editpane editpanes editpanes editpanes focusontextarea editpanes focusontextarea get split pane method returns the top level split pane if any since j edit 2 3pre2 public j split pane get split pane return split pane getsplitpane jedit jsplitpane getsplitpane splitpane get buffer method returns the current edit pane s buffer public buffer get buffer if edit pane null return null else return edit pane get buffer getbuffer getbuffer editpane editpane getbuffer set buffer method sets the current edit pane s buffer public void set buffer buffer buffer edit pane set buffer buffer setbuffer setbuffer editpane setbuffer go to buffer method if this buffer is open in one of the view s edit panes sets focus to that edit pane otherwise opens the buffer in the currently active edit pane param buffer the buffer since j edit 4 2pre1 public edit pane go to buffer buffer buffer if edit pane get buffer buffer edit pane focus on text area return edit pane edit pane edit panes get edit panes for int i 0 i edit panes length i edit pane ep edit panes i if ep get buffer buffer ignore zero height splits etc ep get text area get visible lines 1 set edit pane ep ep focus on text area return ep set buffer buffer return edit pane gotobuffer jedit editpane gotobuffer editpane getbuffer editpane focusontextarea editpane editpane editpanes geteditpanes editpanes editpane editpanes getbuffer gettextarea getvisiblelines seteditpane focusontextarea setbuffer editpane get text area method returns the current edit pane s text area public j edit text area get text area if edit pane null return null else return edit pane get text area gettextarea jedittextarea gettextarea editpane editpane gettextarea get edit pane method returns the current edit pane since j edit 2 5pre2 public edit pane get edit pane return edit pane geteditpane jedit editpane geteditpane editpane get edit panes method returns all edit panes since j edit 2 5pre2 public edit pane get edit panes if split pane null edit pane ep edit pane return ep else vector vec new vector get edit panes vec split pane edit pane ep new edit pane vec size vec copy into ep return ep geteditpanes jedit editpane geteditpanes splitpane editpane editpane geteditpanes splitpane editpane editpane copyinto get view config method since j edit 4 2pre1 public view config get view config string buffer split config new string buffer if split pane null get split config split pane split config else split config append split config append misc utilities chars to escapes get buffer get path split config append buffer view config config new view config config plain view is plain view config split config split config to string config x getx config y gety config width get width config height get height config ext state gui utilities get extended state this config top dockable window manager get top docking area get current config left dockable window manager get left docking area get current config bottom dockable window manager get bottom docking area get current config right dockable window manager get right docking area get current config top pos dockable window manager get top docking area get dimension config left pos dockable window manager get left docking area get dimension config bottom pos dockable window manager get bottom docking area get dimension config right pos dockable window manager get right docking area get dimension return config getviewconfig jedit viewconfig getviewconfig stringbuffer splitconfig stringbuffer splitpane getsplitconfig splitpane splitconfig splitconfig splitconfig miscutilities charstoescapes getbuffer getpath splitconfig viewconfig viewconfig plainview isplainview splitconfig splitconfig tostring getwidth getheight extstate guiutilities getextendedstate dockablewindowmanager gettopdockingarea getcurrent dockablewindowmanager getleftdockingarea getcurrent dockablewindowmanager getbottomdockingarea getcurrent dockablewindowmanager getrightdockingarea getcurrent toppos dockablewindowmanager gettopdockingarea getdimension leftpos dockablewindowmanager getleftdockingarea getdimension bottompos dockablewindowmanager getbottomdockingarea getdimension rightpos dockablewindowmanager getrightdockingarea getdimension is closed method returns true if this view has been closed with link j edit close view view public boolean is closed return closed isclosed jedit closeview isclosed is plain view method returns true if this is an auxilliary view with no dockable windows since j edit 4 1pre2 public boolean is plain view return plain view isplainview jedit isplainview plainview get next method returns the next view in the list public view get next return next getnext getnext get prev method returns the previous view in the list public view get prev return prev getprev getprev handle message method public void handle message eb message msg if msg instanceof properties changed properties changed else if msg instanceof search settings changed if search bar null search bar update else if msg instanceof buffer update handle buffer update buffer update msg else if msg instanceof edit pane update handle edit pane update edit pane update msg handlemessage handlemessage ebmessage propertieschanged propertieschanged searchsettingschanged searchbar searchbar bufferupdate handlebufferupdate bufferupdate editpaneupdate handleeditpaneupdate editpaneupdate get minimum size method public dimension get minimum size return new dimension 0 0 getminimumsize getminimumsize set wait socket method this socket is closed when the buffer is closed public void set wait socket socket wait socket this wait socket wait socket setwaitsocket setwaitsocket waitsocket waitsocket waitsocket to string method public string to string return get class get name j edit get active view this active inactive tostring tostring getclass getname jedit getactiveview view constructor view buffer buffer view config config this plain view config plain view enable events awt event key event mask set icon image gui utilities get editor icon dockable window manager new dockable window manager this config top tool bars new j panel new variable grid layout variable grid layout fixed num columns 1 bottom tool bars new j panel new variable grid layout variable grid layout fixed num columns 1 tool bar manager new tool bar manager top tool bars bottom tool bars status new status bar this input handler new default input handler this default input handler j edit get input handler try component comp restore split config buffer config split config dockable window manager add comp 0 catch io exception e this should never throw an exception throw new internal error get content pane add border layout center dockable window manager dockable window manager init tool bar and status bar gets added in properties changed depending in the tool bar alternate layout setting properties changed set default close operation do nothing on close add window listener new window handler edit bus add to bus this search dialog preload search dialog this viewconfig plainview plainview enableevents awtevent key_event_mask seticonimage guiutilities geteditoricon dockablewindowmanager dockablewindowmanager toptoolbars jpanel variablegridlayout variablegridlayout fixed_num_columns bottomtoolbars jpanel variablegridlayout variablegridlayout fixed_num_columns toolbarmanager toolbarmanager toptoolbars bottomtoolbars statusbar inputhandler defaultinputhandler defaultinputhandler jedit getinputhandler restoresplitconfig splitconfig dockablewindowmanager ioexception internalerror getcontentpane borderlayout dockablewindowmanager dockablewindowmanager propertieschanged propertieschanged setdefaultcloseoperation do_nothing_on_close addwindowlistener windowhandler editbus addtobus searchdialog preloadsearchdialog close method void close gui utilities save geometry this plain view plain view view closed true save dockable window geometry and close em dockable window manager close edit bus remove from bus this dispose edit pane edit panes get edit panes for int i 0 i edit panes length i edit panes i close null some variables so that retaining references to closed views won t hurt as much tool bar manager null tool bar null search bar null split pane null input handler null recorder null get content pane remove all notify clients with wait if wait socket null try wait socket get output stream write 0 wait socket get output stream flush wait socket get input stream close wait socket get output stream close wait socket close catch io exception io log log log error this io guiutilities savegeometry plainview dockablewindowmanager editbus removefrombus editpane editpanes geteditpanes editpanes editpanes toolbarmanager toolbar searchbar splitpane inputhandler getcontentpane removeall waitsocket waitsocket getoutputstream waitsocket getoutputstream waitsocket getinputstream waitsocket getoutputstream waitsocket ioexception update title method updates the title bar void update title vector buffers new vector edit pane edit panes get edit panes for int i 0 i edit panes length i buffer buffer edit panes i get buffer if buffers index of buffer 1 buffers add element buffer string buffer title new string buffer j edit get property view title for int i 0 i buffers size i if i 0 title append buffer buffer buffer buffers element at i title append show full path buffer is new file buffer get path buffer get name if buffer is dirty title append j edit get property view title dirty set title title to string updatetitle updatetitle editpane editpanes geteditpanes editpanes editpanes getbuffer indexof addelement stringbuffer stringbuffer jedit getproperty elementat showfullpath isnewfile getpath getname isdirty jedit getproperty settitle tostring get edit panes method private void get edit panes vector vec component comp if comp instanceof edit pane vec add element comp else if comp instanceof j split pane j split pane split j split pane comp get edit panes vec split get left component get edit panes vec split get right component geteditpanes geteditpanes editpane addelement jsplitpane jsplitpane jsplitpane geteditpanes getleftcomponent geteditpanes getrightcomponent private void get split config j split pane split pane string buffer split config component right split pane get right component if right instanceof j split pane get split config j split pane right split config else split config append split config append misc utilities chars to escapes edit pane right get buffer get path split config append buffer split config append component left split pane get left component if left instanceof j split pane get split config j split pane left split config else split config append split config append misc utilities chars to escapes edit pane left get buffer get path split config append buffer split config append split config append split pane get divider location split config append split config append split pane get orientation j split pane vertical split vertical horizontal getsplitconfig jsplitpane splitpane stringbuffer splitconfig splitpane getrightcomponent jsplitpane getsplitconfig jsplitpane splitconfig splitconfig splitconfig miscutilities charstoescapes editpane getbuffer getpath splitconfig splitconfig splitpane getleftcomponent jsplitpane getsplitconfig jsplitpane splitconfig splitconfig splitconfig miscutilities charstoescapes editpane getbuffer getpath splitconfig splitconfig splitconfig splitpane getdividerlocation splitconfig splitconfig splitpane getorientation jsplitpane vertical_split restore split config method private component restore split config buffer buffer string split config throws io exception this is where checked exceptions piss me off this method only uses a string reader which can never throw an exception if buffer null return edit pane create edit pane buffer else if split config null return edit pane create edit pane j edit get first buffer buffer buffers j edit get buffers stack stack new stack we create a stream tokenizer for parsing a simple stack based language stream tokenizer st new stream tokenizer new string reader split config st whitespace chars 0 all printable ascii characters st word chars st comment char st quote char st eol is significant false loop for switch st next token case stream tokenizer tt eof break loop case stream tokenizer tt word if st sval equals vertical st sval equals horizontal int orientation st sval equals vertical j split pane vertical split j split pane horizontal split int divider integer stack pop int value stack push split pane new j split pane orientation component stack pop component stack pop split pane set one touch expandable true split pane set border null split pane set minimum size new dimension 0 0 split pane set divider location divider else if st sval equals buffer object obj stack pop if obj instanceof integer int index integer obj int value if index 0 index buffers length buffer buffers index else if obj instanceof string string path string obj buffer j edit get buffer path if buffer null buffer j edit get first buffer stack push edit pane create edit pane buffer break case stream tokenizer tt number stack push new integer int st nval break case stack push st sval break update gutter borders return component stack peek restoresplitconfig restoresplitconfig splitconfig ioexception stringreader editpane createeditpane splitconfig editpane createeditpane jedit getfirstbuffer jedit getbuffers streamtokenizer streamtokenizer stringreader splitconfig whitespacechars wordchars commentchar quotechar eolissignificant nexttoken streamtokenizer tt_eof streamtokenizer tt_word jsplitpane vertical_split jsplitpane horizontal_split intvalue splitpane jsplitpane splitpane setonetouchexpandable splitpane setborder splitpane setminimumsize splitpane setdividerlocation intvalue jedit getbuffer jedit getfirstbuffer editpane createeditpane streamtokenizer tt_number updategutterborders properties changed method reloads various settings from the properties private void properties changed setj menu bar gui utilities load menu bar view mbar load tool bars show full path j edit get boolean property view show full path update title status properties changed remove tool bar status get content pane remove status if j edit get boolean property view toolbar alternate layout get content pane add border layout north top tool bars get content pane add border layout south bottom tool bars if plain view j edit get boolean property view status visible add tool bar bottom group status bar layer status else dockable window manager add top tool bars dockable window manager dockable layout top toolbars 0 dockable window manager add bottom tool bars dockable window manager dockable layout bottom toolbars 0 if plain view j edit get boolean property view status visible get content pane add border layout south status get root pane revalidate swing utilities update component treeui get root pane propertieschanged propertieschanged setjmenubar guiutilities loadmenubar loadtoolbars showfullpath jedit getbooleanproperty showfullpath updatetitle propertieschanged removetoolbar getcontentpane jedit getbooleanproperty alternatelayout getcontentpane borderlayout toptoolbars getcontentpane borderlayout bottomtoolbars plainview jedit getbooleanproperty addtoolbar bottom_group status_bar_layer dockablewindowmanager toptoolbars dockablewindowmanager dockablelayout top_toolbars dockablewindowmanager bottomtoolbars dockablewindowmanager dockablelayout bottom_toolbars plainview jedit getbooleanproperty getcontentpane borderlayout getrootpane swingutilities updatecomponenttreeui getrootpane load tool bars method private void load tool bars if j edit get boolean property view show toolbar plain view if tool bar null tool bar manager remove tool bar tool bar tool bar gui utilities load tool bar view toolbar add tool bar top group system bar layer tool bar else if tool bar null remove tool bar tool bar tool bar null if search bar null remove tool bar search bar if j edit get boolean property view show searchbar plain view if search bar null search bar new search bar this false search bar properties changed add tool bar top group search bar layer search bar loadtoolbars loadtoolbars jedit getbooleanproperty showtoolbar plainview toolbar toolbarmanager removetoolbar toolbar toolbar guiutilities loadtoolbar addtoolbar top_group system_bar_layer toolbar toolbar removetoolbar toolbar toolbar searchbar removetoolbar searchbar jedit getbooleanproperty showsearchbar plainview searchbar searchbar searchbar searchbar propertieschanged addtoolbar top_group search_bar_layer searchbar create edit pane method private edit pane create edit pane buffer buffer edit pane edit pane new edit pane this buffer j edit text area text area edit pane get text area text area add focus listener new focus handler text area add caret listener new caret handler text area add scroll listener new scroll handler edit bus send new edit pane update edit pane edit pane update created return edit pane createeditpane editpane createeditpane editpane editpane editpane jedittextarea textarea editpane gettextarea textarea addfocuslistener focushandler textarea addcaretlistener carethandler textarea addscrolllistener scrollhandler editbus editpaneupdate editpane editpaneupdate editpane set edit pane method private void set edit pane edit pane edit pane this edit pane edit pane status update caret status status update buffer status status update misc status repaint the gutter so that the border color reflects the focus state update gutter borders edit bus send new view update this view update edit pane changed seteditpane seteditpane editpane editpane editpane editpane updatecaretstatus updatebufferstatus updatemiscstatus updategutterborders editbus viewupdate viewupdate edit_pane_changed handle buffer update method private void handle buffer update buffer update msg buffer buffer msg get buffer if msg get what buffer update dirty changed msg get what buffer update loaded edit pane edit panes get edit panes for int i 0 i edit panes length i if edit panes i get buffer buffer update title break handlebufferupdate handlebufferupdate bufferupdate getbuffer getwhat bufferupdate dirty_changed getwhat bufferupdate editpane editpanes geteditpanes editpanes editpanes getbuffer updatetitle handle edit pane update method private void handle edit pane update edit pane update msg edit pane edit pane msg get edit pane if edit pane get view this msg get what edit pane update buffer changed edit pane get buffer is loaded status update caret status status update buffer status status update misc status handleeditpaneupdate handleeditpaneupdate editpaneupdate editpane editpane geteditpane editpane getview getwhat editpaneupdate buffer_changed editpane getbuffer isloaded updatecaretstatus updatebufferstatus updatemiscstatus update gutter borders method updates the borders of all gutters in this view to reflect the currently focused text area since j edit 2 6final private void update gutter borders edit pane edit panes get edit panes for int i 0 i edit panes length i edit panes i get text area get gutter update border updategutterborders jedit updategutterborders editpane editpanes geteditpanes editpanes editpanes gettextarea getgutter updateborder preprocesskeyevent method private key event preprocesskeyevent key event evt if is closed return null if get focus owner instanceof j component j component comp j component get focus owner input map map comp get input map action map am comp get action map if map null am null comp is enabled object binding map get key stroke get key stroke for event evt if binding null am get binding null return null if get focus owner instanceof j text component fix for the bug where key events in j text components inside views are also handled by the input handler if evt getid key event key pressed switch evt get key code case key event vk enter case key event vk tab case key event vk back space case key event vk space return null if evt is consumed return null return key event workaround process key event evt _preprocesskeyevent keyevent _preprocesskeyevent keyevent isclosed getfocusowner jcomponent jcomponent jcomponent getfocusowner inputmap getinputmap actionmap getactionmap isenabled keystroke getkeystrokeforevent getfocusowner jtextcomponent jtextcomponents keyevent key_pressed getkeycode keyevent vk_enter keyevent vk_tab keyevent vk_back_space keyevent vk_space isconsumed keyeventworkaround processkeyevent public void caret update caret event evt if evt get source get text area status update caret status caretupdate caretevent getsource gettextarea updatecaretstatus public void focus gained focus event evt walk up hierarchy looking for an edit pane component comp component evt get source while comp instanceof edit pane if comp null return comp comp get parent if comp edit pane set edit pane edit pane comp else update gutter borders focusgained focusevent editpane getsource editpane getparent editpane seteditpane editpane updategutterborders public void scrolled vertically j edit text area text area if get text area text area status update caret status scrolledvertically jedittextarea textarea gettextarea textarea updatecaretstatus public void scrolled horizontally j edit text area text area scrolledhorizontally jedittextarea textarea public void window activated window event evt j edit set active view view this people have reported hangs with jdk 1 4 might be caused by modal dialogs being displayed from window activated swing utilities invoke later new runnable public void run j edit check buffer status view this windowactivated windowevent jedit setactiveview windowactivated swingutilities invokelater jedit checkbufferstatus swing utilities invoke later new runnable public void run j edit check buffer status view this swingutilities invokelater jedit checkbufferstatus public void window closing window event evt j edit close view view this windowclosing windowevent jedit closeview public int top pos left pos bottom pos right pos public view config toppos leftpos bottompos rightpos viewconfig public view config boolean plain view this plain view plain view string prefix plain view plain view view x j edit get integer property prefix x 0 y j edit get integer property prefix y 0 width j edit get integer property prefix width 0 height j edit get integer property prefix height 0 viewconfig plainview plainview plainview plainview jedit getintegerproperty jedit getintegerproperty jedit getintegerproperty jedit getintegerproperty public view config boolean plain view string split config int x int y int width int height int ext state this plain view plain view this split config split config this x x this y y this width width this height height this ext state ext state viewconfig plainview splitconfig extstate plainview plainview splitconfig splitconfig extstate extstate public int kind bsh binary expression int id super id bshbinaryexpression public object eval call stack callstack interpreter interpreter throws eval error object lhs simple node jjt get child 0 eval callstack interpreter doing instanceof next node is a type if kind instanceof null object ref is not instance of any type if lhs primitive null return new primitive false class rhs bsh type jjt get child 1 get type callstack interpreter primitive number or void cannot be tested for instanceof if lhs instanceof primitive throw new eval error cannot be instance of primitive type primitive number or void is not normally an instanceof anything but for internal use we ll test true for the bsh primitive class i e 5 instanceof bsh primitive will be true if lhs instanceof primitive if rhs bsh primitive class return new primitive true else return new primitive false general case performe the instanceof based on assignability boolean ret types is java assignable rhs lhs get class return new primitive ret the following two boolean checks were tacked on this could probably be smoothed out look ahead and short circuit evaluation of the rhs if we re a boolean and and the lhs is false if kind bool and kind bool andx object obj lhs if is primitive value lhs obj primitive lhs get value if obj instanceof boolean boolean obj boolean value false return new primitive false look ahead and short circuit evaluation of the rhs if we re a boolean and and the lhs is false if kind bool or kind bool orx object obj lhs if is primitive value lhs obj primitive lhs get value if obj instanceof boolean boolean obj boolean value true return new primitive true end stuff that was tacked on for boolean short circuiting are both the lhs and rhs either wrappers or primitive values do binary op boolean is lhs wrapper is wrapper lhs object rhs simple node jjt get child 1 eval callstack interpreter boolean is rhs wrapper is wrapper rhs if is lhs wrapper is primitive value lhs is rhs wrapper is primitive value rhs special case for eq on two wrapper objects if is lhs wrapper is rhs wrapper kind eq don t auto unwrap wrappers preserve identity semantics fall through to object operations below else try return primitive binary operation lhs rhs kind catch util eval error e throw e to eval error this callstack doing the following makes it hard to use untyped vars e g if arg null what if arg is a primitive the answer is that we should test only if the var is typed need to get that info here else do we have a mixture of primitive values and non primitives primitive value not null not void int prim count 0 if is primitive value lhs prim count if is primitive value rhs prim count if prim count 1 both primitive types should have been handled above throw new interpreter error should not be here else if prim count 1 mixture of one and the other throw new eval error operator token image kind inappropriate for object primitive combination this callstack else fall through to handle both non primitive types end check for primitive and non primitive mix treat lhs and rhs as arbitrary objects and do the operation including null and void represented by their primitive types system out println binary op arbitrary obj lhs rhs switch kind case eq return new primitive lhs rhs case ne return new primitive lhs rhs case plus if lhs instanceof string rhs instanceof string return lhs to string rhs to string fall through to default case default if lhs instanceof primitive rhs instanceof primitive if lhs primitive void rhs primitive void throw new eval error illegal use of undefined variable class or void literal this callstack else if lhs primitive null rhs primitive null throw new eval error illegal use of null value or null literal this callstack throw new eval error operator token image kind inappropriate for objects this callstack callstack evalerror simplenode jjtgetchild bshtype jjtgetchild gettype evalerror isjavaassignable getclass bool_and bool_andx isprimitivevalue getvalue booleanvalue bool_or bool_orx isprimitivevalue getvalue booleanvalue islhswrapper iswrapper simplenode jjtgetchild isrhswrapper iswrapper islhswrapper isprimitivevalue isrhswrapper isprimitivevalue islhswrapper isrhswrapper binaryoperation utilevalerror toevalerror primitivevalue primcount isprimitivevalue primcount isprimitivevalue primcount primcount interpretererror primcount evalerror tokenimage tostring tostring evalerror evalerror evalerror tokenimage object is a non null and non void primitive type private boolean is primitive value object obj return obj instanceof primitive obj primitive void obj primitive null isprimitivevalue object is a java lang wrapper for boolean char or number type private boolean is wrapper object obj return obj instanceof boolean obj instanceof character obj instanceof number iswrapper public boolean is synchronized false bsh block int id super id issynchronized bshblock public object eval call stack callstack interpreter interpreter throws eval error return eval callstack interpreter false callstack evalerror param override namespace if set to true the block will be executed in the current namespace not a subordinate one p if true no new block namespace will be swapped onto the stack and the eval will happen in the current top namespace this is used by bsh method try statement etc which must intialize the block first and also for those that perform multiple passes in the same block public object eval call stack callstack interpreter interpreter boolean override namespace throws eval error object sync value null if is synchronized first node is the expression on which to sync simple node exp simple node jjt get child 0 sync value exp eval callstack interpreter object ret if is synchronized do the actual synchronization synchronized sync value ret eval block callstack interpreter override namespace null filter else ret eval block callstack interpreter override namespace null filter return ret overridenamespace blocknamespace bshmethod trystatement callstack overridenamespace evalerror syncvalue issynchronized simplenode simplenode jjtgetchild syncvalue issynchronized syncvalue evalblock overridenamespace evalblock overridenamespace object eval block call stack callstack interpreter interpreter boolean override namespace node filter node filter throws eval error object ret primitive void name space enclosing name space null if override namespace enclosing name space callstack top block name space body name space new block name space enclosing name space callstack swap body name space int start child is synchronized 1 0 int num children jjt get num children try evaluate block in two passes first do class declarations then do everything else for int i start child i num children i simple node node simple node jjt get child i if node filter null node filter is visible node continue if node instanceof bsh class declaration node eval callstack interpreter for int i start child i num children i simple node node simple node jjt get child i if node instanceof bsh class declaration continue filter nodes if node filter null node filter is visible node continue ret node eval callstack interpreter statement or embedded block evaluated a return statement if ret instanceof return control break finally make sure we put the namespace back when we leave if override namespace callstack swap enclosing name space return ret evalblock callstack overridenamespace nodefilter nodefilter evalerror namespace enclosingnamespace overridenamespace enclosingnamespace blocknamespace bodynamespace blocknamespace enclosingnamespace bodynamespace startchild issynchronized numchildren jjtgetnumchildren startchild numchildren simplenode simplenode jjtgetchild nodefilter nodefilter isvisible bshclassdeclaration startchild numchildren simplenode simplenode jjtgetchild bshclassdeclaration nodefilter nodefilter isvisible returncontrol overridenamespace enclosingnamespace public interface node filter public boolean is visible simple node node nodefilter isvisible simplenode vfs directory entry table constructor public vfs directory entry table browser view browser view super new vfs directory entry table model this browser view browser view set show grid false set intercell spacing new dimension 0 0 table column col1 get column model get column 0 col1 set min width 20 col1 set max width 20 col1 set preferred width 20 set default renderer vfs directory entry table model entry class renderer new file cell renderer j table header header get table header header set reordering allowed false set row selection allowed true set column selection allowed true set cell selection enabled false set auto resize mode auto resize off vfsdirectoryentrytable vfsdirectoryentrytable browserview browserview vfsdirectoryentrytablemodel browserview browserview setshowgrid setintercellspacing tablecolumn getcolumnmodel getcolumn setminwidth setmaxwidth setpreferredwidth setdefaultrenderer vfsdirectoryentrytablemodel filecellrenderer jtableheader gettableheader setreorderingallowed setrowselectionallowed setcolumnselectionallowed setcellselectionenabled setautoresizemode auto_resize_off select file method public boolean select file string path for int i 0 i get row count i vfs directory entry table model entry entry vfs directory entry table model entry get value at i 1 if entry dir entry path equals path set selected row i return true return false selectfile selectfile getrowcount vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel getvalueat direntry setselectedrow do type select method public void do type select string str boolean dirs only if str length 0 clear selection else if get selected row 1 do type select str 0 get row count dirs only else int start get selection model get max selection index boolean ret val do type select str start get row count dirs only if ret val scan from selection to end failed so scan from start to selection do type select str 0 start dirs only dotypeselect dotypeselect dirsonly clearselection getselectedrow dotypeselect getrowcount dirsonly getselectionmodel getmaxselectionindex retval dotypeselect getrowcount dirsonly retval dotypeselect dirsonly get selected files method public vfs directory entry get selected files vfs directory entry table model model vfs directory entry table model get model linked list return value new linked list int selected rows get selected rows for int i 0 i selected rows length i return value add model files selected rows i dir entry return vfs directory entry return value to array new vfs directory entry return value size getselectedfiles directoryentry getselectedfiles vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel getmodel linkedlist returnvalue linkedlist selectedrows getselectedrows selectedrows returnvalue selectedrows direntry directoryentry returnvalue toarray directoryentry returnvalue get expanded directories method public void get expanded directories set set vfs directory entry table model model vfs directory entry table model get model if model files null for int i 0 i model files length i if model files i expanded set add model files i dir entry path getexpandeddirectories getexpandeddirectories vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel getmodel direntry toggle expanded method public void toggle expanded final int row vfs directory entry table model model vfs directory entry table model get model vfs directory entry table model entry entry model files row if entry dir entry type vfs directory entry file return if entry expanded model collapse vfs manager getvfs for path entry dir entry path row resize columns appropriately else browser view clear expansion state browser view load directory entry entry dir entry path vfs manager run inawt thread new runnable public void run set selected row row toggleexpanded toggleexpanded vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel getmodel vfsdirectoryentrytablemodel direntry directoryentry vfsmanager getvfsforpath direntry resizecolumnsappropriately browserview clearexpansionstate browserview loaddirectory direntry vfsmanager runinawtthread setselectedrow vfs manager run inawt thread new runnable public void run set selected row row vfsmanager runinawtthread setselectedrow set directory method public void set directory vfs vfs object node array list list set tmp expanded timer stop type select buffer set length 0 vfs directory entry table model model vfs directory entry table model get model int start index if node null start index 0 model set root vfs list else start index model expand vfs vfs directory entry table model entry node list start index for int i 0 i list size i vfs directory entry table model entry e model files start index i string path e dir entry path if tmp expanded contains path browser view load directory e path tmp expanded remove path resize columns appropriately setdirectory setdirectory arraylist tmpexpanded typeselectbuffer setlength vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel getmodel startindex startindex setroot startindex vfsdirectoryentrytablemodel startindex vfsdirectoryentrytablemodel startindex direntry tmpexpanded browserview loaddirectory tmpexpanded resizecolumnsappropriately maybe reload directory method public void maybe reload directory string path vfs directory entry table model model vfs directory entry table model get model for int i 0 i model files length i vfs directory entry table model entry e model files i if e expanded e dir entry type vfs directory entry file continue vfs directory entry dir entry e dir entry work around for broken ftp plugin string other path if dir entry symlink path null other path dir entry path else other path dir entry symlink path if vfs browser paths equal path other path browser view save expansion state browser view load directory e path return maybereloaddirectory maybereloaddirectory vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel getmodel vfsdirectoryentrytablemodel direntry directoryentry directoryentry direntry direntry otherpath direntry symlinkpath otherpath direntry otherpath direntry symlinkpath vfsbrowser pathsequal otherpath browserview saveexpansionstate browserview loaddirectory properties changed method public void properties changed renderer properties changed vfs directory entry template new vfs directory entry foo foo foo vfs directory entry file 0l false set row height renderer get table cell renderer component this new vfs directory entry table model entry template 0 false false 0 0 get preferred size height dimension pref size get preferred size set preferred scrollable viewport size new dimension pref size width get row height 12 propertieschanged propertieschanged propertieschanged directoryentry directoryentry directoryentry setrowheight gettablecellrenderercomponent vfsdirectoryentrytablemodel getpreferredsize prefsize getpreferredsize setpreferredscrollableviewportsize prefsize getrowheight scroll rect to visible method public void scroll rect to visible rectangle rect avoid scrolling to the right rect width 0 super scroll rect to visible rect scrollrecttovisible scrollrecttovisible scrollrecttovisible process key event method public void process key event key event evt if evt getid key event key pressed vfs directory entry table model model vfs directory entry table model get model int row get selected row switch evt get key code case key event vk left evt consume if row 1 if model files row expanded model collapse vfs manager getvfs for path model files row dir entry path row break for int i row 1 i 0 i if model files i expanded set selected row i break string dir browser view get browser get directory dir misc utilities get parent of path dir browser view get browser set directory dir break case key event vk right if row 1 if model files row expanded toggle expanded row evt consume break case key event vk down stupid swing if row 1 get model get row count 0 set selected row 0 evt consume break case key event vk enter browser view get browser files activated evt is shift down vfs browser m open new view vfs browser m open false evt consume break else if evt getid key event key typed if evt is control down evt is alt down evt is meta down return hack if evt is shift down evt get key char n return vfs browser browser browser view get browser switch evt get key char case if browser get mode vfs browser browser browser set directory system get property user home break case if browser get mode vfs browser browser browser root directory break case if browser get mode vfs browser browser browser set directory browser get view get buffer get directory break default type select buffer append evt get key char do type select type select buffer to string browser get mode vfs browser choose directory dialog timer stop timer set initial delay 750 timer set repeats false timer start return if evt is consumed super process key event evt processkeyevent processkeyevent keyevent keyevent key_pressed vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel getmodel getselectedrow getkeycode keyevent vk_left vfsmanager getvfsforpath direntry setselectedrow browserview getbrowser getdirectory miscutilities getparentofpath browserview getbrowser setdirectory keyevent vk_right toggleexpanded keyevent vk_down getmodel getrowcount setselectedrow keyevent vk_enter browserview getbrowser filesactivated isshiftdown vfsbrowser m_open_new_view vfsbrowser m_open keyevent key_typed iscontroldown isaltdown ismetadown isshiftdown getkeychar vfsbrowser browserview getbrowser getkeychar getmode vfsbrowser setdirectory getproperty getmode vfsbrowser rootdirectory getmode vfsbrowser setdirectory getview getbuffer getdirectory typeselectbuffer getkeychar dotypeselect typeselectbuffer tostring getmode vfsbrowser choose_directory_dialog setinitialdelay setrepeats isconsumed processkeyevent set selected row method public void set selected row int row get selection model set selection interval row row scroll rect to visible get cell rect row 0 true setselectedrow setselectedrow getselectionmodel setselectioninterval scrollrecttovisible getcellrect do type select method private boolean do type select string str int start int end boolean dirs only for int i start i end i vfs directory entry table model entry entry vfs directory entry table model entry get value at i 1 if dirs only entry dir entry type vfs directory entry file continue string match against misc utilities is absolute path str entry dir entry path entry dir entry name if match against region matches true 0 str 0 str length set selected row i return true return false dotypeselect dotypeselect dirsonly vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel getvalueat dirsonly direntry directoryentry matchagainst miscutilities isabsolutepath direntry direntry matchagainst regionmatches setselectedrow resize columns appropriately method private void resize columns appropriately vfs directory entry table model model vfs directory entry table model get model font render context font render context new font render context null false false int widths new int model get column count for int i 0 i widths length i string column name model get column name i if column name null widths i int renderer plain font get string bounds column name font render context get width for int i 0 i model files length i vfs directory entry table model entry entry model files i font font entry dir entry type vfs directory entry file renderer plain font renderer bold font widths 0 math max widths 0 renderer get entry width entry font font render context for int j 1 j widths length j string ext attr model get extended attribute j 1 string attr entry dir entry get extended attribute ext attr if attr null widths j math max widths j int font get string bounds attr font render context get width for int i 0 i widths length i int width widths i if i widths length 1 width 0 width 10 else width 2 get column model get column i set preferred width width get column model get column i set min width width get column model get column i set max width width get column model get column i set width width do layout resizecolumnsappropriately resizecolumnsappropriately vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel getmodel fontrendercontext fontrendercontext fontrendercontext getcolumncount columnname getcolumnname columnname plainfont getstringbounds columnname fontrendercontext getwidth vfsdirectoryentrytablemodel direntry directoryentry plainfont boldfont getentrywidth fontrendercontext extattr getextendedattribute direntry getextendedattribute extattr getstringbounds fontrendercontext getwidth getcolumnmodel getcolumn setpreferredwidth getcolumnmodel getcolumn setminwidth getcolumnmodel getcolumn setmaxwidth getcolumnmodel getcolumn setwidth dolayout class clear type select implements action listener public void action performed action event evt type select buffer set length 0 cleartypeselect actionlistener actionperformed actionevent typeselectbuffer setlength set icon path method sets the path where j edit looks for icons since j edit 4 2pre5 public static void set icon path string icon path gui utilities icon path icon path if icons null icons clear seticonpath jedit jedit seticonpath iconpath guiutilities iconpath iconpath load icon method loads an icon param icon name the icon name since j edit 2 6pre7 public static icon load icon string icon name if icons null icons new hashtable check if there is a cached version first icon icon icon icons get icon name if icon null return icon get the icon if misc utilities isurl icon name icon new image icon icon name substring 5 else try url url new url icon path icon name icon new image icon url catch exception e try url url new url default icon path icon name icon new image icon url catch exception ex log log log error gui utilities class icon not found icon name log log log error gui utilities class ex return null icons put icon name icon return icon loadicon iconname jedit loadicon iconname iconname miscutilities iconname imageicon iconname iconpath iconname imageicon defaulticonpath iconname imageicon guiutilities iconname guiutilities iconname get editor icon method returns the default editor window image public static image get editor icon return image icon load icon jedit icon gif get image geteditoricon geteditoricon imageicon loadicon getimage get plugin icon method returns the default plugin window image public static image get plugin icon return get editor icon getpluginicon getpluginicon geteditoricon load menu bar method creates a menubar plugins should not need to call this method param name the menu bar name since j edit 3 2pre5 public static j menu bar load menu bar string name return load menu bar j edit get action context name loadmenubar jedit jmenubar loadmenubar loadmenubar jedit getactioncontext load menu bar method creates a menubar plugins should not need to call this method param context an action context param name the menu bar name since j edit 4 2pre1 public static j menu bar load menu bar action context context string name string menus j edit get property name string tokenizer st new string tokenizer menus j menu bar mbar new j menu bar while st has more tokens mbar add load menu context st next token return mbar loadmenubar jedit jmenubar loadmenubar actioncontext jedit getproperty stringtokenizer stringtokenizer jmenubar jmenubar hasmoretokens loadmenu nexttoken load menu method creates a menu the menu label is set from the code i name i label code property the menu contents is taken from the code i name i code property which is a whitespace separated list of action names an action name of code code inserts a separator in the menu param name the menu name see load menu item string since j edit 2 6pre2 public static j menu load menu string name return load menu j edit get action context name loadmenu loadmenuitem jedit jmenu loadmenu loadmenu jedit getactioncontext load menu method creates a menu the menu label is set from the code i name i label code property the menu contents is taken from the code i name i code property which is a whitespace separated list of action names an action name of code code inserts a separator in the menu param context an action context either code j edit get action context code or code vfs browser get action context code param name the menu name see load menu item string since j edit 4 2pre1 public static j menu load menu action context context string name return new enhanced menu name j edit get property name concat label context loadmenu jedit getactioncontext vfsbrowser getactioncontext loadmenuitem jedit jmenu loadmenu actioncontext enhancedmenu jedit getproperty load popup menu method creates a popup menu param name the menu name since j edit 2 6pre2 public static j popup menu load popup menu string name return load popup menu j edit get action context name loadpopupmenu jedit jpopupmenu loadpopupmenu loadpopupmenu jedit getactioncontext load popup menu method creates a popup menu param context an action context either code j edit get action context code or code vfs browser get action context code param name the menu name since j edit 4 2pre1 public static j popup menu load popup menu action context context string name j popup menu menu new j popup menu string menu items j edit get property name if menu items null string tokenizer st new string tokenizer menu items while st has more tokens string menu item name st next token if menu item name equals menu add separator else menu add load menu item context menu item name false return menu loadpopupmenu jedit getactioncontext vfsbrowser getactioncontext jedit jpopupmenu loadpopupmenu actioncontext jpopupmenu jpopupmenu menuitems jedit getproperty menuitems stringtokenizer stringtokenizer menuitems hasmoretokens menuitemname nexttoken menuitemname addseparator loadmenuitem menuitemname load menu item method creates a menu item the menu item is bound to the action named by code name code with label taken from the return value of the link edit action get label method param name the menu item name see load menu string since j edit 2 6pre1 public static j menu item load menu item string name return load menu item j edit get action context name true loadmenuitem editaction getlabel loadmenu jedit jmenuitem loadmenuitem loadmenuitem jedit getactioncontext load menu item method creates a menu item param name the menu item name param set mnemonic true if the menu item should have a mnemonic since j edit 3 1pre1 public static j menu item load menu item string name boolean set mnemonic return load menu item j edit get action context name set mnemonic loadmenuitem setmnemonic jedit jmenuitem loadmenuitem setmnemonic loadmenuitem jedit getactioncontext setmnemonic load menu item method creates a menu item param context an action context either code j edit get action context code or code vfs browser get action context code param name the menu item name param set mnemonic true if the menu item should have a mnemonic since j edit 4 2pre1 public static j menu item load menu item action context context string name boolean set mnemonic if name starts with return load menu context name substring 1 string label j edit get property name label if label null label name char mnemonic int index label index of if index 1 label length index 1 mnemonic character to lower case label char at index 1 label label substring 0 index concat label substring index else mnemonic 0 j menu item mi if j edit get boolean property name toggle mi new enhanced check box menu item label name context else mi new enhanced menu item label name context if operating system is macos set mnemonic mnemonic 0 mi set mnemonic mnemonic return mi loadmenuitem jedit getactioncontext vfsbrowser getactioncontext setmnemonic jedit jmenuitem loadmenuitem actioncontext setmnemonic startswith loadmenu jedit getproperty indexof tolowercase charat jmenuitem jedit getbooleanproperty enhancedcheckboxmenuitem enhancedmenuitem operatingsystem ismacos setmnemonic setmnemonic load tool bar method creates a toolbar param name the toolbar name since j edit 4 2pre2 public static box load tool bar string name return load tool bar j edit get action context name loadtoolbar jedit loadtoolbar loadtoolbar jedit getactioncontext load tool bar method creates a toolbar param context an action context either code j edit get action context code or code vfs browser get action context code param name the toolbar name since j edit 4 2pre2 public static box load tool bar action context context string name box tool bar new box box layout x axis string buttons j edit get property name if buttons null string tokenizer st new string tokenizer buttons while st has more tokens string button st next token if button equals tool bar add box create horizontal strut 12 else j button b load tool button context button if b null tool bar add b tool bar add box create glue return tool bar loadtoolbar jedit getactioncontext vfsbrowser getactioncontext jedit loadtoolbar actioncontext toolbar boxlayout x_axis jedit getproperty stringtokenizer stringtokenizer hasmoretokens nexttoken toolbar createhorizontalstrut jbutton loadtoolbutton toolbar toolbar createglue toolbar load tool button method loads a tool bar button the tooltip is constructed from the code i name i label code and code i name i shortcut code properties and the icon is loaded from the resource named org gjt sp jedit icons suffixed with the value of the code i name i icon code property param name the name of the button public static enhanced button load tool button string name return load tool button j edit get action context name loadtoolbutton enhancedbutton loadtoolbutton loadtoolbutton jedit getactioncontext load tool button method loads a tool bar button the tooltip is constructed from the code i name i label code and code i name i shortcut code properties and the icon is loaded from the resource named org gjt sp jedit icons suffixed with the value of the code i name i icon code property param context an action context either code j edit get action context code or code vfs browser get action context code param name the name of the button since j edit 4 2pre1 public static enhanced button load tool button action context context string name string label j edit get property name label if label null label name icon icon string icon name j edit get property name icon if icon name null icon load icon broken image png else icon load icon icon name if icon null icon load icon broken image png string tool tip prettify menu label label string shortcut1 j edit get property name shortcut string shortcut2 j edit get property name shortcut2 if shortcut1 null shortcut2 null tool tip tool tip shortcut1 null shortcut1 shortcut1 null shortcut2 null or shortcut2 null shortcut2 return new enhanced button icon tool tip name context loadtoolbutton jedit getactioncontext vfsbrowser getactioncontext jedit enhancedbutton loadtoolbutton actioncontext jedit getproperty iconname jedit getproperty iconname loadicon brokenimage loadicon iconname loadicon brokenimage tooltip prettifymenulabel jedit getproperty jedit getproperty tooltip tooltip enhancedbutton tooltip prettify menu label method prettifies a menu item label by removing the sign this can be used to process the contents of an i action i label property public static string prettify menu label string label int index label index of if index 1 label label substring 0 index concat label substring index 1 return label prettifymenulabel prettifymenulabel indexof message method displays a dialog box the title of the dialog is fetched from the code i name i title code property the message is fetched from the code i name i message code property the message is formatted by the property manager with code args code as positional parameters param comp the component to display the dialog for param name the name of the dialog param args positional parameters to be substituted into the message text public static void message component comp string name object args hide splash screen j option pane show message dialog comp j edit get property name concat message args j edit get property name concat title args j option pane information message hidesplashscreen joptionpane showmessagedialog jedit getproperty jedit getproperty joptionpane information_message error method displays an error dialog box the title of the dialog is fetched from the code i name i title code property the message is fetched from the code i name i message code property the message is formatted by the property manager with code args code as positional parameters param comp the component to display the dialog for param name the name of the dialog param args positional parameters to be substituted into the message text public static void error component comp string name object args hide splash screen j option pane show message dialog comp j edit get property name concat message args j edit get property name concat title args j option pane error message hidesplashscreen joptionpane showmessagedialog jedit getproperty jedit getproperty joptionpane error_message input method displays an input dialog box and returns any text the user entered the title of the dialog is fetched from the code i name i title code property the message is fetched from the code i name i message code property param comp the component to display the dialog for param name the name of the dialog param def the text to display by default in the input field public static string input component comp string name object def return input comp name null def input property method displays an input dialog box and returns any text the user entered the title of the dialog is fetched from the code i name i title code property the message is fetched from the code i name i message code property param comp the component to display the dialog for param name the name of the dialog param def the property whose text to display in the input field public static string input property component comp string name string def return input property comp name null def inputproperty inputproperty inputproperty input method displays an input dialog box and returns any text the user entered the title of the dialog is fetched from the code i name i title code property the message is fetched from the code i name i message code property param comp the component to display the dialog for param name the name of the dialog param def the text to display by default in the input field param args positional parameters to be substituted into the message text since j edit 3 1pre3 public static string input component comp string name object args object def hide splash screen string ret val string j option pane show input dialog comp j edit get property name concat message args j edit get property name concat title j option pane question message null null def return ret val jedit hidesplashscreen retval joptionpane showinputdialog jedit getproperty jedit getproperty joptionpane question_message retval input property method displays an input dialog box and returns any text the user entered the title of the dialog is fetched from the code i name i title code property the message is fetched from the code i name i message code property param comp the component to display the dialog for param name the name of the dialog param args positional parameters to be substituted into the message text param def the property whose text to display in the input field since j edit 3 1pre3 public static string input property component comp string name object args string def hide splash screen string ret val string j option pane show input dialog comp j edit get property name concat message args j edit get property name concat title j option pane question message null null j edit get property def if ret val null j edit set property def ret val return ret val inputproperty jedit inputproperty hidesplashscreen retval joptionpane showinputdialog jedit getproperty jedit getproperty joptionpane question_message jedit getproperty retval jedit setproperty retval retval confirm method displays a confirm dialog box and returns the button pushed by the user the title of the dialog is fetched from the code i name i title code property the message is fetched from the code i name i message code property param comp the component to display the dialog for param name the name of the dialog param args positional parameters to be substituted into the message text param buttons the buttons to display for example j option pane yes no cancel option param type the dialog type for example j option pane warning message since j edit 3 1pre3 public static int confirm component comp string name object args int buttons int type hide splash screen return j option pane show confirm dialog comp j edit get property name message args j edit get property name title buttons type joptionpane yes_no_cancel_option joptionpane warning_message jedit hidesplashscreen joptionpane showconfirmdialog jedit getproperty jedit getproperty showvfs file dialog method displays a vfs file selection dialog box param view the view should be non null param path the initial directory to display may be null param type the dialog type one of link org gjt sp jedit browser vfs browser open dialog link org gjt sp jedit browser vfs browser save dialog or link org gjt sp jedit browser vfs browser choose directory dialog param multiple selection true if multiple selection should be allowed return the selected file s since j edit 2 6pre2 public static string showvfs file dialog view view string path int type boolean multiple selection the view should not be null but some plugins might do this if view null log log log warning gui utilities class showvfs file dialog given null view assuming j edit get active view view j edit get active view hide splash screen vfs file chooser dialog file chooser new vfs file chooser dialog view path type multiple selection string selected files file chooser get selected files if selected files null return null return selected files showvfsfiledialog vfsbrowser open_dialog vfsbrowser save_dialog vfsbrowser choose_directory_dialog multipleselection jedit showvfsfiledialog multipleselection guiutilities showvfsfiledialog jedit getactiveview jedit getactiveview hidesplashscreen vfsfilechooserdialog filechooser vfsfilechooserdialog multipleselection selectedfiles filechooser getselectedfiles selectedfiles selectedfiles parse color method converts a color name to a color object the name must either be a known string such as red green etc complete list is in the code java awt color code class or a hex color value prefixed with for example ff0088 param name the color name public static color parse color string name return parse color name color black parsecolor parsecolor parsecolor parse color method public static color parse color string name color default color if name null return default color else if name starts with try return color decode name catch number format exception nf return default color else if red equals name return color red else if green equals name return color green else if blue equals name return color blue else if yellow equals name return color yellow else if orange equals name return color orange else if white equals name return color white else if light gray equals name return color light gray else if gray equals name return color gray else if dark gray equals name return color dark gray else if black equals name return color black else if cyan equals name return color cyan else if magenta equals name return color magenta else if pink equals name return color pink else return default color parsecolor parsecolor defaultcolor defaultcolor startswith numberformatexception defaultcolor lightgray lightgray darkgray darkgray defaultcolor get color hex string method converts a color object to its hex value the hex value prefixed is with for example ff0088 param c the color object public static string get color hex string color c string col string integer to hex string c getrgb 0xffffff return 000000 substring 0 7 col string length concat col string getcolorhexstring getcolorhexstring colstring tohexstring colstring colstring parse style method converts a style string to a style object param str the style string param family style strings only specify font style not font family param size style strings only specify font style not font family exception illegal argument exception if the style is invalid since j edit 3 2pre6 public static syntax style parse style string str string family int size throws illegal argument exception return parse style str family size true parsestyle illegalargumentexception jedit syntaxstyle parsestyle illegalargumentexception parsestyle parse style method converts a style string to a style object param str the style string param family style strings only specify font style not font family param size style strings only specify font style not font family param color if false the styles will be monochrome exception illegal argument exception if the style is invalid since j edit 4 0pre4 public static syntax style parse style string str string family int size boolean color throws illegal argument exception color fg color color black color bg color null boolean italic false boolean bold false string tokenizer st new string tokenizer str while st has more tokens string s st next token if s starts with color if color fg color gui utilities parse color s substring 6 color black else if s starts with bg color if color bg color gui utilities parse color s substring 8 null else if s starts with style for int i 6 i s length i if s char at i i italic true else if s char at i b bold true else throw new illegal argument exception invalid style s else throw new illegal argument exception invalid directive s return new syntax style fg color bg color new font family italic font italic 0 bold font bold 0 size parsestyle illegalargumentexception jedit syntaxstyle parsestyle illegalargumentexception fgcolor bgcolor stringtokenizer stringtokenizer hasmoretokens nexttoken startswith fgcolor guiutilities parsecolor startswith bgcolor bgcolor guiutilities parsecolor startswith charat charat illegalargumentexception illegalargumentexception syntaxstyle fgcolor bgcolor get style string method converts a style into it s string representation param style the style public static string get style string syntax style style string buffer buf new string buffer if style get foreground color null buf append color get color hex string style get foreground color if style get background color null buf append bg color get color hex string style get background color if style get font is plain buf append style style get font is italic i style get font is bold b return buf to string getstylestring getstylestring syntaxstyle stringbuffer stringbuffer getforegroundcolor getcolorhexstring getforegroundcolor getbackgroundcolor bgcolor getcolorhexstring getbackgroundcolor getfont isplain getfont isitalic getfont isbold tostring load styles method loads the syntax styles from the properties giving them the specified base font family and size param family the font family param size the font size since j edit 3 2pre6 public static syntax style load styles string family int size return load styles family size true loadstyles jedit syntaxstyle loadstyles loadstyles load styles method loads the syntax styles from the properties giving them the specified base font family and size param family the font family param size the font size param color if false the styles will be monochrome since j edit 4 0pre4 public static syntax style load styles string family int size boolean color syntax style styles new syntax style token id count start at 1 not 0 to skip token null for int i 1 i styles length i try string style name view style token token to string byte i to lower case styles i gui utilities parse style j edit get property style name family size color catch exception e log log log error gui utilities class e return styles loadstyles jedit syntaxstyle loadstyles syntaxstyle syntaxstyle id_count stylename tokentostring tolowercase guiutilities parsestyle jedit getproperty stylename guiutilities load geometry method loads a windows s geometry from the properties the geometry is loaded from the code i name i x code code i name i y code code i name i width code and code i name i height code properties param win the window param name the window name public static void load geometry window win string name int x y width height dimension size win get size graphics device gd graphics environment get local graphics environment get default screen device rectangle gcbounds gd get default configuration get bounds x gcbounds x y gcbounds y width j edit get integer property name width size width height j edit get integer property name height size height component parent win get parent if parent null x gcbounds width width 2 y gcbounds height height 2 else rectangle bounds parent get bounds x bounds x bounds width width 2 y bounds y bounds height height 2 x j edit get integer property name x x y j edit get integer property name y y int ext state j edit get integer property name extended state 0 rectangle desired new rectangle x y width height adjust for screen bounds desired if operating system isx11 debug geometry workaround new unix workaround win name desired ext state else win set bounds desired if win instanceof frame set extended state frame win ext state loadgeometry loadgeometry getsize graphicsdevice graphicsenvironment getlocalgraphicsenvironment getdefaultscreendevice getdefaultconfiguration getbounds jedit getintegerproperty jedit getintegerproperty getparent getbounds jedit getintegerproperty jedit getintegerproperty extstate jedit getintegerproperty extendedstate adjustforscreenbounds operatingsystem geometry_workaround unixworkaround extstate setbounds setextendedstate extstate adjust for screen bounds method gives a rectangle the specified bounds ensuring it is within the screen bounds since j edit 4 2pre3 public static void adjust for screen bounds rectangle desired make sure the window is displayed in visible region rectangle osbounds operating system get screen bounds desired if desired x osbounds x desired x desired width desired x osbounds width if desired width osbounds width desired width osbounds width desired x osbounds width desired width 2 if desired y osbounds y desired y desired height osbounds y osbounds height if desired height osbounds height desired height osbounds height desired y osbounds height desired height 2 adjustforscreenbounds jedit adjustforscreenbounds operatingsystem getscreenbounds unix workaround constructor unix workaround window win string name rectangle desired int ext state this win win this name name this desired desired int adjust x adjust y adjust width adjust height adjust x j edit get integer property name dx 0 adjust y j edit get integer property name dy 0 adjust width j edit get integer property name d width 0 adjust height j edit get integer property name d height 0 required new rectangle desired x adjust x desired y adjust y desired width adjust width desired height adjust height log log log debug gui utilities class window name desired geometry is desired log log log debug gui utilities class window name setting geometry to required start system current time millis win set bounds required if win instanceof frame set extended state frame win ext state win add component listener new component handler win add window listener new window handler unixworkaround unixworkaround extstate adjust_x adjust_y adjust_width adjust_height adjust_x jedit getintegerproperty adjust_y jedit getintegerproperty adjust_width jedit getintegerproperty adjust_height jedit getintegerproperty adjust_x adjust_y adjust_width adjust_height guiutilities guiutilities currenttimemillis setbounds setextendedstate extstate addcomponentlistener componenthandler addwindowlistener windowhandler component moved method public void component moved component event evt if system current time millis start 1000 rectangle r win get bounds if window opened r equals required return if r equals desired log log log debug gui utilities class window resize blocked win get bounds win set bounds desired win remove component listener this componentmoved componentmoved componentevent currenttimemillis getbounds windowopened guiutilities getbounds setbounds removecomponentlistener component resized method public void component resized component event evt if system current time millis start 1000 rectangle r win get bounds if window opened r equals required return if r equals desired log log log debug gui utilities class window resize blocked win get bounds win set bounds desired win remove component listener this componentresized componentresized componentevent currenttimemillis getbounds windowopened guiutilities getbounds setbounds removecomponentlistener window opened method public void window opened window event evt window opened true rectangle r win get bounds log log log debug gui utilities class window name bounds after opening r j edit set integer property name dx r x required x j edit set integer property name dy r y required y j edit set integer property name d width r width required width j edit set integer property name d height r height required height win remove window listener this windowopened windowopened windowevent windowopened getbounds guiutilities jedit setintegerproperty jedit setintegerproperty jedit setintegerproperty jedit setintegerproperty removewindowlistener save geometry method saves a window s geometry to the properties the geometry is saved to the code i name i x code code i name i y code code i name i width code and code i name i height code properties param win the window param name the window name public static void save geometry window win string name if win instanceof frame j edit set integer property name extended state get extended state frame win rectangle bounds win get bounds j edit set integer property name x bounds x j edit set integer property name y bounds y j edit set integer property name width bounds width j edit set integer property name height bounds height savegeometry savegeometry jedit setintegerproperty extendedstate getextendedstate getbounds jedit setintegerproperty jedit setintegerproperty jedit setintegerproperty jedit setintegerproperty get extended state method on java 1 4 calls code frame get extended state code on java 1 3 returns 0 since j edit 4 2pre1 public static int get extended state frame frame if operating system has java14 try java lang reflect method meth frame class get method get extended state new class 0 integer ext state integer meth invoke frame new object 0 return ext state int value catch exception e log log log error gui utilities class e return 0 getextendedstate getextendedstate jedit getextendedstate operatingsystem hasjava14 getmethod getextendedstate extstate extstate intvalue guiutilities set extended state method on java 1 4 calls code frame set extended state code on java 1 3 does nothing since j edit 4 2pre1 public static void set extended state frame frame int ext state if operating system has java14 try java lang reflect method meth frame class get method set extended state new class int class meth invoke frame new object new integer ext state catch exception e log log log error gui utilities class e setextendedstate setextendedstate jedit setextendedstate extstate operatingsystem hasjava14 getmethod setextendedstate extstate guiutilities center on screen method centers the given window on the screen this method is needed because jdk 1 3 does not have a code j window set location relative to code method since j edit 4 2pre3 public static void center on screen window win graphics device gd graphics environment get local graphics environment get default screen device rectangle gcbounds gd get default configuration get bounds int x gcbounds x gcbounds width win get width 2 int y gcbounds y gcbounds height win get height 2 win set location x y centeronscreen jwindow setlocationrelativeto jedit centeronscreen graphicsdevice graphicsenvironment getlocalgraphicsenvironment getdefaultscreendevice getdefaultconfiguration getbounds getwidth getheight setlocation hide splash screen method ensures that the splash screen is not visible this should be called before displaying any dialog boxes or windows at startup public static void hide splash screen if splash null splash dispose splash null hidesplashscreen hidesplashscreen create multiline label method creates a component that displays a multiple line message this is implemented by assembling a number of code j labels code in a code j panel code param str the string with lines delimited by newline code n code characters since j edit 4 1pre3 public static j component create multiline label string str j panel panel new j panel new variable grid layout variable grid layout fixed num columns 1 1 1 int last offset 0 for int index str index of n last offset if index 1 break else panel add new j label str substring last offset index last offset index 1 if last offset str length panel add new j label str substring last offset return panel createmultilinelabel jlabels jpanel jedit jcomponent createmultilinelabel jpanel jpanel variablegridlayout variablegridlayout fixed_num_columns lastoffset indexof lastoffset jlabel lastoffset lastoffset lastoffset jlabel lastoffset request focus method focuses on the specified component as soon as the window becomes active param win the window param comp the component public static void request focus final window win final component comp win add window listener new window adapter public void window activated window event evt swing utilities invoke later new runnable public void run comp request focus win remove window listener this requestfocus requestfocus addwindowlistener windowadapter windowactivated windowevent swingutilities invokelater requestfocus removewindowlistener public void window activated window event evt swing utilities invoke later new runnable public void run comp request focus win remove window listener this windowactivated windowevent swingutilities invokelater requestfocus removewindowlistener swing utilities invoke later new runnable public void run comp request focus swingutilities invokelater requestfocus is popup trigger method returns if the specified event is the popup trigger event this implements precisely defined behavior as opposed to mouse event is popup trigger param evt the event since j edit 3 2pre8 public static boolean is popup trigger mouse event evt return is right button evt get modifiers ispopuptrigger mouseevent ispopuptrigger jedit ispopuptrigger mouseevent isrightbutton getmodifiers is middle button method param modifiers the modifiers flag from a mouse event since j edit 4 1pre9 public static boolean is middle button int modifiers if operating system is macos if modifiers mouse event button1 mask 0 return modifiers mouse event alt mask 0 if operating system has java14 return modifiers mouse event button3 mask 0 else return modifiers mouse event button2 mask 0 else return modifiers mouse event button2 mask 0 ismiddlebutton jedit ismiddlebutton operatingsystem ismacos mouseevent button1_mask mouseevent alt_mask operatingsystem hasjava14 mouseevent button3_mask mouseevent button2_mask mouseevent button2_mask is right button method param modifiers the modifiers flag from a mouse event since j edit 4 1pre9 public static boolean is right button int modifiers if operating system is macos if modifiers mouse event button1 mask 0 return modifiers mouse event ctrl mask 0 if operating system has java14 return modifiers mouse event button2 mask 0 else return modifiers mouse event button3 mask 0 else return modifiers mouse event button3 mask 0 isrightbutton jedit isrightbutton operatingsystem ismacos mouseevent button1_mask mouseevent ctrl_mask operatingsystem hasjava14 mouseevent button2_mask mouseevent button3_mask mouseevent button3_mask show popup menu method shows the specified popup menu ensuring it is displayed within the bounds of the screen param popup the popup menu param comp the component to show it for param x the x co ordinate param y the y co ordinate since j edit 4 0pre1 public static void show popup menu j popup menu popup component comp int x int y show popup menu popup comp x y true showpopupmenu jedit showpopupmenu jpopupmenu showpopupmenu show popup menu method shows the specified popup menu ensuring it is displayed within the bounds of the screen param popup the popup menu param comp the component to show it for param x the x co ordinate param y the y co ordinate param point if true then the popup originates from a single point otherwise it will originate from the component itself this affects positioning in the case where the popup does not fit onscreen since j edit 4 1pre1 public static void show popup menu j popup menu popup component comp int x int y boolean point int offsetx 0 int offsety 0 int extra offset point 1 0 component win comp while win instanceof window win null offsetx win getx offsety win gety win win get parent if win null dimension size popup get preferred size rectangle screen size win get graphics configuration get bounds if x offsetx size width win getx screen size width x offsetx win getx size width system err println x overflow if point x size width extra offset else x win get width size width offsetx extra offset else x extra offset system err println y y offsety offsety size height size height win height win get height if y offsety size height win gety screen size height y offsety win gety size height if point y win get height size height offsety extra offset else y size height 1 else y extra offset popup show comp x y else popup show comp x extra offset y extra offset showpopupmenu jedit showpopupmenu jpopupmenu extraoffset getparent getpreferredsize screensize getgraphicsconfiguration getbounds screensize extraoffset getwidth extraoffset extraoffset getheight screensize getheight extraoffset extraoffset extraoffset extraoffset is ancestor of method returns if the first component is an ancestor of the second by traversing up the component hierarchy param comp1 the ancestor param comp2 the component to check since j edit 4 1pre5 public static boolean is ancestor of component comp1 component comp2 while comp2 null if comp1 comp2 return true else comp2 comp2 get parent return false isancestorof jedit isancestorof getparent get parent dialog method traverses the given component s parent tree looking for an instance of j dialog and return it if not found return null param c the component public static j dialog get parent dialog component c component p c get parent while p null p instanceof j dialog p p get parent return p instanceof j dialog j dialog p null getparentdialog jdialog jdialog getparentdialog getparent jdialog getparent jdialog jdialog get component parent method finds a parent of the specified component param comp the component param clazz looks for a parent with this class exact match not derived since j edit 4 2pre1 public static component get component parent component comp class clazz for if comp null break if comp instanceof j component component real component j component comp get client property korte real frame if real null comp real if comp get class equals clazz return comp else if comp instanceof j popup menu comp j popup menu comp get invoker else if comp instanceof floating window container comp floating window container comp get dockable window manager else comp comp get parent return null getcomponentparent jedit getcomponentparent jcomponent jcomponent getclientproperty korte_real_frame getclass jpopupmenu jpopupmenu getinvoker floatingwindowcontainer floatingwindowcontainer getdockablewindowmanager getparent get view method finds the view parent of the specified component since j edit 4 0pre2 public static view get view component comp return view get component parent comp view class getview jedit getview getcomponentparent init method static void init don t do this in static since we need j edit init misc run first so we have the jeditresource protocol new buffer icon load icon new gif dirty buffer icon load icon dirty gif read only buffer icon load icon readonly gif normal buffer icon load icon normal gif window icon load icon jedit icon gif jedit initmisc new_buffer_icon loadicon dirty_buffer_icon loadicon read_only_buffer_icon loadicon normal_buffer_icon loadicon window_icon loadicon show splash screen method static void show splash screen splash new splash screen showsplashscreen showsplashscreen splashscreen advance splash progress method static void advance splash progress if splash null splash advance advancesplashprogress advancesplashprogress private static string default icon path jeditresource org gjt sp jedit icons private gui utilities defaulticonpath guiutilities constructs a primitive type param sort the sort of the primitive type to be constructed private type final int sort this sort sort this len 1 constructs a reference type param sort the sort of the reference type to be constructed param buf a buffer containing the descriptor of the previous type param off the offset of this descriptor in the previous buffer param len the length of this descriptor private type final int sort final char buf final int off final int len this sort sort this buf buf this off off this len len returns the java type corresponding to the given type descriptor param type descriptor a type descriptor return the java type corresponding to the given type descriptor public static type get type final string type descriptor return get type type descriptor to char array 0 typedescriptor gettype typedescriptor gettype typedescriptor tochararray returns the java type corresponding to the given class param c a class return the java type corresponding to the given class public static type get type final class c if c is primitive if c integer type return int type else if c void type return void type else if c boolean type return boolean type else if c byte type return byte type else if c character type return char type else if c short type return short type else if c double type return double type else if c float type return float type else if c long type return long type else return get type get descriptor c gettype isprimitive int_type void_type boolean_type byte_type char_type short_type double_type float_type long_type gettype getdescriptor returns the java types corresponding to the argument types of the given method descriptor param method descriptor a method descriptor return the java types corresponding to the argument types of the given method descriptor public static type get argument types final string method descriptor char buf method descriptor to char array int off 1 int size 0 while true char car buf off if car break else if car l while buf off size else if car size type args new type size off 1 size 0 while buf off args size get type buf off off args size len size 1 return args methoddescriptor getargumenttypes methoddescriptor methoddescriptor tochararray gettype returns the java types corresponding to the argument types of the given method param method a method return the java types corresponding to the argument types of the given method public static type get argument types final method method class classes method get parameter types type types new type classes length for int i classes length 1 i 0 i types i get type classes i return types getargumenttypes getparametertypes gettype returns the java type corresponding to the return type of the given method descriptor param method descriptor a method descriptor return the java type corresponding to the return type of the given method descriptor public static type get return type final string method descriptor char buf method descriptor to char array return get type buf method descriptor index of 1 methoddescriptor getreturntype methoddescriptor methoddescriptor tochararray gettype methoddescriptor indexof returns the java type corresponding to the return type of the given method param method a method return the java type corresponding to the return type of the given method public static type get return type final method method return get type method get return type getreturntype gettype getreturntype returns the java type corresponding to the given type descriptor param buf a buffer containing a type descriptor param off the offset of this descriptor in the previous buffer return the java type corresponding to the given type descriptor private static type get type final char buf final int off int len switch buf off case v return void type case z return boolean type case c return char type case b return byte type case s return short type case i return int type case f return float type case j return long type case d return double type case len 1 while buf off len len if buf off len l len while buf off len len return new type array buf off len 1 case l default len 1 while buf off len len return new type object buf off len 1 gettype void_type boolean_type char_type byte_type short_type int_type float_type long_type double_type returns the sort of this java type return link void void link boolean boolean link char char link byte byte link short short link int int link float float link long long link double double link array array or link object object public int get sort return sort getsort returns the number of dimensions of this array type this method should only be used for an array type return the number of dimensions of this array type public int get dimensions int i 1 while buf off i i return i getdimensions returns the type of the elements of this array type this method should only be used for an array type return returns the type of the elements of this array type public type get element type return get type buf off get dimensions getelementtype gettype getdimensions returns the name of the class corresponding to this object type this method should only be used for an object type return the fully qualified name of the class corresponding to this object type public string get class name return new string buf off 1 len 2 replace getclassname returns the internal name of the class corresponding to this object type the internal name of a class is its fully qualified name where are replaced by this method should only be used for an object type return the internal name of the class corresponding to this object type public string get internal name return new string buf off 1 len 2 getinternalname returns the descriptor corresponding to this java type return the descriptor corresponding to this java type public string get descriptor string buffer buf new string buffer get descriptor buf return buf to string getdescriptor stringbuffer stringbuffer getdescriptor tostring returns the descriptor corresponding to the given argument and return types param return type the return type of the method param argument types the argument types of the method return the descriptor corresponding to the given argument and return types public static string get method descriptor final type return type final type argument types string buffer buf new string buffer buf append for int i 0 i argument types length i argument types i get descriptor buf buf append return type get descriptor buf return buf to string returntype argumenttypes getmethoddescriptor returntype argumenttypes stringbuffer stringbuffer argumenttypes argumenttypes getdescriptor returntype getdescriptor tostring appends the descriptor corresponding to this java type to the given string buffer param buf the string buffer to which the descriptor must be appended private void get descriptor final string buffer buf switch sort case void buf append v return case boolean buf append z return case char buf append c return case byte buf append b return case short buf append s return case int buf append i return case float buf append f return case long buf append j return case double buf append d return case array case object default buf append this buf off len getdescriptor stringbuffer returns the internal name of the given class the internal name of a class is its fully qualified name where are replaced by param c an object class return the internal name of the given class public static string get internal name final class c return c get name replace getinternalname getname returns the descriptor corresponding to the given java type param c an object class a primitive class or an array class return the descriptor corresponding to the given class public static string get descriptor final class c string buffer buf new string buffer get descriptor buf c return buf to string getdescriptor stringbuffer stringbuffer getdescriptor tostring returns the descriptor corresponding to the given method param m a link method method object return the descriptor of the given method public static string get method descriptor final method m class parameters m get parameter types string buffer buf new string buffer buf append for int i 0 i parameters length i get descriptor buf parameters i buf append get descriptor buf m get return type return buf to string getmethoddescriptor getparametertypes stringbuffer stringbuffer getdescriptor getdescriptor getreturntype tostring appends the descriptor of the given class to the given string buffer param buf the string buffer to which the descriptor must be appended param c the class whose descriptor must be computed private static void get descriptor final string buffer buf final class c class d c while true if d is primitive char car if d integer type car i else if d void type car v else if d boolean type car z else if d byte type car b else if d character type car c else if d short type car s else if d double type car d else if d float type car f else if d long type car j buf append car return else if d is array buf append d d get component type else buf append l string name d get name int len name length for int i 0 i len i char car name char at i buf append car car buf append return getdescriptor stringbuffer isprimitive isarray getcomponenttype getname charat returns the size of values of this type return the size of values of this type i e 2 for tt long tt and tt double tt and 1 otherwise public int get size return sort long sort double 2 1 getsize returns a jvm instruction opcode adapted to this java type param opcode a jvm instruction opcode this opcode must be one of iload istore iaload iastore iadd isub imul idiv irem ineg ishl ishr iushr iand ior ixor and ireturn return an opcode that is similar to the given opcode but adapted to this java type for example if this type is tt float tt and tt opcode tt is ireturn this method returns freturn public int get opcode final int opcode if opcode constants iaload opcode constants iastore switch sort case void return opcode 5 case boolean case byte return opcode 6 case char return opcode 7 case short return opcode 8 case int return opcode case float return opcode 2 case long return opcode 1 case double return opcode 3 case array case object default return opcode 4 else switch sort case void return opcode 5 case boolean case char case byte case short case int return opcode case float return opcode 2 case long return opcode 1 case double return opcode 3 case array case object default return opcode 4 getopcode public cb zip2 input stream final input stream input bs set stream input initialize init block setup block cbzip2inputstream inputstream bssetstream initblock setupblock private static void bad block header cadvise badblockheader private static void block overrun cadvise blockoverrun private static void cadvise system out println crc error throw new c coruption error ccoruptionerror private static void compressed streameof cadvise compressedstreameof private static void crc error cadvise crcerror public int read if m streamend return 1 else int ret char m currentchar switch m currentstate case start block state break case rand part a state break case rand part b state setup rand partb break case rand part c state setup rand partc break case no rand part a state break case no rand part b state setup no rand partb break case no rand part c state setup no rand partc break default break return ret char m_streamend retchar m_currentchar m_currentstate start_block_state rand_part_a_state rand_part_b_state setuprandpartb rand_part_c_state setuprandpartc no_rand_part_a_state no_rand_part_b_state setupnorandpartb no_rand_part_c_state setupnorandpartc retchar private void set decompress structure sizes int new size100k if 0 new size100k new size100k 9 0 m blocksize100k m blocksize100k 9 throw new io exception invalid block size m blocksize100k new size100k if new size100k 0 return int n base block size new size100k m ll8 new char n m tt new int n setdecompressstructuresizes newsize100k newsize100k newsize100k m_blocksize100k m_blocksize100k ioexception m_blocksize100k newsize100k newsize100k base_block_size newsize100k m_ll8 m_tt private void setup block int cftab new int 257 char ch cftab 0 0 for int i 1 i 256 i cftab i m unzftab i 1 for int i 1 i 256 i cftab i cftab i 1 for int i 0 i m last i ch m ll8 i m tt cftab ch i cftab ch cftab null m tpos m tt m origptr count 0 i2 0 ch2 256 not a char and not eof if m blockrandomised m rntogo 0 m rtpos 0 setup rand parta else setup no rand parta setupblock m_unzftab m_last m_ll8 m_tt m_tpos m_tt m_origptr m_blockrandomised m_rntogo m_rtpos setuprandparta setupnorandparta private void setup no rand parta if i2 m last ch prev ch2 ch2 m ll8 m tpos m tpos m tt m tpos i2 m currentchar ch2 m currentstate no rand part b state m crc updatecrc ch2 else end block init block setup block setupnorandparta m_last chprev m_ll8 m_tpos m_tpos m_tt m_tpos m_currentchar m_currentstate no_rand_part_b_state m_crc endblock initblock setupblock private void setup no rand partb if ch2 ch prev m currentstate no rand part a state count 1 setup no rand parta else count if count 4 z m ll8 m tpos m tpos m tt m tpos m currentstate no rand part c state j2 0 setup no rand partc else m currentstate no rand part a state setup no rand parta setupnorandpartb chprev m_currentstate no_rand_part_a_state setupnorandparta m_ll8 m_tpos m_tpos m_tt m_tpos m_currentstate no_rand_part_c_state setupnorandpartc m_currentstate no_rand_part_a_state setupnorandparta private void setup no rand partc if j2 z m currentchar ch2 m crc updatecrc ch2 j2 else m currentstate no rand part a state i2 count 0 setup no rand parta setupnorandpartc m_currentchar m_crc m_currentstate no_rand_part_a_state setupnorandparta private void setup rand parta if i2 m last ch prev ch2 ch2 m ll8 m tpos m tpos m tt m tpos if m rntogo 0 m rntogo rand nums m rtpos m rtpos if m rtpos 512 m rtpos 0 m rntogo ch2 m rntogo 1 1 0 i2 m currentchar ch2 m currentstate rand part b state m crc updatecrc ch2 else end block init block setup block setuprandparta m_last chprev m_ll8 m_tpos m_tpos m_tt m_tpos m_rntogo m_rntogo rand_nums m_rtpos m_rtpos m_rtpos m_rtpos m_rntogo m_rntogo m_currentchar m_currentstate rand_part_b_state m_crc endblock initblock setupblock private void setup rand partb if ch2 ch prev m currentstate rand part a state count 1 setup rand parta else count if count 4 z m ll8 m tpos m tpos m tt m tpos if m rntogo 0 m rntogo rand nums m rtpos m rtpos if m rtpos 512 m rtpos 0 m rntogo z m rntogo 1 1 0 j2 0 m currentstate rand part c state setup rand partc else m currentstate rand part a state setup rand parta setuprandpartb chprev m_currentstate rand_part_a_state setuprandparta m_ll8 m_tpos m_tpos m_tt m_tpos m_rntogo m_rntogo rand_nums m_rtpos m_rtpos m_rtpos m_rtpos m_rntogo m_rntogo m_currentstate rand_part_c_state setuprandpartc m_currentstate rand_part_a_state setuprandparta private void setup rand partc if j2 z m currentchar ch2 m crc updatecrc ch2 j2 else m currentstate rand part a state i2 count 0 setup rand parta setuprandpartc m_currentchar m_crc m_currentstate rand_part_a_state setuprandparta private void get and move to front decode int next sym int limit last base block size m blocksize100k m origptr read variable sized int 24 recv decoding tables int eob m ninuse 1 int group no 1 int group pos 0 setting up the unzftab entries here is not strictly necessary but it does save having to do it later in a separate pass and so saves a block s worth of cache misses for int i 0 i 255 i m unzftab i 0 final char yy new char 256 for int i 0 i 255 i yy i char i m last 1 int zt int zn int zvec int zj group no group pos g size 1 zt m selector group no zn m minlens zt zvec bsr zn while zvec m limit zt zn zn while m bslive 1 int zzi char thech 0 try thech char m input read catch io exception e compressed streameof if thech 1 compressed streameof zzi thech m bsbuff m bsbuff 8 zzi 0xff m bslive 8 zj m bsbuff m bslive 1 1 m bslive zvec zvec 1 zj next sym m perm zt zvec m base zt zn while true if next sym eob break if next sym runa next sym runb char ch int s 1 int n 1 do if next sym runa s s 0 1 n else if next sym runb s s 1 1 n n n 2 if group pos 0 group no group pos g size group pos zt m selector group no zn m minlens zt zvec bsr zn while zvec m limit zt zn zn while m bslive 1 int zzi char thech 0 try thech char m input read catch io exception e compressed streameof if thech 1 compressed streameof zzi thech m bsbuff m bsbuff 8 zzi 0xff m bslive 8 zj m bsbuff m bslive 1 1 m bslive zvec zvec 1 zj next sym m perm zt zvec m base zt zn while next sym runa next sym runb s ch m seqtounseq yy 0 m unzftab ch s while s 0 m last m ll8 m last ch s if m last limit last block overrun continue else char tmp m last if m last limit last block overrun tmp yy next sym 1 m unzftab m seqtounseq tmp m ll8 m last m seqtounseq tmp this loop is hammered during decompression hence the unrolling for j next sym 1 j 0 j yy j yy j 1 int j next sym 1 for j 3 j 4 yy j yy j 1 yy j 1 yy j 2 yy j 2 yy j 3 yy j 3 yy j 4 for j 0 j yy j yy j 1 yy 0 tmp if group pos 0 group no group pos g size group pos zt m selector group no zn m minlens zt zvec bsr zn while zvec m limit zt zn zn while m bslive 1 char ch 0 try ch char m input read catch io exception e compressed streameof m bsbuff m bsbuff 8 ch 0xff m bslive 8 zj m bsbuff m bslive 1 1 m bslive zvec zvec 1 zj next sym m perm zt zvec m base zt zn continue getandmovetofrontdecode nextsym limitlast base_block_size m_blocksize100k m_origptr readvariablesizedint recvdecodingtables m_ninuse groupno grouppos m_unzftab m_last groupno grouppos g_size m_selector groupno m_minlens m_limit m_bslive m_input ioexception compressedstreameof compressedstreameof m_bsbuff m_bsbuff m_bslive m_bsbuff m_bslive m_bslive nextsym m_perm m_base nextsym nextsym nextsym nextsym nextsym grouppos groupno grouppos g_size grouppos m_selector groupno m_minlens m_limit m_bslive m_input ioexception compressedstreameof compressedstreameof m_bsbuff m_bsbuff m_bslive m_bsbuff m_bslive m_bslive nextsym m_perm m_base nextsym nextsym m_seqtounseq m_unzftab m_last m_ll8 m_last m_last limitlast blockoverrun m_last m_last limitlast blockoverrun nextsym m_unzftab m_seqtounseq m_ll8 m_last m_seqtounseq nextsym nextsym grouppos groupno grouppos g_size grouppos m_selector groupno m_minlens m_limit m_bslive m_input ioexception compressedstreameof m_bsbuff m_bsbuff m_bslive m_bsbuff m_bslive m_bslive nextsym m_perm m_base private void bs finished with stream m input null bsfinishedwithstream m_input private int read variable sized int final int num bits return bsr num bits readvariablesizedint numbits numbits private char read unsigned char return char bsr 8 readunsignedchar private int read int int u 0 u u 8 bsr 8 u u 8 bsr 8 u u 8 bsr 8 u u 8 bsr 8 return u readint private int bsr final int n while m bslive n char ch 0 try ch char m input read catch final io exception ioe compressed streameof if ch 1 compressed streameof m bsbuff m bsbuff 8 ch 0xff m bslive 8 final int result m bsbuff m bslive n 1 n 1 m bslive n return result m_bslive m_input ioexception compressedstreameof compressedstreameof m_bsbuff m_bsbuff m_bslive m_bsbuff m_bslive m_bslive private void bs set stream final input stream input m input input m bslive 0 m bsbuff 0 bssetstream inputstream m_input m_bslive m_bsbuff private void complete m storedcombinedcrc read int if m storedcombinedcrc m computedcombinedcrc crc error bs finished with stream m streamend true m_storedcombinedcrc readint m_storedcombinedcrc m_computedcombinedcrc crcerror bsfinishedwithstream m_streamend private void end block m computedblockcrc m crc get finalcrc a bad crc is considered a fatal error if m storedblockcrc m computedblockcrc crc error m computedcombinedcrc m computedcombinedcrc 1 m computedcombinedcrc 31 m computedcombinedcrc m computedblockcrc endblock m_computedblockcrc m_crc getfinalcrc m_storedblockcrc m_computedblockcrc crcerror m_computedcombinedcrc m_computedcombinedcrc m_computedcombinedcrc m_computedcombinedcrc m_computedblockcrc private void hb create decode tables final int limit final int base final int perm final char length final int min len final int max len final int alpha size int pp 0 for int i min len i max len i for int j 0 j alpha size j if length j i perm pp j pp for int i 0 i max code len i base i 0 for int i 0 i alpha size i base length i 1 for int i 1 i max code len i base i base i 1 for int i 0 i max code len i limit i 0 int vec 0 for int i min len i max len i vec base i 1 base i limit i vec 1 vec 1 for int i min len 1 i max len i base i limit i 1 1 1 base i hbcreatedecodetables minlen maxlen alphasize minlen maxlen alphasize max_code_len alphasize max_code_len max_code_len minlen maxlen minlen maxlen private void init block final char magic1 read unsigned char final char magic2 read unsigned char final char magic3 read unsigned char final char magic4 read unsigned char final char magic5 read unsigned char final char magic6 read unsigned char if magic1 0x17 magic2 0x72 magic3 0x45 magic4 0x38 magic5 0x50 magic6 0x90 complete return if magic1 0x31 magic2 0x41 magic3 0x59 magic4 0x26 magic5 0x53 magic6 0x59 bad block header m streamend true return m storedblockcrc read int if bsr 1 1 m blockrandomised true else m blockrandomised false curr block no get and move to front decode m crc initialisecrc m currentstate start block state initblock readunsignedchar readunsignedchar readunsignedchar readunsignedchar readunsignedchar readunsignedchar badblockheader m_streamend m_storedblockcrc readint m_blockrandomised m_blockrandomised currblockno getandmovetofrontdecode m_crc m_currentstate start_block_state private void initialize final char magic3 read unsigned char final char magic4 read unsigned char if magic3 h magic4 1 magic4 9 bs finished with stream m streamend true return set decompress structure sizes magic4 0 m computedcombinedcrc 0 readunsignedchar readunsignedchar bsfinishedwithstream m_streamend setdecompressstructuresizes m_computedcombinedcrc private void make maps m ninuse 0 for int i 0 i 256 i if m inuse i m seqtounseq m ninuse char i m unseqtoseq i char m ninuse m ninuse makemaps m_ninuse m_inuse m_seqtounseq m_ninuse m_unseqtoseq m_ninuse m_ninuse private void recv decoding tables build in use table make maps final int alpha size m ninuse 2 now the selectors final int group count bsr 3 final int selector count bsr 15 for int i 0 i selector count i int run 0 while bsr 1 1 run m selectormtf i char run undo the mtf values for the selectors final char pos new char n groups for char v 0 v group count v pos v v for int i 0 i selector count i int v m selectormtf i final char tmp pos v while v 0 pos v pos v 1 v pos 0 tmp m selector i tmp final char len new char n groups max alpha size now the coding tables for int i 0 i group count i int curr bsr 5 for int j 0 j alpha size j while bsr 1 1 if bsr 1 0 curr else curr len i j char curr create the huffman decoding tables for int k 0 k group count k int min len 32 int max len 0 for int i 0 i alpha size i if len k i max len max len len k i if len k i min len min len len k i hb create decode tables m limit k m base k m perm k len k min len max len alpha size m minlens k min len recvdecodingtables buildinusetable makemaps alphasize m_ninuse groupcount selectorcount selectorcount m_selectormtf n_groups groupcount selectorcount m_selectormtf m_selector n_groups max_alpha_size groupcount alphasize groupcount minlen maxlen alphasize maxlen maxlen minlen minlen hbcreatedecodetables m_limit m_base m_perm minlen maxlen alphasize m_minlens minlen private void build in use table final boolean in use16 new boolean 16 receive the mapping table for int i 0 i 16 i if bsr 1 1 in use16 i true else in use16 i false for int i 0 i 256 i m inuse i false for int i 0 i 16 i if in use16 i for int j 0 j 16 j if bsr 1 1 m inuse i 16 j true buildinusetable inuse16 inuse16 inuse16 m_inuse inuse16 m_inuse get properties method properties get properties properties total new properties total put all system iterator iter plugins iterator while iter has next total put all properties iter next total put all site total put all user return total getproperties getproperties putall hasnext putall putall putall load system props method void load system props input stream in throws io exception load props system in loadsystemprops loadsystemprops inputstream ioexception loadprops load site props method void load site props input stream in throws io exception load props site in loadsiteprops loadsiteprops inputstream ioexception loadprops load user props method void load user props input stream in throws io exception load props user in loaduserprops loaduserprops inputstream ioexception loadprops save user props method void save user props output stream out throws io exception user store out j edit properties out close saveuserprops saveuserprops outputstream ioexception jedit load plugin props method properties load plugin props input stream in throws io exception properties plugin new properties load props plugin in plugins add plugin return plugin loadpluginprops loadpluginprops inputstream ioexception loadprops add plugin props method void add plugin props properties props plugins add props addpluginprops addpluginprops remove plugin props method void remove plugin props properties props plugins remove props removepluginprops removepluginprops get property method string get property string name string value user get property name if value null return value else return get default property name getproperty getproperty getproperty getdefaultproperty set property method void set property string name string value string prop get default property name if value is null if default is null unset user prop else set user prop to else if default equals value ignore if default doesn t equal value set user if value null if prop null prop length 0 user remove name else user put name else if value equals prop user remove name else user put name value setproperty setproperty getdefaultproperty set temporary property method public void set temporary property string name string value user remove name system put name value settemporaryproperty settemporaryproperty unset property method void unset property string name if get default property name null user put name else user remove name unsetproperty unsetproperty getdefaultproperty reset property method public void reset property string name user remove name resetproperty resetproperty get default property method private string get default property string name string value site get property name if value null return value iterator iter plugins iterator while iter has next value properties iter next get property name if value null return value return system get property name getdefaultproperty getdefaultproperty getproperty hasnext getproperty getproperty load props method private void load props properties into input stream in throws io exception try into load in finally in close loadprops loadprops inputstream ioexception re token any int sub index boolean newline boolean match null super sub index this newline newline this match null match null retokenany subindex matchnull subindex matchnull matchnull int get minimum length return 1 getminimumlength boolean match char indexed input re match mymatch char ch input char at mymatch index if ch char indexed out of bounds newline ch n match null ch 0 return false mymatch index return next input mymatch charindexed rematch charat charindexed out_of_bounds matchnull void dump string buffer os os append stringbuffer this constructor is used in class generation it supplies string type descriptors for return and parameter class types and allows delay of the evaluation of those types until they are requested it does this by holding bsh type nodes as well as an evaluation callstack and interpreter which are called when the class types are requested note technically i think we could get by passing in only the current namespace or perhaps bsh class manager here instead of call stack and interpreter however let s just play it safe in case of future changes anywhere you eval a node you need these delayed eval bsh method string name string return type descriptor bsh return type return type node string param names string param type descriptors bsh formal parameters param types node bsh block method body name space declaring name space modifiers modifiers call stack callstack interpreter interpreter super name null return type param names null param types method body declaring name space modifiers this return type descriptor return type descriptor this return type node return type node this param type descriptors param type descriptors this param types node param types node this callstack callstack this interpreter interpreter bshtype bshclassmanager callstack delayedevalbshmethod returntypedescriptor bshreturntype returntypenode paramnames paramtypedescriptors bshformalparameters paramtypesnode bshblock methodbody namespace declaringnamespace callstack returntype paramnames paramtypes methodbody declaringnamespace returntypedescriptor returntypedescriptor returntypenode returntypenode paramtypedescriptors paramtypedescriptors paramtypesnode paramtypesnode public string get return type descriptor return return type descriptor getreturntypedescriptor returntypedescriptor public class get return type if return type node null return null bsh type will cache the type for us try return return type node eval return type callstack interpreter catch eval error e throw new interpreter error can t eval return type e getreturntype returntypenode bshtype returntypenode evalreturntype evalerror interpretererror public string get param type descriptors return param type descriptors getparamtypedescriptors paramtypedescriptors public class get parameter types bsh formal parameters will cache the type for us try return class param types node eval callstack interpreter catch eval error e throw new interpreter error can t eval param types e getparametertypes bshformalparameters paramtypesnode evalerror interpretererror public class generate class string name modifiers modifiers class interfaces class super class bsh block block boolean is interface call stack callstack interpreter interpreter throws eval error delegate to the static method return generate class impl name modifiers interfaces super class block is interface callstack interpreter generateclass superclass bshblock isinterface callstack evalerror generateclassimpl superclass isinterface public object invoke superclass method bsh class manager bcm object instance string method name object args throws util eval error reflect error invocation target exception delegate to the static method return invoke superclass method impl bcm instance method name args invokesuperclassmethod bshclassmanager methodname utilevalerror reflecterror invocationtargetexception invokesuperclassmethodimpl methodname change the parent of the class instance namespace this is currently used for inner class support note this method will likely be removed in the future this could be static public void set instance name space parent object instance string class name name space parent this ithis class generator util get class instance this instance class name ithis get name space set parent parent setinstancenamespaceparent classname namespace classgeneratorutil getclassinstancethis classname getnamespace setparent parse the bsh block for for the class definition and generate the class using class generator public static class generate class impl string name modifiers modifiers class interfaces class super class bsh block block boolean is interface call stack callstack interpreter interpreter throws eval error scripting classes currently requires accessibility this can be eliminated with a bit more work capabilities set accessibility true if capabilities have accessibility throw new interpreter error defining classes currently requires reflect accessibility name space enclosing name space callstack top string package name enclosing name space get package string class name enclosing name space is class enclosing name space get name name name string fq class name package name null class name package name class name bsh class manager bcm interpreter get class manager race condition here bcm defining class fq class name create the class static namespace name space class static name space new name space enclosing name space class name class static name space is class true callstack push class static name space evaluate any inner class class definitions in the block effectively recursively call this method for contained classes first block eval block callstack interpreter true override class node filter classclasses generate the type for our class variable variables get declared variables block callstack interpreter package name delayed eval bsh method methods get declared methods block callstack interpreter package name class generator util class generator new class generator util modifiers class name package name super class interfaces variables methods class static name space is interface byte code class generator generate class if debug write out the class file to debug classes directory string dir system get property debug classes if dir null try file output stream out new file output stream dir class name class out write code out close catch io exception e define the new class in the classloader class gen class bcm define class fq class name code bcm done defining class fq class name import the unq name into parent enclosing name space import class fq class name replace also cache the class so that no import resolution must occur this avoids having to load our enclosing class which isn t finished being generated yet oy caching is not correct and doesn t seem to help enclosing name space cache class name gen class also cache it in the static namespace class static name space cache class name gen class class static name space import class fq class name replace try class static name space set local variable class generator util bshinit block false strict java catch util eval error e throw new interpreter error unable to init static e give the static space its class static import important to do this after all classes are defined class static name space set class static gen class evaluate the static portion of the block in the static space block eval block callstack interpreter true override class node filter classstatic callstack pop if gen class is interface set the static bsh this callback string bsh static field name class generator util bshstatic class name try lhs lhs reflect getlhs static field gen class bsh static field name lhs assign class static name space get this interpreter false strict catch exception e throw new interpreter error error in class gen setup e bcm done defining class fq class name return gen class bshblock classgenerator generateclassimpl superclass bshblock isinterface callstack evalerror setaccessibility haveaccessibility interpretererror namespace enclosingnamespace packagename enclosingnamespace getpackage classname enclosingnamespace isclass enclosingnamespace getname fqclassname packagename classname packagename classname bshclassmanager getclassmanager definingclass fqclassname namespace classstaticnamespace namespace enclosingnamespace classname classstaticnamespace isclass classstaticnamespace evalblock classnodefilter getdeclaredvariables packagename delayedevalbshmethod getdeclaredmethods packagename classgeneratorutil classgenerator classgeneratorutil classname packagename superclass classstaticnamespace isinterface classgenerator generateclass debugclasses getproperty debugclasses fileoutputstream fileoutputstream classname ioexception genclass defineclass fqclassname donedefiningclass fqclassname enclosingnamespace importclass fqclassname enclosingnamespace cacheclass genclass classstaticnamespace cacheclass genclass classstaticnamespace importclass fqclassname classstaticnamespace setlocalvariable classgeneratorutil strictjava utilevalerror interpretererror classstaticnamespace setclassstatic genclass evalblock classnodefilter genclass isinterface bshstaticfieldname classgeneratorutil classname getlhsstaticfield genclass bshstaticfieldname classstaticnamespace getthis interpretererror donedefiningclass fqclassname genclass static variable get declared variables bsh block body call stack callstack interpreter interpreter string default package throws eval error list vars new array list for int child 0 child body jjt get num children child simple node node simple node body jjt get child child if node instanceof bsh typed variable declaration bsh typed variable declaration tvd bsh typed variable declaration node modifiers modifiers tvd modifiers string type tvd get type descriptor callstack interpreter default package bsh variable declarator vardec tvd get declarators for int i 0 i vardec length i string name vardec i name try variable var new variable name type null value modifiers vars add var catch util eval error e value error shouldn t happen return variable vars to array new variable 0 getdeclaredvariables bshblock callstack defaultpackage evalerror arraylist jjtgetnumchildren simplenode simplenode jjtgetchild bshtypedvariabledeclaration bshtypedvariabledeclaration bshtypedvariabledeclaration gettypedescriptor defaultpackage bshvariabledeclarator getdeclarators utilevalerror toarray static delayed eval bsh method get declared methods bsh block body call stack callstack interpreter interpreter string default package throws eval error list methods new array list for int child 0 child body jjt get num children child simple node node simple node body jjt get child child if node instanceof bsh method declaration bsh method declaration md bsh method declaration node md insure nodes parsed modifiers modifiers md modifiers string name md name string return type md get return type descriptor callstack interpreter default package bsh return type return type node md get return type node bsh formal parameters param types node md params node string param types param types node get type descriptors callstack interpreter default package delayed eval bsh method bm new delayed eval bsh method name return type return type node md params node get param names param types param types node md block node null declaring name space modifiers callstack interpreter methods add bm return delayed eval bsh method methods to array new delayed eval bsh method 0 delayedevalbshmethod getdeclaredmethods bshblock callstack defaultpackage evalerror arraylist jjtgetnumchildren simplenode simplenode jjtgetchild bshmethoddeclaration bshmethoddeclaration bshmethoddeclaration insurenodesparsed returntype getreturntypedescriptor defaultpackage bshreturntype returntypenode getreturntypenode bshformalparameters paramtypesnode paramsnode paramtypes paramtypesnode gettypedescriptors defaultpackage delayedevalbshmethod delayedevalbshmethod returntype returntypenode paramsnode getparamnames paramtypes paramtypesnode blocknode declaringnamespace delayedevalbshmethod toarray delayedevalbshmethod int context private class node filter int context this context context classnodefilter public boolean is visible simple node node if context classes return node instanceof bsh class declaration only show class decs in classes if node instanceof bsh class declaration return false if context static return is static node if context instance return is static node all return true isvisible simplenode bshclassdeclaration bshclassdeclaration isstatic isstatic boolean is static simple node node if node instanceof bsh typed variable declaration return bsh typed variable declaration node modifiers null bsh typed variable declaration node modifiers has modifier static if node instanceof bsh method declaration return bsh method declaration node modifiers null bsh method declaration node modifiers has modifier static need to add static block here if node instanceof bsh block return false return false isstatic simplenode bshtypedvariabledeclaration bshtypedvariabledeclaration bshtypedvariabledeclaration hasmodifier bshmethoddeclaration bshmethoddeclaration bshmethoddeclaration hasmodifier bshblock public static object invoke superclass method impl bsh class manager bcm object instance string method name object args throws util eval error reflect error invocation target exception string super name class generator util bshsuper method name look for the specially named super delegate method class clas instance get class method super method reflect resolve java method bcm clas super name types get types args false only static if super method null return reflect invoke on method super method instance args no super method try to invoke regular method could be a superfluous super which is legal class super class clas get superclass super method reflect resolve expected java method bcm super class instance method name args false only static return reflect invoke on method super method instance args invokesuperclassmethodimpl bshclassmanager methodname utilevalerror reflecterror invocationtargetexception supername classgeneratorutil methodname getclass supermethod resolvejavamethod supername gettypes onlystatic supermethod invokeonmethod supermethod superclass getsuperclass supermethod resolveexpectedjavamethod superclass methodname onlystatic invokeonmethod supermethod init method do not call public static void init int count j edit get integer property io thread count 4 io thread pool new work thread pool j edit i o count jar class loader class loader new jar class loader for int i 0 i io thread pool get thread count i io thread pool get thread i set context class loader class loader jedit getintegerproperty iothreadcount iothreadpool workthreadpool jedit jarclassloader classloader jarclassloader iothreadpool getthreadcount iothreadpool getthread setcontextclassloader classloader start method do not call public static void start io thread pool start iothreadpool get filevfs method returns the local filesystem vfs since j edit 2 5pre1 public static vfs get filevfs return filevfs getfilevfs jedit getfilevfs get urlvfs method returns the url vfs since j edit 2 5pre1 public static vfs get urlvfs return urlvfs geturlvfs jedit geturlvfs getvfs by name method deprecated use code getvfs for protocol code instead public static vfs getvfs by name string name in new api protocol always equals name vfs vfs vfs service manager get service service name if vfs null return vfs vfs hash get name else return vfs getvfsbyname getvfsforprotocol getvfsbyname servicemanager getservice vfshash getvfs for protocol method returns the vfs for the specified protocol param protocol the protocol since j edit 2 5pre1 public static vfs getvfs for protocol string protocol if protocol equals file return filevfs else vfs vfs vfs service manager get service service protocol if vfs null vfs vfs protocol hash get protocol if vfs null return vfs else return urlvfs getvfsforprotocol jedit getvfsforprotocol servicemanager getservice protocolhash getvfs for path method returns the vfs for the specified path param path the path since j edit 2 6pre4 public static vfs getvfs for path string path if misc utilities isurl path return getvfs for protocol misc utilities get protocol ofurl path else return filevfs getvfsforpath jedit getvfsforpath miscutilities getvfsforprotocol miscutilities getprotocolofurl registervfs method deprecated write a code services xml code file instead see link org gjt sp jedit service manager public static void registervfs string protocol vfs vfs log log log debug vfs manager class registered vfs get name filesystem for protocol protocol vfs hash put vfs get name vfs protocol hash put protocol vfs servicemanager vfsmanager getname vfshash getname protocolhash get filesystems method deprecated use code getvf ss code instead public static enumeration get filesystems return vfs hash elements getfilesystems getvfss getfilesystems vfshash getvf ss method returns a list of all registered filesystems since j edit 4 2pre1 public static string getvf ss the sooner ppl move to the new api the less we ll need crap like this list return value new linked list string newapi service manager get service names service if newapi null for int i 0 i newapi length i return value add newapi i enumeration oldapi vfs hash keys while oldapi has more elements return value add oldapi next element return string return value to array new string return value size getvfss jedit getvfss returnvalue linkedlist servicemanager getservicenames returnvalue vfshash hasmoreelements returnvalue nextelement returnvalue toarray returnvalue getio thread pool method returns the i o thread pool public static work thread pool getio thread pool return io thread pool getiothreadpool workthreadpool getiothreadpool iothreadpool wait for requests method returns when all pending requests are complete since j edit 2 5pre1 public static void wait for requests io thread pool wait for requests waitforrequests jedit waitforrequests iothreadpool waitforrequests error occurred method returns if the last request caused an error public static boolean error occurred return error erroroccurred erroroccurred get request count method returns the number of pending i o requests public static int get request count return io thread pool get request count getrequestcount getrequestcount iothreadpool getrequestcount run inawt thread method executes the specified runnable in the awt thread once all pending i o requests are complete since j edit 2 5pre1 public static void run inawt thread runnable run io thread pool add work request run true runinawtthread jedit runinawtthread iothreadpool addworkrequest run in work thread method executes the specified runnable in one of the i o threads since j edit 2 6pre2 public static void run in work thread runnable run io thread pool add work request run false runinworkthread jedit runinworkthread iothreadpool addworkrequest error method deprecated call the other code error code method instead public static void error final component comp final string error final object args if we are already in the awt thread take a shortcut if swing utilities is event dispatch thread gui utilities error comp error args return the error chicanery ensures that stuff like vfs manager wait for requests if vfs manager error occurred will work because the below runnable will only be executed in the next event vfs manager error true run inawt thread new runnable public void run vfs manager error false if comp null comp is showing gui utilities error null error args else gui utilities error comp error args swingutilities iseventdispatchthread guiutilities vfsmanager waitforrequests vfsmanager erroroccurred vfsmanager runinawtthread vfsmanager isshowing guiutilities guiutilities public void run vfs manager error false if comp null comp is showing gui utilities error null error args else gui utilities error comp error args vfsmanager isshowing guiutilities guiutilities error method reports an i o error param comp the component param path the path name that caused the error param message prop the error message property name param args positional parameters since j edit 4 0pre3 public static void error component comp final string path string message prop object args final frame frame j option pane get frame for component comp synchronized error lock error true errors add element new error list dialog error entry path message prop args if errors size 1 vfs manager run inawt thread new runnable public void run string caption j edit get property ioerror caption errors size 1 1 new integer new integer errors size new error list dialog frame is showing frame j edit get first view j edit get property ioerror title caption errors false errors remove all elements error false messageprop jedit messageprop joptionpane getframeforcomponent errorlock addelement errorlistdialog errorentry messageprop vfsmanager runinawtthread jedit getproperty errorlistdialog isshowing jedit getfirstview jedit getproperty removeallelements public void run string caption j edit get property ioerror caption errors size 1 1 new integer new integer errors size new error list dialog frame is showing frame j edit get first view j edit get property ioerror title caption errors false errors remove all elements error false jedit getproperty errorlistdialog isshowing jedit getfirstview jedit getproperty removeallelements sendvfs update method sends a vfs update message param vfs the vfs param path the path that changed param parent true if an update should be sent for the path s parent too since j edit 2 6pre4 public static void sendvfs update vfs vfs string path boolean parent if parent sendvfs update vfs vfs get parent of path path false sendvfs update vfs path false else have to do this hack until vfs path class is written if path length 1 path ends with path ends with java io file separator path path substring 0 path length 1 synchronized vfs update lock for int i 0 i vfs updates size i vfs update msg vfs update vfs updates get i if msg get path equals path don t send two updates for the same path return vfs updates add new vfs update path if vfs updates size 1 we were the first to add an update add update sending runnable to awt thread vfs manager run inawt thread new sendvfs updates safely sendvfsupdate jedit sendvfsupdate sendvfsupdate getparentofpath sendvfsupdate vfspath endswith endswith vfsupdatelock vfsupdates vfsupdate vfsupdate vfsupdates getpath vfsupdates vfsupdate vfsupdates vfsmanager runinawtthread sendvfsupdatessafely public void run synchronized vfs update lock the vfs browser has what you might call a design flaw it doesn t update properly unless the vfs update for a parent arrives before any updates for the children sorting the list alphanumerically guarantees this collections sort vfs updates new misc utilities string compare for int i 0 i vfs updates size i edit bus send vfs update vfs updates get i vfs updates clear vfsupdatelock vfsupdates miscutilities stringcompare vfsupdates editbus vfsupdate vfsupdates vfsupdates private vfs manager vfsmanager gutter constructor public gutter view view j edit text area text area this view view this text area text area set autoscrolls true set opaque true set request focus enabled false extension mgr new extension manager mouse handler ml new mouse handler add mouse listener ml add mouse motion listener ml add extension new marker highlight update border jedittextarea textarea textarea textarea setautoscrolls setopaque setrequestfocusenabled extensionmgr extensionmanager mousehandler mousehandler addmouselistener addmousemotionlistener addextension markerhighlight updateborder paint component method public void paint component graphics gfx graphics2d gfx graphics2d gfx fill the background rectangle clip gfx get clip bounds gfx set color get background gfx fill rect clip x clip y clip width clip height if buffer is loading don t paint anything if text area get buffer is loaded return int line height text area get painter get font metrics get height if line height 0 return int first line clip y line height int last line clip y clip height 1 line height if last line first line text area get visible lines log log log error this bug first line first line log log log error this last line last line log log log error this visible lines text area get visible lines log log log error this height get height log log log error this painter height text area get painter get height log log log error this clip y clip y log log log error this clip height clip height log log log error this line height line height int y clip y clip y line height extension mgr paint screen line range text area gfx first line last line y line height for int line first line line last line line y line height paint line gfx line y paintcomponent paintcomponent _gfx _gfx getclipbounds setcolor getbackground fillrect textarea getbuffer isloaded lineheight textarea getpainter getfontmetrics getheight lineheight firstline lineheight lastline lineheight lastline firstline textarea getvisiblelines firstline firstline lastline lastline visiblelines textarea getvisiblelines getheight textarea getpainter getheight lineheight lineheight lineheight extensionmgr paintscreenlinerange textarea firstline lastline lineheight firstline lastline lineheight paintline add extension method adds a text area extension which can perform custom painting and tool tip handling param extension the extension since j edit 4 0pre4 public void add extension text area extension extension extension mgr add extension default layer extension repaint addextension jedit addextension textareaextension extensionmgr addextension default_layer add extension method adds a text area extension which can perform custom painting and tool tip handling param layer the layer to add the extension to note that more than extension can share the same layer param extension the extension since j edit 4 0pre4 public void add extension int layer text area extension extension extension mgr add extension layer extension repaint addextension jedit addextension textareaextension extensionmgr addextension remove extension method removes a text area extension it will no longer be asked to perform custom painting and tool tip handling param extension the extension since j edit 4 0pre4 public void remove extension text area extension extension extension mgr remove extension extension repaint removeextension jedit removeextension textareaextension extensionmgr removeextension get extensions method returns an array of registered text area extensions useful for debugging purposes since j edit 4 1pre5 public text area extension get extensions return extension mgr get extensions getextensions jedit textareaextension getextensions extensionmgr getextensions get tool tip text method returns the tool tip to display at the specified location param evt the mouse event public string get tool tip text mouse event evt if text area get buffer is loaded return null return extension mgr get tool tip text evt getx evt gety gettooltiptext gettooltiptext mouseevent textarea getbuffer isloaded extensionmgr gettooltiptext set border method convenience method for setting a default matte border on the right with the specified border width and color param width the border width in pixels param color1 the focused border color param color2 the unfocused border color param color3 the gutter text area gap color public void set border int width color color1 color color2 color color3 this border width width focus border new compound border new matte border 0 0 0 width color3 new matte border 0 0 0 width color1 no focus border new compound border new matte border 0 0 0 width color3 new matte border 0 0 0 width color2 update border setborder setborder borderwidth focusborder compoundborder matteborder matteborder nofocusborder compoundborder matteborder matteborder updateborder update border method sets the border differently if the text area has focus or not public void update border if view get edit pane null set border no focus border else if view get edit pane get text area text area set border focus border else set border no focus border updateborder updateborder geteditpane setborder nofocusborder geteditpane gettextarea textarea setborder focusborder setborder nofocusborder public void set border border border super set border border if border null collapsed size width 0 collapsed size height 0 else insets insets border get border insets this collapsed size width fold marker size insets right collapsed size height gutter size height insets top insets bottom gutter size width fold marker size insets right fm string width 12345 revalidate setborder setborder collapsedsize collapsedsize getborderinsets collapsedsize fold_marker_size collapsedsize guttersize guttersize fold_marker_size stringwidth public void set font font font super set font font fm get font metrics font baseline fm get ascent border border get border if border null gutter size width fold marker size border get border insets this right fm string width 12345 revalidate setfont setfont getfontmetrics getascent getborder guttersize fold_marker_size getborderinsets stringwidth get highlighted foreground method get the foreground color for highlighted line numbers return the highlight color public color get highlighted foreground return interval highlight gethighlightedforeground gethighlightedforeground intervalhighlight set highlighted foreground method public void set highlighted foreground color highlight interval highlight highlight sethighlightedforeground sethighlightedforeground intervalhighlight get current line foreground method public color get current line foreground return current line highlight getcurrentlineforeground getcurrentlineforeground currentlinehighlight set current line foreground method public void set current line foreground color highlight current line highlight highlight setcurrentlineforeground setcurrentlineforeground currentlinehighlight get fold color method public color get fold color return fold color getfoldcolor getfoldcolor foldcolor set fold color method public void set fold color color fold color this fold color fold color setfoldcolor setfoldcolor foldcolor foldcolor foldcolor public dimension get preferred size if expanded return gutter size else return collapsed size getpreferredsize guttersize collapsedsize get minimum size method public dimension get minimum size return get preferred size getminimumsize getminimumsize getpreferredsize get line number alignment method identifies whether the horizontal alignment of the line numbers return gutter right gutter center gutter left public int get line number alignment return alignment getlinenumberalignment getlinenumberalignment set line number alignment method sets the horizontal alignment of the line numbers param alignment gutter right gutter center gutter left public void set line number alignment int alignment if this alignment alignment return this alignment alignment repaint setlinenumberalignment setlinenumberalignment is expanded method identifies whether the gutter is collapsed or expanded return true if the gutter is expanded false if it is collapsed public boolean is expanded return expanded isexpanded isexpanded set expanded method sets whether the gutter is collapsed or expanded and force the text area to update its layout if there is a change param expanded true if the gutter is expanded false if it is collapsed public void set expanded boolean expanded if this expanded expanded return this expanded expanded text area revalidate setexpanded setexpanded textarea toggle expanded method toggles whether the gutter is collapsed or expanded public void toggle expanded set expanded expanded toggleexpanded toggleexpanded setexpanded get highlight interval method sets the number of lines between highlighted line numbers return the number of lines between highlighted line numbers or zero if highlighting is disabled public int get highlight interval return interval gethighlightinterval gethighlightinterval set highlight interval method sets the number of lines between highlighted line numbers any value less than or equal to one will result in highlighting being disabled param interval the number of lines between highlighted line numbers public void set highlight interval int interval if interval 1 interval 0 this interval interval repaint sethighlightinterval sethighlightinterval is current line highlight enabled method public boolean is current line highlight enabled return current line highlight enabled iscurrentlinehighlightenabled iscurrentlinehighlightenabled currentlinehighlightenabled set current line highlight enabled method public void set current line highlight enabled boolean enabled if current line highlight enabled enabled return current line highlight enabled enabled repaint setcurrentlinehighlightenabled setcurrentlinehighlightenabled currentlinehighlightenabled currentlinehighlightenabled get structure highlight color method returns the structure highlight color since j edit 4 2pre3 public final color get structure highlight color return structure highlight color getstructurehighlightcolor jedit getstructurehighlightcolor structurehighlightcolor set structure highlight color method sets the structure highlight color param structure highlight color the structure highlight color since j edit 4 2pre3 public final void set structure highlight color color structure highlight color this structure highlight color structure highlight color repaint setstructurehighlightcolor structurehighlightcolor jedit setstructurehighlightcolor structurehighlightcolor structurehighlightcolor structurehighlightcolor is structure highlight enabled method returns true if structure highlighting is enabled false otherwise since j edit 4 2pre3 public final boolean is structure highlight enabled return structure highlight isstructurehighlightenabled jedit isstructurehighlightenabled structurehighlight set structure highlight enabled method enables or disables structure highlighting param structure highlight true if structure highlighting should be enabled false otherwise since j edit 4 2pre3 public final void set structure highlight enabled boolean structure highlight this structure highlight structure highlight repaint setstructurehighlightenabled structurehighlight jedit setstructurehighlightenabled structurehighlight structurehighlight structurehighlight get marker highlight color method public color get marker highlight color return marker highlight color getmarkerhighlightcolor getmarkerhighlightcolor markerhighlightcolor set marker highlight color method public void set marker highlight color color marker highlight color this marker highlight color marker highlight color setmarkerhighlightcolor setmarkerhighlightcolor markerhighlightcolor markerhighlightcolor markerhighlightcolor is marker highlight enabled method public boolean is marker highlight enabled return marker highlight ismarkerhighlightenabled ismarkerhighlightenabled markerhighlight is marker highlight enabled public void set marker highlight enabled boolean marker highlight this marker highlight marker highlight ismarkerhighlightenabled setmarkerhighlightenabled markerhighlight markerhighlight markerhighlight paint line method private void paint line graphics2d gfx int line int y buffer buffer text area get buffer if buffer is loaded return int line height text area get painter get font metrics get height chunk cache line info info text area chunk cache get line info line int physical line info physical line skip lines beyond eof if physical line 1 return paint fold triangles if info first subregion buffer is fold start physical line int y y line height 2 gfx set color fold color if text area display manager is line visible physical line 1 gfx draw line 1 y 3 10 y 3 gfx draw line 2 y 2 9 y 2 gfx draw line 3 y 1 8 y 1 gfx draw line 4 y 7 y gfx draw line 5 y 1 6 y 1 else gfx draw line 4 y 5 4 y 4 gfx draw line 5 y 4 5 y 3 gfx draw line 6 y 3 6 y 2 gfx draw line 7 y 2 7 y 1 gfx draw line 8 y 1 8 y else if info last subregion buffer is fold end physical line gfx set color fold color int y y line height 2 gfx draw line 4 y 4 y 3 gfx draw line 4 y 3 7 y 3 paint bracket scope else if structure highlight structure matcher match match text area get structure match int caret line text area get caret line if text area is structure highlight visible physical line math min caret line match start line physical line math max caret line match start line int caret screen line if caret line text area get last physical line caret screen line integer max value else if text area display manager is line visible text area get caret line caret screen line text area get screen line of offset text area get caret position else caret screen line 1 int struct screen line if match start line text area get last physical line struct screen line integer max value else if text area display manager is line visible match start line struct screen line text area get screen line of offset match start else struct screen line 1 if caret screen line struct screen line int tmp caret screen line caret screen line struct screen line struct screen line tmp gfx set color structure highlight color if struct screen line caret screen line do nothing draw else if line caret screen line gfx fill rect 5 y line height 2 5 2 gfx fill rect 5 y line height 2 2 line height line height 2 draw else if line struct screen line gfx fill rect 5 y 2 line height 2 gfx fill rect 5 y line height 2 5 2 draw else if line caret screen line line struct screen line gfx fill rect 5 y 2 line height paint line numbers if info first subregion expanded string number integer to string physical line 1 int offset switch alignment case right offset gutter size width collapsed size width fm string width number 1 break case center offset gutter size width collapsed size width fm string width number 2 break case left default offset 0 break boolean highlight current line current line highlight enabled text area selection size 0 if physical line text area get caret line highlight current line gfx set color current line highlight else if interval 1 line text area get first line 1 interval 0 gfx set color interval highlight else gfx set color get foreground gfx draw string number fold marker size offset baseline y paintline paintline textarea getbuffer isloaded lineheight textarea getpainter getfontmetrics getheight chunkcache lineinfo textarea chunkcache getlineinfo physicalline physicalline physicalline firstsubregion isfoldstart physicalline _y lineheight setcolor foldcolor textarea displaymanager islinevisible physicalline drawline _y _y drawline _y _y drawline _y _y drawline _y _y drawline _y _y drawline _y _y drawline _y _y drawline _y _y drawline _y _y drawline _y _y lastsubregion isfoldend physicalline setcolor foldcolor _y lineheight drawline _y _y drawline _y _y structurehighlight structurematcher textarea getstructurematch caretline textarea getcaretline textarea isstructurehighlightvisible physicalline caretline startline physicalline caretline startline caretscreenline caretline textarea getlastphysicalline caretscreenline max_value textarea displaymanager islinevisible textarea getcaretline caretscreenline textarea getscreenlineofoffset textarea getcaretposition caretscreenline structscreenline startline textarea getlastphysicalline structscreenline max_value textarea displaymanager islinevisible startline structscreenline textarea getscreenlineofoffset structscreenline caretscreenline structscreenline caretscreenline caretscreenline structscreenline structscreenline setcolor structurehighlightcolor structscreenline caretscreenline caretscreenline fillrect lineheight fillrect lineheight lineheight lineheight _ structscreenline fillrect lineheight fillrect lineheight caretscreenline structscreenline fillrect lineheight firstsubregion tostring physicalline guttersize collapsedsize stringwidth guttersize collapsedsize stringwidth highlightcurrentline currentlinehighlightenabled textarea physicalline textarea getcaretline highlightcurrentline setcolor currentlinehighlight textarea getfirstline setcolor intervalhighlight setcolor getforeground drawstring fold_marker_size mouse entered method public void mouse entered mouse event e tool tip manager ttm tool tip manager shared instance tool tip initial delay ttm get initial delay tool tip reshow delay ttm get reshow delay ttm set initial delay 0 ttm set reshow delay 0 mouseentered mouseentered mouseevent tooltipmanager tooltipmanager sharedinstance tooltipinitialdelay getinitialdelay tooltipreshowdelay getreshowdelay setinitialdelay setreshowdelay mouse exited method public void mouse exited mouse event evt tool tip manager ttm tool tip manager shared instance ttm set initial delay tool tip initial delay ttm set reshow delay tool tip reshow delay mouseexited mouseexited mouseevent tooltipmanager tooltipmanager sharedinstance setinitialdelay tooltipinitialdelay setreshowdelay tooltipreshowdelay mouse pressed method public void mouse pressed mouse event e text area request focus if gui utilities is popup trigger e e getx get width border width 2 e translate point get width 0 text area mouse handler mouse pressed e drag true else buffer buffer text area get buffer int screen line e gety text area get painter get font metrics get height int line text area chunk cache get line info screen line physical line if line 1 return determine action string default action string variant if buffer is fold start line default action toggle fold variant fold else if structure highlight text area is structure highlight visible text area line in structure scope line default action match struct variant struct else return string action mouse actions get action for event e variant if action null action default action handle actions structure matcher match match text area get structure match if action equals select fold text area display manager expand fold line true text area select fold line else if action equals narrow fold int lines buffer get fold at line line text area display manager narrow lines 0 lines 1 else if action starts with toggle fold if text area display manager is line visible line 1 text area display manager collapse fold line else if action ends with fully text area display manager expand fold line true else text area display manager expand fold line false else if action equals match struct if match null text area set caret position match end else if action equals select struct if match null match matcher select match text area else if action equals narrow struct if match null int start math min match start line text area get caret line int end math max match end line text area get caret line text area display manager narrow start end mousepressed mousepressed mouseevent textarea requestfocus guiutilities ispopuptrigger getwidth borderwidth translatepoint getwidth textarea mousehandler mousepressed textarea getbuffer screenline textarea getpainter getfontmetrics getheight textarea chunkcache getlineinfo screenline physicalline defaultaction isfoldstart defaultaction structurehighlight textarea isstructurehighlightvisible textarea lineinstructurescope defaultaction mouseactions getactionforevent defaultaction structurematcher textarea getstructurematch textarea displaymanager expandfold textarea selectfold getfoldatline textarea displaymanager startswith textarea displaymanager islinevisible textarea displaymanager collapsefold endswith textarea displaymanager expandfold textarea displaymanager expandfold textarea setcaretposition selectmatch textarea startline textarea getcaretline endline textarea getcaretline textarea displaymanager mouse dragged method public void mouse dragged mouse event e if drag e getx get width border width 2 e translate point get width 0 text area mouse handler mouse dragged e mousedragged mousedragged mouseevent getwidth borderwidth translatepoint getwidth textarea mousehandler mousedragged mouse released method public void mouse released mouse event e if drag e getx get width border width 2 e translate point get width 0 text area mouse handler mouse released e drag false mousereleased mousereleased mouseevent getwidth borderwidth translatepoint getwidth textarea mousehandler mousereleased paint valid line method public void paint valid line graphics2d gfx int screen line int physical line int start int end int y if is marker highlight enabled buffer buffer text area get buffer if buffer get marker in range start end null gfx set color get marker highlight color font metrics fm text area get painter get font metrics gfx fill rect 0 y text area get gutter get width fm get height paintvalidline paintvalidline screenline physicalline ismarkerhighlightenabled textarea getbuffer getmarkerinrange setcolor getmarkerhighlightcolor fontmetrics textarea getpainter getfontmetrics fillrect textarea getgutter getwidth getheight get tool tip text method public string get tool tip text int x int y if is marker highlight enabled int line height text area get painter get font metrics get height if line height 0 return null int line y line height int start text area get screen line start offset line int end text area get screen line end offset line if start 1 end 1 return null marker marker text area get buffer get marker in range start end if marker null char shortcut marker get shortcut if shortcut 0 return j edit get property view gutter marker no name else string args string value of shortcut return j edit get property view gutter marker args return null gettooltiptext gettooltiptext ismarkerhighlightenabled lineheight textarea getpainter getfontmetrics getheight lineheight lineheight textarea getscreenlinestartoffset textarea getscreenlineendoffset textarea getbuffer getmarkerinrange getshortcut jedit getproperty valueof jedit getproperty object class instance void set class static class clas this class static clas import static clas classinstance setclassstatic classstatic importstatic import static clas void set class instance object instance this class instance instance import object instance importstatic setclassinstance classinstance importobject object get class instance throws util eval error if class instance null return class instance if class static null get parent null get parent class static null throw new util eval error can t refer to class instance from static context else throw new interpreter error can t resolve class instance this in this getclassinstance utilevalerror classinstance classinstance classstatic getparent getparent classstatic utilevalerror interpretererror parent the parent namespace of this namespace child namespaces inherit all variables and methods of their parent and can of course override shadow them public name space name space parent string name note in this case parent must have a class manager this parent null name namespace namespace public name space bsh class manager class manager string name this null class manager name namespace bshclassmanager classmanager classmanager public name space name space parent bsh class manager class manager string name we might want to do this here rather than explicitly in interpreter for global see also prune if class manager null parent null create our own class manager set name name set parent parent set class manager class manager register for notification of classloader change if class manager null class manager add listener this namespace namespace bshclassmanager classmanager classmanager setname setparent setclassmanager classmanager classmanager classmanager addlistener end constructors public void set name string name this ns name name setname nsname the name of this namespace if the namespace is a method body namespace then this is the name of the method if it s a class or class instance then it s the name of the class public string get name return this ns name getname nsname set the node associated with the creation of this namespace this is used in debugging and to support the get invocation line and get invocation text methods void set node simple node node caller info node node getinvocationline getinvocationtext setnode simplenode callerinfonode simple node get node if caller info node null return caller info node if parent null return parent get node else return null simplenode getnode callerinfonode callerinfonode getnode resolve name to an object through this namespace public object get string name interpreter interpreter throws util eval error call stack callstack new call stack this return get name resolver name to object callstack interpreter utilevalerror callstack callstack getnameresolver toobject public void set variable string name object value throws util eval error set variable name value false setvariable utilevalerror setvariable set the variable through this namespace this method obeys the localscoping property to determine how variables are set p note this method is primarily intended for use internally if you use this method outside of the bsh package and wish to set variables with primitive values you will have to wrap them using bsh primitive see bsh primitive p setting a new variable which didn t exist before or removing a variable causes a namespace change param strict java specifies whether strict java rules are applied public void set variable string name object value boolean strict java throws util eval error if localscoping switch follow strict java else recurse boolean recurse interpreter localscoping strict java true set variable name value strict java recurse strictjava setvariable strictjava utilevalerror strictjava strictjava setvariable strictjava set a variable explicitly in the local scope void set local variable string name object value boolean strict java throws util eval error set variable name value strict java false recurse setlocalvariable strictjava utilevalerror setvariable strictjava set the value of a the variable name through this namespace the variable may be an existing or non existing variable it may live in this namespace or in a parent namespace if recurse is true p note this method is not public and does not know about localscoping its caller methods must set recurse intelligently in all situations perhaps based on localscoping p note this method is primarily intended for use internally if you use this method outside of the bsh package and wish to set variables with primitive values you will have to wrap them using bsh primitive see bsh primitive p setting a new variable which didn t exist before or removing a variable causes a namespace change param strict java specifies whether strict java rules are applied param recurse determines whether we will search for the variable in our parent s scope before assigning locally void set variable string name object value boolean strict java boolean recurse throws util eval error if variables null variables new hashtable primitives should have been wrapped if value null don t break j edit core and plugins throw new interpreter error null variable value unset variable name return locate the variable definition if it exists variable existing get variable impl name recurse found an existing variable here or above if recurse allowed if existing null try existing set value value variable assignment catch util eval error e throw new util eval error variable assignment name e get message else no previous variable definition found here or above if recurse if strict java throw new util eval error strict java mode assignment to undeclared variable name if recurse set global untyped var else set it here name space var scope recurse get global this this modification makes default allocation local name space var scope this var scope variables put name new variable name value null modifiers name space changed on new variable addition name space changed strictjava setvariable strictjava utilevalerror jedit interpretererror unsetvariable getvariableimpl setvalue utilevalerror utilevalerror getmessage strictjava utilevalerror namespace varscope getglobal namespace varscope varscope namespacechanged namespacechanged remove the variable from the namespace public void unset variable string name variables remove name name space changed unsetvariable namespacechanged get the names of variables defined in this namespace this does not show variables in parent namespaces public string get variable names if variables null return new string 0 else return enumeration to string array variables keys getvariablenames enumerationtostringarray get the names of methods declared in this namespace this does not include methods in parent namespaces public string get method names if methods null return new string 0 else return enumeration to string array methods keys getmethodnames enumerationtostringarray get the methods defined in this namespace this does not show methods in parent namespaces note this will probably be renamed get declared methods public bsh method get methods if methods null return new bsh method 0 else return flatten method collection methods elements getdeclaredmethods bshmethod getmethods bshmethod flattenmethodcollection private string enumeration to string array enumeration e vector v new vector while e has more elements v add element e next element string sa new string v size v copy into sa return sa enumerationtostringarray hasmoreelements addelement nextelement copyinto flatten the vectors of overloaded methods to a single array see get methods private bsh method flatten method collection enumeration e vector v new vector while e has more elements object o e next element if o instanceof bsh method v add element o else vector ov vector o for int i 0 i ov size i v add element ov element at i bsh method bma new bsh method v size v copy into bma return bma getmethods bshmethod flattenmethodcollection hasmoreelements nextelement bshmethod addelement addelement elementat bshmethod bshmethod copyinto get the parent namespace note this isn t quite the same as get super get super returns this if we are at the root namespace public name space get parent return parent getsuper getsuper namespace getparent get the parent namespace this reference or this namespace this reference if we are the top public this get super interpreter declaring interpreter if parent null return parent get this declaring interpreter else return get this declaring interpreter getsuper declaringinterpreter getthis declaringinterpreter getthis declaringinterpreter get the top level namespace or this namespace if we are the top note this method should probably return type bsh this to be consistent with get this public this get global interpreter declaring interpreter if parent null return parent get global declaring interpreter else return get this declaring interpreter getthis getglobal declaringinterpreter getglobal declaringinterpreter getthis declaringinterpreter a this object is a thin layer over a namespace comprising a bsh object context it handles things like the interface types the bsh object supports and aspects of method invocation on it p the declaring interpreter is here to support callbacks from java through generated proxies the scripted object remembers who created it for things like printing messages and other per interpreter phenomenon when called externally from java note we need a singleton here so that things like this this work and probably a good idea for speed caching a single instance here seems technically incorrect considering the declaring interpreter could be different under some circumstances case a child interpreter running a source eval command however the effect is just that the main interpreter that executes your script should be the one involved in call backs from java i do not know if there are corner cases where a child interpreter would be the first to use a this reference in a namespace or if that would even cause any problems if it did we could do some experiments to find out and if necessary we could cache on a per interpreter basis if we had weak references we might also look at skipping over child interpreters and going to the parent for the declaring interpreter so we d be sure to get the top interpreter this get this interpreter declaring interpreter if this reference null this reference this get this this declaring interpreter return this reference declaringinterpreter declaringinterpreter getthis declaringinterpreter thisreference thisreference getthis declaringinterpreter thisreference public bsh class manager get class manager if class manager null return class manager if parent null parent javacode return parent get class manager system out println experiment creating class manager class manager bsh class manager create class manager null interp interpreter debug no class manager namespace this return class manager bshclassmanager getclassmanager classmanager classmanager getclassmanager classmanager bshclassmanager createclassmanager classmanager void set class manager bsh class manager class manager this class manager class manager setclassmanager bshclassmanager classmanager classmanager classmanager used for serialization public void prune cut off from parent we must have our own class manager can t do this in the run command needs to resolve stuff should we do it by default when we create a namespace will no parent of class manager if this class manager null xxx if we keep the create class manager in get class manager then we can axe this set class manager bsh class manager create class manager null interp set parent null classmanager createclassmanager getclassmanager setclassmanager bshclassmanager createclassmanager setparent public void set parent name space parent this parent parent if we are disconnected from root we need to handle the def imports if parent null load default imports setparent namespace loaddefaultimports get the specified variable in this namespace or a parent namespace p note this method is primarily intended for use internally if you use this method outside of the bsh package you will have to use primitive unwrap to get primitive values see primitive unwrap object return the variable value or primitive void if it is not defined public object get variable string name throws util eval error return get variable name true getvariable utilevalerror getvariable get the specified variable in this namespace param recurse if recurse is true then we recursively search through parent namespaces for the variable p note this method is primarily intended for use internally if you use this method outside of the bsh package you will have to use primitive unwrap to get primitive values see primitive unwrap object return the variable value or primitive void if it is not defined public object get variable string name boolean recurse throws util eval error variable var get variable impl name recurse return unwrap variable var getvariable utilevalerror getvariableimpl unwrapvariable locate a variable and return the variable object with optional recursion through parent name spaces p if this namespace is static return only static variables return the variable value or null if it is not defined protected variable get variable impl string name boolean recurse throws util eval error variable var null change import precedence if we are a class body instance get imported first if var null is class var get imported var name if var null variables null var variable variables get name change import precedence if we are a class body instance if var null is class var get imported var name try parent if recurse var null parent null var parent get variable impl name recurse return var getvariableimpl utilevalerror isclass getimportedvar isclass getimportedvar getvariableimpl public variable get declared variables if variables null return new variable 0 variable vars new variable variables size int i 0 for enumeration e variables elements e has more elements vars i variable e next element return vars getdeclaredvariables hasmoreelements nextelement unwrap a variable to its value return return the variable value a null var is mapped to primitive void protected object unwrap variable variable var throws util eval error return var null primitive void var get value unwrapvariable utilevalerror getvalue deprecated see set typed variable string class object modifiers public void set typed variable string name class type object value boolean is final throws util eval error modifiers modifiers new modifiers if is final modifiers add modifier modifiers field final set typed variable name type value modifiers settypedvariable settypedvariable isfinal utilevalerror isfinal addmodifier settypedvariable declare a variable in the local scope and set its initial value value may be null to indicate that we would like the default value for the variable type e g 0 for integer types null for object types an existing typed variable may only be set to the same type if an untyped variable of the same name exists it will be overridden with the new typed var the set will perform a types get assignable form on the value if necessary p note this method is primarily intended for use internally if you use this method outside of the bsh package and wish to set variables with primitive values you will have to wrap them using bsh primitive see bsh primitive param value if value is null you ll get the default value for the type param modifiers may be null public void set typed variable string name class type object value modifiers modifiers throws util eval error check variable modifiers name modifiers if variables null variables new hashtable setting a typed variable is always a local operation variable existing get variable impl name false recurse null value is just a declaration note we might want to keep any existing value here instead of reset moved to variable if value null value primitive get default value type does the variable already exist if existing null is it typed if existing get type null if it had a different type throw error this allows declaring the same var again but not with a different even if assignable type if existing get type type throw new util eval error typed variable name was previously declared with type existing get type else else set it and return existing set value value variable declaration return careful here else fall through to override and install the new typed version add the new typed var variables put name new variable name type value modifiers getassignableform settypedvariable utilevalerror checkvariablemodifiers getvariableimpl getdefaultvalue gettype gettype utilevalerror gettype setvalue note this is primarily for internal use see interpreter source string see interpreter eval string public void set method string name bsh method method throws util eval error check method modifiers method if methods null methods new hashtable object m methods get name if m null methods put name method else if m instanceof bsh method vector v new vector v add element m v add element method methods put name v else vector vector m add element method setmethod bshmethod utilevalerror checkmethodmodifiers bshmethod addelement addelement addelement see get method string class boolean see get method string class public bsh method get method string name class sig throws util eval error return get method name sig false declared only getmethod getmethod bshmethod getmethod utilevalerror getmethod declaredonly get the bsh method matching the specified signature declared in this name space or a parent p note this method is primarily intended for use internally if you use this method outside of the bsh package you will have to be familiar with bean shell s use of the primitive wrapper class see bsh primitive return the bsh method or null if not found param declared only if true then only methods declared directly in this namespace will be found and no inherited or imported methods will be visible public bsh method get method string name class sig boolean declared only throws util eval error bsh method method null change import precedence if we are a class body instance get import first if method null is class declared only method get imported method name sig object m null if method null methods null m methods get name m contains either bsh method or vector of bsh method if m null unwrap bsh method ma if m instanceof vector vector vm vector m ma new bsh method vm size vm copy into ma else ma new bsh method bsh method m apply most specific signature matching class candidates new class ma length for int i 0 i ma length i candidates i ma i get parameter types int match reflect find most specific signature sig candidates if match 1 method ma match if method null is class declared only method get imported method name sig try parent if declared only method null parent null return parent get method name sig return method beanshell bshmethod declaredonly bshmethod getmethod declaredonly utilevalerror bshmethod isclass declaredonly getimportedmethod bshmethod bshmethod bshmethod bshmethod copyinto bshmethod bshmethod getparametertypes findmostspecificsignature isclass declaredonly getimportedmethod declaredonly getmethod import a class name subsequent imports override earlier ones public void import class string name if imported classes null imported classes new hashtable imported classes put name suffix name 1 name name space changed importclass importedclasses importedclasses importedclasses namespacechanged subsequent imports override earlier ones public void import package string name if imported packages null imported packages new vector if it exists remove it and add it at the end avoid memory leak if imported packages contains name imported packages remove name imported packages add element name name space changed importpackage importedpackages importedpackages importedpackages importedpackages importedpackages addelement namespacechanged command path entry string path class clas this path path this clas clas commandpathentry adds a url to the command path public void add command path string path class clas if imported commands null imported commands new vector if path ends with path path imported commands add element new command path entry path clas addcommandpath importedcommands importedcommands endswith importedcommands addelement commandpathentry remove a ur lfrom the command path public void remove command path string path class clas if imported commands null return for int i 0 i imported commands size i command path entry entry command path entry imported commands element at i if entry path equals path entry clas clas imported commands remove element at i return urlfrom removecommandpath importedcommands importedcommands commandpathentry commandpathentry importedcommands elementat importedcommands removeelementat looks up a command public input stream get command string name if imported commands null string ext name name bsh for int i imported commands size 1 i 0 i command path entry entry command path entry imported commands element at i input stream in entry clas get resource as stream entry path ext name if in null return in if parent null return null else return parent get command name inputstream getcommand importedcommands extname importedcommands commandpathentry commandpathentry importedcommands elementat inputstream getresourceasstream extname getcommand a command is a scripted method or compiled command class implementing a specified method signature commands are loaded from the classpath and may be imported using the import commands method p this method searches the imported commands packages for a script or command object corresponding to the name of the method if it is a script the script is sourced into this namespace and the bsh method for the requested signature is returned if it is a compiled class the class is returned compiled command classes implement static invoke methods p the imported packages are searched in reverse order so that later imports take priority currently only the first object script or class with the appropriate name is checked if another overloaded form is located in another package it will not currently be found this could be fixed p return a bsh method class or null if no such command is found param name is the name of the desired command method param arg types is the signature of the desired command method throws util eval error if load scripted command throws util eval error i e on errors loading a script that was found public object get command string name class arg types interpreter interpreter throws util eval error if interpreter debug interpreter debug get command name bsh class manager bcm interpreter get class manager input stream in get command name if in null return load scripted command in name arg types name interpreter chop leading and change to string class name if path equals class name name else class name path substring 1 replace name class clas bcm class for name class name if clas null return clas if parent null return parent get command name arg types interpreter else return null importcommands bshmethod bshmethod argtypes utilevalerror loadscriptedcommand utilevalerror getcommand argtypes utilevalerror getcommand bshclassmanager getclassmanager inputstream getcommand loadscriptedcommand argtypes classname classname classname classforname classname getcommand argtypes protected bsh method get imported method string name class sig throws util eval error try object imports if imported objects null for int i 0 i imported objects size i object object imported objects element at i class clas object get class method method reflect resolve java method get class manager clas name sig false only static if method null return new bsh method method object try static imports if imported static null for int i 0 i imported static size i class clas class imported static element at i method method reflect resolve java method get class manager clas name sig true only static if method null return new bsh method method null object return null bshmethod getimportedmethod utilevalerror importedobjects importedobjects importedobjects elementat getclass resolvejavamethod getclassmanager onlystatic bshmethod importedstatic importedstatic importedstatic elementat resolvejavamethod getclassmanager onlystatic bshmethod protected variable get imported var string name throws util eval error try object imports if imported objects null for int i 0 i imported objects size i object object imported objects element at i class clas object get class field field reflect resolve java field clas name false only static if field null return new variable name field get type new lhs object field try static imports if imported static null for int i 0 i imported static size i class clas class imported static element at i field field reflect resolve java field clas name true only static if field null return new variable name field get type new lhs field return null getimportedvar utilevalerror importedobjects importedobjects importedobjects elementat getclass resolvejavafield onlystatic gettype importedstatic importedstatic importedstatic elementat resolvejavafield onlystatic gettype load a command script from the input stream and find the bsh method in the target namespace throws util eval error on error in parsing the script or if the the method is not found after parsing the script if we want to support multiple commands in the command path we need to change this to not throw the exception private bsh method load scripted command input stream in string name class arg types string resource path interpreter interpreter throws util eval error try interpreter eval new input stream reader in this resource path catch eval error e here we catch any eval error from the interpreter because we are using it as a tool to load the command not as part of the execution path interpreter debug e to string throw new util eval error error loading script e get message look for the loaded command bsh method meth get method name arg types if meth null throw new util eval error loaded resource resource path had an error or did not contain the correct method return meth bshmethod utilevalerror bshmethod loadscriptedcommand inputstream argtypes resourcepath utilevalerror inputstreamreader resourcepath evalerror evalerror tostring utilevalerror getmessage bshmethod getmethod argtypes utilevalerror resourcepath helper that caches class void cache class string name class c if class cache null class cache new hashtable cache count debug class cache put name c cacheclass classcache classcache cachecount classcache load a class through this namespace taking into account imports the class search will proceed through the parent namespaces if necessary return null if not found public class get class string name throws util eval error class c get class impl name if c null return c else implement the recursion for get class impl if parent null return parent get class name else return null getclass utilevalerror getclassimpl getclassimpl getclass implementation of get class load a class through this namespace taking into account imports p check the cache first if an unqualified name look for imported class or package else try to load absolute name p this method implements caching of unqualified names normally imports qualified names are cached by the bsh class manager unqualified absolute class names e g unpackaged foo are cached too so that we don t go searching through the imports for them each time return null if not found private class get class impl string name throws util eval error class c null check the cache if class cache null c class class cache get name if c null return c unqualified simple non compound name boolean unqualified name name is compound name unqualified name check imported if unqualified name try imported class if c null c get imported class impl name if found as imported also cache it if c null cache class name c return c try absolute c class for name name if c null cache unqualified names to prevent import check again if unqualified name cache class name c return c not found if interpreter debug interpreter debug get class name not found in this return null getclass bshclassmanager getclassimpl utilevalerror classcache classcache unqualifiedname iscompound unqualifiedname getimportedclassimpl cacheclass classforname unqualifiedname cacheclass getclass try to make the name into an imported class this method takes into account only imports class or package found directly in this name space no parent chain private class get imported class impl string name throws util eval error try explicitly imported class e g import foo bar string fullname null if imported classes null fullname string imported classes get name not sure if we should really recurse here for explicitly imported class in parent if fullname null found the full name in imported classes try to make the full imported name class clas class for name fullname handle imported inner class case if clas null imported full name wasn t found as an absolute class if it is compound try to resolve to an inner class maybe this should happen in the bsh class manager if name is compound fullname try clas get name resolver fullname to class catch class not found exception e not a class else if interpreter debug interpreter debug imported unpackaged name not found fullname if found cache the full name in the bsh class manager if clas null should we cache info in not a class case too get class manager cache class info fullname clas return clas else return clas it was explicitly imported but we don t know what it is should we throw an error here return null try imported packages e g import foo bar in reverse order of import give later imports precedence if imported packages null for int i imported packages size 1 i 0 i string s string imported packages element at i name class c class for name s if c null return c bsh class manager bcm get class manager try super import if available note we do this last to allow explicitly imported classes and packages to take priority this method will also throw an error indicating ambiguity if it exists if bcm has super import string s bcm get class name by unq name name if s null return class for name s return null namespace getimportedclassimpl utilevalerror importedclasses importedclasses classforname bshclassmanager iscompound getnameresolver toclass classnotfoundexception bshclassmanager getclassmanager cacheclassinfo importedpackages importedpackages importedpackages elementat classforname bshclassmanager getclassmanager hassuperimport getclassnamebyunqname classforname private class class for name string name return get class manager class for name name classforname getclassmanager classforname implements name source return all variable and method names in this and all parent namespaces public string get all names vector vec new vector get all names aux vec string names new string vec size vec copy into names return names namesource getallnames getallnamesaux copyinto helper for implementing name source protected void get all names aux vector vec enumeration var names variables keys while var names has more elements vec add element var names next element enumeration method names methods keys while method names has more elements vec add element method names next element if parent null parent get all names aux vec namesource getallnamesaux varnames varnames hasmoreelements addelement varnames nextelement methodnames methodnames hasmoreelements addelement methodnames nextelement getallnamesaux vector name source listeners implements name source add a listener who is notified upon changes to names in this space public void add name source listener name source listener listener if name source listeners null name source listeners new vector name source listeners add element listener namesourcelisteners namesource addnamesourcelistener namesource namesourcelisteners namesourcelisteners namesourcelisteners addelement perform import causing the entire classpath to be mapped this can take a while public void do super import throws util eval error get class manager do super import dosuperimport utilevalerror getclassmanager dosuperimport public string to string return name space ns name null super to string ns name super to string is class is class is method method class static null class static class instance null class instance tostring namespace nsname tostring nsname tostring isclass isclass ismethod classstatic classinstance private synchronized void write object java io object output stream s throws io exception clear name resolvers don t know if this is necessary names null s default write object writeobject objectoutputstream ioexception defaultwriteobject invoke a method in this namespace with the specified args and interpreter reference no caller information or call stack is required the method will appear as if called externally from java p see bsh this invoke method string method name object args interpreter interpreter call stack callstack simple node caller info boolean public object invoke method string method name object args interpreter interpreter throws eval error return invoke method method name args interpreter null null invokemethod methodname callstack simplenode callerinfo invokemethod methodname evalerror invokemethod methodname this method simply delegates to this invoke method p see bsh this invoke method string method name object args interpreter interpreter call stack callstack simple node caller info public object invoke method string method name object args interpreter interpreter call stack callstack simple node caller info throws eval error return get this interpreter invoke method method name args interpreter callstack caller info false declared only invokemethod invokemethod methodname callstack simplenode callerinfo invokemethod methodname callstack simplenode callerinfo evalerror getthis invokemethod methodname callerinfo declaredonly clear all cached classes and names public void class loader changed name space changed classloaderchanged namespacechanged clear all cached classes and names public void name space changed class cache null names null namespacechanged classcache import standard packages currently pre import class bsh eval error import class bsh interpreter import package javax swing event import package javax swing import package java awt event import package java awt import package java net import package java util import package java io import package java lang add command path bsh commands get class pre public void load default imports note the resolver looks through these in reverse order per precedence rules so for max efficiency put the most common ones later import class bsh eval error import class bsh interpreter import package javax swing event import package javax swing import package java awt event import package java awt import package java net import package java util import package java io import package java lang add command path bsh commands get class importclass evalerror importclass importpackage importpackage importpackage importpackage importpackage importpackage importpackage importpackage addcommandpath getclass loaddefaultimports importclass evalerror importclass importpackage importpackage importpackage importpackage importpackage importpackage importpackage importpackage addcommandpath getclass this is the factory for name objects which resolve names within this namespace e g to object to class tolhs p this was intended to support name resolver caching allowing name objects to cache info about the resolution of names for performance reasons however this not proven useful yet p we ll leave the caching as it will at least minimize name object creation p this method would be called get name if it weren t already used for the simple name of the name space p this method was public for a time which was a mistake use get instead name get name resolver string ambigname if names null names new hashtable name name name names get ambigname if name null name new name this ambigname names put ambigname name return name toobject toclass getname namespace getnameresolver public int get invocation line simple node node get node if node null return node get line number else return 1 getinvocationline simplenode getnode getlinenumber public string get invocation text simple node node get node if node null return node get text else return invoked from java code getinvocationtext simplenode getnode gettext this is a helper method for working inside of bsh scripts and commands in that context it is impossible to see a class identifier object for what it is attempting to access a method on a class identifier will look like a static method invocation this method is in name space for convenience you don t have to import bsh class identifier to use it public static class identifier to class class identifier ci return ci get target class classidentifier classidentifier namespace classidentifier identifiertoclass classidentifier gettargetclass clear all variables methods and imports from this namespace if this namespace is the root it will be reset to the default imports see load default imports public void clear variables null methods null imported classes null imported packages null imported commands null imported objects null if parent null load default imports class cache null names null loaddefaultimports importedclasses importedpackages importedcommands importedobjects loaddefaultimports classcache import a compiled java object s methods and variables into this namespace when no scripted method command or variable is found locally in this namespace method fields of the object will be checked objects are checked in the order of import with later imports taking precedence p note this impor pattern is becoming common could factor it out into an imported object vector class public void import object object obj if imported objects null imported objects new vector if it exists remove it and add it at the end avoid memory leak if imported objects contains obj imported objects remove obj imported objects add element obj name space changed importedobject importobject importedobjects importedobjects importedobjects importedobjects importedobjects addelement namespacechanged public void import static class clas if imported static null imported static new vector if it exists remove it and add it at the end avoid memory leak if imported static contains clas imported static remove clas imported static add element clas name space changed importstatic importedstatic importedstatic importedstatic importedstatic importedstatic addelement namespacechanged set the package name for classes defined in this namespace subsequent sets override the package void set package string package name this package name package name setpackage packagename packagename packagename string get package if package name null return package name if parent null return parent get package return null getpackage packagename packagename getpackage search bar constructor public search bar final view view boolean temp set layout new box layout this box layout x axis this view view add box create horizontal strut 2 j label label new j label j edit get property view search find add label add box create horizontal strut 12 add find new history text field find find set select all on focus true dimension max find get preferred size max width integer max value find set maximum size max action handler action handler new action handler find add key listener new key handler find add action listener action handler find get document add document listener new document handler insets margin new insets 1 1 1 1 add box create horizontal strut 12 add ignore case new j check box j edit get property search case ignore case add action listener action handler ignore case set margin margin ignore case set request focus enabled false add box create horizontal strut 2 add regexp new j check box j edit get property search regexp regexp add action listener action handler regexp set margin margin regexp set request focus enabled false add box create horizontal strut 2 add hyper search new j check box j edit get property search hypersearch hyper search add action listener action handler hyper search set margin margin hyper search set request focus enabled false update create the timer used by incremental search timer new timer 0 new action listener public void action performed action event evt if incremental search search start search reverse if incremental search search reverse view get buffer get length 0 search reverse not found at all view get status set message and clear j edit get property view status search not found if temp is true hide search bar after user is done with it this temp temp properties changed searchbar searchbar setlayout boxlayout boxlayout x_axis createhorizontalstrut jlabel jlabel jedit getproperty createhorizontalstrut historytextfield setselectallonfocus getpreferredsize max_value setmaximumsize actionhandler actionhandler actionhandler addkeylistener keyhandler addactionlistener actionhandler getdocument adddocumentlistener documenthandler createhorizontalstrut ignorecase jcheckbox jedit getproperty ignorecase addactionlistener actionhandler ignorecase setmargin ignorecase setrequestfocusenabled createhorizontalstrut jcheckbox jedit getproperty addactionlistener actionhandler setmargin setrequestfocusenabled createhorizontalstrut hypersearch jcheckbox jedit getproperty hypersearch addactionlistener actionhandler hypersearch setmargin hypersearch setrequestfocusenabled actionlistener actionperformed actionevent incrementalsearch searchstart searchreverse incrementalsearch searchreverse getbuffer getlength searchreverse getstatus setmessageandclear jedit getproperty propertieschanged public void action performed action event evt if incremental search search start search reverse if incremental search search reverse view get buffer get length 0 search reverse not found at all view get status set message and clear j edit get property view status search not found actionperformed actionevent incrementalsearch searchstart searchreverse incrementalsearch searchreverse getbuffer getlength searchreverse getstatus setmessageandclear jedit getproperty get field method public history text field get field return find getfield historytextfield getfield set hyper search method public void set hyper search boolean hyper search j edit set boolean property view search hypersearch toggle hyper search this hyper search set selected hyper search sethypersearch sethypersearch hypersearch jedit setbooleanproperty hypersearch hypersearch setselected hypersearch update method public void update ignore case set selected search and replace get ignore case regexp set selected search and replace get regexp hyper search set selected j edit get boolean property view search hypersearch toggle ignorecase setselected searchandreplace getignorecase setselected searchandreplace getregexp hypersearch setselected jedit getbooleanproperty properties changed method public void properties changed if temp if close null close new rollover button gui utilities load icon closebox gif close add action listener new action handler close set tool tip text j edit get property view search close tooltip add close else if close null remove close propertieschanged propertieschanged rolloverbutton guiutilities loadicon addactionlistener actionhandler settooltiptext jedit getproperty find method private void find boolean reverse timer stop string text find get text if nothing entered show search and replace dialog box if text length 0 j edit set boolean property search hypersearch toggle hyper search is selected search dialog show search dialog view null search dialog current buffer hyper search else if hyper search is selected if temp view remove tool bar search bar this else find set text null search and replace set search string text search and replace set search file set new current buffer set search and replace hyper search view incremental search else if reverse search and replace get regexp gui utilities error view regexp reverse null return on enter start search from end of current match to find next one int start j edit text area text area view get text area selection s text area get selection at offset text area get caret position if s null start text area get caret position else if reverse start s get start else start s get end if incremental search start reverse not found start from beginning if incremental search reverse view get buffer get length 0 reverse not found at all view get status set message and clear j edit get property view status search not found else inform user search restarted view get status set message and clear j edit get property view status auto wrap beep if beep property set if j edit get boolean property search beep on search auto wrap get toolkit beep gettext jedit setbooleanproperty hypersearch isselected searchdialog showsearchdialog searchdialog current_buffer hypersearch hypersearch isselected removetoolbar searchbar settext searchandreplace setsearchstring searchandreplace setsearchfileset currentbufferset searchandreplace hypersearch searchandreplace getregexp guiutilities jedittextarea textarea gettextarea textarea getselectionatoffset textarea getcaretposition textarea getcaretposition getstart getend incrementalsearch incrementalsearch getbuffer getlength getstatus setmessageandclear jedit getproperty getstatus setmessageandclear jedit getproperty jedit getbooleanproperty beeponsearchautowrap gettoolkit incremental search method private boolean incremental search int start boolean reverse for example if the current fileset is a directory c g will find the next match within that fileset this can be annoying if you have just done an incremental search and want the next occurrence in the current buffer search and replace set search file set new current buffer set search and replace set search string find get text search and replace set reverse search reverse try if search and replace find view view get buffer start false reverse return true catch exception e log log log debug this e invalid regexp ignore return true to avoid annoying beeping while typing a re return true return false incrementalsearch incrementalsearch searchandreplace setsearchfileset currentbufferset searchandreplace setsearchstring gettext searchandreplace setreversesearch searchandreplace getbuffer timer incremental search method private void timer incremental search int start boolean reverse this search start start this search reverse reverse timer stop timer set repeats false timer set initial delay 150 timer start timerincrementalsearch timerincrementalsearch searchstart searchreverse setrepeats setinitialdelay action performed method public void action performed action event evt object source evt get source if source find find false else if source hyper search j edit set boolean property view search hypersearch toggle hyper search is selected update else if source ignore case search and replace set ignore case ignore case is selected else if source regexp search and replace set regexp regexp is selected else if source close view remove tool bar search bar this view get edit pane focus on text area actionperformed actionperformed actionevent getsource hypersearch jedit setbooleanproperty hypersearch isselected ignorecase searchandreplace setignorecase ignorecase isselected searchandreplace setregexp isselected removetoolbar searchbar geteditpane focusontextarea insert update method public void insert update document event evt on insert start search from beginning of current match this will continue to highlight the current match until another match is found if hyper search is selected int start j edit text area text area view get text area selection s text area get selection at offset text area get caret position if s null start text area get caret position else start s get start timer incremental search start false insertupdate insertupdate documentevent hypersearch isselected jedittextarea textarea gettextarea textarea getselectionatoffset textarea getcaretposition textarea getcaretposition getstart timerincrementalsearch remove update method public void remove update document event evt on backspace restart from beginning if hyper search is selected string text find get text if text length 0 don t beep if not found subsequent beeps are very annoying when backspacing an invalid search string if regexp is selected reverse regexp search not supported yet so simulate with restart timer incremental search 0 false else int start j edit text area text area view get text area selection s text area get selection at offset text area get caret position if s null start text area get caret position else start s get start timer incremental search start true removeupdate removeupdate documentevent hypersearch isselected gettext isselected timerincrementalsearch jedittextarea textarea gettextarea textarea getselectionatoffset textarea getcaretposition textarea getcaretposition getstart timerincrementalsearch changed update method public void changed update document event evt changedupdate changedupdate documentevent public void key pressed key event evt switch evt get key code case key event vk escape if temp view remove tool bar search bar this evt consume view get edit pane focus on text area break case key event vk enter if evt is shift down evt consume find true break keypressed keyevent getkeycode keyevent vk_escape removetoolbar searchbar geteditpane focusontextarea keyevent vk_enter isshiftdown edit server constructor edit server string port file super j edit server daemon port file set daemon true this port file port file try on unix set permissions of port file to rw so that on broken unices which give everyone read access to user home dirs people can t see your port file and hence send arbitriary bean shell code your way nasty if operating system is unix new file port file create new file filevfs set permissions port file 0600 bind to any port on localhost accept 2 simultaneous connection attempts before rejecting connections socket new server socket 0 2 inet address get by name 127 0 0 1 auth key math abs new random next int int port socket get local port file writer out new file writer port file try out write b n out write string value of port out write n out write string value of auth key out write n finally out close ok true log log log debug this j edit server started on port socket get local port log log log debug this authorization key is auth key catch io exception io on some windows versions connections to localhost fail if the network is not running to avoid confusing newbies with weird error messages log errors that occur while starting the server as notice not error log log log notice this io editserver editserver portfile jedit portfile setdaemon portfile portfile beanshell operatingsystem isunix portfile createnewfile setpermissions portfile serversocket inetaddress getbyname authkey nextint getlocalport filewriter filewriter portfile valueof valueof authkey jedit getlocalport authkey ioexception run method public void run for if abort return socket client null try client socket accept stop script kiddies from opening the edit server port and just leaving it open as a dos client set so timeout 1000 log log log message this client connected data input stream in new data input stream client get input stream if handle client client in abort true catch exception e if abort log log log error this e abort true finally if client null try client close catch exception e log log log error this e client null setsotimeout datainputstream datainputstream getinputstream handleclient handle client method param restore ignored unless no views are open param parent the client s parent directory param args a list of files null entries are ignored for convinience since j edit 3 2pre7 public static void handle client boolean restore string parent string args handle client restore false false parent args handleclient jedit handleclient handleclient handle client method param restore ignored unless no views are open param new view open a new view param new plain view open a new plain view param parent the client s parent directory param args a list of files null entries are ignored for convinience since j edit 4 2pre1 public static buffer handle client boolean restore boolean new view boolean new plain view string parent string args we have to deal with a huge range of possible border cases here if j edit get first view null coming out of background mode no views open no buffers open if args empty buffer buffer j edit open files null parent args if j edit get buffer count 0 j edit new file null boolean restore files restore j edit get boolean property restore buffer null j edit get boolean property restore cli view view perspective manager load perspective restore files if view null if buffer null buffer j edit get first buffer view j edit new view null buffer else if buffer null view set buffer buffer return buffer else if new plain view no background mode and opening a new view buffer buffer j edit open files null parent args if buffer null buffer j edit get first buffer j edit new view null buffer true return buffer else if new view no background mode and opening a new view buffer buffer j edit open files null parent args if buffer null buffer j edit get first buffer j edit new view j edit get active view buffer false return buffer else no background mode and reusing existing view view view j edit get active view buffer buffer j edit open files view parent args hack done to fix bringing the window to the front at least on windows frame to front doesn t cut it remove the is windows check if it s broken under other o ses too if j edit get boolean property server broken to front view set state java awt frame iconified un iconify using jdk 1 3 api view set state java awt frame normal view request focus view to front return buffer handleclient newview newplainview jedit handleclient newview newplainview jedit getfirstview jedit openfiles jedit getbuffercount jedit newfile restorefiles jedit getbooleanproperty jedit getbooleanproperty perspectivemanager loadperspective restorefiles jedit getfirstbuffer jedit newview setbuffer newplainview jedit openfiles jedit getfirstbuffer jedit newview newview jedit openfiles jedit getfirstbuffer jedit newview jedit getactiveview jedit getactiveview jedit openfiles tofront iswindows oses jedit getbooleanproperty brokentofront setstate setstate requestfocus tofront isok method boolean isok return ok get port method public int get port return socket get local port getport getport getlocalport stop server method void stop server abort true try socket close catch io exception io new file port file delete stopserver stopserver ioexception portfile handle client method private boolean handle client final socket client data input stream in throws exception int key in read int if key auth key log log log error this client wrong authorization key got key expected auth key in close client close return false else reset the timeout client set so timeout 0 log log log debug this client authenticated successfully final string script in readutf log log log debug this script swing utilities invoke later new runnable public void run try name space ns new name space bean shell get name space edit server namespace ns set variable socket client bean shell eval null ns script catch bsh util eval error e log log log error this e finally try bean shell get name space set variable socket null catch bsh util eval error e log log log error this e return true handleclient handleclient datainputstream readint authkey authkey setsotimeout swingutilities invokelater namespace namespace beanshell getnamespace editserver setvariable beanshell utilevalerror beanshell getnamespace setvariable utilevalerror public void run try name space ns new name space bean shell get name space edit server namespace ns set variable socket client bean shell eval null ns script catch bsh util eval error e log log log error this e finally try bean shell get name space set variable socket null catch bsh util eval error e log log log error this e namespace namespace beanshell getnamespace editserver setvariable beanshell utilevalerror beanshell getnamespace setvariable utilevalerror create sequence rule method public static final parser rule create sequence rule int pos match string seq parser rule set delegate byte id return new parser rule seq seq char at 0 pos match seq to char array null 0 null delegate id createsequencerule parserrule createsequencerule posmatch parserruleset parserrule charat posmatch tochararray create regexp sequence rule method public static final parser rule create regexp sequence rule char hash char int pos match string seq parser rule set delegate byte id boolean ignore case throws re exception return new parser rule seq regexp hash char pos match null new re a seq ignore case re reg icase 0 re syntax jedit 0 null delegate id createregexpsequencerule parserrule createregexpsequencerule hashchar posmatch parserruleset ignorecase reexception parserrule hashchar posmatch ignorecase reg_icase re_syntax_jedit create span rule method public static final parser rule create span rule int start pos match string start int end pos match string end parser rule set delegate byte id boolean exclude match boolean no line break boolean no word break boolean no escape int rule action span no line break no line break 0 exclude match exclude match 0 no word break no word break 0 no escape no escape 0 return new parser rule rule action start char at 0 start pos match start to char array null end pos match end to char array delegate id createspanrule parserrule createspanrule startposmatch endposmatch parserruleset excludematch nolinebreak nowordbreak noescape ruleaction nolinebreak no_line_break excludematch exclude_match nowordbreak no_word_break noescape no_escape parserrule ruleaction charat startposmatch tochararray endposmatch tochararray create regexp span rule method public static final parser rule create regexp span rule char hash char int start pos match string start int end pos match string end parser rule set delegate byte id boolean exclude match boolean no line break boolean no word break boolean ignore case boolean no escape throws re exception int rule action span regexp no line break no line break 0 exclude match exclude match 0 no word break no word break 0 no escape no escape 0 return new parser rule rule action hash char start pos match null new re a start ignore case re reg icase 0 re syntax jedit end pos match end to char array delegate id createregexpspanrule parserrule createregexpspanrule hashchar startposmatch endposmatch parserruleset excludematch nolinebreak nowordbreak ignorecase noescape reexception ruleaction nolinebreak no_line_break excludematch exclude_match nowordbreak no_word_break noescape no_escape parserrule ruleaction hashchar startposmatch ignorecase reg_icase re_syntax_jedit endposmatch tochararray createeol span rule method public static final parser rule createeol span rule int pos match string seq parser rule set delegate byte id boolean exclude match int rule action eol span exclude match exclude match 0 no line break return new parser rule rule action seq char at 0 pos match seq to char array null 0 null delegate id createeolspanrule parserrule createeolspanrule posmatch parserruleset excludematch ruleaction eol_span excludematch exclude_match no_line_break parserrule ruleaction charat posmatch tochararray create regexpeol span rule method public static final parser rule create regexpeol span rule char hash char int pos match string seq parser rule set delegate byte id boolean exclude match boolean ignore case throws re exception int rule action eol span regexp exclude match exclude match 0 no line break return new parser rule rule action hash char pos match null new re a seq ignore case re reg icase 0 re syntax jedit 0 null delegate id createregexpeolspanrule parserrule createregexpeolspanrule hashchar posmatch parserruleset excludematch ignorecase reexception ruleaction eol_span excludematch exclude_match no_line_break parserrule ruleaction hashchar posmatch ignorecase reg_icase re_syntax_jedit create mark following rule method public static final parser rule create mark following rule int pos match string seq byte id boolean exclude match int rule action mark following exclude match exclude match 0 return new parser rule rule action seq char at 0 pos match seq to char array null 0 null null id createmarkfollowingrule parserrule createmarkfollowingrule posmatch excludematch ruleaction mark_following excludematch exclude_match parserrule ruleaction charat posmatch tochararray create mark previous rule method public static final parser rule create mark previous rule int pos match string seq byte id boolean exclude match int rule action mark previous exclude match exclude match 0 return new parser rule rule action seq char at 0 pos match seq to char array null 0 null null id createmarkpreviousrule parserrule createmarkpreviousrule posmatch excludematch ruleaction mark_previous excludematch exclude_match parserrule ruleaction charat posmatch tochararray create escape rule method public static final parser rule create escape rule string seq int rule action is escape return new parser rule rule action seq char at 0 0 seq to char array null 0 null null token null createescaperule parserrule createescaperule ruleaction is_escape parserrule ruleaction charat tochararray private members private parser rule int action char hash char int start pos match char start re start regexp int end pos match char end parser rule set delegate byte token this action action this hash char hash char this start pos match start pos match this start start this start regexp start regexp this end pos match end pos match this end end this delegate delegate this token token if this delegate null if action major actions seq this delegate parser rule set get standard rule set token parserrule hashchar startposmatch startregexp endposmatch parserruleset hashchar hashchar startposmatch startposmatch startregexp startregexp endposmatch endposmatch major_actions parserruleset getstandardruleset private vector stack new vector 2 public call stack callstack public call stack public call stack name space namespace push namespace callstack callstack namespace public void clear stack remove all elements removeallelements public void push name space ns stack insert element at ns 0 namespace insertelementat public name space top return get 0 namespace zero based public name space get int depth if depth depth return name space javacode else return name space stack element at depth namespace namespace namespace elementat this is kind of crazy but used by the set name space command zero based public void set int depth name space ns stack set element at ns depth setnamespace namespace setelementat public name space pop if depth 1 throw new interpreter error pop on empty call stack name space top top stack remove element at 0 return top namespace interpretererror callstack namespace removeelementat swap in the value as the new top of the stack and return the old value public name space swap name space new top name space old top name space stack element at 0 stack set element at new top 0 return old top namespace namespace newtop namespace oldtop namespace elementat setelementat newtop oldtop public int depth return stack size public name space to array name space nsa new name space depth stack copy into nsa return nsa namespace toarray namespace namespace copyinto public string to string string buffer sb new string buffer sb append call stack n name space nsa to array for int i 0 i nsa length i sb append t nsa i n return sb to string tostring stringbuffer stringbuffer callstack namespace toarray tostring occasionally we need to freeze the callstack for error reporting purposes etc public call stack copy call stack cs new call stack cs stack vector this stack clone return cs callstack callstack callstack public static boolean start root doc root try file writer out new file writer out out write header package doc packages root specified packages for int i 0 i packages length i process package out packages i out write footer out close return true catch io exception e e print stack trace return false rootdoc filewriter filewriter packagedoc specifiedpackages processpackage ioexception printstacktrace private static void process package writer out package doc pkg throws io exception out write entry href string pkg path pkg name replace out write pkg path out write package summary html title out write pkg name out write title n class doc classes pkg all classes string class names new string classes length for int i 0 i classes length i class names i classes i name arrays sort class names for int i 0 i classes length i process class out pkg path class names i out write entry processpackage packagedoc ioexception pkgpath pkgpath classdoc allclasses classnames classnames classnames processclass pkgpath classnames private static void process class writer out string pkg path string clazz throws io exception out write entry href out write pkg path out write clazz out write html title out write clazz out write title n out write entry processclass pkgpath ioexception pkgpath read lock method public synchronized void read lock this seems to make nested read lock calls work okay but i have no idea if it actually fixes things or not if active readers 0 allow read active readers readers add element thread current thread return waiting readers while allow read try wait catch interrupted exception e waiting readers roll back state log log log error this e return waiting readers active readers readers add element thread current thread readlock readlock readlock activereaders allowread activereaders addelement currentthread waitingreaders allowread interruptedexception waitingreaders waitingreaders activereaders addelement currentthread read unlock method public synchronized void read unlock if active readers 0 throw new internal error unbalanced read lock read unlock calls active readers readers remove element thread current thread notify all readunlock readunlock activereaders internalerror readlock readunlock activereaders removeelement currentthread notifyall write lock method public synchronized void write lock if writer thread null write in progress if thread current thread writer thread same thread lock count return if allow write claim write lock return waiting writers while allow write try wait catch interrupted exception e waiting writers log log log error this e return waiting writers claim write lock writelock writelock writerthread currentthread writerthread lockcount allowwrite claimwritelock waitingwriters allowwrite interruptedexception waitingwriters waitingwriters claimwritelock write unlock method public synchronized void write unlock if active writers 1 lock count 0 throw new internal error unbalanced write lock write unlock calls if thread current thread writer thread throw new internal error write unlock from wrong thread if lock count 0 active writers writer thread null notify all writeunlock writeunlock activewriters lockcount internalerror writelock writeunlock currentthread writerthread internalerror writeunlock lockcount activewriters writerthread notifyall is write locked method public synchronized boolean is write locked debug assert active writers 0 active writers 1 return active writers 1 iswritelocked iswritelocked activewriters activewriters activewriters allow read method private final boolean allow read return thread current thread writer thread waiting writers 0 active writers 0 allowread allowread currentthread writerthread waitingwriters activewriters allow write method private final boolean allow write thread current thread current thread for int i 0 i readers size i if readers element at i current throw new internal error cannot nest write lock inside read lock return active readers 0 active writers 0 allowwrite allowwrite currentthread elementat internalerror writelock readlock activereaders activewriters claim write lock method private void claim write lock active writers debug assert writer thread null writer thread thread current thread debug assert lock count 0 lock count 1 claimwritelock claimwritelock activewriters writerthread writerthread currentthread lockcount lockcount variable string name class type lhs lhs this name name this lhs lhs this type type variable string name object value modifiers modifiers throws util eval error this name class null type value modifiers utilevalerror this constructor is used in class generation variable string name string type descriptor object value modifiers modifiers throws util eval error this name class null type value modifiers this type descriptor type descriptor typedescriptor utilevalerror typedescriptor typedescriptor param value may be null if this variable string name class type object value modifiers modifiers throws util eval error this name name this type type this modifiers modifiers set value value declaration utilevalerror setvalue set the value of the typed variable param value should be an object or wrapped bsh primitive type if value is null the appropriate default value will be set for the type e g false for boolean zero for integer types public void set value object value int context throws util eval error check this value if has modifier final this value null throw new util eval error final variable can t re assign if value null value primitive get default value type if lhs null lhs assign value false strictjava return if type null value types cast object value type context declaration types cast types assignment this value value setvalue utilevalerror hasmodifier utilevalerror getdefaultvalue castobject object get value throws util eval error if lhs null return lhs get value return value getvalue utilevalerror getvalue a type of null means loosely typed variable public class get type return type gettype public class get type return type public string get type descriptor return type descriptor gettype gettypedescriptor typedescriptor public string get type descriptor return type descriptor public modifiers get modifiers return modifiers gettypedescriptor typedescriptor getmodifiers public modifiers get modifiers return modifiers public string get name return name getmodifiers getname public string get name return name public boolean has modifier string name return modifiers null modifiers has modifier name getname hasmodifier hasmodifier public string to string return variable super to string name type type value value lhs lhs tostring tostring syntax style constructor creates a new syntax style param fg color the text color param bg color the background color param font the text font public syntax style color fg color color bg color font font this fg color fg color this bg color bg color this font font syntaxstyle syntaxstyle fgcolor bgcolor syntaxstyle fgcolor bgcolor fgcolor fgcolor bgcolor bgcolor get foreground color method returns the text color public color get foreground color return fg color getforegroundcolor getforegroundcolor fgcolor get background color method returns the background color public color get background color return bg color getbackgroundcolor getbackgroundcolor bgcolor get font method returns the style font public font get font return font getfont getfont get char width method returns the character width of the monospaced font since j edit 4 2pre1 public int get char width return char width getcharwidth jedit getcharwidth charwidth set char width method sets the character width of the monospaced font param char width the character width since j edit 4 2pre1 public void set char width int char width this char width char width setcharwidth charwidth jedit setcharwidth charwidth charwidth charwidth select line range constructor public select line range view view super view j edit get property selectlinerange title true this view view j panel content new j panel new border layout content set border new empty border 12 12 12 0 set content pane content j label label new j label j edit get property selectlinerange caption label set border new empty border 0 0 6 12 content add border layout north label j panel panel create field panel content add border layout center panel panel new j panel panel set layout new box layout panel box layout x axis panel set border new empty border 6 0 0 12 panel add box create glue panel add box create glue ok new j button j edit get property common ok ok add action listener this get root pane set default button ok panel add ok panel add box create horizontal strut 6 cancel new j button j edit get property common cancel cancel add action listener this panel add cancel panel add box create glue content add panel border layout south gui utilities request focus this start field pack set location relative to view set visible true selectlinerange selectlinerange jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane jlabel jlabel jedit getproperty setborder emptyborder borderlayout jpanel createfieldpanel borderlayout jpanel setlayout boxlayout boxlayout x_axis setborder emptyborder createglue createglue jbutton jedit getproperty addactionlistener getrootpane setdefaultbutton createhorizontalstrut jbutton jedit getproperty addactionlistener createglue borderlayout guiutilities requestfocus startfield setlocationrelativeto setvisible ok method public void ok int start line int end line try start line integer parse int start field get text 1 end line integer parse int end field get text 1 catch number format exception nf get toolkit beep return buffer buffer view get buffer if start line 0 end line buffer get line count start line end line get toolkit beep return j edit text area text area view get text area selection s new selection range buffer get line start offset start line buffer get line end offset end line 1 if text area is multiple selection enabled text area add to selection s else text area set selection s text area move caret position buffer get line end offset end line 1 dispose startline endline startline parseint startfield gettext endline parseint endfield gettext numberformatexception gettoolkit getbuffer startline endline getlinecount startline endline gettoolkit jedittextarea textarea gettextarea getlinestartoffset startline getlineendoffset endline textarea ismultipleselectionenabled textarea addtoselection textarea setselection textarea movecaretposition getlineendoffset endline cancel method public void cancel dispose action performed method public void action performed action event evt object source evt get source if source ok ok else if source cancel cancel actionperformed actionperformed actionevent getsource create field panel method private j panel create field panel grid bag layout layout new grid bag layout j panel panel new j panel layout grid bag constraints cons new grid bag constraints cons insets new insets 0 0 6 12 cons gridwidth cons gridheight 1 cons gridx cons gridy 0 cons fill grid bag constraints both j label label new j label j edit get property selectlinerange start swing constants right layout set constraints label cons panel add label start field new j text field 10 cons gridx 1 cons weightx 1 0f layout set constraints start field cons panel add start field label new j label j edit get property selectlinerange end swing constants right cons gridx 0 cons weightx 0 0f cons gridy 1 layout set constraints label cons panel add label end field new j text field 10 cons gridx 1 cons weightx 1 0f layout set constraints end field cons panel add end field return panel createfieldpanel jpanel createfieldpanel gridbaglayout gridbaglayout jpanel jpanel gridbagconstraints gridbagconstraints gridbagconstraints jlabel jlabel jedit getproperty swingconstants setconstraints startfield jtextfield setconstraints startfield startfield jlabel jedit getproperty swingconstants setconstraints endfield jtextfield setconstraints endfield endfield public static void main string args string java version system get property java version if java version compare to 1 3 0 system err println you are running java version java version system err println this installer requires java 1 3 or later system exit 1 if args length 0 new swing install else if args length 1 args 0 equals text new console install else if args length 2 args 0 equals auto new non interactive install args else system err println usage system err println java jar installer jar system err println java jar installer jar text system err println java jar installer jar auto install dir unix script dir unix man dir system err println text parameter starts installer in text only mode system err println auto parameter starts installer in non interactive mode javaversion getproperty javaversion compareto javaversion swinginstall consoleinstall noninteractiveinstall public install props new properties try input stream in get class get resource as stream installer install props props load in in close catch io exception io system err println error loading install props io print stack trace buf new byte 32768 inputstream getclass getresourceasstream ioexception printstacktrace public string get property string name return props get property name getproperty getproperty public int get integer property string name try return integer parse int props get property name catch exception e return 1 getintegerproperty parseint getproperty public void copy input stream in string outfile progress progress throws io exception file out file new file outfile operating system get operating system mkdirs out file get parent buffered output stream out new buffered output stream new file output stream out file int count for count in read buf 0 math min in available buf length if count 1 count 0 break out write buf 0 count if progress null progress advance count in close out close inputstream ioexception outfile operatingsystem getoperatingsystem outfile getparent bufferedoutputstream bufferedoutputstream fileoutputstream outfile general option pane constructor public general option pane super general generaloptionpane generaloptionpane init method protected void init line separator string line seps j edit get property line sep unix j edit get property line sep windows j edit get property line sep mac line separator new j combo box line seps string line sep j edit get property buffer line separator system get property line separator if n equals line sep line separator set selected index 0 else if r n equals line sep line separator set selected index 1 else if r equals line sep line separator set selected index 2 add component j edit get property options general line separator line separator default file encoding string encodings misc utilities get encodings arrays sort encodings new misc utilities stringi case compare encoding new j combo box encodings encoding set editable true encoding set selected item j edit get property buffer encoding system get property file encoding add component j edit get property options general encoding encoding auto detect encoding encoding autodetect new j check box j edit get property options general encoding autodetect encoding autodetect set selected j edit get boolean property buffer encoding autodetect add component encoding autodetect check mod status on focus string mod check options j edit get property options general check mod status nothing j edit get property options general check mod status prompt j edit get property options general check mod status reload check mod status new j combo box mod check options if j edit get boolean property auto reload check mod status set selected index 2 else if j edit get boolean property auto reload dialog check mod status set selected index 1 else check mod status set selected index 0 add component j edit get property options general check mod status check mod status recent file list size recent files new j text field j edit get property options general recent files recent files set text j edit get property recent files add component j edit get property options general recent files recent files sort recent file list sort recent new j check box j edit get property options general sort recent sort recent set selected j edit get boolean property sort recent add component sort recent save caret positions save caret new j check box j edit get property options general save caret save caret set selected j edit get boolean property save caret add component save caret persistent markers persistent markers new j check box j edit get property options general persistent markers persistent markers set selected j edit get boolean property persistent markers add component persistent markers session management restore new j check box j edit get property options general restore restore set selected j edit get boolean property restore restore add action listener new action listener public void action performed action event evt restorecli set enabled restore is selected add component restore restorecli new j check box j edit get property options general restore cli restorecli set selected j edit get boolean property restore cli restorecli set enabled restore is selected add component restorecli sort buffers sort buffers new j check box j edit get property options general sort buffers sort buffers set selected j edit get boolean property sort buffers sort buffers add action listener new action listener public void action performed action event evt sort by name set enabled sort buffers is selected add component sort buffers sort buffers by names sort by name new j check box j edit get property options general sort by name sort by name set selected j edit get boolean property sort by name sort by name set enabled sort buffers is selected add component sort by name two stage save two stage save new j check box j edit get property options general two stage save two stage save set selected j edit get boolean property two stage save add component two stage save confirm save all confirm save all new j check box j edit get property options general confirm save all confirm save all set selected j edit get boolean property confirm save all add component confirm save all strip trailing eol strip trailingeol new j check box j edit get property options general strip trailingeol strip trailingeol set selected j edit get boolean property strip trailingeol add component strip trailingeol _init _init lineseps jedit getproperty linesep jedit getproperty linesep jedit getproperty linesep lineseparator jcombobox lineseps linesep jedit getproperty lineseparator getproperty linesep lineseparator setselectedindex linesep lineseparator setselectedindex linesep lineseparator setselectedindex addcomponent jedit getproperty lineseparator lineseparator miscutilities getencodings miscutilities stringicasecompare jcombobox seteditable setselecteditem jedit getproperty getproperty addcomponent jedit getproperty encodingautodetect jcheckbox jedit getproperty encodingautodetect encodingautodetect setselected jedit getbooleanproperty encodingautodetect addcomponent encodingautodetect modcheckoptions jedit getproperty checkmodstatus jedit getproperty checkmodstatus jedit getproperty checkmodstatus checkmodstatus jcombobox modcheckoptions jedit getbooleanproperty autoreload checkmodstatus setselectedindex jedit getbooleanproperty autoreloaddialog checkmodstatus setselectedindex checkmodstatus setselectedindex addcomponent jedit getproperty checkmodstatus checkmodstatus recentfiles jtextfield jedit getproperty recentfiles recentfiles settext jedit getproperty recentfiles addcomponent jedit getproperty recentfiles recentfiles sortrecent jcheckbox jedit getproperty sortrecent sortrecent setselected jedit getbooleanproperty sortrecent addcomponent sortrecent savecaret jcheckbox jedit getproperty savecaret savecaret setselected jedit getbooleanproperty savecaret addcomponent savecaret persistentmarkers jcheckbox jedit getproperty persistentmarkers persistentmarkers setselected jedit getbooleanproperty persistentmarkers addcomponent persistentmarkers jcheckbox jedit getproperty setselected jedit getbooleanproperty addactionlistener actionlistener actionperformed actionevent setenabled isselected addcomponent jcheckbox jedit getproperty setselected jedit getbooleanproperty setenabled isselected addcomponent sortbuffers jcheckbox jedit getproperty sortbuffers sortbuffers setselected jedit getbooleanproperty sortbuffers sortbuffers addactionlistener actionlistener actionperformed actionevent sortbyname setenabled sortbuffers isselected addcomponent sortbuffers sortbyname jcheckbox jedit getproperty sortbyname sortbyname setselected jedit getbooleanproperty sortbyname sortbyname setenabled sortbuffers isselected addcomponent sortbyname twostagesave jcheckbox jedit getproperty twostagesave twostagesave setselected jedit getbooleanproperty twostagesave addcomponent twostagesave confirmsaveall jcheckbox jedit getproperty confirmsaveall confirmsaveall setselected jedit getbooleanproperty confirmsaveall addcomponent confirmsaveall striptrailingeol jcheckbox jedit getproperty striptrailingeol striptrailingeol setselected jedit getbooleanproperty striptrailingeol addcomponent striptrailingeol restore add action listener new action listener public void action performed action event evt restorecli set enabled restore is selected addactionlistener actionlistener actionperformed actionevent setenabled isselected sort buffers add action listener new action listener public void action performed action event evt sort by name set enabled sort buffers is selected sortbuffers addactionlistener actionlistener actionperformed actionevent sortbyname setenabled sortbuffers isselected save method protected void save string line sep null switch line separator get selected index case 0 line sep n break case 1 line sep r n break case 2 line sep r break j edit set property buffer line separator line sep j edit set property buffer encoding string encoding get selected item j edit set boolean property buffer encoding autodetect encoding autodetect is selected switch check mod status get selected index case 0 j edit set boolean property auto reload dialog false j edit set boolean property auto reload false break case 1 j edit set boolean property auto reload dialog true j edit set boolean property auto reload false break case 2 j edit set boolean property auto reload dialog true j edit set boolean property auto reload true break j edit set property recent files recent files get text j edit set boolean property sort recent sort recent is selected j edit set boolean property save caret save caret is selected j edit set boolean property persistent markers persistent markers is selected j edit set boolean property restore restore is selected j edit set boolean property restore cli restorecli is selected j edit set boolean property sort buffers sort buffers is selected j edit set boolean property sort by name sort by name is selected j edit set boolean property two stage save two stage save is selected j edit set boolean property confirm save all confirm save all is selected j edit set boolean property strip trailingeol strip trailingeol is selected _save _save linesep lineseparator getselectedindex linesep linesep linesep jedit setproperty lineseparator linesep jedit setproperty getselecteditem jedit setbooleanproperty encodingautodetect encodingautodetect isselected checkmodstatus getselectedindex jedit setbooleanproperty autoreloaddialog jedit setbooleanproperty autoreload jedit setbooleanproperty autoreloaddialog jedit setbooleanproperty autoreload jedit setbooleanproperty autoreloaddialog jedit setbooleanproperty autoreload jedit setproperty recentfiles recentfiles gettext jedit setbooleanproperty sortrecent sortrecent isselected jedit setbooleanproperty savecaret savecaret isselected jedit setbooleanproperty persistentmarkers persistentmarkers isselected jedit setbooleanproperty isselected jedit setbooleanproperty isselected jedit setbooleanproperty sortbuffers sortbuffers isselected jedit setbooleanproperty sortbyname sortbyname isselected jedit setbooleanproperty twostagesave twostagesave isselected jedit setbooleanproperty confirmsaveall confirmsaveall isselected jedit setbooleanproperty striptrailingeol striptrailingeol isselected floating window container constructor public floating window container dockable window manager dockable window manager boolean clone this dockable window manager dockable window manager this clone clone set icon image gui utilities get plugin icon set default close operation dispose on close box caption new box box layout x axis caption add menu new rollover button gui utilities load icon toolbar menu gif menu add mouse listener new mouse handler box separator box new box box layout y axis separator box add box create vertical strut 3 separator box add new j separator j separator horizontal separator box add box create vertical strut 3 caption add separator box get content pane add border layout north caption floatingwindowcontainer floatingwindowcontainer dockablewindowmanager dockablewindowmanager dockablewindowmanager dockablewindowmanager seticonimage guiutilities getpluginicon setdefaultcloseoperation dispose_on_close boxlayout x_axis rolloverbutton guiutilities loadicon toolbarmenu addmouselistener mousehandler separatorbox boxlayout y_axis separatorbox createverticalstrut separatorbox jseparator jseparator separatorbox createverticalstrut separatorbox getcontentpane borderlayout register method public void register dockable window manager entry entry this entry entry set title entry title get content pane add border layout center entry win pack gui utilities load geometry this entry factory name set visible true dockablewindowmanager settitle getcontentpane borderlayout guiutilities loadgeometry setvisible remove method public void remove dockable window manager entry entry entry container null dispose dockablewindowmanager unregister method public void unregister dockable window manager entry entry dispose dockablewindowmanager show method public void show final dockable window manager entry entry if entry null dispose else to front request focus swing utilities invoke later new runnable public void run if entry win instanceof default focus component default focus component entry win focus on default component else entry win request default focus dockablewindowmanager tofront requestfocus swingutilities invokelater defaultfocuscomponent defaultfocuscomponent focusondefaultcomponent requestdefaultfocus public void run if entry win instanceof default focus component default focus component entry win focus on default component else entry win request default focus defaultfocuscomponent defaultfocuscomponent focusondefaultcomponent requestdefaultfocus is visible method public boolean is visible dockable window manager entry entry return true isvisible isvisible dockablewindowmanager dispose method public void dispose gui utilities save geometry this entry factory name entry container null entry win null super dispose guiutilities savegeometry get dockable window manager method public dockable window manager get dockable window manager return dockable window manager getdockablewindowmanager dockablewindowmanager getdockablewindowmanager dockablewindowmanager get minimum size method public dimension get minimum size return new dimension 0 0 getminimumsize getminimumsize public void mouse pressed mouse event evt if popup null popup is visible popup set visible false else popup dockable window manager create popup menu floating window container this entry factory name clone gui utilities show popup menu popup menu menu getx menu gety menu get height false mousepressed mouseevent isvisible setvisible dockablewindowmanager createpopupmenu floatingwindowcontainer guiutilities showpopupmenu getheight public class indent fold handler extends fold handler public indent fold handler super indent indentfoldhandler foldhandler indentfoldhandler get fold level method returns the fold level of the specified line param buffer the buffer in question param line index the line index param seg a segment the fold handler can use to obtain any text from the buffer if necessary return the fold level of the specified line since j edit 4 0pre1 public int get fold level buffer buffer int line index segment seg int tab size buffer get tab size buffer get line text line index seg int offset seg offset int count seg count int whitespace 0 boolean seen non white space false loop for int i 0 i count i switch seg array offset i case whitespace break case t whitespace tab size whitespace tab size break default seen non white space true break loop if seen non white space empty line inherit previous line s fold level if line index 0 return buffer get fold level line index 1 else return 0 return whitespace getfoldlevel lineindex jedit getfoldlevel lineindex tabsize gettabsize getlinetext lineindex seennonwhitespace tabsize tabsize seennonwhitespace seennonwhitespace lineindex getfoldlevel lineindex class bsh arguments extends simple node bsh arguments int id super id bsharguments simplenode bsharguments this node holds a set of arguments for a method invocation or constructor call note arguments are not currently allowed to be void disallowing voi ds here was an easy way to support the throwing of a more descriptive error message on use of an undefined argument to a method call very common if it ever turns out that we need to support that for some reason we ll have to re evaluate how we get meta information about the arguments in the various invoke methods that take object we could either pass bsh arguments down to overloaded forms of the methods or throw an exception subtype including the argument position back up where the error message would be compounded public object get arguments call stack callstack interpreter interpreter throws eval error evaluate each child object args new object jjt get num children for int i 0 i args length i args i simple node jjt get child i eval callstack interpreter if args i primitive void throw new eval error undefined argument simple node jjt get child i get text this callstack return args voids bsharguments getarguments callstack evalerror jjtgetnumchildren simplenode jjtgetchild evalerror simplenode jjtgetchild gettext sets if the request can be aborted public void set abortable boolean abortable thread thread thread current thread if thread instanceof work thread work thread thread set abortable abortable setabortable currentthread workthread workthread setabortable sets the status text param status the status text public void set status string status thread thread thread current thread if thread instanceof work thread work thread thread set status status setstatus currentthread workthread workthread setstatus sets the progress value param value the progress value public void set progress value int value thread thread thread current thread if thread instanceof work thread work thread thread set progress value value setprogressvalue currentthread workthread workthread setprogressvalue sets the maximum progress value param value the progress value public void set progress maximum int value thread thread thread current thread if thread instanceof work thread work thread thread set progress maximum value setprogressmaximum currentthread workthread workthread setprogressmaximum get expand on input method returns if abbreviations should be expanded after the user finishes typing a word public static boolean get expand on input return expand on input getexpandoninput getexpandoninput expandoninput set expand on input method sets if abbreviations should be expanded after the user finishes typing a word param expand on input if true typing a non alphanumeric character will automatically attempt to expand the current abbrev public static void set expand on input boolean expand on input abbrevs expand on input expand on input setexpandoninput expandoninput setexpandoninput expandoninput expandoninput expandoninput expand abbrev method expands the abbrev at the caret position in the specified view param view the view param add if true and abbrev not found will ask user if it should be added since j edit 2 6pre4 public static boolean expand abbrev view view boolean add figure out some minor things buffer buffer view get buffer j edit text area text area view get text area if buffer is editable view get toolkit beep return false int line text area get caret line int line start buffer get line start offset line int caret text area get caret position string line text buffer get line text line if line text length 0 if add view get toolkit beep return false int pos caret line start if pos 0 if add view get toolkit beep return false we reuse the pp vector to save time pp remove all elements int word start string abbrev handle abbrevs of the form abbrev pos1 pos2 pos3 if line text char at pos 1 word start line text index of word start text utilities find word start line text word start buffer get string property no word sep abbrev line text substring word start pos 1 positional parameters will be inserted where 1 2 3 occurs in the expansion int last index 0 for int i 0 i abbrev length i if abbrev char at i pp add element abbrev substring last index i last index i 1 pp add element abbrev substring last index the first element of pp is the abbrev itself abbrev string pp element at 0 pp remove element at 0 handle ordinary abbrevs else word start text utilities find word start line text pos 1 buffer get string property no word sep abbrev line text substring word start pos expansion expand expand abbrev buffer get mode get name abbrev buffer get boolean property no tabs buffer get tab size 0 pp maybe show add abbrev dialog if expand null if add new add abbrev dialog view abbrev return false insert the expansion else buffer remove line start word start pos word start int whitespace buffer insert indented line start word start expand text int newlines count newlines expand text expand caret position if expand caret position 1 text area set caret position line start word start expand caret position newlines whitespace if expand pos param count pp size view get status set message and clear j edit get property view status incomplete abbrev new integer new integer pp size new integer expand pos param count return true expandabbrev jedit expandabbrev getbuffer jedittextarea textarea gettextarea iseditable gettoolkit textarea getcaretline linestart getlinestartoffset textarea getcaretposition linetext getlinetext linetext gettoolkit linestart gettoolkit removeallelements wordstart linetext charat wordstart linetext indexof wordstart textutilities findwordstart linetext wordstart getstringproperty nowordsep linetext wordstart lastindex charat addelement lastindex lastindex addelement lastindex elementat removeelementat wordstart textutilities findwordstart linetext getstringproperty nowordsep linetext wordstart expandabbrev getmode getname getbooleanproperty notabs gettabsize addabbrevdialog linestart wordstart wordstart insertindented linestart wordstart countnewlines caretposition caretposition textarea setcaretposition linestart wordstart caretposition posparamcount getstatus setmessageandclear jedit getproperty posparamcount get global abbrevs method returns the global abbreviation set since j edit 2 3pre1 public static hashtable get global abbrevs if loaded load return global abbrevs getglobalabbrevs jedit getglobalabbrevs globalabbrevs set global abbrevs method sets the global abbreviation set param global abbrevs the new global abbrev set since j edit 2 3pre1 public static void set global abbrevs hashtable global abbrevs abbrevs changed true abbrevs global abbrevs global abbrevs setglobalabbrevs globalabbrevs jedit setglobalabbrevs globalabbrevs abbrevschanged globalabbrevs globalabbrevs get mode abbrevs method returns the mode specific abbreviation set since j edit 2 3pre1 public static hashtable get mode abbrevs if loaded load return modes getmodeabbrevs jedit getmodeabbrevs set mode abbrevs method sets the mode specific abbreviation set param modes the new mode abbrev set since j edit 2 3pre1 public static void set mode abbrevs hashtable modes abbrevs changed true abbrevs modes modes setmodeabbrevs jedit setmodeabbrevs abbrevschanged add global abbrev method adds an abbreviation to the global abbreviation list param abbrev the abbreviation param expansion the expansion since j edit 3 1pre1 public static void add global abbrev string abbrev string expansion if loaded load global abbrevs put abbrev expansion abbrevs changed true addglobalabbrev jedit addglobalabbrev globalabbrevs abbrevschanged add mode abbrev method adds a mode specific abbrev param mode the edit mode param abbrev the abbrev param expansion the expansion since j edit 3 1pre1 public static void add mode abbrev string mode string abbrev string expansion if loaded load hashtable mode abbrevs hashtable modes get mode if mode abbrevs null mode abbrevs new hashtable modes put mode mode abbrevs mode abbrevs put abbrev expansion abbrevs changed true addmodeabbrev jedit addmodeabbrev modeabbrevs modeabbrevs modeabbrevs modeabbrevs modeabbrevs abbrevschanged save method static void save j edit set boolean property view expand on input expand on input string settings j edit get settings directory if abbrevs changed settings null file file1 new file misc utilities construct path settings abbrevs save file file2 new file misc utilities construct path settings abbrevs if file2 exists file2 last modified abbrevs mod time log log log warning abbrevs class file2 changed on disk will not save abbrevs else j edit backup settings file file2 try save abbrevs new output stream writer new file output stream file1 encoding file2 delete file1 rename to file2 catch exception e log log log error abbrevs class error while saving file1 log log log error abbrevs class e abbrevs mod time file2 last modified jedit setbooleanproperty expandoninput expandoninput jedit getsettingsdirectory abbrevschanged miscutilities constructpath miscutilities constructpath lastmodified abbrevsmodtime jedit backupsettingsfile saveabbrevs outputstreamwriter fileoutputstream renameto abbrevsmodtime lastmodified private abbrevs load method private static void load global abbrevs new hashtable modes new hashtable string settings j edit get settings directory if settings null file file new file misc utilities construct path settings abbrevs abbrevs mod time file last modified try load abbrevs new input stream reader new file input stream file encoding loaded true catch file not found exception fnf catch exception e log log log error abbrevs class error while loading file log log log error abbrevs class e only load global abbrevs if user abbrevs file could not be loaded if loaded try load abbrevs new input stream reader abbrevs class get resource as stream default abbrevs encoding catch exception e log log log error abbrevs class error while loading default abbrevs log log log error abbrevs class e loaded true globalabbrevs jedit getsettingsdirectory miscutilities constructpath abbrevsmodtime lastmodified loadabbrevs inputstreamreader fileinputstream filenotfoundexception loadabbrevs inputstreamreader getresourceasstream count newlines method private static int count newlines string s int end int counter 0 for int i 0 i end i if s char at i n counter return counter countnewlines countnewlines charat expand abbrev method private static expansion expand abbrev string mode string abbrev int soft tab size vector pp if loaded load try mode specific abbrevs first string expand null hashtable mode abbrevs hashtable modes get mode if mode abbrevs null expand string mode abbrevs get abbrev if expand null expand string global abbrevs get abbrev if expand null return null else return new expansion expand soft tab size pp expandabbrev expandabbrev softtabsize modeabbrevs modeabbrevs modeabbrevs globalabbrevs softtabsize load abbrevs method private static void load abbrevs reader in throws exception buffered reader in new buffered reader in try hashtable current abbrevs global abbrevs string line while line in read line null int index line index of if line length 0 continue else if line starts with index 1 if line equals global current abbrevs global abbrevs else string mode line substring 1 line length 1 current abbrevs hashtable modes get mode if current abbrevs null current abbrevs new hashtable modes put mode current abbrevs else if index 1 current abbrevs put line substring 0 index line substring index 1 finally in close loadabbrevs loadabbrevs _in bufferedreader bufferedreader _in currentabbrevs globalabbrevs readline indexof startswith currentabbrevs globalabbrevs currentabbrevs currentabbrevs currentabbrevs currentabbrevs currentabbrevs save abbrevs method private static void save abbrevs writer out throws exception buffered writer out new buffered writer out string line sep system get property line separator write global abbrevs out write global out write line sep save abbrevs out global abbrevs write mode abbrevs enumeration keys modes keys enumeration values modes elements while keys has more elements out write out write string keys next element out write out write line sep save abbrevs out hashtable values next element out close saveabbrevs saveabbrevs _out bufferedwriter bufferedwriter _out linesep getproperty linesep saveabbrevs globalabbrevs hasmoreelements nextelement linesep saveabbrevs nextelement save abbrevs method private static void save abbrevs writer out hashtable abbrevs throws exception string line sep system get property line separator enumeration keys abbrevs keys enumeration values abbrevs elements while keys has more elements string abbrev string keys next element out write abbrev out write out write values next element to string out write line sep saveabbrevs saveabbrevs linesep getproperty hasmoreelements nextelement nextelement tostring linesep expansion constructor expansion string text int soft tab size vector pp string buffer buf new string buffer boolean backslash false for int i 0 i text length i char ch text char at i handle backslash if backslash backslash false if ch caret position buf length else if ch n buf append n line count else if ch t if soft tab size 0 buf append t else for int j 0 j soft tab size j buf append else buf append ch else if ch backslash true handle else if ch if i text length 1 ch text char at i 1 if character is digit ch ch 0 i int pos ch 0 pos param count math max pos pos param count n is 1 indexed but vector contents is zero indexed if pos pp size buf append pp element at pos 1 else key will be key for example buf append else buf append at end is literal else buf append ch this text buf to string softtabsize stringbuffer stringbuffer charat caretposition linecount softtabsize softtabsize charat isdigit posparamcount posparamcount elementat tostring char indexed input stream input stream str int index if str instanceof buffered input stream br buffered input stream str else br new buffered input stream str buffer increment next if index 0 move index charindexedinputstream inputstream bufferedinputstream bufferedinputstream bufferedinputstream buffer_increment private boolean next if end 1 return false end closer to end try if index 1 br reset int i br read br mark bufsize if i 1 end 1 cached out of bounds return false cached char i index 1 catch io exception e e print stack trace cached out of bounds return false return true out_of_bounds ioexception printstacktrace out_of_bounds public char char at int index if index 0 return cached else if index end return out of bounds else if index 1 return look behind 0 else if index 2 return look behind 1 else if index 2 return out of bounds else if index bufsize allocate more space in the buffer try while bufsize index bufsize buffer increment br reset br mark bufsize br skip index 1 catch io exception e else if this index index try br reset br skip index 1 catch io exception e char ch out of bounds try int i br read this index index 1 this index is index of next pos relative to char at 0 if i 1 set flag that next should fail next time end index return ch ch char i catch io exception ie return ch charat out_of_bounds lookbehind lookbehind out_of_bounds buffer_increment ioexception ioexception out_of_bounds charat ioexception public boolean move int index move read position index clicks from char at 0 boolean retval true while retval index 0 retval next return retval charat public boolean is valid return cached out of bounds isvalid out_of_bounds get path method returns the full path name of this plugin s jar file public string get path return path getpath getpath get cache path method returns the full path name of this plugin s summary file the summary file is used to store certain information which allows loading of the plugin s resources and core class to be deferred until the plugin is first used as long as a plugin is using the j edit 4 2 plugin api no extra effort is required to take advantage of the summary cache public string get cache path return cache path getcachepath jedit getcachepath cachepath get file method returns a file pointing to the plugin jar public file get file return file getfile getfile get class loader method returns the plugin s class loader public jar class loader get class loader return class loader getclassloader jarclassloader getclassloader classloader get zip file method returns the plugin s jar file opening it if necessary since j edit 4 2pre1 public synchronized zip file get zip file throws io exception if zip file null log log log debug this opening path zip file new zip file path return zip file getzipfile jedit zipfile getzipfile ioexception zipfile zipfile zipfile zipfile get actions method deprecated call get action set instead public action set get actions return get action set getactions getactionset actionset getactions getactionset get action set method returns the plugin s action set for the j edit action context link j edit get action context these actions are loaded from the code actions xml code file see link action set since j edit 4 2pre1 public action set get action set return actions getactionset jedit jedit getactioncontext actionset jedit actionset getactionset get browser action set method returns the plugin s action set for the file system browser action context link org gjt sp jedit browser vfs browser get action context these actions are loaded from the code browser actions xml code file see link action set since j edit 4 2pre1 public action set get browser action set return browser actions getbrowseractionset vfsbrowser getactioncontext actionset jedit actionset getbrowseractionset browseractions check dependencies method returns true if all dependencies are satisified false otherwise also if dependencies are not satisfied the plugin is marked as broken public boolean check dependencies if plugin null return true int i 0 boolean ok true boolean optional false string name plugin get class name string dep while dep j edit get property plugin name depend i null if dep starts with optional optional true dep dep substring optional length int index dep index of if index 1 log log log error this name has an invalid dependency dep ok false continue string what dep substring 0 index string arg dep substring index 1 if what equals jdk if optional misc utilities compare strings system get property java version arg false 0 string args arg system get property java version j edit plugin error path plugin error dep jdk args ok false else if what equals jedit if arg length 11 log log log error this invalid j edit version number arg ok false if optional misc utilities compare strings j edit get build arg false 0 string needs misc utilities build to version arg string args needs j edit get version j edit plugin error path plugin error dep jedit args ok false else if what equals plugin int index2 arg index of if index2 1 log log log error this name has an invalid dependency dep version is missing ok false continue string plugin name arg substring 0 index2 string need version arg substring index2 1 string curr version j edit get property plugin plugin name version edit plugin plugin j edit get plugin plugin name if plugin null if optional string args need version plugin name j edit plugin error path plugin error dep plugin no version args ok false else if misc utilities compare strings curr version need version false 0 if optional string args need version plugin name curr version j edit plugin error path plugin error dep plugin args ok false else if plugin instanceof edit plugin broken if optional string args plugin name j edit plugin error path plugin error dep plugin broken args ok false else pluginjar jar plugin get pluginjar jar these require me add path we require these add jar get path else if what equals class if optional try class loader load class arg false catch exception e string args arg j edit plugin error path plugin error dep class args ok false else log log log error this name has unknown dependency dep ok false each jar file listed in the plugin s jars property needs to know that we need them string jars j edit get property plugin plugin get class name jars if jars null string dir misc utilities get parent of path path string tokenizer st new string tokenizer jars while st has more tokens string jar path misc utilities construct path dir st next token pluginjar jar j edit get pluginjar jar path if jar null string args jar path j edit plugin error path plugin error missing jar args ok false else we require these add jar path jar these require me add path if ok break plugin return ok checkdependencies checkdependencies getclassname jedit getproperty startswith indexof miscutilities comparestrings getproperty getproperty jedit pluginerror jedit miscutilities comparestrings jedit getbuild miscutilities buildtoversion jedit getversion jedit pluginerror indexof pluginname needversion currversion jedit getproperty pluginname editplugin jedit getplugin pluginname needversion pluginname jedit pluginerror miscutilities comparestrings currversion needversion needversion pluginname currversion jedit pluginerror editplugin pluginname jedit pluginerror getpluginjar theserequireme werequirethese getpath classloader loadclass jedit pluginerror jedit getproperty getclassname miscutilities getparentofpath stringtokenizer stringtokenizer hasmoretokens jarpath miscutilities constructpath nexttoken jedit getpluginjar jarpath jarpath jedit pluginerror werequirethese jarpath theserequireme breakplugin get dependent plugins method returns an array of all plugins that depend on this one since j edit 4 2pre2 public string get dependent plugins return string these require me to array new string these require me size getdependentplugins jedit getdependentplugins theserequireme toarray theserequireme get plugin method returns the plugin core class for this jar file note that if the plugin has not been activated this will return an instance of link edit plugin deferred if you need the actual plugin core class instance call link activate plugin first since j edit 4 2pre1 public edit plugin get plugin return plugin getplugin editplugin activateplugin jedit editplugin getplugin activate plugin method loads the plugin core class does nothing if the plugin core class has already been loaded this method might be called on startup depending on what properties are set see link edit plugin start this method is thread safe since j edit 4 2pre1 public void activate plugin synchronized this if activated recursive call return activated true if plugin instanceof edit plugin deferred return string class name plugin get class name try class clazz class loader load class class name false int modifiers clazz get modifiers if modifier is interface modifiers modifier is abstract modifiers edit plugin class is assignable from clazz log log log error this plugin has properties but does not extend edit plugin class name break plugin return plugin edit plugin clazz new instance plugin jar edit plugin jar this catch throwable t break plugin log log log error this error while starting plugin class name log log log error this t string args t to string j edit plugin error path plugin error start error args return if j edit is main thread swing utilities is event dispatch thread start plugin else for thread safety start plugin later edit bus send new plugin update this plugin update activated false activateplugin editplugin jedit activateplugin editplugin classname getclassname classloader loadclass classname getmodifiers isinterface isabstract editplugin isassignablefrom editplugin classname breakplugin editplugin newinstance editplugin breakplugin classname tostring jedit pluginerror jedit ismainthread swingutilities iseventdispatchthread startplugin startpluginlater editbus pluginupdate pluginupdate activate if necessary method should be called after a new plugin is installed since j edit 4 2pre2 public void activate plugin if necessary if plugin instanceof edit plugin deferred plugin null return string class name plugin get class name default for plugins that don t specify this property ie 4 1 style plugins is to load them on startup string activate j edit get property plugin class name activate if activate null 4 1 plugin if j edit is main thread break plugin j edit plugin error path plugin error not 42 null else activate plugin else 4 2 plugin if at least one property listed here is true load the plugin boolean load false string tokenizer st new string tokenizer activate while st has more tokens string prop st next token boolean value j edit get boolean property prop if value log log log debug this activating class name because of prop load true break if load activate plugin activateifnecessary jedit activatepluginifnecessary editplugin classname getclassname jedit getproperty classname jedit ismainthread breakplugin jedit pluginerror activateplugin stringtokenizer stringtokenizer hasmoretokens nexttoken jedit getbooleanproperty classname activateplugin deactivate plugin method unloads the plugin core class does nothing if the plugin core class has not been loaded this method can only be called from the awt event dispatch thread see edit plugin stop since j edit 4 2pre3 public void deactivate plugin boolean exit if activated return if exit buffers retain a reference to the fold handler in question and the easiest way to handle fold handler unloading is this buffer buffer j edit get first buffer while buffer null if buffer get fold handler null buffer get fold handler get class get class loader class loader buffer set fold handler new dummy fold handler buffer buffer get next if plugin null plugin instanceof edit plugin broken if plugin instanceof eb plugin edit bus remove from bus eb plugin plugin try plugin stop catch throwable t log log log error this error while stopping plugin log log log error this t plugin new edit plugin deferred plugin get class name plugin jar edit plugin jar this edit bus send new plugin update this plugin update deactivated exit if exit see if this is a 4 1 style plugin string activate j edit get property plugin plugin get class name activate if activate null break plugin j edit plugin error path plugin error not 42 null activated false deactivateplugin editplugin jedit deactivateplugin jedit getfirstbuffer getfoldhandler getfoldhandler getclass getclassloader classloader setfoldhandler dummyfoldhandler getnext editplugin ebplugin editbus removefrombus ebplugin editplugin getclassname editplugin editbus pluginupdate pluginupdate jedit getproperty getclassname breakplugin jedit pluginerror get dockablesuri method returns the location of the plugin s code dockables xml code file since j edit 4 2pre1 public url get dockablesuri return dockablesuri getdockablesuri jedit getdockablesuri get servicesuri method returns the location of the plugin s code services xml code file since j edit 4 2pre1 public url get servicesuri return servicesuri getservicesuri jedit getservicesuri to string method public string to string if plugin null return path else return path class plugin get class name tostring tostring getclassname get plugin cache method static plugin cache entry get plugin cache pluginjar plugin string jar cache path plugin get cache path if jar cache path null return null data input stream din null try plugin cache entry cache new plugin cache entry cache plugin plugin cache mod time plugin get file last modified din new data input stream new buffered input stream new file input stream jar cache path if cache read din return cache else returns false with outdated cache return null catch file not found exception fnf return null catch io exception io log log log error pluginjar class io return null finally try if din null din close catch io exception io log log log error pluginjar class io getplugincache plugincacheentry getplugincache jarcachepath getcachepath jarcachepath datainputstream plugincacheentry plugincacheentry modtime getfile lastmodified datainputstream bufferedinputstream fileinputstream jarcachepath filenotfoundexception ioexception ioexception set plugin cache method static void set plugin cache pluginjar plugin plugin cache entry cache string jar cache path plugin get cache path if jar cache path null return log log log debug pluginjar class writing jar cache path data output stream dout null try dout new data output stream new buffered output stream new file output stream jar cache path cache write dout dout close catch io exception io log log log error pluginjar class io try if dout null dout close catch io exception io2 log log log error pluginjar class io2 new file jar cache path delete setplugincache setplugincache plugincacheentry jarcachepath getcachepath jarcachepath jarcachepath dataoutputstream dataoutputstream bufferedoutputstream fileoutputstream jarcachepath ioexception ioexception jarcachepath pluginjar constructor pluginjar file file this path file get path string jar cache dir j edit getjar cache directory if jar cache dir null cache path misc utilities construct path jar cache dir file get name summary this file file class loader new jar class loader this actions new action set getpath jarcachedir jedit getjarcachedirectory jarcachedir cachepath miscutilities constructpath jarcachedir getname classloader jarclassloader actionset init method void init boolean initialized false plugin cache entry cache get plugin cache this if cache null load cache cache class loader activate initialized true else try cache generate cache if cache null set plugin cache this cache class loader activate initialized true catch io exception io log log log error this cannot load plugin path log log log error this io string args io to string j edit plugin error path plugin error load error args uninit false plugincacheentry getplugincache loadcache classloader generatecache setplugincache classloader ioexception tostring jedit pluginerror uninit method void uninit boolean exit deactivate plugin exit if exit iterator iter we require these iterator while iter has next string path string iter next pluginjar jar j edit get pluginjar path if jar null jar these require me remove this path class loader deactivate bean shell reset class manager if actions null j edit get action context remove action set actions if browser actions null vfs browser get action context remove action set browser actions dockable window manager unload dockable windows this service manager unload services this j edit remove plugin props properties try if zip file null zip file close zip file null catch io exception io log log log error this io deactivateplugin werequirethese hasnext jedit getpluginjar theserequireme classloader beanshell resetclassmanager jedit getactioncontext removeactionset browseractions vfsbrowser getactioncontext removeactionset browseractions dockablewindowmanager unloaddockablewindows servicemanager unloadservices jedit removepluginprops zipfile zipfile zipfile ioexception get classes method string get classes return classes getclasses getclasses actions present but not core class method private void actions present but not core class log log log warning this get path has an actions xml but no plugin core class actions set label missing plugin core class actionspresentbutnotcoreclass actionspresentbutnotcoreclass getpath setlabel load cache method private void load cache plugin cache entry cache classes cache classes this should be before dockables are initialized if cache cached properties null properties cache cached properties j edit add plugin props cache cached properties if cache actionsuri null cache cached action names null actions new action set this cache cached action names cache cached action toggle flags cache actionsuri if cache browser actionsuri null cache cached browser action names null browser actions new action set this cache cached browser action names cache cached browser action toggle flags cache browser actionsuri vfs browser get action context add action set browser actions if cache dockablesuri null cache cached dockable names null cache cached dockable action flags null dockablesuri cache dockablesuri dockable window manager cache dockable windows this cache cached dockable names cache cached dockable action flags if actions size 0 j edit add action set actions if cache servicesuri null cache cached services null servicesuri cache servicesuri for int i 0 i cache cached services length i service manager descriptor d cache cached services i service manager register service d if cache plugin class null check if a plugin with the same name is already loaded if j edit get plugin cache plugin class null j edit plugin error path plugin error already loaded null uninit false else string label j edit get property plugin cache plugin class name actions set label j edit get property action set plugin new string label plugin new edit plugin deferred cache plugin class plugin jar edit plugin jar this else if actions size 0 actions present but not core class loadcache loadcache plugincacheentry cachedproperties cachedproperties jedit addpluginprops cachedproperties cachedactionnames actionset cachedactionnames cachedactiontoggleflags browseractionsuri cachedbrowseractionnames browseractions actionset cachedbrowseractionnames cachedbrowseractiontoggleflags browseractionsuri vfsbrowser getactioncontext addactionset browseractions cacheddockablenames cacheddockableactionflags dockablewindowmanager cachedockablewindows cacheddockablenames cacheddockableactionflags jedit addactionset cachedservices cachedservices servicemanager cachedservices servicemanager registerservice pluginclass jedit getplugin pluginclass jedit pluginerror jedit getproperty pluginclass setlabel jedit getproperty editplugin pluginclass editplugin actionspresentbutnotcoreclass generate cache method private plugin cache entry generate cache throws io exception properties new properties linked list classes new linked list zip file zip file get zip file list plugins new linked list plugin cache entry cache new plugin cache entry cache mod time file last modified cache cached properties new properties enumeration entries zip file entries while entries has more elements zip entry entry zip entry entries next element string name entry get name string lname name to lower case if lname equals actions xml cache actionsuri class loader get resource name else if lname equals browser actions xml cache browser actionsuri class loader get resource name else if lname equals dockables xml dockablesuri class loader get resource name cache dockablesuri dockablesuri else if lname equals services xml servicesuri class loader get resource name cache servicesuri servicesuri else if lname ends with props input stream in class loader get resource as stream name properties load in in close else if name ends with class string class name misc utilities file to class name if class name ends with plugin plugins add class name classes add class name cache cached properties properties j edit add plugin props properties this classes cache classes string classes to array new string classes size string label null iterator iter plugins iterator while iter has next string class name string iter next string label j edit get property plugin class name name string version j edit get property plugin class name version if label null version null log log log warning this ignoring class name else cache plugin class class name check if a plugin with the same name is already loaded if j edit get plugin class name null j edit plugin error path plugin error already loaded null return null else plugin new edit plugin deferred class name plugin jar edit plugin jar this label label break if cache actionsuri null actions new action set this null null cache actionsuri actions load cache cached action names actions get cacheable action names cache cached action toggle flags new boolean cache cached action names length for int i 0 i cache cached action names length i cache cached action toggle flags i j edit get boolean property cache cached action names i toggle if cache browser actionsuri null browser actions new action set this null null cache browser actionsuri browser actions load vfs browser get action context add action set browser actions cache cached browser action names browser actions get cacheable action names cache cached browser action toggle flags new boolean cache cached browser action names length for int i 0 i cache cached browser action names length i cache cached browser action toggle flags i j edit get boolean property cache cached browser action names i toggle if dockablesuri null dockable window manager load dockable windows this dockablesuri cache if actions size 0 if label null actions set label j edit get property action set plugin new string label else actions present but not core class j edit add action set actions if servicesuri null service manager load services this servicesuri cache return cache generatecache plugincacheentry generatecache ioexception linkedlist linkedlist zipfile zipfile getzipfile linkedlist plugincacheentry plugincacheentry modtime lastmodified cachedproperties zipfile hasmoreelements zipentry zipentry nextelement getname tolowercase classloader getresource browseractionsuri classloader getresource classloader getresource classloader getresource endswith inputstream classloader getresourceasstream endswith classname miscutilities filetoclass classname endswith classname classname cachedproperties jedit addpluginprops toarray hasnext classname _label jedit getproperty classname jedit getproperty classname _label classname pluginclass classname jedit getplugin classname jedit pluginerror editplugin classname editplugin _label actionset cachedactionnames getcacheableactionnames cachedactiontoggleflags cachedactionnames cachedactionnames cachedactiontoggleflags jedit getbooleanproperty cachedactionnames browseractionsuri browseractions actionset browseractionsuri browseractions vfsbrowser getactioncontext addactionset browseractions cachedbrowseractionnames browseractions getcacheableactionnames cachedbrowseractiontoggleflags cachedbrowseractionnames cachedbrowseractionnames cachedbrowseractiontoggleflags jedit getbooleanproperty cachedbrowseractionnames dockablewindowmanager loaddockablewindows setlabel jedit getproperty actionspresentbutnotcoreclass jedit addactionset servicemanager loadservices start plugin method private void start plugin try plugin start catch throwable t break plugin log log log error pluginjar this error while starting plugin plugin get class name log log log error pluginjar this t string args t to string j edit plugin error path plugin error start error args if plugin instanceof eb plugin if j edit get property plugin plugin get class name activate null old plugins expected j edit 4 1 style behavior where a properties changed was sent after plugins were started eb component plugin handle message new org gjt sp jedit msg properties changed null edit bus add to bus eb plugin plugin buffers retain a reference to the fold handler in question and the easiest way to handle fold handler loading is this buffer buffer j edit get first buffer while buffer null fold handler handler fold handler get fold handler buffer get string property folding null before loaded if buffer get fold handler null handler null handler buffer get fold handler buffer set fold handler handler buffer buffer get next startplugin startplugin breakplugin getclassname tostring jedit pluginerror ebplugin jedit getproperty getclassname jedit propertieschanged ebcomponent handlemessage propertieschanged editbus addtobus ebplugin jedit getfirstbuffer foldhandler foldhandler getfoldhandler getstringproperty getfoldhandler getfoldhandler setfoldhandler getnext start plugin later method private void start plugin later swing utilities invoke later new runnable public void run if activated return start plugin startpluginlater startpluginlater swingutilities invokelater startplugin public void run if activated return start plugin startplugin break plugin method private void break plugin plugin new edit plugin broken plugin get class name plugin jar edit plugin jar this remove action sets dockables etc so that user doesn t see the broken plugin uninit false but we want properties to hang around j edit add plugin props properties breakplugin breakplugin editplugin getclassname editplugin jedit addpluginprops read method public boolean read data input stream din throws io exception int cache magic din read int if cache magic magic return false string cache build read string din if cache build equals j edit get build return false long cache mod time din read long if cache mod time mod time return false actionsuri readuri din cached action names read string array din cached action toggle flags read boolean array din browser actionsuri readuri din cached browser action names read string array din cached browser action toggle flags read boolean array din dockablesuri readuri din cached dockable names read string array din cached dockable action flags read boolean array din servicesuri readuri din int len din read int if len 0 cached services null else cached services new service manager descriptor len for int i 0 i len i service manager descriptor d new service manager descriptor read string din read string din null plugin cached services i d classes read string array din cached properties read map din plugin class read string din return true datainputstream ioexception cachemagic readint cachemagic cachebuild readstring cachebuild jedit getbuild cachemodtime readlong cachemodtime modtime cachedactionnames readstringarray cachedactiontoggleflags readbooleanarray browseractionsuri cachedbrowseractionnames readstringarray cachedbrowseractiontoggleflags readbooleanarray cacheddockablenames readstringarray cacheddockableactionflags readbooleanarray readint cachedservices cachedservices servicemanager servicemanager servicemanager readstring readstring cachedservices readstringarray cachedproperties readmap pluginclass readstring write method public void write data output stream dout throws io exception dout write int magic write string dout j edit get build dout write long mod time write string dout actionsuri write string array dout cached action names write boolean array dout cached action toggle flags write string dout browser actionsuri write string array dout cached browser action names write boolean array dout cached browser action toggle flags write string dout dockablesuri write string array dout cached dockable names write boolean array dout cached dockable action flags write string dout servicesuri if cached services null dout write int 0 else dout write int cached services length for int i 0 i cached services length i write string dout cached services i clazz write string dout cached services i name write string array dout classes write map dout cached properties write string dout plugin class dataoutputstream ioexception writeint writestring jedit getbuild writelong modtime writestring writestringarray cachedactionnames writebooleanarray cachedactiontoggleflags writestring browseractionsuri writestringarray cachedbrowseractionnames writebooleanarray cachedbrowseractiontoggleflags writestring writestringarray cacheddockablenames writebooleanarray cacheddockableactionflags writestring cachedservices writeint writeint cachedservices cachedservices writestring cachedservices writestring cachedservices writestringarray writemap cachedproperties writestring pluginclass read string method private string read string data input stream din throws io exception int len din read int if len 0 return null char str new char len for int i 0 i len i str i din read char return new string str readstring readstring datainputstream ioexception readint readchar readuri method private url readuri data input stream din throws io exception string str read string din if str null return null else return new url str datainputstream ioexception readstring read string array method private string read string array data input stream din throws io exception int len din read int if len 0 return null string str new string len for int i 0 i len i str i read string din return str readstringarray readstringarray datainputstream ioexception readint readstring read boolean array method private boolean read boolean array data input stream din throws io exception int len din read int if len 0 return null boolean bools new boolean len for int i 0 i len i bools i din read boolean return bools readbooleanarray readbooleanarray datainputstream ioexception readint readboolean read map method private properties read map data input stream din throws io exception properties return value new properties int count din read int for int i 0 i count i string key read string din string value read string din if value null value return value put key value return return value readmap readmap datainputstream ioexception returnvalue readint readstring readstring returnvalue returnvalue write string method private void write string data output stream dout object obj throws io exception if obj null dout write int 0 else string str obj to string dout write int str length dout write chars str writestring writestring dataoutputstream ioexception writeint tostring writeint writechars write string array method private void write string array data output stream dout string str throws io exception if str null dout write int 0 else dout write int str length for int i 0 i str length i write string dout str i writestringarray writestringarray dataoutputstream ioexception writeint writeint writestring write boolean array method private void write boolean array data output stream dout boolean bools throws io exception if bools null dout write int 0 else dout write int bools length for int i 0 i bools length i dout write boolean bools i writebooleanarray writebooleanarray dataoutputstream ioexception writeint writeint writeboolean write map method private void write map data output stream dout map map throws io exception dout write int map size iterator iter map key set iterator while iter has next string key string iter next write string dout key write string dout map get key writemap writemap dataoutputstream ioexception writeint keyset hasnext writestring writestring public view registers view view super view j edit get property view registers title true j panel content new j panel new border layout content set border new empty border 12 12 12 12 set content pane content j panel panel new j panel new border layout panel set border new empty border 0 12 0 0 j label label new j label j edit get property view registers register label set border new empty border 0 0 3 0 panel add border layout north label default list model register model new default list model register list new j list register model register list set selection mode list selection model single selection register list set cell renderer new renderer registers register registers registers get registers int index 0 for int i 0 i registers length i registers register reg registers i if reg null continue string value reg to string if value null value length 0 continue register model add element new character char i if register model get size 0 register model add element j edit get property view registers none panel add border layout center new j scroll pane register list content add border layout west panel panel new j panel new border layout panel set border new empty border 0 12 0 0 label new j label j edit get property view registers contents label set border new empty border 0 0 3 0 panel add border layout north label content text area new j text area 10 80 content text area set editable false panel add border layout center new j scroll pane content text area content add border layout center panel panel new j panel panel set layout new box layout panel box layout x axis panel set border new empty border 12 0 0 0 close new j button j edit get property common close close add action listener new action handler panel add box create glue panel add close panel add box create glue get root pane set default button close content add border layout south panel register list add list selection listener new list handler register list set selected index index pack set location relative to view set visible true viewregisters jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane jpanel jpanel borderlayout setborder emptyborder jlabel jlabel jedit getproperty setborder emptyborder borderlayout defaultlistmodel registermodel defaultlistmodel registerlist jlist registermodel registerlist setselectionmode listselectionmodel single_selection registerlist setcellrenderer getregisters tostring registermodel addelement registermodel getsize registermodel addelement jedit getproperty borderlayout jscrollpane registerlist borderlayout jpanel borderlayout setborder emptyborder jlabel jedit getproperty setborder emptyborder borderlayout contenttextarea jtextarea contenttextarea seteditable borderlayout jscrollpane contenttextarea borderlayout jpanel setlayout boxlayout boxlayout x_axis setborder emptyborder jbutton jedit getproperty addactionlistener actionhandler createglue createglue getrootpane setdefaultbutton borderlayout registerlist addlistselectionlistener listhandler registerlist setselectedindex setlocationrelativeto setvisible enhanced dialog implementation public void ok dispose enhanceddialog public void cancel dispose public component get list cell renderer component j list list object value int index boolean is selected boolean cell has focus super get list cell renderer component list value index is selected cell has focus if value instanceof character char name character value char value string label if name n label n else if name t label t else if name label j edit get property view registers clipboard else if name label j edit get property view registers selection else label string value of char name set text label return this getlistcellrenderercomponent jlist isselected cellhasfocus getlistcellrenderercomponent isselected cellhasfocus charvalue jedit getproperty jedit getproperty valueof settext public void action performed action event evt if evt get source close cancel actionperformed actionevent getsource public void value changed list selection event evt object value register list get selected value if value instanceof character return char name character value char value registers register reg registers get register name if reg null return content text area set text reg to string content text area set caret position 0 valuechanged listselectionevent registerlist getselectedvalue charvalue getregister contenttextarea settext tostring contenttextarea setcaretposition public bsh package declaration int id super id bshpackagedeclaration public object eval call stack callstack interpreter interpreter throws eval error bsh ambiguous name name bsh ambiguous name jjt get child 0 name space namespace callstack top namespace set package name text import the package we re in by default namespace import package name text return primitive void callstack evalerror bshambiguousname bshambiguousname jjtgetchild namespace setpackage importpackage protected jjt parser state jjtree new jjt parser state boolean retain comments false public void set retain comments boolean b retain comments b jjtparserstate jjtparserstate retaincomments setretaincomments retaincomments void jjtree open node scope node n simple node n first token get token 1 jjtreeopennodescope simplenode firsttoken gettoken void jjtree close node scope node n simple node n last token get token 0 jjtreeclosenodescope simplenode lasttoken gettoken re initialize the input stream and token source void re init input reader in re init in reinitinput reinit public simple node pop node if jjtree node arity 0 number of child nodes return simple node jjtree pop node else return null simplenode popnode nodearity simplenode popnode explicitly re initialize just the token reader this seems to be necessary to avoid certain looping errors when reading bogus input see interpreter void re init token input reader in jj input stream re init in jj input stream get end line jj input stream get end column reinittokeninput jj_input_stream reinit jj_input_stream getendline jj_input_stream getendcolumn public static void main string args throws io exception parse exception boolean print false int i 0 if args 0 equals p i print true for i args length i reader in new file reader args i parser parser new parser in parser set retain comments true while parser line eof if print system out println parser pop node ioexception parseexception filereader setretaincomments popnode lookahead for the enhanced for statement expect for and then see whether we hit or a first boolean is regular for statement int cur tok 1 token tok tok get token cur tok if tok kind for return false tok get token cur tok if tok kind lparen return false while true tok get token cur tok switch tok kind case colon return false case semicolon return true case eof return false isregularforstatement curtok gettoken curtok gettoken curtok gettoken curtok generate a parse exception with the specified message pointing to the current token the auto generated parser generate parse exception method does not provide line number info therefore we do this parse exception create parse exception string message token errortok token int line errortok begin line column errortok begin column string mess errortok kind 0 token image 0 errortok image return new parse exception parse error at line line column column message parseexception generateparseexception parseexception createparseexception beginline begincolumn tokenimage parseexception final public boolean line throws parse exception switch jj ntk 1 jj ntk jj ntk case 0 jj consume token 0 interpreter debug end of file if true return true break default if jj 2 1 1 block statement if true return false else jj consume token 1 throw new parse exception throw new error missing return statement in function parseexception jj_ntk jj_ntk jj_ntk jj_consume_token jj_2_1 blockstatement jj_consume_token parseexception the java language grammar starts here gather modifiers for a class method or field i lookahead is true then we are being called as part of a lookahead and we should not enforce any rules otherwise we validate based on context field method class final public modifiers modifiers int context boolean lookahead throws parse exception modifiers mods null label 1 while true switch jj ntk 1 jj ntk jj ntk case abstract case final case native case private case protected case public case static case strictfp case synchronized case transient case volatile break default break label 1 switch jj ntk 1 jj ntk jj ntk case private jj consume token private break case protected jj consume token protected break case public jj consume token public break case synchronized jj consume token synchronized break case final jj consume token final break case native jj consume token native break case transient jj consume token transient break case volatile jj consume token volatile break case abstract jj consume token abstract break case static jj consume token static break case strictfp jj consume token strictfp break default jj consume token 1 throw new parse exception if lookahead try if mods null mods new modifiers mods add modifier context get token 0 image catch illegal state exception e if true throw create parse exception e get message if true return mods throw new error missing return statement in function parseexception label_1 jj_ntk jj_ntk jj_ntk label_1 jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token parseexception addmodifier gettoken illegalstateexception createparseexception getmessage final public void class declaration throws parse exception bgen jjtree class declaration bsh class declaration jjtn000 new bsh class declaration jjtclassdeclaration boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 modifiers mods token name int num interfaces try mods modifiers modifiers class false switch jj ntk 1 jj ntk jj ntk case class jj consume token class break case interface jj consume token interface jjtn000 is interface true break default jj consume token 1 throw new parse exception name jj consume token identifier switch jj ntk 1 jj ntk jj ntk case extends jj consume token extends ambiguous name jjtn000 extend true break default switch jj ntk 1 jj ntk jj ntk case implements jj consume token implements num interfaces name list jjtn000 num interfaces num interfaces break default block jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 modifiers mods jjtn000 name name image catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 classdeclaration parseexception classdeclaration bshclassdeclaration bshclassdeclaration opennodescope jjtreeopennodescope numinterfaces jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token isinterface jj_consume_token parseexception jj_consume_token jj_ntk jj_ntk jj_ntk jj_consume_token ambiguousname jj_ntk jj_ntk jj_ntk jj_consume_token numinterfaces namelist numinterfaces numinterfaces closenodescope jjtreeclosenodescope clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void method declaration throws parse exception bgen jjtree method declaration bsh method declaration jjtn000 new bsh method declaration jjtmethoddeclaration boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 token t null modifiers mods int count try mods modifiers modifiers method false jjtn000 modifiers mods if jj 2 2 2147483647 t jj consume token identifier jjtn000 name t image else switch jj ntk 1 jj ntk jj ntk case boolean case byte case char case double case float case int case long case short case void case identifier return type t jj consume token identifier jjtn000 name t image break default jj consume token 1 throw new parse exception formal parameters switch jj ntk 1 jj ntk jj ntk case throws jj consume token throws count name list jjtn000 num throws count break default switch jj ntk 1 jj ntk jj ntk case lbrace block break case semicolon jj consume token semicolon break default jj consume token 1 throw new parse exception catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 methoddeclaration parseexception methoddeclaration bshmethoddeclaration bshmethoddeclaration opennodescope jjtreeopennodescope jj_2_2 jj_consume_token jj_ntk jj_ntk jj_ntk returntype jj_consume_token jj_consume_token parseexception formalparameters jj_ntk jj_ntk jj_ntk jj_consume_token namelist numthrows jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token parseexception clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void package declaration throws parse exception bgen jjtree package declaration bsh package declaration jjtn000 new bsh package declaration jjtpackagedeclaration boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token package ambiguous name catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 packagedeclaration parseexception packagedeclaration bshpackagedeclaration bshpackagedeclaration opennodescope jjtreeopennodescope jj_consume_token ambiguousname clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void import declaration throws parse exception bgen jjtree import declaration bsh import declaration jjtn000 new bsh import declaration jjtimportdeclaration boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 token s null token t null try if jj 2 3 3 switch jj ntk 1 jj ntk jj ntk case static s jj consume token static break default jj consume token import ambiguous name switch jj ntk 1 jj ntk jj ntk case dot t jj consume token dot jj consume token star break default jj consume token semicolon jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 if s null jjtn000 static import true if t null jjtn000 import package true else switch jj ntk 1 jj ntk jj ntk case import jj consume token import jj consume token star jj consume token semicolon jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 super import true break default jj consume token 1 throw new parse exception catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 importdeclaration parseexception importdeclaration bshimportdeclaration bshimportdeclaration opennodescope jjtreeopennodescope jj_2_3 jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token ambiguousname jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token closenodescope jjtreeclosenodescope staticimport importpackage jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token closenodescope jjtreeclosenodescope superimport jj_consume_token parseexception clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void variable declarator throws parse exception bgen jjtree variable declarator bsh variable declarator jjtn000 new bsh variable declarator jjtvariabledeclarator boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 token t try t jj consume token identifier switch jj ntk 1 jj ntk jj ntk case assign jj consume token assign variable initializer break default jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 name t image catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 variabledeclarator parseexception variabledeclarator bshvariabledeclarator bshvariabledeclarator opennodescope jjtreeopennodescope jj_consume_token jj_ntk jj_ntk jj_ntk jj_consume_token variableinitializer closenodescope jjtreeclosenodescope clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void variable initializer throws parse exception switch jj ntk 1 jj ntk jj ntk case lbrace array initializer break case boolean case byte case char case double case false case float case int case long case new case null case short case true case void case integer literal case floating point literal case character literal case string literal case identifier case lparen case bang case tilde case incr case decr case plus case minus expression break default jj consume token 1 throw new parse exception variableinitializer parseexception jj_ntk jj_ntk jj_ntk arrayinitializer integer_literal floating_point_literal character_literal string_literal jj_consume_token parseexception final public void array initializer throws parse exception bgen jjtree array initializer bsh array initializer jjtn000 new bsh array initializer jjtarrayinitializer boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token lbrace switch jj ntk 1 jj ntk jj ntk case boolean case byte case char case double case false case float case int case long case new case null case short case true case void case integer literal case floating point literal case character literal case string literal case identifier case lparen case lbrace case bang case tilde case incr case decr case plus case minus variable initializer label 2 while true if jj 2 4 2 else break label 2 jj consume token comma variable initializer break default switch jj ntk 1 jj ntk jj ntk case comma jj consume token comma break default jj consume token rbrace catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 arrayinitializer parseexception arrayinitializer bsharrayinitializer bsharrayinitializer opennodescope jjtreeopennodescope jj_consume_token jj_ntk jj_ntk jj_ntk integer_literal floating_point_literal character_literal string_literal variableinitializer label_2 jj_2_4 label_2 jj_consume_token variableinitializer jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void formal parameters throws parse exception bgen jjtree formal parameters bsh formal parameters jjtn000 new bsh formal parameters jjtformalparameters boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token lparen switch jj ntk 1 jj ntk jj ntk case boolean case byte case char case double case float case int case long case short case identifier formal parameter label 3 while true switch jj ntk 1 jj ntk jj ntk case comma break default break label 3 jj consume token comma formal parameter break default jj consume token rparen catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 formalparameters parseexception formalparameters bshformalparameters bshformalparameters opennodescope jjtreeopennodescope jj_consume_token jj_ntk jj_ntk jj_ntk formalparameter label_3 jj_ntk jj_ntk jj_ntk label_3 jj_consume_token formalparameter jj_consume_token clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void formal parameter throws parse exception bgen jjtree formal parameter bsh formal parameter jjtn000 new bsh formal parameter jjtformalparameter boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 token t try if jj 2 5 2 type t jj consume token identifier jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 name t image else switch jj ntk 1 jj ntk jj ntk case identifier t jj consume token identifier jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 name t image break default jj consume token 1 throw new parse exception catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 formalparameter parseexception formalparameter bshformalparameter bshformalparameter opennodescope jjtreeopennodescope jj_2_5 jj_consume_token closenodescope jjtreeclosenodescope jj_ntk jj_ntk jj_ntk jj_consume_token closenodescope jjtreeclosenodescope jj_consume_token parseexception clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void type throws parse exception bgen jjtree type bsh type jjtn000 new bsh type jjttype boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try switch jj ntk 1 jj ntk jj ntk case boolean case byte case char case double case float case int case long case short primitive type break case identifier ambiguous name break default jj consume token 1 throw new parse exception label 4 while true if jj 2 6 2 else break label 4 jj consume token lbracket jj consume token rbracket jjtn000 add array dimension catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 parseexception bshtype bshtype opennodescope jjtreeopennodescope jj_ntk jj_ntk jj_ntk primitivetype ambiguousname jj_consume_token parseexception label_4 jj_2_6 label_4 jj_consume_token jj_consume_token addarraydimension clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void return type throws parse exception bgen jjtree return type bsh return type jjtn000 new bsh return type jjtreturntype boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try switch jj ntk 1 jj ntk jj ntk case void jj consume token void jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 is void true break case boolean case byte case char case double case float case int case long case short case identifier type break default jj consume token 1 throw new parse exception catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 returntype parseexception returntype bshreturntype bshreturntype opennodescope jjtreeopennodescope jj_ntk jj_ntk jj_ntk jj_consume_token closenodescope jjtreeclosenodescope isvoid jj_consume_token parseexception clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void primitive type throws parse exception bgen jjtree primitive type bsh primitive type jjtn000 new bsh primitive type jjtprimitivetype boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try switch jj ntk 1 jj ntk jj ntk case boolean jj consume token boolean jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 type boolean type break case char jj consume token char jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 type character type break case byte jj consume token byte jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 type byte type break case short jj consume token short jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 type short type break case int jj consume token int jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 type integer type break case long jj consume token long jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 type long type break case float jj consume token float jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 type float type break case double jj consume token double jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 type double type break default jj consume token 1 throw new parse exception finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 primitivetype parseexception primitivetype bshprimitivetype bshprimitivetype opennodescope jjtreeopennodescope jj_ntk jj_ntk jj_ntk jj_consume_token closenodescope jjtreeclosenodescope jj_consume_token closenodescope jjtreeclosenodescope jj_consume_token closenodescope jjtreeclosenodescope jj_consume_token closenodescope jjtreeclosenodescope jj_consume_token closenodescope jjtreeclosenodescope jj_consume_token closenodescope jjtreeclosenodescope jj_consume_token closenodescope jjtreeclosenodescope jj_consume_token closenodescope jjtreeclosenodescope jj_consume_token parseexception closenodescope jjtreeclosenodescope final public void ambiguous name throws parse exception bgen jjtree ambiguous name bsh ambiguous name jjtn000 new bsh ambiguous name jjtambiguousname boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 token t string buffer s try t jj consume token identifier s new string buffer t image label 5 while true if jj 2 7 2 else break label 5 jj consume token dot t jj consume token identifier s append t image jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 text s to string finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 ambiguousname parseexception ambiguousname bshambiguousname bshambiguousname opennodescope jjtreeopennodescope stringbuffer jj_consume_token stringbuffer label_5 jj_2_7 label_5 jj_consume_token jj_consume_token closenodescope jjtreeclosenodescope tostring closenodescope jjtreeclosenodescope final public int name list throws parse exception int count 0 ambiguous name count label 6 while true switch jj ntk 1 jj ntk jj ntk case comma break default break label 6 jj consume token comma ambiguous name count if true return count throw new error missing return statement in function namelist parseexception ambiguousname label_6 jj_ntk jj_ntk jj_ntk label_6 jj_consume_token ambiguousname final public void expression throws parse exception if jj 2 8 2147483647 assignment else switch jj ntk 1 jj ntk jj ntk case boolean case byte case char case double case false case float case int case long case new case null case short case true case void case integer literal case floating point literal case character literal case string literal case identifier case lparen case bang case tilde case incr case decr case plus case minus conditional expression break default jj consume token 1 throw new parse exception parseexception jj_2_8 jj_ntk jj_ntk jj_ntk integer_literal floating_point_literal character_literal string_literal conditionalexpression jj_consume_token parseexception final public void assignment throws parse exception bgen jjtree assignment bsh assignment jjtn000 new bsh assignment jjtassignment boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 int op try primary expression op assignment operator jjtn000 operator op expression catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 parseexception bshassignment bshassignment opennodescope jjtreeopennodescope primaryexpression assignmentoperator clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public int assignment operator throws parse exception token t switch jj ntk 1 jj ntk jj ntk case assign jj consume token assign break case starassign jj consume token starassign break case slashassign jj consume token slashassign break case modassign jj consume token modassign break case plusassign jj consume token plusassign break case minusassign jj consume token minusassign break case andassign jj consume token andassign break case xorassign jj consume token xorassign break case orassign jj consume token orassign break case lshiftassign jj consume token lshiftassign break case lshiftassignx jj consume token lshiftassignx break case rsignedshiftassign jj consume token rsignedshiftassign break case rsignedshiftassignx jj consume token rsignedshiftassignx break case runsignedshiftassign jj consume token runsignedshiftassign break case runsignedshiftassignx jj consume token runsignedshiftassignx break default jj consume token 1 throw new parse exception t get token 0 if true return t kind throw new error missing return statement in function assignmentoperator parseexception jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token parseexception gettoken final public void conditional expression throws parse exception conditional or expression switch jj ntk 1 jj ntk jj ntk case hook jj consume token hook expression jj consume token colon bsh ternary expression jjtn001 new bsh ternary expression jjtternaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try conditional expression catch throwable jjte001 if jjtc001 jjtree clear node scope jjtn001 jjtc001 false else jjtree pop node if jjte001 instanceof runtime exception if true throw runtime exception jjte001 if jjte001 instanceof parse exception if true throw parse exception jjte001 if true throw error jjte001 finally if jjtc001 jjtree close node scope jjtn001 3 jjtree close node scope jjtn001 break default conditionalexpression parseexception conditionalorexpression jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token bshternaryexpression bshternaryexpression opennodescope jjtreeopennodescope conditionalexpression clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void conditional or expression throws parse exception token t null conditional and expression label 7 while true switch jj ntk 1 jj ntk jj ntk case bool or case bool orx break default break label 7 switch jj ntk 1 jj ntk jj ntk case bool or t jj consume token bool or break case bool orx t jj consume token bool orx break default jj consume token 1 throw new parse exception conditional and expression bsh binary expression jjtn001 new bsh binary expression jjtbinaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 2 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 2 jjtree close node scope jjtn001 conditionalorexpression parseexception conditionalandexpression label_7 jj_ntk jj_ntk jj_ntk bool_or bool_orx label_7 jj_ntk jj_ntk jj_ntk bool_or jj_consume_token bool_or bool_orx jj_consume_token bool_orx jj_consume_token parseexception conditionalandexpression bshbinaryexpression bshbinaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void conditional and expression throws parse exception token t null inclusive or expression label 8 while true switch jj ntk 1 jj ntk jj ntk case bool and case bool andx break default break label 8 switch jj ntk 1 jj ntk jj ntk case bool and t jj consume token bool and break case bool andx t jj consume token bool andx break default jj consume token 1 throw new parse exception inclusive or expression bsh binary expression jjtn001 new bsh binary expression jjtbinaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 2 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 2 jjtree close node scope jjtn001 conditionalandexpression parseexception inclusiveorexpression label_8 jj_ntk jj_ntk jj_ntk bool_and bool_andx label_8 jj_ntk jj_ntk jj_ntk bool_and jj_consume_token bool_and bool_andx jj_consume_token bool_andx jj_consume_token parseexception inclusiveorexpression bshbinaryexpression bshbinaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void inclusive or expression throws parse exception token t null exclusive or expression label 9 while true switch jj ntk 1 jj ntk jj ntk case bit or case bit orx break default break label 9 switch jj ntk 1 jj ntk jj ntk case bit or t jj consume token bit or break case bit orx t jj consume token bit orx break default jj consume token 1 throw new parse exception exclusive or expression bsh binary expression jjtn001 new bsh binary expression jjtbinaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 2 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 2 jjtree close node scope jjtn001 inclusiveorexpression parseexception exclusiveorexpression label_9 jj_ntk jj_ntk jj_ntk bit_or bit_orx label_9 jj_ntk jj_ntk jj_ntk bit_or jj_consume_token bit_or bit_orx jj_consume_token bit_orx jj_consume_token parseexception exclusiveorexpression bshbinaryexpression bshbinaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void exclusive or expression throws parse exception token t null and expression label 10 while true switch jj ntk 1 jj ntk jj ntk case xor break default break label 10 t jj consume token xor and expression bsh binary expression jjtn001 new bsh binary expression jjtbinaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 2 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 2 jjtree close node scope jjtn001 exclusiveorexpression parseexception andexpression label_10 jj_ntk jj_ntk jj_ntk label_10 jj_consume_token andexpression bshbinaryexpression bshbinaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void and expression throws parse exception token t null equality expression label 11 while true switch jj ntk 1 jj ntk jj ntk case bit and case bit andx break default break label 11 switch jj ntk 1 jj ntk jj ntk case bit and t jj consume token bit and break case bit andx t jj consume token bit andx break default jj consume token 1 throw new parse exception equality expression bsh binary expression jjtn001 new bsh binary expression jjtbinaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 2 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 2 jjtree close node scope jjtn001 andexpression parseexception equalityexpression label_11 jj_ntk jj_ntk jj_ntk bit_and bit_andx label_11 jj_ntk jj_ntk jj_ntk bit_and jj_consume_token bit_and bit_andx jj_consume_token bit_andx jj_consume_token parseexception equalityexpression bshbinaryexpression bshbinaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void equality expression throws parse exception token t null instance of expression label 12 while true switch jj ntk 1 jj ntk jj ntk case eq case ne break default break label 12 switch jj ntk 1 jj ntk jj ntk case eq t jj consume token eq break case ne t jj consume token ne break default jj consume token 1 throw new parse exception instance of expression bsh binary expression jjtn001 new bsh binary expression jjtbinaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 2 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 2 jjtree close node scope jjtn001 equalityexpression parseexception instanceofexpression label_12 jj_ntk jj_ntk jj_ntk label_12 jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token parseexception instanceofexpression bshbinaryexpression bshbinaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void instance of expression throws parse exception token t null relational expression switch jj ntk 1 jj ntk jj ntk case instanceof t jj consume token instanceof type bsh binary expression jjtn001 new bsh binary expression jjtbinaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 2 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 2 jjtree close node scope jjtn001 break default instanceofexpression parseexception relationalexpression jj_ntk jj_ntk jj_ntk jj_consume_token bshbinaryexpression bshbinaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void relational expression throws parse exception token t null shift expression label 13 while true switch jj ntk 1 jj ntk jj ntk case gt case gtx case lt case ltx case le case lex case ge case gex break default break label 13 switch jj ntk 1 jj ntk jj ntk case lt t jj consume token lt break case ltx t jj consume token ltx break case gt t jj consume token gt break case gtx t jj consume token gtx break case le t jj consume token le break case lex t jj consume token lex break case ge t jj consume token ge break case gex t jj consume token gex break default jj consume token 1 throw new parse exception shift expression bsh binary expression jjtn001 new bsh binary expression jjtbinaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 2 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 2 jjtree close node scope jjtn001 relationalexpression parseexception shiftexpression label_13 jj_ntk jj_ntk jj_ntk label_13 jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token parseexception shiftexpression bshbinaryexpression bshbinaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void shift expression throws parse exception token t null additive expression label 14 while true switch jj ntk 1 jj ntk jj ntk case lshift case lshiftx case rsignedshift case rsignedshiftx case runsignedshift case runsignedshiftx break default break label 14 switch jj ntk 1 jj ntk jj ntk case lshift t jj consume token lshift break case lshiftx t jj consume token lshiftx break case rsignedshift t jj consume token rsignedshift break case rsignedshiftx t jj consume token rsignedshiftx break case runsignedshift t jj consume token runsignedshift break case runsignedshiftx t jj consume token runsignedshiftx break default jj consume token 1 throw new parse exception additive expression bsh binary expression jjtn001 new bsh binary expression jjtbinaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 2 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 2 jjtree close node scope jjtn001 shiftexpression parseexception additiveexpression label_14 jj_ntk jj_ntk jj_ntk label_14 jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token parseexception additiveexpression bshbinaryexpression bshbinaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void additive expression throws parse exception token t null multiplicative expression label 15 while true switch jj ntk 1 jj ntk jj ntk case plus case minus break default break label 15 switch jj ntk 1 jj ntk jj ntk case plus t jj consume token plus break case minus t jj consume token minus break default jj consume token 1 throw new parse exception multiplicative expression bsh binary expression jjtn001 new bsh binary expression jjtbinaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 2 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 2 jjtree close node scope jjtn001 additiveexpression parseexception multiplicativeexpression label_15 jj_ntk jj_ntk jj_ntk label_15 jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token parseexception multiplicativeexpression bshbinaryexpression bshbinaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void multiplicative expression throws parse exception token t null unary expression label 16 while true switch jj ntk 1 jj ntk jj ntk case star case slash case mod break default break label 16 switch jj ntk 1 jj ntk jj ntk case star t jj consume token star break case slash t jj consume token slash break case mod t jj consume token mod break default jj consume token 1 throw new parse exception unary expression bsh binary expression jjtn001 new bsh binary expression jjtbinaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 2 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 2 jjtree close node scope jjtn001 multiplicativeexpression parseexception unaryexpression label_16 jj_ntk jj_ntk jj_ntk label_16 jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token jj_consume_token parseexception unaryexpression bshbinaryexpression bshbinaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void unary expression throws parse exception token t null switch jj ntk 1 jj ntk jj ntk case plus case minus switch jj ntk 1 jj ntk jj ntk case plus t jj consume token plus break case minus t jj consume token minus break default jj consume token 1 throw new parse exception unary expression bsh unary expression jjtn001 new bsh unary expression jjtunaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 1 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 1 jjtree close node scope jjtn001 break case incr pre increment expression break case decr pre decrement expression break case boolean case byte case char case double case false case float case int case long case new case null case short case true case void case integer literal case floating point literal case character literal case string literal case identifier case lparen case bang case tilde unary expression not plus minus break default jj consume token 1 throw new parse exception unaryexpression parseexception jj_ntk jj_ntk jj_ntk jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token parseexception unaryexpression bshunaryexpression bshunaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope preincrementexpression predecrementexpression integer_literal floating_point_literal character_literal string_literal unaryexpressionnotplusminus jj_consume_token parseexception final public void pre increment expression throws parse exception token t null t jj consume token incr primary expression bsh unary expression jjtn001 new bsh unary expression jjtunaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 1 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 1 jjtree close node scope jjtn001 preincrementexpression parseexception jj_consume_token primaryexpression bshunaryexpression bshunaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void pre decrement expression throws parse exception token t null t jj consume token decr primary expression bsh unary expression jjtn001 new bsh unary expression jjtunaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 1 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 1 jjtree close node scope jjtn001 predecrementexpression parseexception jj_consume_token primaryexpression bshunaryexpression bshunaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void unary expression not plus minus throws parse exception token t null switch jj ntk 1 jj ntk jj ntk case bang case tilde switch jj ntk 1 jj ntk jj ntk case tilde t jj consume token tilde break case bang t jj consume token bang break default jj consume token 1 throw new parse exception unary expression bsh unary expression jjtn001 new bsh unary expression jjtunaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 1 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind finally if jjtc001 jjtree close node scope jjtn001 1 jjtree close node scope jjtn001 break default if jj 2 9 2147483647 cast expression else switch jj ntk 1 jj ntk jj ntk case boolean case byte case char case double case false case float case int case long case new case null case short case true case void case integer literal case floating point literal case character literal case string literal case identifier case lparen postfix expression break default jj consume token 1 throw new parse exception unaryexpressionnotplusminus parseexception jj_ntk jj_ntk jj_ntk jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token parseexception unaryexpression bshunaryexpression bshunaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope jj_2_9 castexpression jj_ntk jj_ntk jj_ntk integer_literal floating_point_literal character_literal string_literal postfixexpression jj_consume_token parseexception this production is to determine lookahead only final public void cast lookahead throws parse exception if jj 2 10 2 jj consume token lparen primitive type else if jj 2 11 2147483647 jj consume token lparen ambiguous name jj consume token lbracket jj consume token rbracket else switch jj ntk 1 jj ntk jj ntk case lparen jj consume token lparen ambiguous name jj consume token rparen switch jj ntk 1 jj ntk jj ntk case tilde jj consume token tilde break case bang jj consume token bang break case lparen jj consume token lparen break case identifier jj consume token identifier break case new jj consume token new break case false case null case true case void case integer literal case floating point literal case character literal case string literal literal break default jj consume token 1 throw new parse exception break default jj consume token 1 throw new parse exception castlookahead parseexception jj_2_10 jj_consume_token primitivetype jj_2_11 jj_consume_token ambiguousname jj_consume_token jj_consume_token jj_ntk jj_ntk jj_ntk jj_consume_token ambiguousname jj_consume_token jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token integer_literal floating_point_literal character_literal string_literal jj_consume_token parseexception jj_consume_token parseexception final public void postfix expression throws parse exception token t null if jj 2 12 2147483647 primary expression switch jj ntk 1 jj ntk jj ntk case incr t jj consume token incr break case decr t jj consume token decr break default jj consume token 1 throw new parse exception bsh unary expression jjtn001 new bsh unary expression jjtunaryexpression boolean jjtc001 true jjtree open node scope jjtn001 jjtree open node scope jjtn001 try jjtree close node scope jjtn001 1 jjtc001 false jjtree close node scope jjtn001 jjtn001 kind t kind jjtn001 postfix true finally if jjtc001 jjtree close node scope jjtn001 1 jjtree close node scope jjtn001 else switch jj ntk 1 jj ntk jj ntk case boolean case byte case char case double case false case float case int case long case new case null case short case true case void case integer literal case floating point literal case character literal case string literal case identifier case lparen primary expression break default jj consume token 1 throw new parse exception postfixexpression parseexception jj_2_12 primaryexpression jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token parseexception bshunaryexpression bshunaryexpression opennodescope jjtreeopennodescope closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope jj_ntk jj_ntk jj_ntk integer_literal floating_point_literal character_literal string_literal primaryexpression jj_consume_token parseexception final public void cast expression throws parse exception bgen jjtree cast expression bsh cast expression jjtn000 new bsh cast expression jjtcastexpression boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try if jj 2 13 2147483647 jj consume token lparen type jj consume token rparen unary expression else switch jj ntk 1 jj ntk jj ntk case lparen jj consume token lparen type jj consume token rparen unary expression not plus minus break default jj consume token 1 throw new parse exception catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 castexpression parseexception castexpression bshcastexpression bshcastexpression opennodescope jjtreeopennodescope jj_2_13 jj_consume_token jj_consume_token unaryexpression jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token unaryexpressionnotplusminus jj_consume_token parseexception clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void primary expression throws parse exception bgen jjtree primary expression bsh primary expression jjtn000 new bsh primary expression jjtprimaryexpression boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try primary prefix label 17 while true switch jj ntk 1 jj ntk jj ntk case lbrace case lbracket case dot break default break label 17 primary suffix catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 primaryexpression parseexception primaryexpression bshprimaryexpression bshprimaryexpression opennodescope jjtreeopennodescope primaryprefix label_17 jj_ntk jj_ntk jj_ntk label_17 primarysuffix clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void method invocation throws parse exception bgen jjtree method invocation bsh method invocation jjtn000 new bsh method invocation jjtmethodinvocation boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try ambiguous name arguments catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 methodinvocation parseexception methodinvocation bshmethodinvocation bshmethodinvocation opennodescope jjtreeopennodescope ambiguousname clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void primary prefix throws parse exception switch jj ntk 1 jj ntk jj ntk case false case null case true case void case integer literal case floating point literal case character literal case string literal literal break case lparen jj consume token lparen expression jj consume token rparen break case new allocation expression break default if jj 2 14 2147483647 method invocation else if jj 2 15 2147483647 type else switch jj ntk 1 jj ntk jj ntk case identifier ambiguous name break default jj consume token 1 throw new parse exception primaryprefix parseexception jj_ntk jj_ntk jj_ntk integer_literal floating_point_literal character_literal string_literal jj_consume_token jj_consume_token allocationexpression jj_2_14 methodinvocation jj_2_15 jj_ntk jj_ntk jj_ntk ambiguousname jj_consume_token parseexception final public void primary suffix throws parse exception bgen jjtree primary suffix bsh primary suffix jjtn000 new bsh primary suffix jjtprimarysuffix boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 token t null try if jj 2 16 2 jj consume token dot jj consume token class jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 operation bsh primary suffix class else switch jj ntk 1 jj ntk jj ntk case lbracket jj consume token lbracket expression jj consume token rbracket jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 operation bsh primary suffix index break case dot jj consume token dot t jj consume token identifier switch jj ntk 1 jj ntk jj ntk case lparen arguments break default jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 operation bsh primary suffix name jjtn000 field t image break case lbrace jj consume token lbrace expression jj consume token rbrace jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 operation bsh primary suffix property break default jj consume token 1 throw new parse exception catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 primarysuffix parseexception primarysuffix bshprimarysuffix bshprimarysuffix opennodescope jjtreeopennodescope jj_2_16 jj_consume_token jj_consume_token closenodescope jjtreeclosenodescope bshprimarysuffix jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token closenodescope jjtreeclosenodescope bshprimarysuffix jj_consume_token jj_consume_token jj_ntk jj_ntk jj_ntk closenodescope jjtreeclosenodescope bshprimarysuffix jj_consume_token jj_consume_token closenodescope jjtreeclosenodescope bshprimarysuffix jj_consume_token parseexception clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void literal throws parse exception bgen jjtree literal bsh literal jjtn000 new bsh literal jjtliteral boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 token x boolean b string literal char ch try switch jj ntk 1 jj ntk jj ntk case integer literal x jj consume token integer literal jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 literal x image ch literal char at literal length 1 if ch l ch l literal literal substring 0 literal length 1 this really should be long decode but there isn t one as a result hex and octal literals ending in l or l don t work jjtn000 value new primitive new long literal long value else try jjtn000 value new primitive integer decode literal int value catch number format exception e if true throw create parse exception error or number too big for integer type literal break case floating point literal x jj consume token floating point literal jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 literal x image ch literal char at literal length 1 if ch f ch f literal literal substring 0 literal length 1 jjtn000 value new primitive new float literal float value else if ch d ch d literal literal substring 0 literal length 1 jjtn000 value new primitive new double literal double value break case character literal x jj consume token character literal jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 try jjtn000 char setup x image substring 1 x image length 1 catch exception e if true throw create parse exception error parsing character x image break case string literal x jj consume token string literal jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 try jjtn000 string setup x image substring 1 x image length 1 catch exception e if true throw create parse exception error parsing string x image break case false case true b boolean literal jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 value new primitive b break case null null literal jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 value primitive null break case void void literal jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 value primitive void break default jj consume token 1 throw new parse exception catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 parseexception bshliteral bshliteral opennodescope jjtreeopennodescope jj_ntk jj_ntk jj_ntk integer_literal jj_consume_token integer_literal closenodescope jjtreeclosenodescope charat longvalue intvalue numberformatexception createparseexception floating_point_literal jj_consume_token floating_point_literal closenodescope jjtreeclosenodescope charat floatvalue doublevalue character_literal jj_consume_token character_literal closenodescope jjtreeclosenodescope charsetup createparseexception string_literal jj_consume_token string_literal closenodescope jjtreeclosenodescope stringsetup createparseexception booleanliteral closenodescope jjtreeclosenodescope nullliteral closenodescope jjtreeclosenodescope voidliteral closenodescope jjtreeclosenodescope jj_consume_token parseexception clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public boolean boolean literal throws parse exception switch jj ntk 1 jj ntk jj ntk case true jj consume token true if true return true break case false jj consume token false if true return false break default jj consume token 1 throw new parse exception throw new error missing return statement in function booleanliteral parseexception jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token parseexception final public void null literal throws parse exception jj consume token null nullliteral parseexception jj_consume_token final public void void literal throws parse exception jj consume token void voidliteral parseexception jj_consume_token final public void arguments throws parse exception bgen jjtree arguments bsh arguments jjtn000 new bsh arguments jjtarguments boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token lparen switch jj ntk 1 jj ntk jj ntk case boolean case byte case char case double case false case float case int case long case new case null case short case true case void case integer literal case floating point literal case character literal case string literal case identifier case lparen case bang case tilde case incr case decr case plus case minus argument list break default jj consume token rparen catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 parseexception bsharguments bsharguments opennodescope jjtreeopennodescope jj_consume_token jj_ntk jj_ntk jj_ntk integer_literal floating_point_literal character_literal string_literal argumentlist jj_consume_token clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope leave these on the stack for arguments to handle final public void argument list throws parse exception expression label 18 while true switch jj ntk 1 jj ntk jj ntk case comma break default break label 18 jj consume token comma expression argumentlist parseexception label_18 jj_ntk jj_ntk jj_ntk label_18 jj_consume_token final public void allocation expression throws parse exception bgen jjtree allocation expression bsh allocation expression jjtn000 new bsh allocation expression jjtallocationexpression boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try if jj 2 18 2 jj consume token new primitive type array dimensions else switch jj ntk 1 jj ntk jj ntk case new jj consume token new ambiguous name switch jj ntk 1 jj ntk jj ntk case lbracket array dimensions break case lparen arguments if jj 2 17 2 block else break default jj consume token 1 throw new parse exception break default jj consume token 1 throw new parse exception catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 allocationexpression parseexception allocationexpression bshallocationexpression bshallocationexpression opennodescope jjtreeopennodescope jj_2_18 jj_consume_token primitivetype arraydimensions jj_ntk jj_ntk jj_ntk jj_consume_token ambiguousname jj_ntk jj_ntk jj_ntk arraydimensions jj_2_17 jj_consume_token parseexception jj_consume_token parseexception clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void array dimensions throws parse exception bgen jjtree array dimensions bsh array dimensions jjtn000 new bsh array dimensions jjtarraydimensions boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try if jj 2 21 2 label 19 while true jj consume token lbracket expression jj consume token rbracket jjtn000 add defined dimension if jj 2 19 2 else break label 19 label 20 while true if jj 2 20 2 else break label 20 jj consume token lbracket jj consume token rbracket jjtn000 add undefined dimension else switch jj ntk 1 jj ntk jj ntk case lbracket label 21 while true jj consume token lbracket jj consume token rbracket jjtn000 add undefined dimension switch jj ntk 1 jj ntk jj ntk case lbracket break default break label 21 array initializer break default jj consume token 1 throw new parse exception catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 arraydimensions parseexception arraydimensions bsharraydimensions bsharraydimensions opennodescope jjtreeopennodescope jj_2_21 label_19 jj_consume_token jj_consume_token adddefineddimension jj_2_19 label_19 label_20 jj_2_20 label_20 jj_consume_token jj_consume_token addundefineddimension jj_ntk jj_ntk jj_ntk label_21 jj_consume_token jj_consume_token addundefineddimension jj_ntk jj_ntk jj_ntk label_21 arrayinitializer jj_consume_token parseexception clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void statement throws parse exception if jj 2 22 2 labeled statement else switch jj ntk 1 jj ntk jj ntk case lbrace block break case semicolon empty statement break case boolean case byte case char case double case false case float case int case long case new case null case short case true case void case integer literal case floating point literal case character literal case string literal case identifier case lparen case bang case tilde case incr case decr case plus case minus statement expression jj consume token semicolon break case switch switch statement break case if if statement break case while while statement break case do do statement break default if is regular for statement for statement else switch jj ntk 1 jj ntk jj ntk case for enhanced for statement break case break break statement break case continue continue statement break case return return statement break case synchronized synchronized statement break case throw throw statement break case try try statement break default jj consume token 1 throw new parse exception parseexception jj_2_22 labeledstatement jj_ntk jj_ntk jj_ntk emptystatement integer_literal floating_point_literal character_literal string_literal statementexpression jj_consume_token switchstatement ifstatement whilestatement dostatement isregularforstatement forstatement jj_ntk jj_ntk jj_ntk enhancedforstatement breakstatement continuestatement returnstatement synchronizedstatement throwstatement trystatement jj_consume_token parseexception final public void labeled statement throws parse exception jj consume token identifier jj consume token colon statement labeledstatement parseexception jj_consume_token jj_consume_token final public void block throws parse exception bgen jjtree block bsh block jjtn000 new bsh block jjtblock boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token lbrace label 22 while true if jj 2 23 1 else break label 22 block statement jj consume token rbrace catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 parseexception bshblock bshblock opennodescope jjtreeopennodescope jj_consume_token label_22 jj_2_23 label_22 blockstatement jj_consume_token clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void block statement throws parse exception if jj 2 24 2147483647 class declaration else if jj 2 25 2147483647 method declaration else if jj 2 26 2147483647 method declaration else if jj 2 27 2147483647 typed variable declaration jj consume token semicolon else if jj 2 28 1 statement else switch jj ntk 1 jj ntk jj ntk case import case static import declaration break case package package declaration break case formal comment formal comment break default jj consume token 1 throw new parse exception blockstatement parseexception jj_2_24 classdeclaration jj_2_25 methoddeclaration jj_2_26 methoddeclaration jj_2_27 typedvariabledeclaration jj_consume_token jj_2_28 jj_ntk jj_ntk jj_ntk importdeclaration packagedeclaration formal_comment formalcomment jj_consume_token parseexception final public void formal comment throws parse exception bgen jjtree formal comment retain comments bsh formal comment jjtn000 new bsh formal comment jjtformalcomment boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 token t try t jj consume token formal comment jjtree close node scope jjtn000 retain comments jjtc000 false jjtree close node scope jjtn000 jjtn000 text t image finally if jjtc000 jjtree close node scope jjtn000 retain comments jjtree close node scope jjtn000 formalcomment parseexception formalcomment retaincomments bshformalcomment bshformalcomment opennodescope jjtreeopennodescope jj_consume_token formal_comment closenodescope retaincomments jjtreeclosenodescope closenodescope retaincomments jjtreeclosenodescope final public void empty statement throws parse exception jj consume token semicolon emptystatement parseexception jj_consume_token final public void statement expression throws parse exception expression statementexpression parseexception final public void switch statement throws parse exception bgen jjtree switch statement bsh switch statement jjtn000 new bsh switch statement jjtswitchstatement boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token switch jj consume token lparen expression jj consume token rparen jj consume token lbrace label 23 while true switch jj ntk 1 jj ntk jj ntk case case case default break default break label 23 switch label label 24 while true if jj 2 29 1 else break label 24 block statement jj consume token rbrace catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 switchstatement parseexception switchstatement bshswitchstatement bshswitchstatement opennodescope jjtreeopennodescope jj_consume_token jj_consume_token jj_consume_token jj_consume_token label_23 jj_ntk jj_ntk jj_ntk _default label_23 switchlabel label_24 jj_2_29 label_24 blockstatement jj_consume_token clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void switch label throws parse exception bgen jjtree switch label bsh switch label jjtn000 new bsh switch label jjtswitchlabel boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try switch jj ntk 1 jj ntk jj ntk case case jj consume token case expression jj consume token colon break case default jj consume token default jj consume token colon jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 is default true break default jj consume token 1 throw new parse exception catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 switchlabel parseexception switchlabel bshswitchlabel bshswitchlabel opennodescope jjtreeopennodescope jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token _default jj_consume_token _default jj_consume_token closenodescope jjtreeclosenodescope isdefault jj_consume_token parseexception clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void if statement throws parse exception bgen jjtree if statement bsh if statement jjtn000 new bsh if statement jjtifstatement boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token if jj consume token lparen expression jj consume token rparen statement switch jj ntk 1 jj ntk jj ntk case else jj consume token else statement break default catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 ifstatement parseexception ifstatement bshifstatement bshifstatement opennodescope jjtreeopennodescope jj_consume_token jj_consume_token jj_consume_token jj_ntk jj_ntk jj_ntk jj_consume_token clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void while statement throws parse exception bgen jjtree while statement bsh while statement jjtn000 new bsh while statement jjtwhilestatement boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token while jj consume token lparen expression jj consume token rparen statement catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 whilestatement parseexception whilestatement bshwhilestatement bshwhilestatement opennodescope jjtreeopennodescope jj_consume_token jj_consume_token jj_consume_token clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void do statement throws parse exception bgen jjtree while statement bsh while statement jjtn000 new bsh while statement jjtwhilestatement boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token do statement jj consume token while jj consume token lparen expression jj consume token rparen jj consume token semicolon jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 is do statement true catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 dostatement parseexception whilestatement bshwhilestatement bshwhilestatement opennodescope jjtreeopennodescope jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token closenodescope jjtreeclosenodescope isdostatement clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void for statement throws parse exception bgen jjtree for statement bsh for statement jjtn000 new bsh for statement jjtforstatement boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 token t null try jj consume token for jj consume token lparen switch jj ntk 1 jj ntk jj ntk case abstract case boolean case byte case char case double case false case final case float case int case long case native case new case null case private case protected case public case short case static case strictfp case synchronized case transient case true case void case volatile case integer literal case floating point literal case character literal case string literal case identifier case lparen case bang case tilde case incr case decr case plus case minus for init jjtn000 has for init true break default jj consume token semicolon switch jj ntk 1 jj ntk jj ntk case boolean case byte case char case double case false case float case int case long case new case null case short case true case void case integer literal case floating point literal case character literal case string literal case identifier case lparen case bang case tilde case incr case decr case plus case minus expression jjtn000 has expression true break default jj consume token semicolon switch jj ntk 1 jj ntk jj ntk case boolean case byte case char case double case false case float case int case long case new case null case short case true case void case integer literal case floating point literal case character literal case string literal case identifier case lparen case bang case tilde case incr case decr case plus case minus for update jjtn000 has for update true break default jj consume token rparen statement catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 forstatement parseexception forstatement bshforstatement bshforstatement opennodescope jjtreeopennodescope jj_consume_token jj_consume_token jj_ntk jj_ntk jj_ntk integer_literal floating_point_literal character_literal string_literal forinit hasforinit jj_consume_token jj_ntk jj_ntk jj_ntk integer_literal floating_point_literal character_literal string_literal hasexpression jj_consume_token jj_ntk jj_ntk jj_ntk integer_literal floating_point_literal character_literal string_literal forupdate hasforupdate jj_consume_token clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void enhanced for statement throws parse exception bgen jjtree enhanced for statement bsh enhanced for statement jjtn000 new bsh enhanced for statement jjtenhancedforstatement boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 token t null try if jj 2 30 4 jj consume token for jj consume token lparen t jj consume token identifier jj consume token colon expression jj consume token rparen statement jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 var name t image else switch jj ntk 1 jj ntk jj ntk case for jj consume token for jj consume token lparen type t jj consume token identifier jj consume token colon expression jj consume token rparen statement jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 var name t image break default jj consume token 1 throw new parse exception catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 enhancedforstatement parseexception enhancedforstatement bshenhancedforstatement bshenhancedforstatement opennodescope jjtreeopennodescope jj_2_30 jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token closenodescope jjtreeclosenodescope varname jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token jj_consume_token jj_consume_token jj_consume_token closenodescope jjtreeclosenodescope varname jj_consume_token parseexception clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void for init throws parse exception token t null if jj 2 31 2147483647 typed variable declaration else switch jj ntk 1 jj ntk jj ntk case boolean case byte case char case double case false case float case int case long case new case null case short case true case void case integer literal case floating point literal case character literal case string literal case identifier case lparen case bang case tilde case incr case decr case plus case minus statement expression list break default jj consume token 1 throw new parse exception forinit parseexception jj_2_31 typedvariabledeclaration jj_ntk jj_ntk jj_ntk integer_literal floating_point_literal character_literal string_literal statementexpressionlist jj_consume_token parseexception declared a typed variable untyped variables are not declared per se but are handled by the part of the grammar that deals with assignments final public void typed variable declaration throws parse exception bgen jjtree typed variable declaration bsh typed variable declaration jjtn000 new bsh typed variable declaration jjttypedvariabledeclaration boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 token t null modifiers mods try mods modifiers modifiers field false type variable declarator label 25 while true switch jj ntk 1 jj ntk jj ntk case comma break default break label 25 jj consume token comma variable declarator jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 modifiers mods catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 typedvariabledeclaration parseexception typedvariabledeclaration bshtypedvariabledeclaration bshtypedvariabledeclaration opennodescope jjtreeopennodescope variabledeclarator label_25 jj_ntk jj_ntk jj_ntk label_25 jj_consume_token variabledeclarator closenodescope jjtreeclosenodescope clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void statement expression list throws parse exception bgen jjtree statement expression list bsh statement expression list jjtn000 new bsh statement expression list jjtstatementexpressionlist boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try statement expression label 26 while true switch jj ntk 1 jj ntk jj ntk case comma break default break label 26 jj consume token comma statement expression catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 statementexpressionlist parseexception statementexpressionlist bshstatementexpressionlist bshstatementexpressionlist opennodescope jjtreeopennodescope statementexpression label_26 jj_ntk jj_ntk jj_ntk label_26 jj_consume_token statementexpression clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void for update throws parse exception statement expression list forupdate parseexception statementexpressionlist final public void break statement throws parse exception bgen jjtree return statement bsh return statement jjtn000 new bsh return statement jjtreturnstatement boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token break switch jj ntk 1 jj ntk jj ntk case identifier jj consume token identifier break default jj consume token semicolon jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 kind break finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 breakstatement parseexception returnstatement bshreturnstatement bshreturnstatement opennodescope jjtreeopennodescope jj_consume_token jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void continue statement throws parse exception bgen jjtree return statement bsh return statement jjtn000 new bsh return statement jjtreturnstatement boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token continue switch jj ntk 1 jj ntk jj ntk case identifier jj consume token identifier break default jj consume token semicolon jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 kind continue finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 continuestatement parseexception returnstatement bshreturnstatement bshreturnstatement opennodescope jjtreeopennodescope jj_consume_token jj_ntk jj_ntk jj_ntk jj_consume_token jj_consume_token closenodescope jjtreeclosenodescope closenodescope jjtreeclosenodescope final public void return statement throws parse exception bgen jjtree return statement bsh return statement jjtn000 new bsh return statement jjtreturnstatement boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token return switch jj ntk 1 jj ntk jj ntk case boolean case byte case char case double case false case float case int case long case new case null case short case true case void case integer literal case floating point literal case character literal case string literal case identifier case lparen case bang case tilde case incr case decr case plus case minus expression break default jj consume token semicolon jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 kind return catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 returnstatement parseexception returnstatement bshreturnstatement bshreturnstatement opennodescope jjtreeopennodescope jj_consume_token jj_ntk jj_ntk jj_ntk integer_literal floating_point_literal character_literal string_literal jj_consume_token closenodescope jjtreeclosenodescope clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void synchronized statement throws parse exception bgen jjtree block bsh block jjtn000 new bsh block jjtblock boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token synchronized jj consume token lparen expression jj consume token rparen block jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 jjtn000 is synchronized true catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 synchronizedstatement parseexception bshblock bshblock opennodescope jjtreeopennodescope jj_consume_token jj_consume_token jj_consume_token closenodescope jjtreeclosenodescope issynchronized clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void throw statement throws parse exception bgen jjtree throw statement bsh throw statement jjtn000 new bsh throw statement jjtthrowstatement boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 try jj consume token throw expression jj consume token semicolon catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 throwstatement parseexception throwstatement bshthrowstatement bshthrowstatement opennodescope jjtreeopennodescope jj_consume_token jj_consume_token clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final public void try statement throws parse exception bgen jjtree try statement bsh try statement jjtn000 new bsh try statement jjttrystatement boolean jjtc000 true jjtree open node scope jjtn000 jjtree open node scope jjtn000 boolean closed false try jj consume token try block label 27 while true switch jj ntk 1 jj ntk jj ntk case catch break default break label 27 jj consume token catch jj consume token lparen formal parameter jj consume token rparen block closed true switch jj ntk 1 jj ntk jj ntk case finally jj consume token finally block closed true break default jjtree close node scope jjtn000 true jjtc000 false jjtree close node scope jjtn000 if closed if true throw generate parse exception catch throwable jjte000 if jjtc000 jjtree clear node scope jjtn000 jjtc000 false else jjtree pop node if jjte000 instanceof runtime exception if true throw runtime exception jjte000 if jjte000 instanceof parse exception if true throw parse exception jjte000 if true throw error jjte000 finally if jjtc000 jjtree close node scope jjtn000 true jjtree close node scope jjtn000 trystatement parseexception trystatement bshtrystatement bshtrystatement opennodescope jjtreeopennodescope jj_consume_token label_27 jj_ntk jj_ntk jj_ntk label_27 jj_consume_token jj_consume_token formalparameter jj_consume_token jj_ntk jj_ntk jj_ntk jj_consume_token closenodescope jjtreeclosenodescope generateparseexception clearnodescope popnode runtimeexception runtimeexception parseexception parseexception closenodescope jjtreeclosenodescope final private boolean jj 2 1 int xla jj la xla jj lastpos jj scanpos token try return jj 3 1 catch lookahead success ls return true jj_2_1 jj_la jj_lastpos jj_scanpos jj_3_1 lookaheadsuccess final private boolean jj 2 2 int xla jj la xla jj lastpos jj scanpos token try return jj 3 2 catch lookahead success ls return true jj_2_2 jj_la jj_lastpos jj_scanpos jj_3_2 lookaheadsuccess final private boolean jj 2 3 int xla jj la xla jj lastpos jj scanpos token try return jj 3 3 catch lookahead success ls return true jj_2_3 jj_la jj_lastpos jj_scanpos jj_3_3 lookaheadsuccess final private boolean jj 2 4 int xla jj la xla jj lastpos jj scanpos token try return jj 3 4 catch lookahead success ls return true jj_2_4 jj_la jj_lastpos jj_scanpos jj_3_4 lookaheadsuccess final private boolean jj 2 5 int xla jj la xla jj lastpos jj scanpos token try return jj 3 5 catch lookahead success ls return true jj_2_5 jj_la jj_lastpos jj_scanpos jj_3_5 lookaheadsuccess final private boolean jj 2 6 int xla jj la xla jj lastpos jj scanpos token try return jj 3 6 catch lookahead success ls return true jj_2_6 jj_la jj_lastpos jj_scanpos jj_3_6 lookaheadsuccess final private boolean jj 2 7 int xla jj la xla jj lastpos jj scanpos token try return jj 3 7 catch lookahead success ls return true jj_2_7 jj_la jj_lastpos jj_scanpos jj_3_7 lookaheadsuccess final private boolean jj 2 8 int xla jj la xla jj lastpos jj scanpos token try return jj 3 8 catch lookahead success ls return true jj_2_8 jj_la jj_lastpos jj_scanpos jj_3_8 lookaheadsuccess final private boolean jj 2 9 int xla jj la xla jj lastpos jj scanpos token try return jj 3 9 catch lookahead success ls return true jj_2_9 jj_la jj_lastpos jj_scanpos jj_3_9 lookaheadsuccess final private boolean jj 2 10 int xla jj la xla jj lastpos jj scanpos token try return jj 3 10 catch lookahead success ls return true jj_2_10 jj_la jj_lastpos jj_scanpos jj_3_10 lookaheadsuccess final private boolean jj 2 11 int xla jj la xla jj lastpos jj scanpos token try return jj 3 11 catch lookahead success ls return true jj_2_11 jj_la jj_lastpos jj_scanpos jj_3_11 lookaheadsuccess final private boolean jj 2 12 int xla jj la xla jj lastpos jj scanpos token try return jj 3 12 catch lookahead success ls return true jj_2_12 jj_la jj_lastpos jj_scanpos jj_3_12 lookaheadsuccess final private boolean jj 2 13 int xla jj la xla jj lastpos jj scanpos token try return jj 3 13 catch lookahead success ls return true jj_2_13 jj_la jj_lastpos jj_scanpos jj_3_13 lookaheadsuccess final private boolean jj 2 14 int xla jj la xla jj lastpos jj scanpos token try return jj 3 14 catch lookahead success ls return true jj_2_14 jj_la jj_lastpos jj_scanpos jj_3_14 lookaheadsuccess final private boolean jj 2 15 int xla jj la xla jj lastpos jj scanpos token try return jj 3 15 catch lookahead success ls return true jj_2_15 jj_la jj_lastpos jj_scanpos jj_3_15 lookaheadsuccess final private boolean jj 2 16 int xla jj la xla jj lastpos jj scanpos token try return jj 3 16 catch lookahead success ls return true jj_2_16 jj_la jj_lastpos jj_scanpos jj_3_16 lookaheadsuccess final private boolean jj 2 17 int xla jj la xla jj lastpos jj scanpos token try return jj 3 17 catch lookahead success ls return true jj_2_17 jj_la jj_lastpos jj_scanpos jj_3_17 lookaheadsuccess final private boolean jj 2 18 int xla jj la xla jj lastpos jj scanpos token try return jj 3 18 catch lookahead success ls return true jj_2_18 jj_la jj_lastpos jj_scanpos jj_3_18 lookaheadsuccess final private boolean jj 2 19 int xla jj la xla jj lastpos jj scanpos token try return jj 3 19 catch lookahead success ls return true jj_2_19 jj_la jj_lastpos jj_scanpos jj_3_19 lookaheadsuccess final private boolean jj 2 20 int xla jj la xla jj lastpos jj scanpos token try return jj 3 20 catch lookahead success ls return true jj_2_20 jj_la jj_lastpos jj_scanpos jj_3_20 lookaheadsuccess final private boolean jj 2 21 int xla jj la xla jj lastpos jj scanpos token try return jj 3 21 catch lookahead success ls return true jj_2_21 jj_la jj_lastpos jj_scanpos jj_3_21 lookaheadsuccess final private boolean jj 2 22 int xla jj la xla jj lastpos jj scanpos token try return jj 3 22 catch lookahead success ls return true jj_2_22 jj_la jj_lastpos jj_scanpos jj_3_22 lookaheadsuccess final private boolean jj 2 23 int xla jj la xla jj lastpos jj scanpos token try return jj 3 23 catch lookahead success ls return true jj_2_23 jj_la jj_lastpos jj_scanpos jj_3_23 lookaheadsuccess final private boolean jj 2 24 int xla jj la xla jj lastpos jj scanpos token try return jj 3 24 catch lookahead success ls return true jj_2_24 jj_la jj_lastpos jj_scanpos jj_3_24 lookaheadsuccess final private boolean jj 2 25 int xla jj la xla jj lastpos jj scanpos token try return jj 3 25 catch lookahead success ls return true jj_2_25 jj_la jj_lastpos jj_scanpos jj_3_25 lookaheadsuccess final private boolean jj 2 26 int xla jj la xla jj lastpos jj scanpos token try return jj 3 26 catch lookahead success ls return true jj_2_26 jj_la jj_lastpos jj_scanpos jj_3_26 lookaheadsuccess final private boolean jj 2 27 int xla jj la xla jj lastpos jj scanpos token try return jj 3 27 catch lookahead success ls return true jj_2_27 jj_la jj_lastpos jj_scanpos jj_3_27 lookaheadsuccess final private boolean jj 2 28 int xla jj la xla jj lastpos jj scanpos token try return jj 3 28 catch lookahead success ls return true jj_2_28 jj_la jj_lastpos jj_scanpos jj_3_28 lookaheadsuccess final private boolean jj 2 29 int xla jj la xla jj lastpos jj scanpos token try return jj 3 29 catch lookahead success ls return true jj_2_29 jj_la jj_lastpos jj_scanpos jj_3_29 lookaheadsuccess final private boolean jj 2 30 int xla jj la xla jj lastpos jj scanpos token try return jj 3 30 catch lookahead success ls return true jj_2_30 jj_la jj_lastpos jj_scanpos jj_3_30 lookaheadsuccess final private boolean jj 2 31 int xla jj la xla jj lastpos jj scanpos token try return jj 3 31 catch lookahead success ls return true jj_2_31 jj_la jj_lastpos jj_scanpos jj_3_31 lookaheadsuccess final private boolean jj 3r 46 if jj 3r 91 return true return false jj_3r_46 jj_3r_91 final private boolean jj 3r 28 token xsp xsp jj scanpos if jj 3r 46 jj scanpos xsp if jj 3r 47 jj scanpos xsp if jj 3r 48 jj scanpos xsp if jj 3r 49 jj scanpos xsp if jj 3 28 jj scanpos xsp if jj 3r 50 jj scanpos xsp if jj 3r 51 jj scanpos xsp if jj 3r 52 return true return false jj_3r_28 jj_scanpos jj_3r_46 jj_scanpos jj_3r_47 jj_scanpos jj_3r_48 jj_scanpos jj_3r_49 jj_scanpos jj_3_28 jj_scanpos jj_3r_50 jj_scanpos jj_3r_51 jj_scanpos jj_3r_52 final private boolean jj 3 23 if jj 3r 28 return true return false jj_3_23 jj_3r_28 final private boolean jj 3r 161 if jj 3r 164 return true token xsp while true xsp jj scanpos if jj 3r 169 jj scanpos xsp break return false jj_3r_161 jj_3r_164 jj_scanpos jj_3r_169 jj_scanpos final private boolean jj 3r 38 if jj scan token lbrace return true token xsp while true xsp jj scanpos if jj 3 23 jj scanpos xsp break if jj scan token rbrace return true return false jj_3r_38 jj_scan_token jj_scanpos jj_3_23 jj_scanpos jj_scan_token final private boolean jj 3r 158 if jj 3r 161 return true token xsp while true xsp jj scanpos if jj 3r 167 jj scanpos xsp break return false jj_3r_158 jj_3r_161 jj_scanpos jj_3r_167 jj_scanpos final private boolean jj 3r 40 if jj scan token identifier return true if jj scan token colon return true if jj 3r 45 return true return false jj_3r_40 jj_scan_token jj_scan_token jj_3r_45 final private boolean jj 3r 156 if jj scan token hook return true if jj 3r 39 return true if jj scan token colon return true if jj 3r 108 return true return false jj_3r_156 jj_scan_token jj_3r_39 jj_scan_token jj_3r_108 final private boolean jj 3r 165 token xsp xsp jj scanpos if jj scan token 108 jj scanpos xsp if jj scan token 109 return true if jj 3r 158 return true return false jj_3r_165 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_3r_158 final private boolean jj 3r 153 if jj 3r 158 return true token xsp while true xsp jj scanpos if jj 3r 165 jj scanpos xsp break return false jj_3r_153 jj_3r_158 jj_scanpos jj_3r_165 jj_scanpos final private boolean jj 3r 90 if jj 3r 124 return true return false jj_3r_90 jj_3r_124 final private boolean jj 3r 89 if jj 3r 123 return true return false jj_3r_89 jj_3r_123 final private boolean jj 3r 88 if jj 3r 122 return true return false jj_3r_88 jj_3r_122 final private boolean jj 3r 162 token xsp xsp jj scanpos if jj scan token 98 jj scanpos xsp if jj scan token 99 return true if jj 3r 153 return true return false jj_3r_162 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_3r_153 final private boolean jj 3r 87 if jj 3r 121 return true return false jj_3r_87 jj_3r_121 final private boolean jj 3r 148 if jj 3r 153 return true token xsp while true xsp jj scanpos if jj 3r 162 jj scanpos xsp break return false jj_3r_148 jj_3r_153 jj_scanpos jj_3r_162 jj_scanpos final private boolean jj 3r 86 if jj 3r 120 return true return false jj_3r_86 jj_3r_120 final private boolean jj 3r 85 if jj 3r 119 return true return false jj_3r_85 jj_3r_119 final private boolean jj 3r 84 if jj 3r 118 return true return false jj_3r_84 jj_3r_118 final private boolean jj 3r 159 token xsp xsp jj scanpos if jj scan token 96 jj scanpos xsp if jj scan token 97 return true if jj 3r 148 return true return false jj_3r_159 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_3r_148 final private boolean jj 3r 83 if jj 3r 117 return true return false jj_3r_83 jj_3r_117 final private boolean jj 3r 135 if jj 3r 148 return true token xsp while true xsp jj scanpos if jj 3r 159 jj scanpos xsp break return false jj_3r_135 jj_3r_148 jj_scanpos jj_3r_159 jj_scanpos final private boolean jj 3r 82 if jj 3r 116 return true return false jj_3r_82 jj_3r_116 final private boolean jj 3r 81 if jj 3r 115 return true return false jj_3r_81 jj_3r_115 final private boolean jj 3r 80 if jj 3r 114 return true return false jj_3r_80 jj_3r_114 final private boolean jj 3r 108 if jj 3r 135 return true token xsp xsp jj scanpos if jj 3r 156 jj scanpos xsp return false jj_3r_108 jj_3r_135 jj_scanpos jj_3r_156 jj_scanpos final private boolean jj 3r 79 if jj 3r 113 return true return false jj_3r_79 jj_3r_113 final private boolean jj 3r 78 if jj 3r 112 return true if jj scan token semicolon return true return false jj_3r_78 jj_3r_112 jj_scan_token final private boolean jj 3 17 if jj 3r 38 return true return false jj_3_17 jj_3r_38 final private boolean jj 3r 77 if jj 3r 38 return true return false jj_3r_77 jj_3r_38 final private boolean jj 3r 45 token xsp xsp jj scanpos if jj 3 22 jj scanpos xsp if jj 3r 77 jj scanpos xsp if jj scan token 78 jj scanpos xsp if jj 3r 78 jj scanpos xsp if jj 3r 79 jj scanpos xsp if jj 3r 80 jj scanpos xsp if jj 3r 81 jj scanpos xsp if jj 3r 82 jj scanpos xsp looking ahead true jj semla is regular for statement looking ahead false if jj semla jj 3r 83 jj scanpos xsp if jj 3r 84 jj scanpos xsp if jj 3r 85 jj scanpos xsp if jj 3r 86 jj scanpos xsp if jj 3r 87 jj scanpos xsp if jj 3r 88 jj scanpos xsp if jj 3r 89 jj scanpos xsp if jj 3r 90 return true return false jj_3r_45 jj_scanpos jj_3_22 jj_scanpos jj_3r_77 jj_scanpos jj_scan_token jj_scanpos jj_3r_78 jj_scanpos jj_3r_79 jj_scanpos jj_3r_80 jj_scanpos jj_3r_81 jj_scanpos jj_3r_82 jj_scanpos lookingahead jj_semla isregularforstatement lookingahead jj_semla jj_3r_83 jj_scanpos jj_3r_84 jj_scanpos jj_3r_85 jj_scanpos jj_3r_86 jj_scanpos jj_3r_87 jj_scanpos jj_3r_88 jj_scanpos jj_3r_89 jj_scanpos jj_3r_90 final private boolean jj 3 22 if jj 3r 40 return true return false jj_3_22 jj_3r_40 final private boolean jj 3r 34 token xsp xsp jj scanpos if jj scan token 81 jj scanpos xsp if jj scan token 120 jj scanpos xsp if jj scan token 121 jj scanpos xsp if jj scan token 127 jj scanpos xsp if jj scan token 118 jj scanpos xsp if jj scan token 119 jj scanpos xsp if jj scan token 122 jj scanpos xsp if jj scan token 126 jj scanpos xsp if jj scan token 124 jj scanpos xsp if jj scan token 128 jj scanpos xsp if jj scan token 129 jj scanpos xsp if jj scan token 130 jj scanpos xsp if jj scan token 131 jj scanpos xsp if jj scan token 132 jj scanpos xsp if jj scan token 133 return true return false jj_3r_34 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token final private boolean jj 3r 111 if jj scan token comma return true if jj 3r 29 return true return false jj_3r_111 jj_scan_token jj_3r_29 final private boolean jj 3r 160 if jj scan token lbracket return true if jj scan token rbracket return true return false jj_3r_160 jj_scan_token jj_scan_token final private boolean jj 3r 152 if jj 3r 69 return true token xsp xsp jj scanpos if jj 3 17 jj scanpos xsp return false jj_3r_152 jj_3r_69 jj_scanpos jj_3_17 jj_scanpos final private boolean jj 3r 157 token xsp if jj 3r 160 return true while true xsp jj scanpos if jj 3r 160 jj scanpos xsp break if jj 3r 97 return true return false jj_3r_157 jj_3r_160 jj_scanpos jj_3r_160 jj_scanpos jj_3r_97 final private boolean jj 3 8 if jj 3r 33 return true if jj 3r 34 return true return false jj_3_8 jj_3r_33 jj_3r_34 final private boolean jj 3 20 if jj scan token lbracket return true if jj scan token rbracket return true return false jj_3_20 jj_scan_token jj_scan_token final private boolean jj 3r 151 if jj 3r 150 return true return false jj_3r_151 jj_3r_150 final private boolean jj 3 19 if jj scan token lbracket return true if jj 3r 39 return true if jj scan token rbracket return true return false jj_3_19 jj_scan_token jj_3r_39 jj_scan_token final private boolean jj 3r 107 if jj 3r 33 return true if jj 3r 34 return true if jj 3r 39 return true return false jj_3r_107 jj_3r_33 jj_3r_34 jj_3r_39 final private boolean jj 3 21 token xsp if jj 3 19 return true while true xsp jj scanpos if jj 3 19 jj scanpos xsp break while true xsp jj scanpos if jj 3 20 jj scanpos xsp break return false jj_3_21 jj_3_19 jj_scanpos jj_3_19 jj_scanpos jj_scanpos jj_3_20 jj_scanpos final private boolean jj 3r 150 token xsp xsp jj scanpos if jj 3 21 jj scanpos xsp if jj 3r 157 return true return false jj_3r_150 jj_scanpos jj_3_21 jj_scanpos jj_3r_157 final private boolean jj 3r 71 if jj 3r 108 return true return false jj_3r_71 jj_3r_108 final private boolean jj 3r 39 token xsp xsp jj scanpos if jj 3r 70 jj scanpos xsp if jj 3r 71 return true return false jj_3r_39 jj_scanpos jj_3r_70 jj_scanpos jj_3r_71 final private boolean jj 3r 70 if jj 3r 107 return true return false jj_3r_70 jj_3r_107 final private boolean jj 3r 145 if jj scan token new return true if jj 3r 29 return true token xsp xsp jj scanpos if jj 3r 151 jj scanpos xsp if jj 3r 152 return true return false jj_3r_145 jj_scan_token jj_3r_29 jj_scanpos jj_3r_151 jj_scanpos jj_3r_152 final private boolean jj 3 18 if jj scan token new return true if jj 3r 36 return true if jj 3r 150 return true return false jj_3_18 jj_scan_token jj_3r_36 jj_3r_150 final private boolean jj 3r 130 token xsp xsp jj scanpos if jj 3 18 jj scanpos xsp if jj 3r 145 return true return false jj_3r_130 jj_scanpos jj_3_18 jj_scanpos jj_3r_145 final private boolean jj 3r 147 if jj scan token comma return true if jj 3r 39 return true return false jj_3r_147 jj_scan_token jj_3r_39 final private boolean jj 3r 76 if jj 3r 29 return true token xsp while true xsp jj scanpos if jj 3r 111 jj scanpos xsp break return false jj_3r_76 jj_3r_29 jj_scanpos jj_3r_111 jj_scanpos final private boolean jj 3r 134 if jj 3r 39 return true token xsp while true xsp jj scanpos if jj 3r 147 jj scanpos xsp break return false jj_3r_134 jj_3r_39 jj_scanpos jj_3r_147 jj_scanpos final private boolean jj 3r 106 if jj 3r 134 return true return false jj_3r_106 jj_3r_134 final private boolean jj 3 7 if jj scan token dot return true if jj scan token identifier return true return false jj_3_7 jj_scan_token jj_scan_token final private boolean jj 3r 69 if jj scan token lparen return true token xsp xsp jj scanpos if jj 3r 106 jj scanpos xsp if jj scan token rparen return true return false jj_3r_69 jj_scan_token jj_scanpos jj_3r_106 jj_scanpos jj_scan_token final private boolean jj 3r 29 if jj scan token identifier return true token xsp while true xsp jj scanpos if jj 3 7 jj scanpos xsp break return false jj_3r_29 jj_scan_token jj_scanpos jj_3_7 jj_scanpos final private boolean jj 3r 68 if jj scan token double return true return false jj_3r_68 jj_scan_token final private boolean jj 3r 67 if jj scan token float return true return false jj_3r_67 jj_scan_token final private boolean jj 3r 155 if jj scan token false return true return false jj_3r_155 jj_scan_token final private boolean jj 3r 66 if jj scan token long return true return false jj_3r_66 jj_scan_token final private boolean jj 3r 65 if jj scan token int return true return false jj_3r_65 jj_scan_token final private boolean jj 3r 154 if jj scan token true return true return false jj_3r_154 jj_scan_token final private boolean jj 3r 149 token xsp xsp jj scanpos if jj 3r 154 jj scanpos xsp if jj 3r 155 return true return false jj_3r_149 jj_scanpos jj_3r_154 jj_scanpos jj_3r_155 final private boolean jj 3r 64 if jj scan token short return true return false jj_3r_64 jj_scan_token final private boolean jj 3r 56 if jj 3r 29 return true return false jj_3r_56 jj_3r_29 final private boolean jj 3r 63 if jj scan token byte return true return false jj_3r_63 jj_scan_token final private boolean jj 3r 62 if jj scan token char return true return false jj_3r_62 jj_scan_token final private boolean jj 3r 61 if jj scan token boolean return true return false jj_3r_61 jj_scan_token final private boolean jj 3r 36 token xsp xsp jj scanpos if jj 3r 61 jj scanpos xsp if jj 3r 62 jj scanpos xsp if jj 3r 63 jj scanpos xsp if jj 3r 64 jj scanpos xsp if jj 3r 65 jj scanpos xsp if jj 3r 66 jj scanpos xsp if jj 3r 67 jj scanpos xsp if jj 3r 68 return true return false jj_3r_36 jj_scanpos jj_3r_61 jj_scanpos jj_3r_62 jj_scanpos jj_3r_63 jj_scanpos jj_3r_64 jj_scanpos jj_3r_65 jj_scanpos jj_3r_66 jj_scanpos jj_3r_67 jj_scanpos jj_3r_68 final private boolean jj 3r 144 if jj scan token 57 return true return false jj_3r_144 jj_scan_token final private boolean jj 3r 74 if jj 3r 32 return true return false jj_3r_74 jj_3r_32 final private boolean jj 3r 42 token xsp xsp jj scanpos if jj 3r 73 jj scanpos xsp if jj 3r 74 return true return false jj_3r_42 jj_scanpos jj_3r_73 jj_scanpos jj_3r_74 final private boolean jj 3r 73 if jj scan token void return true return false jj_3r_73 jj_scan_token final private boolean jj 3r 143 if jj scan token 41 return true return false jj_3r_143 jj_scan_token final private boolean jj 3 6 if jj scan token lbracket return true if jj scan token rbracket return true return false jj_3_6 jj_scan_token jj_scan_token final private boolean jj 3r 142 if jj 3r 149 return true return false jj_3r_142 jj_3r_149 final private boolean jj 3r 55 if jj 3r 36 return true return false jj_3r_55 jj_3r_36 final private boolean jj 3r 110 if jj scan token comma return true if jj 3r 109 return true return false jj_3r_110 jj_scan_token jj_3r_109 final private boolean jj 3r 141 if jj scan token string literal return true return false jj_3r_141 jj_scan_token string_literal final private boolean jj 3r 32 token xsp xsp jj scanpos if jj 3r 55 jj scanpos xsp if jj 3r 56 return true while true xsp jj scanpos if jj 3 6 jj scanpos xsp break return false jj_3r_32 jj_scanpos jj_3r_55 jj_scanpos jj_3r_56 jj_scanpos jj_3_6 jj_scanpos final private boolean jj 3r 140 if jj scan token character literal return true return false jj_3r_140 jj_scan_token character_literal final private boolean jj 3r 190 if jj scan token finally return true if jj 3r 38 return true return false jj_3r_190 jj_scan_token jj_3r_38 final private boolean jj 3 4 if jj scan token comma return true if jj 3r 31 return true return false jj_3_4 jj_scan_token jj_3r_31 final private boolean jj 3r 189 if jj scan token catch return true if jj scan token lparen return true if jj 3r 109 return true if jj scan token rparen return true if jj 3r 38 return true return false jj_3r_189 jj_scan_token jj_scan_token jj_3r_109 jj_scan_token jj_3r_38 final private boolean jj 3r 136 if jj scan token identifier return true return false jj_3r_136 jj_scan_token final private boolean jj 3 5 if jj 3r 32 return true if jj scan token identifier return true return false jj_3_5 jj_3r_32 jj_scan_token final private boolean jj 3r 75 if jj 3r 109 return true token xsp while true xsp jj scanpos if jj 3r 110 jj scanpos xsp break return false jj_3r_75 jj_3r_109 jj_scanpos jj_3r_110 jj_scanpos final private boolean jj 3r 109 token xsp xsp jj scanpos if jj 3 5 jj scanpos xsp if jj 3r 136 return true return false jj_3r_109 jj_scanpos jj_3_5 jj_scanpos jj_3r_136 final private boolean jj 3r 124 if jj scan token try return true if jj 3r 38 return true token xsp while true xsp jj scanpos if jj 3r 189 jj scanpos xsp break xsp jj scanpos if jj 3r 190 jj scanpos xsp return false jj_3r_124 jj_scan_token jj_3r_38 jj_scanpos jj_3r_189 jj_scanpos jj_scanpos jj_3r_190 jj_scanpos final private boolean jj 3r 43 if jj scan token lparen return true token xsp xsp jj scanpos if jj 3r 75 jj scanpos xsp if jj scan token rparen return true return false jj_3r_43 jj_scan_token jj_scanpos jj_3r_75 jj_scanpos jj_scan_token final private boolean jj 3r 163 if jj 3r 31 return true token xsp while true xsp jj scanpos if jj 3 4 jj scanpos xsp break return false jj_3r_163 jj_3r_31 jj_scanpos jj_3_4 jj_scanpos final private boolean jj 3r 139 if jj scan token floating point literal return true return false jj_3r_139 jj_scan_token floating_point_literal final private boolean jj 3r 97 if jj scan token lbrace return true token xsp xsp jj scanpos if jj 3r 163 jj scanpos xsp xsp jj scanpos if jj scan token 79 jj scanpos xsp if jj scan token rbrace return true return false jj_3r_97 jj_scan_token jj_scanpos jj_3r_163 jj_scanpos jj_scanpos jj_scan_token jj_scanpos jj_scan_token final private boolean jj 3r 30 if jj scan token dot return true if jj scan token star return true return false jj_3r_30 jj_scan_token jj_scan_token final private boolean jj 3r 123 if jj scan token throw return true if jj 3r 39 return true if jj scan token semicolon return true return false jj_3r_123 jj_scan_token jj_3r_39 jj_scan_token final private boolean jj 3r 180 if jj scan token assign return true if jj 3r 31 return true return false jj_3r_180 jj_scan_token jj_3r_31 final private boolean jj 3r 54 if jj 3r 39 return true return false jj_3r_54 jj_3r_39 final private boolean jj 3r 188 if jj 3r 39 return true return false jj_3r_188 jj_3r_39 final private boolean jj 3r 53 if jj 3r 97 return true return false jj_3r_53 jj_3r_97 final private boolean jj 3r 31 token xsp xsp jj scanpos if jj 3r 53 jj scanpos xsp if jj 3r 54 return true return false jj_3r_31 jj_scanpos jj_3r_53 jj_scanpos jj_3r_54 final private boolean jj 3r 122 if jj scan token synchronized return true if jj scan token lparen return true if jj 3r 39 return true if jj scan token rparen return true if jj 3r 38 return true return false jj_3r_122 jj_scan_token jj_scan_token jj_3r_39 jj_scan_token jj_3r_38 final private boolean jj 3r 177 if jj scan token comma return true if jj 3r 176 return true return false jj_3r_177 jj_scan_token jj_3r_176 final private boolean jj 3r 210 if jj scan token comma return true if jj 3r 112 return true return false jj_3r_210 jj_scan_token jj_3r_112 final private boolean jj 3r 121 if jj scan token return return true token xsp xsp jj scanpos if jj 3r 188 jj scanpos xsp if jj scan token semicolon return true return false jj_3r_121 jj_scan_token jj_scanpos jj_3r_188 jj_scanpos jj_scan_token final private boolean jj 3r 129 token xsp xsp jj scanpos if jj 3r 138 jj scanpos xsp if jj 3r 139 jj scanpos xsp if jj 3r 140 jj scanpos xsp if jj 3r 141 jj scanpos xsp if jj 3r 142 jj scanpos xsp if jj 3r 143 jj scanpos xsp if jj 3r 144 return true return false jj_3r_129 jj_scanpos jj_3r_138 jj_scanpos jj_3r_139 jj_scanpos jj_3r_140 jj_scanpos jj_3r_141 jj_scanpos jj_3r_142 jj_scanpos jj_3r_143 jj_scanpos jj_3r_144 final private boolean jj 3r 138 if jj scan token integer literal return true return false jj_3r_138 jj_scan_token integer_literal final private boolean jj 3r 146 if jj 3r 69 return true return false jj_3r_146 jj_3r_69 final private boolean jj 3r 176 if jj scan token identifier return true token xsp xsp jj scanpos if jj 3r 180 jj scanpos xsp return false jj_3r_176 jj_scan_token jj_scanpos jj_3r_180 jj_scanpos final private boolean jj 3r 105 if jj 3r 129 return true return false jj_3r_105 jj_3r_129 final private boolean jj 3r 120 if jj scan token continue return true token xsp xsp jj scanpos if jj scan token 69 jj scanpos xsp if jj scan token semicolon return true return false jj_3r_120 jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token final private boolean jj 3r 119 if jj scan token break return true token xsp xsp jj scanpos if jj scan token 69 jj scanpos xsp if jj scan token semicolon return true return false jj_3r_119 jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token final private boolean jj 3r 195 if jj 3r 205 return true return false jj_3r_195 jj_3r_205 final private boolean jj 3r 128 if jj scan token import return true if jj scan token star return true if jj scan token semicolon return true return false jj_3r_128 jj_scan_token jj_scan_token jj_scan_token final private boolean jj 3r 133 if jj scan token lbrace return true if jj 3r 39 return true if jj scan token rbrace return true return false jj_3r_133 jj_scan_token jj_3r_39 jj_scan_token final private boolean jj 3r 205 if jj 3r 112 return true token xsp while true xsp jj scanpos if jj 3r 210 jj scanpos xsp break return false jj_3r_205 jj_3r_112 jj_scanpos jj_3r_210 jj_scanpos final private boolean jj 3r 132 if jj scan token dot return true if jj scan token identifier return true token xsp xsp jj scanpos if jj 3r 146 jj scanpos xsp return false jj_3r_132 jj_scan_token jj_scan_token jj_scanpos jj_3r_146 jj_scanpos final private boolean jj 3 3 token xsp xsp jj scanpos if jj scan token 48 jj scanpos xsp if jj scan token import return true if jj 3r 29 return true xsp jj scanpos if jj 3r 30 jj scanpos xsp if jj scan token semicolon return true return false jj_3_3 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_3r_29 jj_scanpos jj_3r_30 jj_scanpos jj_scan_token final private boolean jj 3r 94 token xsp xsp jj scanpos if jj 3 3 jj scanpos xsp if jj 3r 128 return true return false jj_3r_94 jj_scanpos jj_3_3 jj_scanpos jj_3r_128 final private boolean jj 3r 93 if jj 3r 41 return true if jj 3r 32 return true if jj 3r 176 return true token xsp while true xsp jj scanpos if jj 3r 177 jj scanpos xsp break return false jj_3r_93 jj_3r_41 jj_3r_32 jj_3r_176 jj_scanpos jj_3r_177 jj_scanpos final private boolean jj 3r 131 if jj scan token lbracket return true if jj 3r 39 return true if jj scan token rbracket return true return false jj_3r_131 jj_scan_token jj_3r_39 jj_scan_token final private boolean jj 3r 95 if jj scan token package return true if jj 3r 29 return true return false jj_3r_95 jj_scan_token jj_3r_29 final private boolean jj 3 2 if jj scan token identifier return true if jj scan token lparen return true return false jj_3_2 jj_scan_token jj_scan_token final private boolean jj 3r 175 if jj 3r 38 return true return false jj_3r_175 jj_3r_38 final private boolean jj 3 16 if jj scan token dot return true if jj scan token class return true return false jj_3_16 jj_scan_token jj_scan_token final private boolean jj 3r 104 token xsp xsp jj scanpos if jj 3 16 jj scanpos xsp if jj 3r 131 jj scanpos xsp if jj 3r 132 jj scanpos xsp if jj 3r 133 return true return false jj_3r_104 jj_scanpos jj_3_16 jj_scanpos jj_3r_131 jj_scanpos jj_3r_132 jj_scanpos jj_3r_133 final private boolean jj 3r 174 if jj scan token throws return true if jj 3r 76 return true return false jj_3r_174 jj_scan_token jj_3r_76 final private boolean jj 3 15 if jj 3r 32 return true if jj scan token dot return true if jj scan token class return true return false jj_3_15 jj_3r_32 jj_scan_token jj_scan_token final private boolean jj 3 31 if jj 3r 41 return true if jj 3r 32 return true if jj scan token identifier return true return false jj_3_31 jj_3r_41 jj_3r_32 jj_scan_token final private boolean jj 3 14 if jj 3r 37 return true return false jj_3_14 jj_3r_37 final private boolean jj 3r 126 if jj scan token identifier return true return false jj_3r_126 jj_scan_token final private boolean jj 3r 127 if jj 3r 42 return true if jj scan token identifier return true return false jj_3r_127 jj_3r_42 jj_scan_token final private boolean jj 3r 92 if jj 3r 41 return true token xsp xsp jj scanpos if jj 3r 126 jj scanpos xsp if jj 3r 127 return true if jj 3r 43 return true xsp jj scanpos if jj 3r 174 jj scanpos xsp xsp jj scanpos if jj 3r 175 jj scanpos xsp if jj scan token 78 return true return false jj_3r_92 jj_3r_41 jj_scanpos jj_3r_126 jj_scanpos jj_3r_127 jj_3r_43 jj_scanpos jj_3r_174 jj_scanpos jj_scanpos jj_3r_175 jj_scanpos jj_scan_token final private boolean jj 3r 204 if jj 3r 205 return true return false jj_3r_204 jj_3r_205 final private boolean jj 3r 103 if jj 3r 29 return true return false jj_3r_103 jj_3r_29 final private boolean jj 3r 203 if jj 3r 93 return true return false jj_3r_203 jj_3r_93 final private boolean jj 3r 194 token xsp xsp jj scanpos if jj 3r 203 jj scanpos xsp if jj 3r 204 return true return false jj_3r_194 jj_scanpos jj_3r_203 jj_scanpos jj_3r_204 final private boolean jj 3r 102 if jj 3r 32 return true return false jj_3r_102 jj_3r_32 final private boolean jj 3r 58 if jj 3r 104 return true return false jj_3r_58 jj_3r_104 final private boolean jj 3r 125 if jj scan token interface return true return false jj_3r_125 jj_scan_token final private boolean jj 3r 101 if jj 3r 37 return true return false jj_3r_101 jj_3r_37 final private boolean jj 3r 100 if jj 3r 130 return true return false jj_3r_100 jj_3r_130 final private boolean jj 3r 99 if jj scan token lparen return true if jj 3r 39 return true if jj scan token rparen return true return false jj_3r_99 jj_scan_token jj_3r_39 jj_scan_token final private boolean jj 3r 137 if jj scan token for return true if jj scan token lparen return true if jj 3r 32 return true if jj scan token identifier return true if jj scan token colon return true if jj 3r 39 return true if jj scan token rparen return true if jj 3r 45 return true return false jj_3r_137 jj_scan_token jj_scan_token jj_3r_32 jj_scan_token jj_scan_token jj_3r_39 jj_scan_token jj_3r_45 final private boolean jj 3r 184 if jj scan token else return true if jj 3r 45 return true return false jj_3r_184 jj_scan_token jj_3r_45 final private boolean jj 3r 173 if jj scan token implements return true if jj 3r 76 return true return false jj_3r_173 jj_scan_token jj_3r_76 final private boolean jj 3r 57 token xsp xsp jj scanpos if jj 3r 98 jj scanpos xsp if jj 3r 99 jj scanpos xsp if jj 3r 100 jj scanpos xsp if jj 3r 101 jj scanpos xsp if jj 3r 102 jj scanpos xsp if jj 3r 103 return true return false jj_3r_57 jj_scanpos jj_3r_98 jj_scanpos jj_3r_99 jj_scanpos jj_3r_100 jj_scanpos jj_3r_101 jj_scanpos jj_3r_102 jj_scanpos jj_3r_103 final private boolean jj 3r 98 if jj 3r 129 return true return false jj_3r_98 jj_3r_129 final private boolean jj 3r 172 if jj scan token extends return true if jj 3r 29 return true return false jj_3r_172 jj_scan_token jj_3r_29 final private boolean jj 3 30 if jj scan token for return true if jj scan token lparen return true if jj scan token identifier return true if jj scan token colon return true if jj 3r 39 return true if jj scan token rparen return true if jj 3r 45 return true return false jj_3_30 jj_scan_token jj_scan_token jj_scan_token jj_scan_token jj_3r_39 jj_scan_token jj_3r_45 final private boolean jj 3r 118 token xsp xsp jj scanpos if jj 3 30 jj scanpos xsp if jj 3r 137 return true return false jj_3r_118 jj_scanpos jj_3_30 jj_scanpos jj_3r_137 final private boolean jj 3r 37 if jj 3r 29 return true if jj 3r 69 return true return false jj_3r_37 jj_3r_29 jj_3r_69 final private boolean jj 3r 185 if jj 3r 194 return true return false jj_3r_185 jj_3r_194 final private boolean jj 3r 91 if jj 3r 41 return true token xsp xsp jj scanpos if jj scan token 13 jj scanpos xsp if jj 3r 125 return true if jj scan token identifier return true xsp jj scanpos if jj 3r 172 jj scanpos xsp xsp jj scanpos if jj 3r 173 jj scanpos xsp if jj 3r 38 return true return false jj_3r_91 jj_3r_41 jj_scanpos jj_scan_token jj_scanpos jj_3r_125 jj_scan_token jj_scanpos jj_3r_172 jj_scanpos jj_scanpos jj_3r_173 jj_scanpos jj_3r_38 final private boolean jj 3 13 if jj scan token lparen return true if jj 3r 36 return true return false jj_3_13 jj_scan_token jj_3r_36 final private boolean jj 3r 187 if jj 3r 195 return true return false jj_3r_187 jj_3r_195 final private boolean jj 3r 186 if jj 3r 39 return true return false jj_3r_186 jj_3r_39 final private boolean jj 3r 33 if jj 3r 57 return true token xsp while true xsp jj scanpos if jj 3r 58 jj scanpos xsp break return false jj_3r_33 jj_3r_57 jj_scanpos jj_3r_58 jj_scanpos final private boolean jj 3r 217 if jj scan token lparen return true if jj 3r 32 return true if jj scan token rparen return true if jj 3r 208 return true return false jj_3r_217 jj_scan_token jj_3r_32 jj_scan_token jj_3r_208 final private boolean jj 3r 216 if jj scan token lparen return true if jj 3r 32 return true if jj scan token rparen return true if jj 3r 191 return true return false jj_3r_216 jj_scan_token jj_3r_32 jj_scan_token jj_3r_191 final private boolean jj 3r 117 if jj scan token for return true if jj scan token lparen return true token xsp xsp jj scanpos if jj 3r 185 jj scanpos xsp if jj scan token semicolon return true xsp jj scanpos if jj 3r 186 jj scanpos xsp if jj scan token semicolon return true xsp jj scanpos if jj 3r 187 jj scanpos xsp if jj scan token rparen return true if jj 3r 45 return true return false jj_3r_117 jj_scan_token jj_scan_token jj_scanpos jj_3r_185 jj_scanpos jj_scan_token jj_scanpos jj_3r_186 jj_scanpos jj_scan_token jj_scanpos jj_3r_187 jj_scanpos jj_scan_token jj_3r_45 final private boolean jj 3r 214 token xsp xsp jj scanpos if jj 3r 216 jj scanpos xsp if jj 3r 217 return true return false jj_3r_214 jj_scanpos jj_3r_216 jj_scanpos jj_3r_217 final private boolean jj 3 12 if jj 3r 33 return true token xsp xsp jj scanpos if jj scan token 100 jj scanpos xsp if jj scan token 101 return true return false jj_3_12 jj_3r_33 jj_scanpos jj_scan_token jj_scanpos jj_scan_token final private boolean jj 3r 219 if jj 3r 33 return true return false jj_3r_219 jj_3r_33 final private boolean jj 3r 116 if jj scan token do return true if jj 3r 45 return true if jj scan token while return true if jj scan token lparen return true if jj 3r 39 return true if jj scan token rparen return true if jj scan token semicolon return true return false jj_3r_116 jj_scan_token jj_3r_45 jj_scan_token jj_scan_token jj_3r_39 jj_scan_token jj_scan_token final private boolean jj 3 11 if jj scan token lparen return true if jj 3r 29 return true if jj scan token lbracket return true return false jj_3_11 jj_scan_token jj_3r_29 jj_scan_token final private boolean jj 3r 218 if jj 3r 33 return true token xsp xsp jj scanpos if jj scan token 100 jj scanpos xsp if jj scan token 101 return true return false jj_3r_218 jj_3r_33 jj_scanpos jj_scan_token jj_scanpos jj_scan_token final private boolean jj 3r 215 token xsp xsp jj scanpos if jj 3r 218 jj scanpos xsp if jj 3r 219 return true return false jj_3r_215 jj_scanpos jj_3r_218 jj_scanpos jj_3r_219 final private boolean jj 3r 72 token xsp xsp jj scanpos if jj scan token 43 jj scanpos xsp if jj scan token 44 jj scanpos xsp if jj scan token 45 jj scanpos xsp if jj scan token 51 jj scanpos xsp if jj scan token 27 jj scanpos xsp if jj scan token 39 jj scanpos xsp if jj scan token 52 jj scanpos xsp if jj scan token 58 jj scanpos xsp if jj scan token 10 jj scanpos xsp if jj scan token 48 jj scanpos xsp if jj scan token 49 return true return false jj_3r_72 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token final private boolean jj 3r 115 if jj scan token while return true if jj scan token lparen return true if jj 3r 39 return true if jj scan token rparen return true if jj 3r 45 return true return false jj_3r_115 jj_scan_token jj_scan_token jj_3r_39 jj_scan_token jj_3r_45 final private boolean jj 3r 60 if jj scan token lparen return true if jj 3r 29 return true if jj scan token rparen return true token xsp xsp jj scanpos if jj scan token 87 jj scanpos xsp if jj scan token 86 jj scanpos xsp if jj scan token 72 jj scanpos xsp if jj scan token 69 jj scanpos xsp if jj scan token 40 jj scanpos xsp if jj 3r 105 return true return false jj_3r_60 jj_scan_token jj_3r_29 jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_3r_105 final private boolean jj 3r 59 if jj scan token lparen return true if jj 3r 29 return true if jj scan token lbracket return true if jj scan token rbracket return true return false jj_3r_59 jj_scan_token jj_3r_29 jj_scan_token jj_scan_token final private boolean jj 3 9 if jj 3r 35 return true return false jj_3_9 jj_3r_35 final private boolean jj 3 29 if jj 3r 28 return true return false jj_3_29 jj_3r_28 final private boolean jj 3r 114 if jj scan token if return true if jj scan token lparen return true if jj 3r 39 return true if jj scan token rparen return true if jj 3r 45 return true token xsp xsp jj scanpos if jj 3r 184 jj scanpos xsp return false jj_3r_114 jj_scan_token jj_scan_token jj_3r_39 jj_scan_token jj_3r_45 jj_scanpos jj_3r_184 jj_scanpos final private boolean jj 3r 41 token xsp while true xsp jj scanpos if jj 3r 72 jj scanpos xsp break return false jj_3r_41 jj_scanpos jj_3r_72 jj_scanpos final private boolean jj 3r 35 token xsp xsp jj scanpos if jj 3 10 jj scanpos xsp if jj 3r 59 jj scanpos xsp if jj 3r 60 return true return false jj_3r_35 jj_scanpos jj_3_10 jj_scanpos jj_3r_59 jj_scanpos jj_3r_60 final private boolean jj 3 10 if jj scan token lparen return true if jj 3r 36 return true return false jj_3_10 jj_scan_token jj_3r_36 final private boolean jj 3r 213 if jj 3r 215 return true return false jj_3r_213 jj_3r_215 final private boolean jj 3r 212 if jj 3r 214 return true return false jj_3r_212 jj_3r_214 final private boolean jj 3r 202 if jj scan token default return true if jj scan token colon return true return false jj_3r_202 jj_scan_token _default jj_scan_token final private boolean jj 3r 211 token xsp xsp jj scanpos if jj scan token 87 jj scanpos xsp if jj scan token 86 return true if jj 3r 191 return true return false jj_3r_211 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_3r_191 final private boolean jj 3r 208 token xsp xsp jj scanpos if jj 3r 211 jj scanpos xsp if jj 3r 212 jj scanpos xsp if jj 3r 213 return true return false jj_3r_208 jj_scanpos jj_3r_211 jj_scanpos jj_3r_212 jj_scanpos jj_3r_213 final private boolean jj 3r 201 if jj scan token case return true if jj 3r 39 return true if jj scan token colon return true return false jj_3r_201 jj_scan_token jj_3r_39 jj_scan_token final private boolean jj 3r 193 token xsp xsp jj scanpos if jj 3r 201 jj scanpos xsp if jj 3r 202 return true return false jj_3r_193 jj_scanpos jj_3r_201 jj_scanpos jj_3r_202 final private boolean jj 3r 183 if jj 3r 193 return true token xsp while true xsp jj scanpos if jj 3 29 jj scanpos xsp break return false jj_3r_183 jj_3r_193 jj_scanpos jj_3_29 jj_scanpos final private boolean jj 3r 207 if jj scan token decr return true if jj 3r 33 return true return false jj_3r_207 jj_scan_token jj_3r_33 final private boolean jj 3 1 if jj 3r 28 return true return false jj_3_1 jj_3r_28 final private boolean jj 3r 113 if jj scan token switch return true if jj scan token lparen return true if jj 3r 39 return true if jj scan token rparen return true if jj scan token lbrace return true token xsp while true xsp jj scanpos if jj 3r 183 jj scanpos xsp break if jj scan token rbrace return true return false jj_3r_113 jj_scan_token jj_scan_token jj_3r_39 jj_scan_token jj_scan_token jj_scanpos jj_3r_183 jj_scanpos jj_scan_token final private boolean jj 3r 209 token xsp xsp jj scanpos if jj scan token 104 jj scanpos xsp if jj scan token 105 jj scanpos xsp if jj scan token 111 return true if jj 3r 191 return true return false jj_3r_209 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_3r_191 final private boolean jj 3r 206 if jj scan token incr return true if jj 3r 33 return true return false jj_3r_206 jj_scan_token jj_3r_33 final private boolean jj 3r 199 if jj 3r 208 return true return false jj_3r_199 jj_3r_208 final private boolean jj 3r 198 if jj 3r 207 return true return false jj_3r_198 jj_3r_207 final private boolean jj 3r 197 if jj 3r 206 return true return false jj_3r_197 jj_3r_206 final private boolean jj 3r 196 token xsp xsp jj scanpos if jj scan token 102 jj scanpos xsp if jj scan token 103 return true if jj 3r 191 return true return false jj_3r_196 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_3r_191 final private boolean jj 3r 191 token xsp xsp jj scanpos if jj 3r 196 jj scanpos xsp if jj 3r 197 jj scanpos xsp if jj 3r 198 jj scanpos xsp if jj 3r 199 return true return false jj_3r_191 jj_scanpos jj_3r_196 jj_scanpos jj_3r_197 jj_scanpos jj_3r_198 jj_scanpos jj_3r_199 final private boolean jj 3r 44 if jj scan token throws return true if jj 3r 76 return true return false jj_3r_44 jj_scan_token jj_3r_76 final private boolean jj 3r 112 if jj 3r 39 return true return false jj_3r_112 jj_3r_39 final private boolean jj 3r 181 if jj 3r 191 return true token xsp while true xsp jj scanpos if jj 3r 209 jj scanpos xsp break return false jj_3r_181 jj_3r_191 jj_scanpos jj_3r_209 jj_scanpos final private boolean jj 3r 200 token xsp xsp jj scanpos if jj scan token 102 jj scanpos xsp if jj scan token 103 return true if jj 3r 181 return true return false jj_3r_200 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_3r_181 final private boolean jj 3r 178 if jj 3r 181 return true token xsp while true xsp jj scanpos if jj 3r 200 jj scanpos xsp break return false jj_3r_178 jj_3r_181 jj_scanpos jj_3r_200 jj_scanpos final private boolean jj 3r 96 if jj scan token formal comment return true return false jj_3r_96 jj_scan_token formal_comment final private boolean jj 3r 192 token xsp xsp jj scanpos if jj scan token 112 jj scanpos xsp if jj scan token 113 jj scanpos xsp if jj scan token 114 jj scanpos xsp if jj scan token 115 jj scanpos xsp if jj scan token 116 jj scanpos xsp if jj scan token 117 return true if jj 3r 178 return true return false jj_3r_192 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_3r_178 final private boolean jj 3r 171 token xsp xsp jj scanpos if jj scan token 90 jj scanpos xsp if jj scan token 95 return true if jj 3r 166 return true return false jj_3r_171 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_3r_166 final private boolean jj 3r 170 if jj 3r 178 return true token xsp while true xsp jj scanpos if jj 3r 192 jj scanpos xsp break return false jj_3r_170 jj_3r_178 jj_scanpos jj_3r_192 jj_scanpos final private boolean jj 3r 52 if jj 3r 96 return true return false jj_3r_52 jj_3r_96 final private boolean jj 3r 182 token xsp xsp jj scanpos if jj scan token 84 jj scanpos xsp if jj scan token 85 jj scanpos xsp if jj scan token 82 jj scanpos xsp if jj scan token 83 jj scanpos xsp if jj scan token 91 jj scanpos xsp if jj scan token 92 jj scanpos xsp if jj scan token 93 jj scanpos xsp if jj scan token 94 return true if jj 3r 170 return true return false jj_3r_182 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_3r_170 final private boolean jj 3 27 if jj 3r 41 return true if jj 3r 32 return true if jj scan token identifier return true return false jj_3_27 jj_3r_41 jj_3r_32 jj_scan_token final private boolean jj 3r 51 if jj 3r 95 return true return false jj_3r_51 jj_3r_95 final private boolean jj 3r 168 if jj 3r 170 return true token xsp while true xsp jj scanpos if jj 3r 182 jj scanpos xsp break return false jj_3r_168 jj_3r_170 jj_scanpos jj_3r_182 jj_scanpos final private boolean jj 3r 50 if jj 3r 94 return true return false jj_3r_50 jj_3r_94 final private boolean jj 3 26 if jj 3r 41 return true if jj scan token identifier return true if jj 3r 43 return true token xsp xsp jj scanpos if jj 3r 44 jj scanpos xsp if jj scan token lbrace return true return false jj_3_26 jj_3r_41 jj_scan_token jj_3r_43 jj_scanpos jj_3r_44 jj_scanpos jj_scan_token final private boolean jj 3r 179 if jj scan token instanceof return true if jj 3r 32 return true return false jj_3r_179 jj_scan_token jj_3r_32 final private boolean jj 3 28 if jj 3r 45 return true return false jj_3_28 jj_3r_45 final private boolean jj 3r 166 if jj 3r 168 return true token xsp xsp jj scanpos if jj 3r 179 jj scanpos xsp return false jj_3r_166 jj_3r_168 jj_scanpos jj_3r_179 jj_scanpos final private boolean jj 3 25 if jj 3r 41 return true if jj 3r 42 return true if jj scan token identifier return true if jj scan token lparen return true return false jj_3_25 jj_3r_41 jj_3r_42 jj_scan_token jj_scan_token final private boolean jj 3r 49 if jj 3r 93 return true if jj scan token semicolon return true return false jj_3r_49 jj_3r_93 jj_scan_token final private boolean jj 3 24 if jj 3r 41 return true token xsp xsp jj scanpos if jj scan token 13 jj scanpos xsp if jj scan token 37 return true return false jj_3_24 jj_3r_41 jj_scanpos jj_scan_token jj_scanpos jj_scan_token final private boolean jj 3r 167 if jj scan token xor return true if jj 3r 161 return true return false jj_3r_167 jj_scan_token jj_3r_161 final private boolean jj 3r 48 if jj 3r 92 return true return false jj_3r_48 jj_3r_92 final private boolean jj 3r 164 if jj 3r 166 return true token xsp while true xsp jj scanpos if jj 3r 171 jj scanpos xsp break return false jj_3r_164 jj_3r_166 jj_scanpos jj_3r_171 jj_scanpos final private boolean jj 3r 47 if jj 3r 92 return true return false jj_3r_47 jj_3r_92 final private boolean jj 3r 169 token xsp xsp jj scanpos if jj scan token 106 jj scanpos xsp if jj scan token 107 return true if jj 3r 164 return true return false jj_3r_169 jj_scanpos jj_scan_token jj_scanpos jj_scan_token jj_3r_164 public parser java io input stream stream jj input stream new java char stream stream 1 1 token source new parser token manager jj input stream token new token jj ntk 1 inputstream jj_input_stream javacharstream token_source parsertokenmanager jj_input_stream jj_ntk public void re init java io input stream stream jj input stream re init stream 1 1 token source re init jj input stream token new token jj ntk 1 jjtree reset reinit inputstream jj_input_stream reinit token_source reinit jj_input_stream jj_ntk public parser java io reader stream jj input stream new java char stream stream 1 1 token source new parser token manager jj input stream token new token jj ntk 1 jj_input_stream javacharstream token_source parsertokenmanager jj_input_stream jj_ntk public void re init java io reader stream jj input stream re init stream 1 1 token source re init jj input stream token new token jj ntk 1 jjtree reset reinit jj_input_stream reinit token_source reinit jj_input_stream jj_ntk public parser parser token manager tm token source tm token new token jj ntk 1 parsertokenmanager token_source jj_ntk public void re init parser token manager tm token source tm token new token jj ntk 1 jjtree reset reinit parsertokenmanager token_source jj_ntk final private token jj consume token int kind throws parse exception token old token if old token token next null token token next else token token next token source get next token jj ntk 1 if token kind kind return token token old token throw generate parse exception jj_consume_token parseexception oldtoken oldtoken token_source getnexttoken jj_ntk oldtoken generateparseexception final private lookahead success jj ls new lookahead success final private boolean jj scan token int kind if jj scanpos jj lastpos jj la if jj scanpos next null jj lastpos jj scanpos jj scanpos next token source get next token else jj lastpos jj scanpos jj scanpos next else jj scanpos jj scanpos next if jj scanpos kind kind return true if jj la 0 jj scanpos jj lastpos throw jj ls return false lookaheadsuccess jj_ls lookaheadsuccess jj_scan_token jj_scanpos jj_lastpos jj_la jj_scanpos jj_lastpos jj_scanpos jj_scanpos token_source getnexttoken jj_lastpos jj_scanpos jj_scanpos jj_scanpos jj_scanpos jj_scanpos jj_la jj_scanpos jj_lastpos jj_ls final public token get next token if token next null token token next else token token next token source get next token jj ntk 1 return token getnexttoken token_source getnexttoken jj_ntk final public token get token int index token t looking ahead jj scanpos token for int i 0 i index i if t next null t t next else t t next token source get next token return t gettoken lookingahead jj_scanpos token_source getnexttoken final private int jj ntk if jj nt token next null return jj ntk token next token source get next token kind else return jj ntk jj nt kind jj_ntk jj_nt jj_ntk token_source getnexttoken jj_ntk jj_nt public parse exception generate parse exception token errortok token next int line errortok begin line column errortok begin column string mess errortok kind 0 token image 0 errortok image return new parse exception parse error at line line column column encountered mess parseexception generateparseexception beginline begincolumn tokenimage parseexception final public void enable tracing enable_tracing final public void disable tracing disable_tracing tool bar manager constructor public tool bar manager container top container bottom this top top this bottom bottom toolbarmanager toolbarmanager add tool bar method public void add tool bar int group int layer component toolbar entry entry new entry layer toolbar if group view top group add tool bar top top tool bars entry else if group view bottom group add tool bar bottom bottom tool bars entry else throw new internal error invalid tool bar group addtoolbar addtoolbar top_group addtoolbar toptoolbars bottom_group addtoolbar bottomtoolbars internalerror remove tool bar method public void remove tool bar component toolbar remove tool bar top top tool bars toolbar remove tool bar bottom bottom tool bars toolbar removetoolbar removetoolbar removetoolbar toptoolbars removetoolbar bottomtoolbars add tool bar method private void add tool bar container group array list toolbars entry entry see if we should place this toolbar before any others for int i 0 i toolbars size i if entry layer entry toolbars get i layer toolbars add i entry group add entry toolbar i return place the toolbar at the bottom of the group toolbars add entry group add entry toolbar addtoolbar addtoolbar arraylist remove tool bar method private void remove tool bar container group array list toolbars component toolbar for int i 0 i toolbars size i if toolbar entry toolbars get i toolbar group remove toolbar toolbars remove i return removetoolbar removetoolbar arraylist entry int layer component toolbar this layer layer this toolbar toolbar constructs a new link class writer class writer object param compute maxs tt true tt if the maximum stack size and the maximum number of local variables must be automatically computed if this flag is tt true tt then the arguments of the link code visitor visit maxs visit maxs method of the link code visitor code visitor returned by the link visit method visit method method will be ignored and computed automatically from the signature and the bytecode of each method public class writer final boolean compute maxs index 1 pool new byte vector table new item 64 threshold int 0 75d table length key new item key2 new item key3 new item this compute maxs compute maxs classwriter classwriter computemaxs codevisitor visitmaxs visitmaxs codevisitor codevisitor visitmethod visitmethod classwriter computemaxs bytevector computemaxs computemaxs public void visit final int access final string name final string super name final string interfaces final string source file this access access this name new class name index this super name super name null 0 new class super name index if interfaces null interfaces length 0 interface count interfaces length this interfaces new int interface count for int i 0 i interface count i this interfaces i new class interfaces i index if source file null newutf8 source file this source file newutf8 source file if access constants acc deprecated 0 newutf8 deprecated supername sourcefile newclass supername supername newclass supername interfacecount interfacecount interfacecount newclass sourcefile sourcefile sourcefile sourcefile acc_deprecated public void visit inner class final string name final string outer name final string inner name final int access if inner classes null newutf8 inner classes inner classes new byte vector inner classes count inner classes put2 name null 0 new class name index inner classes put2 outer name null 0 new class outer name index inner classes put2 inner name null 0 newutf8 inner name index inner classes put2 access visitinnerclass outername innername innerclasses innerclasses innerclasses bytevector innerclassescount innerclasses newclass innerclasses outername newclass outername innerclasses innername innername innerclasses public void visit field final int access final string name final string desc final object value field count if fields null fields new byte vector fields put2 access put2 newutf8 name index put2 newutf8 desc index int attribute count 0 if value null attribute count if access constants acc synthetic 0 attribute count if access constants acc deprecated 0 attribute count fields put2 attribute count if value null fields put2 newutf8 constant value index fields put4 2 put2 new cst value index if access constants acc synthetic 0 fields put2 newutf8 synthetic index put4 0 if access constants acc deprecated 0 fields put2 newutf8 deprecated index put4 0 visitfield fieldcount bytevector attributecount attributecount acc_synthetic attributecount acc_deprecated attributecount attributecount constantvalue newcst acc_synthetic acc_deprecated public code visitor visit method final int access final string name final string desc final string exceptions code writer cw new code writer this compute maxs cw init access name desc exceptions return cw codevisitor visitmethod codewriter codewriter computemaxs public void visit end visitend returns the bytecode of the class that was build with this class writer return the bytecode of the class that was build with this class writer public byte to byte array computes the real size of the bytecode of this class int size 24 2 interface count if fields null size fields length int nb methods 0 code writer cb first method while cb null nb methods size cb get size cb cb next size pool length int attribute count 0 if source file null attribute count size 8 if access constants acc deprecated 0 attribute count size 6 if inner classes null attribute count size 8 inner classes length allocates a byte vector of this size in order to avoid unnecessary arraycopy operations in the byte vector enlarge method byte vector out new byte vector size out put4 0xcafebabe put2 3 put2 45 out put2 index put byte array pool data 0 pool length out put2 access put2 name put2 super name out put2 interface count for int i 0 i interface count i out put2 interfaces i out put2 field count if fields null out put byte array fields data 0 fields length out put2 nb methods cb first method while cb null cb put out cb cb next out put2 attribute count if source file null out put2 newutf8 source file index put4 2 put2 source file index if access constants acc deprecated 0 out put2 newutf8 deprecated index put4 0 if inner classes null out put2 newutf8 inner classes index out put4 inner classes length 2 put2 inner classes count out put byte array inner classes data 0 inner classes length return out data tobytearray interfacecount nbmethods codewriter firstmethod nbmethods getsize attributecount sourcefile attributecount acc_deprecated attributecount innerclasses attributecount innerclasses bytevector bytevector bytevector putbytearray supername interfacecount interfacecount fieldcount putbytearray nbmethods firstmethod attributecount sourcefile sourcefile sourcefile acc_deprecated innerclasses innerclasses innerclasses innerclassescount putbytearray innerclasses innerclasses adds a number or string constant to the constant pool of the class being build does nothing if the constant pool already contains a similar item param cst the value of the constant to be added to the constant pool this parameter must be an link java lang integer integer a link java lang float float a link java lang long long a link java lang double double or a link string string return a new or already existing constant item with the given value item new cst final object cst if cst instanceof integer int val integer cst int value return new integer val else if cst instanceof float float val float cst float value return new float val else if cst instanceof long long val long cst long value return new long val else if cst instanceof double double val double cst double value return new double val else if cst instanceof string return new string string cst else throw new illegal argument exception value cst newcst intvalue newinteger floatvalue newfloat longvalue newlong doublevalue newdouble newstring illegalargumentexception adds an utf string to the constant pool of the class being build does nothing if the constant pool already contains a similar item param value the string value return a new or already existing utf8 item item newutf8 final string value key set utf8 value null null item result get key if result null pool put1 utf8 pututf value result new item index key put result return result adds a class reference to the constant pool of the class being build does nothing if the constant pool already contains a similar item param value the internal name of the class return a new or already existing class reference item item new class final string value key2 set class value null null item result get key2 if result null pool put12 class newutf8 value index result new item index key2 put result return result newclass adds a field reference to the constant pool of the class being build does nothing if the constant pool already contains a similar item param owner the internal name of the field s owner class param name the field s name param desc the field s descriptor return a new or already existing field reference item item new field final string owner final string name final string desc key3 set field owner name desc item result get key3 if result null put122 field new class owner index new name type name desc index result new item index key3 put result return result newfield newclass newnametype adds a method reference to the constant pool of the class being build does nothing if the constant pool already contains a similar item param owner the internal name of the method s owner class param name the method s name param desc the method s descriptor return a new or already existing method reference item item new method final string owner final string name final string desc key3 set meth owner name desc item result get key3 if result null put122 meth new class owner index new name type name desc index result new item index key3 put result return result newmethod newclass newnametype adds an interface method reference to the constant pool of the class being build does nothing if the constant pool already contains a similar item param owner itf the internal name of the method s owner interface param name the method s name param desc the method s descriptor return a new or already existing interface method reference item item new itf method final string owner itf final string name final string desc key3 set imeth owner itf name desc item result get key3 if result null put122 imeth new class owner itf index new name type name desc index result new item index key3 put result return result owneritf newitfmethod owneritf owneritf newclass owneritf newnametype adds an integer to the constant pool of the class being build does nothing if the constant pool already contains a similar item param value the int value return a new or already existing int item private item new integer final int value key set value item result get key if result null pool put1 int put4 value result new item index key put result return result newinteger adds a float to the constant pool of the class being build does nothing if the constant pool already contains a similar item param value the float value return a new or already existing float item private item new float final float value key set value item result get key if result null pool put1 float put4 float float to int bits value result new item index key put result return result newfloat floattointbits adds a long to the constant pool of the class being build does nothing if the constant pool already contains a similar item param value the long value return a new or already existing long item private item new long final long value key set value item result get key if result null pool put1 long put8 value result new item index key put result index 2 return result newlong adds a double to the constant pool of the class being build does nothing if the constant pool already contains a similar item param value the double value return a new or already existing double item private item new double final double value key set value item result get key if result null pool put1 double put8 double double to long bits value result new item index key put result index 2 return result newdouble doubletolongbits adds a string to the constant pool of the class being build does nothing if the constant pool already contains a similar item param value the string value return a new or already existing string item private item new string final string value key2 set str value null null item result get key2 if result null pool put12 str newutf8 value index result new item index key2 put result return result newstring adds a name and type to the constant pool of the class being build does nothing if the constant pool already contains a similar item param name a name param desc a type descriptor return a new or already existing name and type item private item new name type final string name final string desc key2 set name type name desc null item result get key2 if result null put122 name type newutf8 name index newutf8 desc index result new item index key2 put result return result newnametype name_type name_type returns the constant pool s hash table item which is equal to the given item param key a constant pool item return the constant pool s hash table item which is equal to the given item or tt null tt if there is no such item private item get final item key item tab table int hash code key hash code int index hash code 0x7fffffff tab length for item i tab index i null i i next if i hash code hash code key is equal to i return i return null hashcode hashcode hashcode hashcode hashcode isequalto puts the given item in the constant pool s hash table the hash table i must i not already contains this item param i the item to be added to the constant pool s hash table private void put final item i if index threshold int old capacity table length item old map table int new capacity old capacity 2 1 item new map new item new capacity threshold int new capacity 0 75 table new map for int j old capacity j 0 for item old old map j old null item e old old old next int index e hash code 0x7fffffff new capacity e next new map index new map index e int index i hash code 0x7fffffff table length i next table index table index i oldcapacity oldmap newcapacity oldcapacity newmap newcapacity newcapacity newmap oldcapacity oldmap hashcode newcapacity newmap newmap hashcode puts one byte and two shorts into the constant pool param b a byte param s1 a short param s2 another short private void put122 final int b final int s1 final int s2 pool put12 b s1 put2 s2 jjt parser state nodes new java util stack marks new java util stack sp 0 mk 0 jjtparserstate pushed this should only be called in the final user action of a node scope boolean node created return node created nodecreated node_created automatically by the parser s re init method void reset nodes remove all elements marks remove all elements sp 0 mk 0 reinit removeallelements removeallelements returns the root node of the ast it only makes sense to call this after a successful parse node root node return node nodes element at 0 rootnode elementat pushes a node on to the stack void push node node n nodes push n sp pushnode stack node pop node if sp mk mk integer marks pop int value return node nodes pop popnode intvalue returns the node currently on the top of the stack node peek node return node nodes peek peeknode returns the number of children on the stack in the current node scope int node arity return sp mk nodearity void clear node scope node n while sp mk pop node mk integer marks pop int value clearnodescope popnode intvalue void open node scope node n marks push new integer mk mk sp n jjt open opennodescope jjtopen is pushed on to the stack void close node scope node n int num mk integer marks pop int value while num 0 node c pop node c jjt set parent n n jjt add child c num n jjt close push node n node created true closenodescope intvalue popnode jjtsetparent jjtaddchild jjtclose pushnode node_created constructed and they are left on the stack void close node scope node n boolean condition if condition int a node arity mk integer marks pop int value while a 0 node c pop node c jjt set parent n n jjt add child c a n jjt close push node n node created true else mk integer marks pop int value node created false closenodescope nodearity intvalue popnode jjtsetparent jjtaddchild jjtclose pushnode node_created intvalue node_created public tar header this magic new string buffer tar header tmagic this name new string buffer this link name new string buffer string user system get property user name if user length 31 user user substring 0 31 this user id 0 this group id 0 this user name new string buffer user this group name new string buffer tarheader stringbuffer tarheader stringbuffer linkname stringbuffer getproperty userid groupid username stringbuffer groupname stringbuffer tar headers can be cloned public object clone tar header hdr null try hdr tar header super clone hdr name this name null null new string buffer this name to string hdr mode this mode hdr user id this user id hdr group id this group id hdr size this size hdr mod time this mod time hdr check sum this check sum hdr link flag this link flag hdr link name this link name null null new string buffer this link name to string hdr magic this magic null null new string buffer this magic to string hdr user name this user name null null new string buffer this user name to string hdr group name this group name null null new string buffer this group name to string hdr dev major this dev major hdr dev minor this dev minor catch clone not supported exception ex ex print stack trace return hdr tarheaders tarheader tarheader stringbuffer tostring userid userid groupid groupid modtime modtime checksum checksum linkflag linkflag linkname linkname stringbuffer linkname tostring stringbuffer tostring username username stringbuffer username tostring groupname groupname stringbuffer groupname tostring devmajor devmajor devminor devminor clonenotsupportedexception printstacktrace get the name of this entry return teh entry s name public string get name return this name to string getname tostring parse an octal string from a header buffer this is used for the file permission mode value param header the header buffer from which to parse param offset the offset into the buffer from which to parse param length the number of header bytes to parse return the long value of the octal string public static long parse octal byte header int offset int length throws invalid header exception long result 0 boolean still padding true int end offset length for int i offset i end i if header i 0 break if header i byte header i 0 if still padding continue if header i byte break still padding false result result 3 header i 0 return result parseoctal invalidheaderexception stillpadding stillpadding stillpadding parse an entry name from a header buffer param header the header buffer from which to parse param offset the offset into the buffer from which to parse param length the number of header bytes to parse return the header s entry name public static string buffer parse name byte header int offset int length throws invalid header exception string buffer result new string buffer length int end offset length for int i offset i end i if header i 0 break result append char header i return result stringbuffer parsename invalidheaderexception stringbuffer stringbuffer determine the number of bytes in an entry name param header the header buffer from which to parse param offset the offset into the buffer from which to parse param length the number of header bytes to parse return the number of bytes in a header s entry name public static int get name bytes string buffer name byte buf int offset int length int i for i 0 i length i name length i buf offset i byte name char at i for i length i buf offset i 0 return offset length getnamebytes stringbuffer charat parse an octal integer from a header buffer param header the header buffer from which to parse param offset the offset into the buffer from which to parse param length the number of header bytes to parse return the integer value of the octal bytes public static int get octal bytes long value byte buf int offset int length byte result new byte length int idx length 1 buf offset idx 0 idx buf offset idx byte idx if value 0 buf offset idx byte 0 idx else for long val value idx 0 val 0 idx buf offset idx byte byte 0 byte val 7 val val 3 for idx 0 idx buf offset idx byte return offset length getoctalbytes parse an octal long integer from a header buffer param header the header buffer from which to parse param offset the offset into the buffer from which to parse param length the number of header bytes to parse return the long value of the octal bytes public static int get long octal bytes long value byte buf int offset int length byte temp new byte length 1 tar header get octal bytes value temp 0 length 1 system arraycopy temp 0 buf offset length return offset length getlongoctalbytes tarheader getoctalbytes parse the checksum octal integer from a header buffer param header the header buffer from which to parse param offset the offset into the buffer from which to parse param length the number of header bytes to parse return the integer value of the entry s checksum public static int get check sum octal bytes long value byte buf int offset int length tar header get octal bytes value buf offset length buf offset length 1 byte buf offset length 2 0 return offset length getchecksumoctalbytes tarheader getoctalbytes tip of the day constructor public tip of the day view view super view j edit get property tip title false j panel content new j panel new border layout 12 12 content set border new empty border 12 12 12 12 set content pane content j label label new j label j edit get property tip caption label set font new font sans serif font plain 24 label set foreground ui manager get color button foreground content add border layout north label tip text new j editor pane tip text set editable false tip text set content type text html next tip j scroll pane scroller new j scroll pane tip text scroller set preferred size new dimension 150 150 content add border layout center scroller action handler action handler new action handler box buttons new box box layout x axis show next time new j check box j edit get property tip show next time j edit get boolean property tip show show next time add action listener action handler buttons add show next time buttons add box create horizontal strut 6 buttons add box create glue next tip new j button j edit get property tip next tip next tip add action listener action handler buttons add next tip buttons add box create horizontal strut 6 close new j button j edit get property common close close add action listener action handler buttons add close content get root pane set default button close dimension dim next tip get preferred size dim width math max dim width close get preferred size width next tip set preferred size dim close set preferred size dim content add border layout south buttons set default close operation dispose on close pack set location relative to view set visible true tipoftheday tipoftheday jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane jlabel jlabel jedit getproperty setfont sansserif setforeground uimanager getcolor borderlayout tiptext jeditorpane tiptext seteditable tiptext setcontenttype nexttip jscrollpane jscrollpane tiptext setpreferredsize borderlayout actionhandler actionhandler actionhandler boxlayout x_axis shownexttime jcheckbox jedit getproperty jedit getbooleanproperty shownexttime addactionlistener actionhandler shownexttime createhorizontalstrut createglue nexttip jbutton jedit getproperty nexttip addactionlistener actionhandler nexttip createhorizontalstrut jbutton jedit getproperty addactionlistener actionhandler getrootpane setdefaultbutton nexttip getpreferredsize getpreferredsize nexttip setpreferredsize setpreferredsize borderlayout setdefaultcloseoperation dispose_on_close setlocationrelativeto setvisible ok method public void ok dispose cancel method public void cancel dispose next tip method private void next tip file tips new file misc utilities construct path j edit getj edit home doc tips list files if tips null tips length 0 tip text set text j edit get property tip not found return int count tips length so that we don t see the same tip again if the user clicks next tip int tip to show current tip while tip to show current tip tips tip to show get name ends with html tip to show math abs new random next int count try tip text set page tips tip to show tourl catch exception e log log log error this e nexttip nexttip miscutilities constructpath jedit getjedithome listfiles tiptext settext jedit getproperty tiptoshow currenttip tiptoshow currenttip tiptoshow getname endswith tiptoshow nextint tiptext setpage tiptoshow public void action performed action event evt object source evt get source if source show next time j edit set boolean property tip show show next time is selected else if source next tip next tip else if source close dispose actionperformed actionevent getsource shownexttime jedit setbooleanproperty shownexttime isselected nexttip nexttip public abstract class search matcher public search matcher return value new match searchmatcher searchmatcher returnvalue returns the offset of the first match of the specified text within this matcher param text the text to search in param start true if the start of the segment is the beginning of the buffer param end true if the end of the segment is the end of the buffer param first time if false and the search string matched at the start offset with length zero automatically find next match param reverse if true searching will be performed in a backward direction return an array where the first element is the start offset of the match and the second element is the end offset of the match since j edit 4 2pre4 public abstract match next match char indexed text boolean start firsttime jedit nextmatch charindexed directory list set constructor public directory list set string directory string glob boolean recurse this directory directory this glob glob this recurse recurse directorylistset directorylistset get directory method public string get directory return directory getdirectory getdirectory set directory method since j edit 4 2pre1 public void set directory string directory this directory directory invalidate cached list setdirectory jedit setdirectory invalidatecachedlist get file filter method public string get file filter return glob getfilefilter getfilefilter set file filter method since j edit 4 2pre1 public void set file filter string glob this glob glob invalidate cached list setfilefilter jedit setfilefilter invalidatecachedlist is recursive method public boolean is recursive return recurse isrecursive isrecursive set recursive method since j edit 4 2pre1 public void set recursive boolean recurse this recurse recurse invalidate cached list setrecursive jedit setrecursive invalidatecachedlist get code method public string get code return new directory list set misc utilities chars to escapes directory misc utilities chars to escapes glob recurse getcode getcode directorylistset miscutilities charstoescapes miscutilities charstoescapes getfiles method protected string getfiles final component comp final vfs vfs vfs manager getvfs for path directory object session if swing utilities is event dispatch thread session vfs createvfs session directory comp else final object return value new object 1 try swing utilities invoke and wait new runnable public void run return value 0 vfs createvfs session directory comp catch exception e log log log error this e session return value 0 if session null return null try return vfs listdirectory session directory glob recurse comp catch io exception io vfs manager error comp directory ioerror new string io to string return null _getfiles _getfiles vfsmanager getvfsforpath swingutilities iseventdispatchthread createvfssession returnvalue swingutilities invokeandwait returnvalue createvfssession returnvalue _listdirectory ioexception vfsmanager tostring swing utilities invoke and wait new runnable public void run return value 0 vfs createvfs session directory comp swingutilities invokeandwait returnvalue createvfssession status bar option pane constructor public status bar option pane super status statusbaroptionpane statusbaroptionpane init method protected void init status bar visible status visible new j check box j edit get property options status visible status visible set selected j edit get boolean property view status visible status visible add action listener new action handler add component status visible foreground color add component j edit get property options status foreground foreground color new color well button j edit get color property view status foreground grid bag constraints vertical background color add component j edit get property options status background background color new color well button j edit get color property view status background grid bag constraints vertical caret status show caret status new j check box j edit get property options status show caret status show caret status set selected j edit get boolean property view status show caret status add component show caret status edit mode show edit mode new j check box j edit get property options status show edit mode show edit mode set selected j edit get boolean property view status show edit mode add component show edit mode fold mode show fold mode new j check box j edit get property options status show fold mode show fold mode set selected j edit get boolean property view status show fold mode add component show fold mode encoding show encoding new j check box j edit get property options status show encoding show encoding set selected j edit get boolean property view status show encoding add component show encoding wrap show wrap new j check box j edit get property options status show wrap show wrap set selected j edit get boolean property view status show wrap add component show wrap multi select show multi select new j check box j edit get property options status show multi select show multi select set selected j edit get boolean property view status show multi select add component show multi select rect select show rect select new j check box j edit get property options status show rect select show rect select set selected j edit get boolean property view status show rect select add component show rect select overwrite show overwrite new j check box j edit get property options status show overwrite show overwrite set selected j edit get boolean property view status show overwrite add component show overwrite line seperator show line seperator new j check box j edit get property options status show line seperator show line seperator set selected j edit get boolean property view status show line seperator add component show line seperator memory status show memory new j check box j edit get property options status show memory show memory set selected j edit get boolean property view status show memory show memory add action listener new action handler add component show memory memory foreground color add component j edit get property options status memory foreground mem foreground color new color well button j edit get color property view status memory foreground grid bag constraints vertical memory background color add component j edit get property options status memory background mem background color new color well button j edit get color property view status memory background grid bag constraints vertical clock show clock new j check box j edit get property options status show clock show clock set selected j edit get boolean property view status show clock show clock add action listener new action handler add component show clock update enabled _init _init statusvisible jcheckbox jedit getproperty statusvisible setselected jedit getbooleanproperty statusvisible addactionlistener actionhandler addcomponent statusvisible addcomponent jedit getproperty foregroundcolor colorwellbutton jedit getcolorproperty gridbagconstraints addcomponent jedit getproperty backgroundcolor colorwellbutton jedit getcolorproperty gridbagconstraints showcaretstatus jcheckbox jedit getproperty showcaretstatus setselected jedit getbooleanproperty addcomponent showcaretstatus showeditmode jcheckbox jedit getproperty showeditmode setselected jedit getbooleanproperty addcomponent showeditmode showfoldmode jcheckbox jedit getproperty showfoldmode setselected jedit getbooleanproperty addcomponent showfoldmode showencoding jcheckbox jedit getproperty showencoding setselected jedit getbooleanproperty addcomponent showencoding showwrap jcheckbox jedit getproperty showwrap setselected jedit getbooleanproperty addcomponent showwrap showmultiselect jcheckbox jedit getproperty showmultiselect setselected jedit getbooleanproperty addcomponent showmultiselect showrectselect jcheckbox jedit getproperty showrectselect setselected jedit getbooleanproperty addcomponent showrectselect showoverwrite jcheckbox jedit getproperty showoverwrite setselected jedit getbooleanproperty addcomponent showoverwrite showlineseperator jcheckbox jedit getproperty showlineseperator setselected jedit getbooleanproperty addcomponent showlineseperator showmemory jcheckbox jedit getproperty showmemory setselected jedit getbooleanproperty showmemory addactionlistener actionhandler addcomponent showmemory addcomponent jedit getproperty memforegroundcolor colorwellbutton jedit getcolorproperty gridbagconstraints addcomponent jedit getproperty membackgroundcolor colorwellbutton jedit getcolorproperty gridbagconstraints showclock jcheckbox jedit getproperty showclock setselected jedit getbooleanproperty showclock addactionlistener actionhandler addcomponent showclock updateenabled save method protected void save j edit set boolean property view status visible status visible is selected j edit set color property view status foreground foreground color get selected color j edit set color property view status background background color get selected color j edit set boolean property view status show caret status show caret status is selected j edit set boolean property view status show edit mode show edit mode is selected j edit set boolean property view status show fold mode show fold mode is selected j edit set boolean property view status show encoding show encoding is selected j edit set boolean property view status show wrap show wrap is selected j edit set boolean property view status show multi select show multi select is selected j edit set boolean property view status show rect select show rect select is selected j edit set boolean property view status show overwrite show overwrite is selected j edit set boolean property view status show line seperator show line seperator is selected j edit set boolean property view status show memory show memory is selected j edit set color property view status memory foreground mem foreground color get selected color j edit set color property view status memory background mem background color get selected color j edit set boolean property view status show clock show clock is selected _save _save jedit setbooleanproperty statusvisible isselected jedit setcolorproperty foregroundcolor getselectedcolor jedit setcolorproperty backgroundcolor getselectedcolor jedit setbooleanproperty showcaretstatus isselected jedit setbooleanproperty showeditmode isselected jedit setbooleanproperty showfoldmode isselected jedit setbooleanproperty showencoding isselected jedit setbooleanproperty showwrap isselected jedit setbooleanproperty showmultiselect isselected jedit setbooleanproperty showrectselect isselected jedit setbooleanproperty showoverwrite isselected jedit setbooleanproperty showlineseperator isselected jedit setbooleanproperty showmemory isselected jedit setcolorproperty memforegroundcolor getselectedcolor jedit setcolorproperty membackgroundcolor getselectedcolor jedit setbooleanproperty showclock isselected private void update enabled boolean enabled status visible is selected show caret status set enabled enabled show edit mode set enabled enabled show fold mode set enabled enabled show encoding set enabled enabled show wrap set enabled enabled show multi select set enabled enabled show rect select set enabled enabled show overwrite set enabled enabled show line seperator set enabled enabled show memory set enabled enabled mem foreground color set enabled enabled show memory is selected mem background color set enabled enabled show memory is selected show clock set enabled enabled updateenabled statusvisible isselected showcaretstatus setenabled showeditmode setenabled showfoldmode setenabled showencoding setenabled showwrap setenabled showmultiselect setenabled showrectselect setenabled showoverwrite setenabled showlineseperator setenabled showmemory setenabled memforegroundcolor setenabled showmemory isselected membackgroundcolor setenabled showmemory isselected showclock setenabled class action handler implements action listener public void action performed action event evt update enabled actionhandler actionlistener actionperformed actionevent updateenabled print option pane constructor public print option pane super print printoptionpane printoptionpane init method protected void init font font new font selector j edit get font property print font add component j edit get property options print font font header print header new j check box j edit get property options print header print header set selected j edit get boolean property print header add component print header footer print footer new j check box j edit get property options print footer print footer set selected j edit get boolean property print footer add component print footer line numbering print line numbers new j check box j edit get property options print line numbers print line numbers set selected j edit get boolean property print line numbers add component print line numbers color color new j check box j edit get property options print color color set selected j edit get boolean property print color add component color tab size string tab sizes 2 4 8 tab size new j combo box tab sizes tab size set editable true tab size set selected item j edit get property print tab size add component j edit get property options print tab size tab size add separator options print workarounds spacing workaround glyph vector new j check box j edit get property options print glyph vector glyph vector set selected j edit get boolean property print glyph vector add component glyph vector force 1 3 print dialog force13 new j check box j edit get property options print force13 force13 set selected j edit get boolean property print force13 if operating system has java14 add component force13 _init _init fontselector jedit getfontproperty addcomponent jedit getproperty printheader jcheckbox jedit getproperty printheader setselected jedit getbooleanproperty addcomponent printheader printfooter jcheckbox jedit getproperty printfooter setselected jedit getbooleanproperty addcomponent printfooter printlinenumbers jcheckbox jedit getproperty linenumbers printlinenumbers setselected jedit getbooleanproperty linenumbers addcomponent printlinenumbers jcheckbox jedit getproperty setselected jedit getbooleanproperty addcomponent tabsizes tabsize jcombobox tabsizes tabsize seteditable tabsize setselecteditem jedit getproperty tabsize addcomponent jedit getproperty tabsize tabsize addseparator glyphvector jcheckbox jedit getproperty glyphvector glyphvector setselected jedit getbooleanproperty glyphvector addcomponent glyphvector jcheckbox jedit getproperty setselected jedit getbooleanproperty operatingsystem hasjava14 addcomponent save method protected void save j edit set font property print font font get font j edit set boolean property print header print header is selected j edit set boolean property print footer print footer is selected j edit set boolean property print line numbers print line numbers is selected j edit set boolean property print color color is selected j edit set property print tab size string tab size get selected item j edit set boolean property print glyph vector glyph vector is selected j edit set boolean property print force13 force13 is selected _save _save jedit setfontproperty getfont jedit setbooleanproperty printheader isselected jedit setbooleanproperty printfooter isselected jedit setbooleanproperty linenumbers printlinenumbers isselected jedit setbooleanproperty isselected jedit setproperty tabsize tabsize getselecteditem jedit setbooleanproperty glyphvector glyphvector isselected jedit setbooleanproperty isselected public tar output stream output stream os this os tar buffer default blksize tar buffer default rcdsize taroutputstream outputstream tarbuffer default_blksize tarbuffer default_rcdsize public tar output stream output stream os int block size this os block size tar buffer default rcdsize taroutputstream outputstream blocksize blocksize tarbuffer default_rcdsize public tar output stream output stream os int block size int record size super os this buffer new tar buffer os block size record size this debug false this assem len 0 this assem buf new byte record size this record buf new byte record size this one buf new byte 1 taroutputstream outputstream blocksize recordsize tarbuffer blocksize recordsize assemlen assembuf recordsize recordbuf recordsize onebuf sets the debugging flag param debugf true to turn on debugging public void set debug boolean debugf this debug debugf setdebug sets the debugging flag in this stream s tar buffer param debugf true to turn on debugging public void set buffer debug boolean debug this buffer set debug debug tarbuffer setbufferdebug setdebug ends the tar archive without closing the underlying output stream the result is that the eof record of nulls is written public void finish throws io exception this writeeof record outputstream ioexception writeeofrecord ends the tar archive and closes the underlying output stream this means that finish is called followed by calling the tar buffer s close public void close throws io exception this finish this buffer close outputstream tarbuffer ioexception get the record size being used by this stream s tar buffer return the tar buffer record size public int get record size return this buffer get record size tarbuffer tarbuffer getrecordsize getrecordsize put an entry on the output stream this writes the entry s header record and positions the output stream for writing the contents of the entry once this method is called the stream is ready for calls to write to write the entry s contents once the contents are written close entry b must b be called to ensure that all buffered data is completely written to the output stream param entry the tar entry to be written to the archive public void put next entry tar entry entry throws io exception if entry get header name length tar header namelen throw new invalid header exception file name entry get header name is too long tar header namelen bytes entry write entry header this record buf this buffer write record this record buf this curr bytes 0 if entry is directory this curr size 0 else this curr size int entry get size closeentry tarentry putnextentry tarentry ioexception getheader tarheader invalidheaderexception getheader tarheader writeentryheader recordbuf writerecord recordbuf currbytes isdirectory currsize currsize getsize close an entry this method must be called for all file entries that contain data the reason is that we must buffer data written to the stream in order to satisfy the buffer s record based writes thus there may be data fragments still being assembled that must be written to the output stream before this entry is closed and the next entry written public void close entry throws io exception if this assem len 0 for int i this assem len i this assem buf length i this assem buf i 0 this buffer write record this assem buf this curr bytes this assem len this assem len 0 if this curr bytes this curr size throw new io exception entry closed at this curr bytes before the this curr size bytes specified in the header were written closeentry ioexception assemlen assemlen assembuf assembuf writerecord assembuf currbytes assemlen assemlen currbytes currsize ioexception currbytes currsize writes a byte to the current tar archive entry this method simply calls read byte int int param b the byte written public void write int b throws io exception this one buf 0 byte b this write this one buf 0 1 ioexception onebuf onebuf writes bytes to the current tar archive entry this method simply calls read byte int int param w buf the buffer to write to the archive return the number of bytes read or 1 at eof public void write byte w buf throws io exception this write w buf 0 w buf length wbuf wbuf ioexception wbuf wbuf writes bytes to the current tar archive entry this method is aware of the current entry and will throw an exception if you attempt to write bytes past the length specified for the current entry the method is also painfully aware of the record buffering required by tar buffer and manages buffers that are not a multiple of recordsize in length including assembling records from small buffers this method simply calls read byte int int param w buf the buffer to write to the archive param w offset the offset in the buffer from which to get bytes param num to write the number of bytes to write public void write byte w buf int w offset int num to write throws io exception if this curr bytes num to write this curr size throw new io exception request to write num to write bytes exceeds size in header of this curr size bytes we have to deal with assembly the programmer can be writing little 32 byte chunks for all we know and we must assemble complete records for writing review maybe this should be in tar buffer could that help to eliminate some of the buffer copying if this assem len 0 if this assem len num to write this record buf length int a len this record buf length this assem len system arraycopy this assem buf 0 this record buf 0 this assem len system arraycopy w buf w offset this record buf this assem len a len this buffer write record this record buf this curr bytes this record buf length w offset a len num to write a len this assem len 0 else this assem len num to write this record buf length system arraycopy w buf w offset this assem buf this assem len num to write w offset num to write this assem len num to write num to write num to write when we get here we have either o an empty assemble buffer o no bytes to write num to write 0 for num to write 0 if num to write this record buf length system arraycopy w buf w offset this assem buf this assem len num to write this assem len num to write break this buffer write record w buf w offset int num this record buf length this curr bytes num num to write num w offset num tarbuffer wbuf woffset numtowrite wbuf woffset numtowrite ioexception currbytes numtowrite currsize ioexception numtowrite currsize tarbuffer assemlen assemlen numtowrite recordbuf alen recordbuf assemlen assembuf recordbuf assemlen wbuf woffset recordbuf assemlen alen writerecord recordbuf currbytes recordbuf woffset alen numtowrite alen assemlen assemlen numtowrite recordbuf wbuf woffset assembuf assemlen numtowrite woffset numtowrite assemlen numtowrite numtowrite numtowrite numtowrite numtowrite numtowrite recordbuf wbuf woffset assembuf assemlen numtowrite assemlen numtowrite writerecord wbuf woffset recordbuf currbytes numtowrite woffset write an eof end of archive record to the tar archive an eof record consists of a record of all zeros private void writeeof record throws io exception for int i 0 i this record buf length i this record buf i 0 this buffer write record this record buf writeeofrecord ioexception recordbuf recordbuf writerecord recordbuf public boolean super import bsh import declaration int id super id superimport bshimportdeclaration public object eval call stack callstack interpreter interpreter throws eval error name space namespace callstack top if super import try namespace do super import catch util eval error e throw e to eval error this callstack else if static import if import package class clas bsh ambiguous name jjt get child 0 to class callstack interpreter namespace import static clas else throw new eval error static field imports not supported yet this callstack else string name bsh ambiguous name jjt get child 0 text if import package namespace import package name else namespace import class name return primitive void callstack evalerror namespace superimport dosuperimport utilevalerror toevalerror staticimport importpackage bshambiguousname jjtgetchild toclass importstatic evalerror bshambiguousname jjtgetchild importpackage importpackage importclass public error entry string path string message prop object args this path path string message j edit get property message prop args if message null message undefined property message prop log log log error this path log log log error this message vector tokenized message new vector int last index 1 for int i 0 i message length i if message char at i n tokenized message add element message substring last index 1 i last index i if last index message length tokenized message add element message substring last index 1 messages new string tokenized message size tokenized message copy into messages errorentry messageprop jedit getproperty messageprop messageprop tokenizedmessage lastindex charat tokenizedmessage addelement lastindex lastindex lastindex tokenizedmessage addelement lastindex tokenizedmessage tokenizedmessage copyinto public boolean equals object o if o instanceof error entry error entry e error entry o return e path equals path else return false errorentry errorentry errorentry error list dialog constructor public error list dialog frame frame string title string caption vector messages boolean plugin error super frame title plugin error j panel content new j panel new border layout 12 12 content set border new empty border 12 12 12 12 set content pane content box icon box new box box layout y axis icon box add new j label ui manager get icon option pane error icon icon box add box create glue content add border layout west icon box j panel center panel new j panel new border layout j label label new j label caption label set border new empty border 0 0 6 0 center panel add border layout north label j list errors new j list messages errors set cell renderer new error list cell renderer errors set visible row count math min messages size 4 need this bullshit scroll bar policy for the preferred size hack to work j scroll pane scroll pane new j scroll pane errors j scroll pane vertical scrollbar always j scroll pane horizontal scrollbar always dimension size scroll pane get preferred size size width math min size width 400 scroll pane set preferred size size center panel add border layout center scroll pane content add border layout center center panel box buttons new box box layout x axis buttons add box create glue ok new j button j edit get property common ok ok add action listener new action handler if plugin error plugin mgr new j button j edit get property error list plugin manager plugin mgr add action listener new action handler buttons add plugin mgr buttons add box create horizontal strut 6 buttons add ok buttons add box create glue content add border layout south buttons get root pane set default button ok pack set location relative to frame set visible true errorlistdialog errorlistdialog pluginerror pluginerror jpanel jpanel borderlayout setborder emptyborder setcontentpane iconbox boxlayout y_axis iconbox jlabel uimanager geticon optionpane erroricon iconbox createglue borderlayout iconbox jpanel centerpanel jpanel borderlayout jlabel jlabel setborder emptyborder centerpanel borderlayout jlist jlist setcellrenderer errorlistcellrenderer setvisiblerowcount jscrollpane scrollpane jscrollpane jscrollpane vertical_scrollbar_always jscrollpane horizontal_scrollbar_always scrollpane getpreferredsize scrollpane setpreferredsize centerpanel borderlayout scrollpane borderlayout centerpanel boxlayout x_axis createglue jbutton jedit getproperty addactionlistener actionhandler pluginerror pluginmgr jbutton jedit getproperty pluginmgr addactionlistener actionhandler pluginmgr createhorizontalstrut createglue borderlayout getrootpane setdefaultbutton setlocationrelativeto setvisible ok method public void ok dispose cancel method public void cancel dispose action performed method public void action performed action event evt if evt get source ok dispose else if evt get source plugin mgr org gjt sp jedit pluginmgr plugin manager show plugin manager j option pane get frame for component error list dialog this actionperformed actionperformed actionevent getsource getsource pluginmgr pluginmanager showpluginmanager joptionpane getframeforcomponent errorlistdialog private string newline re token end int sub index string newline super sub index this newline newline retokenend subindex subindex boolean match char indexed input re match mymatch char ch input char at mymatch index if ch char indexed out of bounds return mymatch eflags re reg noteol 0 false next input mymatch if newline null char z int i 0 position in newline do z newline char at i if ch z return false i ch input char at mymatch index i while i newline length return next input mymatch return false charindexed rematch charat charindexed out_of_bounds reg_noteol charat charat void dump string buffer os os append stringbuffer show in finder method public static void show in finder string path if new file path exists remember to make this an option later ns application shared application hide j edit get plugin macos plugin ns workspace shared workspace select file path path showinfinder showinfinder nsapplication sharedapplication jedit getplugin macosplugin nsworkspace sharedworkspace selectfile run script method public static void run script string path new script runner path start swing utilities invoke later new script runner path runscript runscript scriptrunner swingutilities invokelater scriptrunner private string path public script runner string path this path path scriptrunner public void run file file new file path if file exists try buffered reader reader new buffered reader new file reader file string buffer code new string buffer string line while line reader read line null code append line n ns apple script script new ns apple script code to string ns mutable dictionary compile err info new ns mutable dictionary ns mutable dictionary exec err info new ns mutable dictionary if script compile compile err info if script execute exec err info null j option pane show message dialog null exec err info object for key ns apple script error brief message j edit get property macos plugin dialog script title j option pane error message else j option pane show message dialog null compile err info object for key ns apple script error brief message j edit get property macos plugin dialog script title j option pane error message catch exception ex bufferedreader bufferedreader filereader stringbuffer stringbuffer readline nsapplescript nsapplescript tostring nsmutabledictionary compileerrinfo nsmutabledictionary nsmutabledictionary execerrinfo nsmutabledictionary compileerrinfo execerrinfo joptionpane showmessagedialog execerrinfo objectforkey nsapplescripterrorbriefmessage jedit getproperty macosplugin joptionpane error_message joptionpane showmessagedialog compileerrinfo objectforkey nsapplescripterrorbriefmessage jedit getproperty macosplugin joptionpane error_message bufferio request constructor creates a new buffer i o request param type the request type param view the view param buffer the buffer param session the vfs session param vfs the vfs param path the path public bufferio request int type view view buffer buffer object session vfs vfs string path this type type this view view this buffer buffer this session session this vfs vfs this path path markers path vfs get parent of path path vfs get file name path marks bufferiorequest bufferiorequest markerspath getparentofpath getfilename run method public void run switch type case load load break case save save break case autosave autosave break case insert insert break default throw new internal error internalerror to string method public string to string string type string switch type case load type string load break case save type string save break case autosave type string autosave break default type string unknown return get class get name type type string buffer buffer tostring tostring typestring typestring typestring typestring typestring getclass getname typestring load method private void load input stream in null try try string args vfs get file name path set abortable true if buffer is temporary set status j edit get property vfs status load args set progress value 0 path vfs canonpath session path view vfs directory entry entry vfs getdirectoryentry session path view long length if entry null length entry length else length 0l in vfs createinputstream session path false view if in null return read autodetect in length false buffer set new file false catch char conversion exception ch log log log error this ch object pp buffer get property buffer encoding ch to string vfs manager error view path ioerror encoding error pp buffer set boolean property error occurred true catch unsupported encoding exception uu log log log error this uu object pp buffer get property buffer encoding uu to string vfs manager error view path ioerror encoding error pp buffer set boolean property error occurred true catch io exception io log log log error this io object pp io to string vfs manager error view path ioerror read error pp buffer set boolean property error occurred true catch out of memory error oom log log log error this oom vfs manager error view path out of memory error null buffer set boolean property error occurred true if j edit get boolean property persistent markers try string args vfs get file name path if buffer is temporary set status j edit get property vfs status load markers args set abortable true in vfs createinputstream session markers path true view if in null read markers buffer in catch io exception io ignore catch work thread abort a if in null try in close catch io exception io buffer set boolean property error occurred true finally try vfs endvfssession session view catch io exception io log log log error this io string pp io to string vfs manager error view path ioerror read error pp buffer set boolean property error occurred true catch work thread abort a buffer set boolean property error occurred true inputstream getfilename setabortable istemporary setstatus jedit getproperty setprogressvalue _canonpath directoryentry _getdirectoryentry _createinputstream setnewfile charconversionexception getproperty tostring vfsmanager setbooleanproperty error_occurred unsupportedencodingexception getproperty tostring vfsmanager setbooleanproperty error_occurred ioexception tostring vfsmanager setbooleanproperty error_occurred outofmemoryerror vfsmanager setbooleanproperty error_occurred jedit getbooleanproperty persistentmarkers getfilename istemporary setstatus jedit getproperty setabortable _createinputstream markerspath readmarkers ioexception workthread ioexception setbooleanproperty error_occurred _endvfssession ioexception tostring vfsmanager setbooleanproperty error_occurred workthread setbooleanproperty error_occurred autodetect method tries to detect if the stream is gzipped and if it has an encoding specified with an xml pi private reader autodetect input stream in throws io exception in new buffered input stream in string encoding buffer get string property buffer encoding if in mark supported log log log warning this mark not supported in else if buffer get boolean property buffer encoding autodetect in mark xml pi length int b1 in read int b2 in read int b3 in read if encoding equals misc utilities utf 8 y java does not support this encoding so we have to handle it manually if b1 utf8 magic 1 b2 utf8 magic 2 b3 utf8 magic 3 file does not begin with utf 8 y signature reset stream read as utf 8 in reset else file begins with utf 8 y signature discard the signature and read the remainder as utf 8 encoding utf 8 else if b1 gzip magic 1 b2 gzip magic 2 in reset in new gzip input stream in buffer set boolean property buffer gzipped true auto detect encoding within the gzip stream return autodetect in else if b1 unicode magic 1 b2 unicode magic 2 b1 unicode magic 2 b2 unicode magic 1 in reset encoding utf 16 buffer set property buffer encoding encoding else if b1 utf8 magic 1 b2 utf8 magic 2 b3 utf8 magic 3 do not reset the stream and just treat it like a normal utf 8 file buffer set property buffer encoding misc utilities utf 8 y encoding utf 8 else in reset byte xmlpi new byte xml pi length int offset 0 int count while count in read xmlpi offset xml pi length offset 1 offset count if offset xml pi length break string xmlpi new string xmlpi 0 offset ascii if xmlpi starts with xml int index xmlpi index of encoding if index 1 index 9 xmlpi length char ch xmlpi char at index 9 int end index xmlpi index of ch index 10 encoding xmlpi substring index 10 end index if misc utilities is supported encoding encoding buffer set property buffer encoding encoding else log log log warning this xml pi specifies unsupported encoding encoding in reset return new input stream reader in encoding inputstream ioexception bufferedinputstream getstringproperty marksupported getbooleanproperty encoding_autodetect xml_pi_length miscutilities utf_8_y utf8_magic_1 utf8_magic_2 utf8_magic_3 gzip_magic_1 gzip_magic_2 gzipinputstream setbooleanproperty unicode_magic_1 unicode_magic_2 unicode_magic_2 unicode_magic_1 setproperty utf8_magic_1 utf8_magic_2 utf8_magic_3 setproperty miscutilities utf_8_y _xmlpi xml_pi_length _xmlpi xml_pi_length xml_pi_length _xmlpi startswith indexof charat endindex indexof endindex miscutilities issupportedencoding setproperty inputstreamreader read method private segment buffer read reader in long length boolean insert throws io exception we guess an initial size for the array integer array end offsets new integer array math max 1 int length 50 only true if the file size is known boolean track progress buffer is temporary length 0 if track progress set progress value 0 set progress maximum int length if the file size is not known start with a resonable default buffer size if length 0 length iobufsize segment buffer seg new segment buffer int length 1 char buf new char iobufsize number of characters in buf array input stream read doesn t always fill the array eg the file size is not a multiple of iobufsize or it is a g zipped file etc int len true if a n was read after a r usually means this is a dos windows file boolean crlf false a r was read hence a macos file boolean cr only false was the previous read character a r if we read a n and this is true we assume we have a dos windows file boolean last wascr false number of lines read every 100 lines we update the progress bar int line count 0 while len in read buf 0 buf length 1 offset of previous line relative to the start of the i o buffer not relative to the start of the document int last line 0 for int i 0 i len i look for line endings switch buf i case r if we read a r and last wascr is also true it is probably a mac file r r in stream if last wascr cr only true crlf false otherwise set a flag so that n knows that last was a r else last wascr true insert a line seg append buf last line i last line seg append n end offsets add seg count if track progress line count progress interval 0 set progress value seg count this is i 1 to take the trailing n into account last line i 1 break case n if last wascr is true we just read a r followed by a n we specify that this is a windows file but take no further action and just ignore the r if last wascr cr only false crlf true last wascr false bump last line so that the next line doesn t erronously pick up the r last line i 1 otherwise we found a n that follows some other character hence we have a unix file else cr only false crlf false seg append buf last line i last line seg append n end offsets add seg count if track progress line count progress interval 0 set progress value seg count last line i 1 break default if we find some other character that follows a r so it is not a windows file and probably a mac file if last wascr cr only true crlf false last wascr false break if track progress set progress value seg count add remaining stuff from buffer seg append buf last line len last line set abortable false string line separator if seg count 0 fix for 865589 0 byte files should open using the default line seperator line separator j edit get property buffer line separator system get property line separator else if crlf line separator r n else if cr only line separator r else line separator n in close chop trailing newline and or z if any int buffer length seg count if buffer length 0 char ch seg array buffer length 1 if ch 0x1a dos z seg count buffer set boolean property buffer trailing eol false if buffer length 0 j edit get boolean property strip trailingeol char ch seg array buffer length 1 if ch n buffer set boolean property buffer trailing eol true seg count end offsets set size end offsets get size 1 add a line marker at the end for proper offset manager operation end offsets add seg count 1 to avoid having to deal with read write locks and such we insert the loaded data into the buffer in the post load cleanup runnable which runs in the awt thread if insert buffer set property load data seg buffer set property end offsets end offsets buffer set property new path path if line separator null buffer set property buffer linesep line separator used in insert return seg segmentbuffer ioexception integerarray endoffsets integerarray trackprogress istemporary trackprogress setprogressvalue setprogressmaximum segmentbuffer segmentbuffer inputstream gzipped cronly lastwascr linecount lastline lastwascr lastwascr cronly lastwascr lastline lastline endoffsets trackprogress linecount progress_interval setprogressvalue lastline lastwascr lastwascr cronly lastwascr lastline lastline cronly lastline lastline endoffsets trackprogress linecount progress_interval setprogressvalue lastline lastwascr cronly lastwascr trackprogress setprogressvalue lastline lastline setabortable lineseparator lineseparator jedit getproperty lineseparator getproperty lineseparator cronly lineseparator lineseparator bufferlength bufferlength bufferlength setbooleanproperty trailing_eol bufferlength jedit getbooleanproperty striptrailingeol bufferlength setbooleanproperty trailing_eol endoffsets setsize endoffsets getsize endoffsets setproperty load_data setproperty end_offsets endoffsets setproperty new_path lineseparator setproperty lineseparator read markers method private void read markers buffer buffer input stream in throws io exception for reload command buffer remove all markers buffered reader in new buffered reader new input stream reader in try string line while line in read line null compatibility kludge for j edit 3 1 and earlier if line starts with continue char shortcut line char at 1 int start line index of int end line index of start 1 int position integer parse int line substring start 1 end buffer add marker shortcut position finally in close readmarkers readmarkers inputstream _in ioexception removeallmarkers bufferedreader bufferedreader inputstreamreader _in readline jedit startswith charat indexof indexof parseint addmarker save method private void save output stream out null try string args vfs get file name path set status j edit get property vfs status save args the entire save operation can be aborted set abortable true path vfs canonpath session path view if misc utilities isurl path path misc utilities resolve symlinks path only backup once per session if buffer get property buffer backed up null j edit get boolean property backup every save vfs backup session path view buffer set boolean property buffer backed up true if the vfs supports renaming files we first save to filename save then rename that to filename so that if the save fails data will not be lost as of 4 1pre7 we now call vfs get two stage save name instead of constructing the path directly since some vfs s might not allow in filenames string save path boolean two stage save vfs get capabilities vfs rename cap 0 j edit get boolean property two stage save if two stage save save path vfs get two stage save name path else save path path out vfs createoutputstream session save path view try this must be after the stream is created or we deadlock with ssh tools buffer read lock if out null can t use buffer get name here because it is not changed until the save is complete if save path ends with gz buffer set boolean property buffer gzipped true if buffer get boolean property buffer gzipped out new gzip output stream out write buffer out if two stage save if vfs rename session save path path view throw new io exception rename failed save path we only save markers to vfs s that support deletion otherwise we will accumilate stale marks files if vfs get capabilities vfs delete cap 0 if j edit get boolean property persistent markers buffer get markers size 0 set status j edit get property vfs status save markers args set progress value 0 out vfs createoutputstream session markers path view if out null write markers buffer out else vfs delete session markers path view else buffer set boolean property error occurred true if two stage save vfs manager sendvfs update vfs path true finally buffer read unlock catch io exception io log log log error this io string pp io to string vfs manager error view path ioerror write error pp buffer set boolean property error occurred true catch work thread abort a if out null try out close catch io exception io buffer set boolean property error occurred true finally try vfs savecomplete session buffer path view vfs endvfssession session view catch io exception io log log log error this io string pp io to string vfs manager error view path ioerror write error pp buffer set boolean property error occurred true catch work thread abort a buffer set boolean property error occurred true outputstream getfilename setstatus jedit getproperty setabortable _canonpath miscutilities miscutilities resolvesymlinks getproperty backed_up jedit getbooleanproperty backupeverysave _backup setbooleanproperty backed_up gettwostagesavename savepath twostagesave getcapabilities rename_cap jedit getbooleanproperty twostagesave twostagesave savepath gettwostagesavename savepath _createoutputstream savepath sshtools readlock getname savepath endswith setbooleanproperty getbooleanproperty gzipoutputstream twostagesave _rename savepath ioexception savepath getcapabilities delete_cap jedit getbooleanproperty persistentmarkers getmarkers setstatus jedit getproperty setprogressvalue _createoutputstream markerspath writemarkers _delete markerspath setbooleanproperty error_occurred twostagesave vfsmanager sendvfsupdate readunlock ioexception tostring vfsmanager setbooleanproperty error_occurred workthread ioexception setbooleanproperty error_occurred _savecomplete _endvfssession ioexception tostring vfsmanager setbooleanproperty error_occurred workthread setbooleanproperty error_occurred autosave method private void autosave output stream out null try string args vfs get file name path set status j edit get property vfs status autosave args the entire save operation can be aborted set abortable true try buffer read lock if buffer is dirty buffer has been saved while we were waiting return out vfs createoutputstream session path view if out null return write buffer out catch exception e finally buffer read unlock catch work thread abort a if out null try out close catch io exception io outputstream getfilename setstatus jedit getproperty setabortable readlock isdirty _createoutputstream readunlock workthread ioexception write method private void write buffer buffer output stream out throws io exception buffered writer out null try string encoding buffer get string property buffer encoding if encoding equals misc utilities utf 8 y not supported by java out write utf8 magic 1 out write utf8 magic 2 out write utf8 magic 3 out flush encoding utf 8 out new buffered writer new output stream writer out encoding iobufsize segment line segment new segment string newline buffer get string property buffer linesep if newline null newline system get property line separator set progress maximum buffer get line count progress interval set progress value 0 int i 0 while i buffer get line count buffer get line text i line segment out write line segment array line segment offset line segment count if i buffer get line count 1 out write newline if i progress interval 0 set progress value i progress interval if j edit get boolean property strip trailingeol buffer get boolean property buffer trailing eol out write newline finally if out null out close else out close outputstream _out ioexception bufferedwriter getstringproperty miscutilities utf_8_y _out utf8_magic_1 _out utf8_magic_2 _out utf8_magic_3 _out bufferedwriter outputstreamwriter _out linesegment getstringproperty getproperty setprogressmaximum getlinecount progress_interval setprogressvalue getlinecount getlinetext linesegment linesegment linesegment linesegment getlinecount progress_interval setprogressvalue progress_interval jedit getbooleanproperty striptrailingeol getbooleanproperty trailing_eol _out write markers method private void write markers buffer buffer output stream out throws io exception writer o new buffered writer new output stream writer out try vector markers buffer get markers for int i 0 i markers size i marker marker marker markers element at i o write o write marker get shortcut o write string pos string value of marker get position o write pos o write o write pos o write n finally o close writemarkers writemarkers outputstream ioexception bufferedwriter outputstreamwriter getmarkers elementat getshortcut valueof getposition insert method private void insert input stream in null try try string args vfs get file name path set status j edit get property vfs status load args set abortable true path vfs canonpath session path view vfs directory entry entry vfs getdirectoryentry session path view long length if entry null length entry length else length 0l in vfs createinputstream session path false view if in null return final segment buffer seg read autodetect in length true we don t do this in buffer insert so that we can insert multiple files at once vfs manager run inawt thread new runnable public void run view get text area set selected text seg to string catch io exception io log log log error this io string pp io to string vfs manager error view path ioerror read error pp buffer set boolean property error occurred true catch work thread abort a if in null try in close catch io exception io buffer set boolean property error occurred true finally try vfs endvfssession session view catch io exception io log log log error this io string pp io to string vfs manager error view path ioerror read error pp buffer set boolean property error occurred true catch work thread abort a buffer set boolean property error occurred true inputstream getfilename setstatus jedit getproperty setabortable _canonpath directoryentry _getdirectoryentry _createinputstream segmentbuffer vfsmanager runinawtthread gettextarea setselectedtext tostring ioexception tostring vfsmanager setbooleanproperty error_occurred workthread ioexception setbooleanproperty error_occurred _endvfssession ioexception tostring vfsmanager setbooleanproperty error_occurred workthread setbooleanproperty error_occurred public void run view get text area set selected text seg to string gettextarea setselectedtext tostring public class context option pane extends abstract option pane public context option pane super context contextoptionpane abstractoptionpane contextoptionpane protected members protected void init set layout new border layout j label caption new j label j edit get property options context caption add border layout north caption string context menu j edit get property view context string tokenizer st new string tokenizer context menu list model new default list model while st has more tokens string action name string st next token if action name equals list model add element new context option pane menu item else edit action action j edit get action action name if action null continue string label action get label if label null continue list model add element new context option pane menu item action name label list new j list list model list set selection mode list selection model single selection list add list selection listener new list handler add border layout center new j scroll pane list j panel buttons new j panel buttons set border new empty border 3 0 0 0 buttons set layout new box layout buttons box layout x axis action handler action handler new action handler add new rollover button gui utilities load icon plus png add set tool tip text j edit get property common add add add action listener action handler buttons add add buttons add box create horizontal strut 6 remove new rollover button gui utilities load icon minus png remove set tool tip text j edit get property common remove remove add action listener action handler buttons add remove buttons add box create horizontal strut 6 move up new rollover button gui utilities load icon arrowu png move up set tool tip text j edit get property common move up move up add action listener action handler buttons add move up buttons add box create horizontal strut 6 move down new rollover button gui utilities load icon arrowd png move down set tool tip text j edit get property common move down move down add action listener action handler buttons add move down buttons add box create glue update buttons add border layout south buttons _init setlayout borderlayout jlabel jlabel jedit getproperty borderlayout contextmenu jedit getproperty stringtokenizer stringtokenizer contextmenu listmodel defaultlistmodel hasmoretokens actionname nexttoken actionname listmodel addelement contextoptionpane menuitem editaction jedit getaction actionname getlabel listmodel addelement contextoptionpane menuitem actionname jlist listmodel setselectionmode listselectionmodel single_selection addlistselectionlistener listhandler borderlayout jscrollpane jpanel jpanel setborder emptyborder setlayout boxlayout boxlayout x_axis actionhandler actionhandler actionhandler rolloverbutton guiutilities loadicon settooltiptext jedit getproperty addactionlistener actionhandler createhorizontalstrut rolloverbutton guiutilities loadicon settooltiptext jedit getproperty addactionlistener actionhandler createhorizontalstrut moveup rolloverbutton guiutilities loadicon moveup settooltiptext jedit getproperty moveup moveup addactionlistener actionhandler moveup createhorizontalstrut movedown rolloverbutton guiutilities loadicon movedown settooltiptext jedit getproperty movedown movedown addactionlistener actionhandler movedown createglue updatebuttons borderlayout public int compare object obj1 object obj2 return misc utilities compare strings menu item obj1 label menu item obj2 label true miscutilities comparestrings menuitem menuitem protected void save string buffer buf new string buffer for int i 0 i list model get size i if i 0 buf append buf append menu item list model element at i action name j edit set property view context buf to string _save stringbuffer stringbuffer listmodel getsize menuitem listmodel elementat actionname jedit setproperty tostring private void update buttons int index list get selected index remove set enabled index 1 list model get size 0 move up set enabled index 0 move down set enabled index 1 index list model get size 1 updatebuttons getselectedindex setenabled listmodel getsize moveup setenabled movedown setenabled listmodel getsize menu item string action name string label this action name action name this label gui utilities prettify menu label label menuitem actionname actionname actionname guiutilities prettifymenulabel public string to string return label tostring public void action performed action event evt object source evt get source if source add context add dialog dialog new context add dialog context option pane this string selection dialog get selection if selection null return int index list get selected index if index 1 index list model get size else index menu item menu item if selection equals menu item new context option pane menu item else menu item new context option pane menu item selection j edit get action selection get label list model insert element at menu item index list set selected index index list ensure index is visible index else if source remove int index list get selected index list model remove element at index if list model get size 0 list set selected index math min list model get size 1 index update buttons else if source move up int index list get selected index object selected list get selected value list model remove element at index list model insert element at selected index 1 list set selected index index 1 list ensure index is visible index 1 else if source move down int index list get selected index object selected list get selected value list model remove element at index list model insert element at selected index 1 list set selected index index 1 list ensure index is visible index 1 actionperformed actionevent getsource contextadddialog contextadddialog contextoptionpane getselection getselectedindex listmodel getsize menuitem menuitem menuitem contextoptionpane menuitem menuitem contextoptionpane menuitem jedit getaction getlabel listmodel insertelementat menuitem setselectedindex ensureindexisvisible getselectedindex listmodel removeelementat listmodel getsize setselectedindex listmodel getsize updatebuttons moveup getselectedindex getselectedvalue listmodel removeelementat listmodel insertelementat setselectedindex ensureindexisvisible movedown getselectedindex getselectedvalue listmodel removeelementat listmodel insertelementat setselectedindex ensureindexisvisible class list handler implements list selection listener public void value changed list selection event evt update buttons listhandler listselectionlistener valuechanged listselectionevent updatebuttons public context add dialog component comp super gui utilities get parent dialog comp j edit get property options context add title true j panel content new j panel new border layout content set border new empty border 12 12 12 12 set content pane content action handler action handler new action handler button group grp new button group j panel type panel new j panel new grid layout 3 1 6 6 type panel set border new empty border 0 0 6 0 type panel add new j label j edit get property options context add caption separator new j radio button j edit get property options context add separator separator add action listener action handler grp add separator type panel add separator action new j radio button j edit get property options context add action action add action listener action handler grp add action action set selected true type panel add action content add border layout north type panel j panel action panel new j panel new border layout 6 6 action set actions list j edit get action sets vector vec new vector actions list length for int i 0 i actions list length i action set action set actions list i if action set get action count 0 vec add element action set combo new j combo box vec combo add action listener action handler action panel add border layout north combo list new j list list set visible row count 8 list set selection mode list selection model single selection action panel add border layout center new j scroll pane list content add border layout center action panel j panel south panel new j panel south panel set layout new box layout south panel box layout x axis south panel set border new empty border 12 0 0 0 south panel add box create glue ok new j button j edit get property common ok ok add action listener action handler get root pane set default button ok south panel add ok south panel add box create horizontal strut 6 cancel new j button j edit get property common cancel cancel add action listener action handler south panel add cancel south panel add box create glue content add border layout south south panel update list pack set location relative to gui utilities get parent dialog comp set visible true contextadddialog guiutilities getparentdialog jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane actionhandler actionhandler actionhandler buttongroup buttongroup jpanel typepanel jpanel gridlayout typepanel setborder emptyborder typepanel jlabel jedit getproperty jradiobutton jedit getproperty addactionlistener actionhandler typepanel jradiobutton jedit getproperty addactionlistener actionhandler setselected typepanel borderlayout typepanel jpanel actionpanel jpanel borderlayout actionset actionslist jedit getactionsets actionslist actionslist actionset actionset actionslist actionset getactioncount addelement actionset jcombobox addactionlistener actionhandler actionpanel borderlayout jlist setvisiblerowcount setselectionmode listselectionmodel single_selection actionpanel borderlayout jscrollpane borderlayout actionpanel jpanel southpanel jpanel southpanel setlayout boxlayout southpanel boxlayout x_axis southpanel setborder emptyborder southpanel createglue jbutton jedit getproperty addactionlistener actionhandler getrootpane setdefaultbutton southpanel southpanel createhorizontalstrut jbutton jedit getproperty addactionlistener actionhandler southpanel southpanel createglue borderlayout southpanel updatelist setlocationrelativeto guiutilities getparentdialog setvisible public void ok isok true dispose public void cancel dispose public string get selection if isok return null if separator is selected return else if action is selected return context option pane menu item list get selected value action name else throw new internal error getselection isselected isselected contextoptionpane menuitem getselectedvalue actionname internalerror private void update list action set action set action set combo get selected item edit action actions action set get actions vector list model new vector actions length for int i 0 i actions length i edit action action actions i string label action get label if label null continue list model add element new context option pane menu item action get name label misc utilities quicksort list model new context option pane menu item compare list set list data list model updatelist actionset actionset actionset getselecteditem editaction actionset getactions listmodel editaction getlabel listmodel addelement contextoptionpane menuitem getname miscutilities listmodel contextoptionpane menuitemcompare setlistdata listmodel public void action performed action event evt object source evt get source if source instanceof j radio button combo set enabled action is selected list set enabled action is selected if source ok ok else if source cancel cancel else if source combo update list actionperformed actionevent getsource jradiobutton setenabled isselected setenabled isselected updatelist public static final boolean static flag false static final int hexval char c throws java io io exception switch c case 0 return 0 case 1 return 1 case 2 return 2 case 3 return 3 case 4 return 4 case 5 return 5 case 6 return 6 case 7 return 7 case 8 return 8 case 9 return 9 case a case a return 10 case b case b return 11 case c case c return 12 case d case d return 13 case e case e return 14 case f case f return 15 throw new java io io exception should never come here staticflag ioexception ioexception protected void expand buff boolean wrap around char newbuffer new char bufsize 2048 int newbufline new int bufsize 2048 int newbufcolumn new int bufsize 2048 try if wrap around system arraycopy buffer token begin newbuffer 0 bufsize token begin system arraycopy buffer 0 newbuffer bufsize token begin bufpos buffer newbuffer system arraycopy bufline token begin newbufline 0 bufsize token begin system arraycopy bufline 0 newbufline bufsize token begin bufpos bufline newbufline system arraycopy bufcolumn token begin newbufcolumn 0 bufsize token begin system arraycopy bufcolumn 0 newbufcolumn bufsize token begin bufpos bufcolumn newbufcolumn bufpos bufsize token begin else system arraycopy buffer token begin newbuffer 0 bufsize token begin buffer newbuffer system arraycopy bufline token begin newbufline 0 bufsize token begin bufline newbufline system arraycopy bufcolumn token begin newbufcolumn 0 bufsize token begin bufcolumn newbufcolumn bufpos token begin catch throwable t throw new error t get message available bufsize 2048 token begin 0 expandbuff wraparound wraparound tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin getmessage tokenbegin protected void fill buff throws java io io exception int i if max next char ind 4096 max next char ind next char ind 0 try if i input stream read next char buf max next char ind 4096 max next char ind 1 input stream close throw new java io io exception else max next char ind i return catch java io io exception e if bufpos 0 bufpos backup 0 else bufline bufpos line bufcolumn bufpos column throw e fillbuff ioexception maxnextcharind maxnextcharind nextcharind inputstream nextcharbuf maxnextcharind maxnextcharind inputstream ioexception maxnextcharind ioexception protected char read byte throws java io io exception if next char ind max next char ind fill buff return next char buf next char ind readbyte ioexception nextcharind maxnextcharind fillbuff nextcharbuf nextcharind public char begin token throws java io io exception if in buf 0 in buf if bufpos bufsize bufpos 0 token begin bufpos return buffer bufpos token begin 0 bufpos 1 return read char begintoken ioexception inbuf inbuf tokenbegin tokenbegin readchar protected void adjust buff size if available bufsize if token begin 2048 bufpos 0 available token begin else expand buff false else if available token begin available bufsize else if token begin available 2048 expand buff true else available token begin adjustbuffsize tokenbegin tokenbegin expandbuff tokenbegin tokenbegin expandbuff tokenbegin protected void update line column char c column if prev char islf prev char islf false line column 1 else if prev char iscr prev char iscr false if c n prev char islf true else line column 1 switch c case r prev char iscr true break case n prev char islf true break case t column column 8 column 07 break default break bufline bufpos line bufcolumn bufpos column updatelinecolumn prevcharislf prevcharislf prevchariscr prevchariscr prevcharislf prevchariscr prevcharislf public char read char throws java io io exception if in buf 0 in buf if bufpos bufsize bufpos 0 return buffer bufpos char c if bufpos available adjust buff size if buffer bufpos c read byte update line column c int back slash cnt 1 for read all the backslashes if bufpos available adjust buff size try if buffer bufpos c read byte update line column c found a non backslash char if c u back slash cnt 1 1 if bufpos 0 bufpos bufsize 1 break backup back slash cnt return catch java io io exception e if back slash cnt 1 backup back slash cnt return update line column c back slash cnt here we have seen an odd number of backslash s followed by a u try while c read byte u column buffer bufpos c char hexval c 12 hexval read byte 8 hexval read byte 4 hexval read byte column 4 catch java io io exception e throw new error invalid escape character at line line column column if back slash cnt 1 return c else backup back slash cnt 1 return else update line column c return c readchar ioexception inbuf inbuf adjustbuffsize readbyte updatelinecolumn backslashcnt adjustbuffsize readbyte updatelinecolumn backslashcnt backslashcnt ioexception backslashcnt backslashcnt updatelinecolumn backslashcnt readbyte readbyte readbyte readbyte ioexception backslashcnt backslashcnt updatelinecolumn deprecated see get end column public int get column return bufcolumn bufpos getendcolumn getcolumn deprecated see get end line public int get line return bufline bufpos getendline getline public int get end column return bufcolumn bufpos getendcolumn public int get end line return bufline bufpos getendline public int get begin column return bufcolumn token begin getbegincolumn tokenbegin public int get begin line return bufline token begin getbeginline tokenbegin public void backup int amount in buf amount if bufpos amount 0 bufpos bufsize inbuf public java char stream java io reader dstream int startline int startcolumn int buffersize input stream dstream line startline column startcolumn 1 available bufsize buffersize buffer new char buffersize bufline new int buffersize bufcolumn new int buffersize next char buf new char 4096 javacharstream inputstream nextcharbuf public java char stream java io reader dstream int startline int startcolumn this dstream startline startcolumn 4096 javacharstream public java char stream java io reader dstream this dstream 1 1 4096 javacharstream public void re init java io reader dstream int startline int startcolumn int buffersize input stream dstream line startline column startcolumn 1 if buffer null buffersize buffer length available bufsize buffersize buffer new char buffersize bufline new int buffersize bufcolumn new int buffersize next char buf new char 4096 prev char islf prev char iscr false token begin in buf max next char ind 0 next char ind bufpos 1 reinit inputstream nextcharbuf prevcharislf prevchariscr tokenbegin inbuf maxnextcharind nextcharind public void re init java io reader dstream int startline int startcolumn re init dstream startline startcolumn 4096 reinit reinit public void re init java io reader dstream re init dstream 1 1 4096 reinit reinit public java char stream java io input stream dstream int startline int startcolumn int buffersize this new java io input stream reader dstream startline startcolumn 4096 javacharstream inputstream inputstreamreader public java char stream java io input stream dstream int startline int startcolumn this dstream startline startcolumn 4096 javacharstream inputstream public java char stream java io input stream dstream this dstream 1 1 4096 javacharstream inputstream public void re init java io input stream dstream int startline int startcolumn int buffersize re init new java io input stream reader dstream startline startcolumn 4096 reinit inputstream reinit inputstreamreader public void re init java io input stream dstream int startline int startcolumn re init dstream startline startcolumn 4096 reinit inputstream reinit re init dstream startline startcolumn 4096 public void re init java io input stream dstream re init dstream 1 1 4096 reinit reinit inputstream reinit public string get image if bufpos token begin return new string buffer token begin bufpos token begin 1 else return new string buffer token begin bufsize token begin new string buffer 0 bufpos 1 getimage tokenbegin tokenbegin tokenbegin tokenbegin tokenbegin public char get suffix int len char ret new char len if bufpos 1 len system arraycopy buffer bufpos len 1 ret 0 len else system arraycopy buffer bufsize len bufpos 1 ret 0 len bufpos 1 system arraycopy buffer 0 ret len bufpos 1 bufpos 1 return ret getsuffix public void done next char buf null buffer null bufline null bufcolumn null nextcharbuf method to adjust line and column numbers for the start of a token br public void adjust begin line column int new line int new col int start token begin int len if bufpos token begin len bufpos token begin in buf 1 else len bufsize token begin bufpos 1 in buf int i 0 j 0 k 0 int next col diff 0 column diff 0 while i len bufline j start bufsize bufline k start bufsize bufline j new line next col diff column diff bufcolumn k bufcolumn j bufcolumn j new col column diff column diff next col diff i if i len bufline j new line bufcolumn j new col column diff while i len if bufline j start bufsize bufline start bufsize bufline j new line else bufline j new line line bufline j column bufcolumn j adjustbeginlinecolumn newline newcol tokenbegin tokenbegin tokenbegin inbuf tokenbegin inbuf nextcoldiff columndiff newline nextcoldiff columndiff newcol columndiff columndiff nextcoldiff newline newcol columndiff newline newline class bsh throw statement extends simple node bsh throw statement int id super id bshthrowstatement simplenode bshthrowstatement public object eval call stack callstack interpreter interpreter throws eval error object obj simple node jjt get child 0 eval callstack interpreter need to loosen this to any throwable do we need to handle that in interpreter somewhere check first if obj instanceof exception throw new eval error expression in throw must be exception type this callstack wrap the exception in a target exception to propogate it up throw new target error exception obj this callstack callstack evalerror simplenode jjtgetchild evalerror targetexception targeterror animated icon constructor param frames the frames to be used in the animation param rate the frame rate of the animation in frames per second param host the container that the animation is used in public animated icon image icon image frames int rate component host super icon this icon icon this frames frames delay 1000 rate this host host animatedicon animatedicon get frames method public image get frames return frames getframes getframes get icon method public image get icon return icon geticon geticon get rate method public int get rate return 1000 delay getrate getrate set frames method public void set frames image frames this frames frames setframes setframes set icon method public void set icon image icon this icon icon seticon seticon set rate method public void set rate int rate delay 1000 rate setrate setrate start method starts the animation rolling public void start if timer null return timer new timer delay new animator timer start stop method stops the animation and resets to frame 0 public void stop current 0 if timer null timer stop timer null set image icon host repaint setimage public void action performed action event evt current current 1 frames length set image frames current host repaint actionperformed actionevent setimage private static boolean accessibility false public static boolean have swing class exists caches info for us return class exists javax swing j button haveswing classexists classexists jbutton public static boolean can generate interfaces class exists caches info for us return class exists java lang reflect proxy cangenerateinterfaces classexists classexists if accessibility is enabled determine if the accessibility mechanism exists and if we have the optional bsh package to use it note that even if both are true it does not necessarily mean that we have runtime permission to access the fields java security has a say in it see bsh reflect manager public static boolean have accessibility class exists caches the tests for us return accessibility class exists java lang reflect accessible object class exists bsh reflect reflect manager impl reflectmanager haveaccessibility classexists classexists accessibleobject classexists reflectmanagerimpl public static void set accessibility boolean b accessibility b setaccessibility private static hashtable classes new hashtable use direct class for name to test for the existence of a class we should not use bsh class manager here because a the systems using these tests would probably not load the classes through it anyway b bshclassmanager is heavy and touches other class files this capabilities code must be light enough to be used by any system including the remote applet public static boolean class exists string name object c classes get name if c null try note do not change this to bsh class manager plain class for name or equivalent this class must not touch any other bsh classes c class for name name catch class not found exception e if c null classes put c unused return c null forname bshclassmanager classexists bshclassmanager plainclassforname forname classnotfoundexception public static class unavailable extends util eval error public unavailable string s super s utilevalerror class bsh method invocation extends simple node bsh method invocation int id super id bshmethodinvocation simplenode bshmethodinvocation bsh method invocation int id super id bsh ambiguous name get name node return bsh ambiguous name jjt get child 0 bshmethodinvocation bshambiguousname getnamenode bshambiguousname jjtgetchild bsh arguments get args node return bsh arguments jjt get child 1 bsharguments getargsnode bsharguments jjtgetchild evaluate the method invocation with the specified callstack and interpreter public object eval call stack callstack interpreter interpreter throws eval error name space namespace callstack top bsh ambiguous name name node get name node do not evaluate methods this or super in class instance space i e inside a constructor if namespace get parent null namespace get parent is class name node text equals super name node text equals this return primitive void name name name node get name namespace object args get args node get arguments callstack interpreter try return name invoke method interpreter args callstack this catch reflect error e xxx e print stack trace throw new eval error error in method invocation e get message this callstack catch invocation target exception e string msg method invocation name throwable te e get target exception try to squeltch the native code stack trace if the exception was caused by a reflective call back into the bsh interpreter e g eval or source boolean is native true if te instanceof eval error if te instanceof target error is native target error te in native code else is native false throw new target error msg te this callstack is native catch util eval error e throw e to eval error this callstack callstack evalerror namespace bshambiguousname namenode getnamenode getparent getparent isclass namenode namenode namenode getname getargsnode getarguments invokemethod reflecterror printstacktrace evalerror getmessage invocationtargetexception gettargetexception isnative evalerror targeterror isnative targeterror innativecode isnative targeterror isnative utilevalerror toevalerror set a java lang reflect field method constructor or array of accessible objects to accessible mode if the object is not an accessible object then do nothing return true if the object was accessible or false if it was not arrays incomplete need to use the array setter public boolean set accessible object obj if obj instanceof accessible object accessible object obj set accessible true return true else return false accessibleobject setaccessible accessibleobject accessibleobject setaccessible public boolean is void bsh return type int id super id isvoid bshreturntype bsh return type int id super id bsh type get type node return bsh type jjt get child 0 bshreturntype bshtype gettypenode bshtype jjtgetchild public string get type descriptor call stack callstack interpreter interpreter string default package if is void return v else return get type node get type descriptor callstack interpreter default package gettypedescriptor callstack defaultpackage isvoid gettypenode gettypedescriptor defaultpackage public class eval return type call stack callstack interpreter interpreter throws eval error if is void return void type else return get type node get type callstack interpreter evalreturntype callstack evalerror isvoid gettypenode gettype public abstract class operating system public abstract string get install directory string name string version operatingsystem getinstalldirectory public os task install installer string name this installer installer this name name this label installer get property ostask name label this directory get default directory installer on by default enabled true ostask getproperty getdefaultdirectory public string get name return name getname public string get label return label getlabel public string get default directory install installer return null getdefaultdirectory public string get directory return directory getdirectory public boolean is enabled return enabled isenabled public void set enabled boolean enabled this enabled enabled setenabled public void set directory string directory this directory directory setdirectory public abstract void perform string install dir vector filesets throws io exception installdir ioexception public os task getos tasks install installer return new os task 0 ostask getostasks ostask public void mkdirs string directory throws io exception file file new file directory if file exists file mkdirs ioexception public static operating system get operating system if os null return os if system get property mrj version null os new macos else string os name system get property os name if os name index of windows 1 os new windows else if os name index of os 2 1 os new half anos else if os name index of vms 1 os new vms else os new unix return os operatingsystem getoperatingsystem getproperty osname getproperty osname indexof osname indexof halfanos osname indexof public string get install directory string name string version string dir usr local share if new file dir can write dir system get property user home return new file dir name to lower case version get path getinstalldirectory canwrite getproperty tolowercase getpath public class scriptos task extends os task public scriptos task install installer super installer unix script scriptostask ostask scriptostask public string get default directory install installer string dir usr local if new file dir can write dir system get property user home return new file dir bin get path getdefaultdirectory canwrite getproperty getpath public void perform string install dir vector filesets throws io exception if enabled return mkdirs directory string name installer get property app name create app start script string script directory file separator char name to lower case delete existing copy new file script delete write simple script file writer out new file writer script out write bin sh n out write java heap size in megabytes n out write java heap size 32 n out write default java home system get property java home n out write if java home then n out write java home default java home n out write fi n out write exec java home bin java mx java heap size m name to upper case string jar install dir file separator name to lower case jar out write jar jar n out close make it executable string chmod args chmod 755 script exec chmod args installdir ioexception getproperty separatorchar tolowercase filewriter filewriter java_heap_size default_java_home getproperty java_home java_home default_java_home java_home java_heap_size touppercase installdir tolowercase chmodargs chmodargs public class man pageos task extends os task public man pageos task install installer super installer unix man manpageostask ostask manpageostask public string get default directory install installer string dir usr local if new file dir can write dir system get property user home return new file dir man man1 get path getdefaultdirectory canwrite getproperty getpath public void perform string install dir vector filesets throws io exception if enabled return mkdirs directory string name installer get property app name install man page string manpage installer get property ostask unix man manpage input stream in get class get resource as stream manpage installer copy in new file directory manpage get path null installdir ioexception getproperty getproperty inputstream getclass getresourceasstream getpath public os task getos tasks install installer return new os task new scriptos task installer new man pageos task installer ostask getostasks ostask scriptostask manpageostask public void mkdirs string directory throws io exception file file new file directory if file exists string mkdir args mkdir m 755 p directory exec mkdir args ioexception mkdirargs mkdirargs public void exec string args throws io exception process proc runtime get runtime exec args proc get input stream close proc get output stream close proc get error stream close try proc wait for catch interrupted exception ie ioexception getruntime getinputstream getoutputstream geterrorstream waitfor interruptedexception public static class macos extends unix public string get install directory string name string version return applications name version getinstalldirectory public static class windows extends operating system public string get install directory string name string version return c program files name version operatingsystem getinstalldirectory public class j edit launcheros task extends os task public j edit launcheros task install installer super installer jedit launcher jeditlauncherostask ostask jeditlauncherostask public string get default directory install installer return null getdefaultdirectory public void perform string install dir vector filesets if enabled filesets contains jedit windows return run j edit launcher installation file executable new file install dir jedit exe if executable exists return string args executable get path i system get property java home file separator bin try runtime get runtime exec args wait for catch io exception io catch interrupted exception ie installdir jeditlauncher installdir getpath getproperty getruntime waitfor ioexception interruptedexception public os task getos tasks install installer return new os task new j edit launcheros task installer ostask getostasks ostask jeditlauncherostask public static class half anos extends operating system public string get install directory string name string version return c name version halfanos operatingsystem getinstalldirectory public static class vms extends operating system public string get install directory string name string version return name to lower case version operatingsystem getinstalldirectory tolowercase public class interpreter error extends runtime exception public interpreter error string s super s interpretererror runtimeexception interpretererror variable lhs constructor lhs name space name space string var name throw new error namespace lhs type variable this var name var name this name space name space namespace namespace varname varname varname namespace namespace param local var if true the variable is set directly in the this reference s local scope if false recursion to look for the variable definition in parent s scope is allowed e g the default case for undefined vars going to global lhs name space name space string var name boolean local var type variable this local var local var this var name var name this name space name space localvar namespace namespace varname localvar localvar localvar varname varname namespace namespace static field lhs constructor this simply calls object field constructor with null object lhs field field type field this object null this field field object field lhs constructor lhs object object field field if object null throw new null pointer exception constructed empty lhs type field this object object this field field nullpointerexception object property lhs constructor lhs object object string prop name if object null throw new null pointer exception constructed empty lhs type property this object object this prop name prop name propname nullpointerexception propname propname array index lhs constructor lhs object array int index if array null throw new null pointer exception constructed empty lhs type index this object array this index index nullpointerexception public object get value throws util eval error if type variable return name space get variable var name if type field try object o field get object return primitive wrap o field get type catch illegal access exception e2 throw new util eval error can t read field field if type property try return reflect get object property object prop name catch reflect error e interpreter debug e get message throw new util eval error no such property prop name if type index try return reflect get index object index catch exception e throw new util eval error array access e throw new interpreter error lhs type getvalue utilevalerror namespace getvariable varname gettype illegalaccessexception utilevalerror getobjectproperty propname reflecterror getmessage utilevalerror propname getindex utilevalerror interpretererror assign a value to the lhs public object assign object val boolean strict java throws util eval error if type variable set the variable in namespace according to local var flag if local var name space set local variable var name val strict java else name space set variable var name val strict java else if type field try object field val val instanceof primitive primitive val get value val this should probably be in reflect java reflect manager rm set accessible field field set object field val return val catch null pointer exception e throw new util eval error lhs field get name not a static field catch illegal access exception e2 throw new util eval error lhs field get name can t access field e2 catch illegal argument exception e3 string type val instanceof primitive primitive val get type get name val get class get name throw new util eval error argument type mismatch val null null type not assignable to field field get name else if type property if object instanceof hashtable hashtable object put prop name val collection manager cm collection manager get collection manager if cm is map object cm put in map object map prop name val else try reflect set object property object prop name val catch reflect error e interpreter debug assignment e get message throw new util eval error no such property prop name else if type index try reflect set index object index val catch util target error e1 pass along target error throw e1 catch exception e throw new util eval error assignment e get message else throw new interpreter error unknown lhs return val strictjava utilevalerror localvar localvar namespace setlocalvariable varname strictjava namespace setvariable varname strictjava fieldval getvalue reflectmanager rmsetaccessible fieldval nullpointerexception utilevalerror getname illegalaccessexception utilevalerror getname illegalargumentexception gettype getname getclass getname utilevalerror getname propname collectionmanager collectionmanager getcollectionmanager ismap putinmap propname setobjectproperty propname reflecterror getmessage utilevalerror propname setindex utiltargeterror utilevalerror getmessage interpretererror public string to string return lhs field null field field to string var name null var name var name name space null name space name space to string tostring tostring varname varname varname namespace namespace namespace tostring install panel constructor install panel plugin manager window boolean updates super new border layout 12 12 this window window this updates updates set border new empty border 12 12 12 12 final j split pane split new j split pane j split pane vertical split true setup the table table new j table plugin model new plugin table model table set show grid false table set intercell spacing new dimension 0 0 table set row height table get row height 2 table set preferred scrollable viewport size new dimension 500 200 table set request focus enabled false table get selection model set selection mode list selection model single selection table set default renderer object class new text renderer default table cell renderer table get default renderer object class table column col1 table get column model get column 0 table column col2 table get column model get column 1 table column col3 table get column model get column 2 table column col4 table get column model get column 3 table column col5 table get column model get column 4 col1 set preferred width 30 col1 set min width 30 col1 set max width 30 col1 set resizable false col2 set preferred width 180 col3 set preferred width 130 col4 set preferred width 70 col5 set preferred width 70 j table header header table get table header header set reordering allowed false header add mouse listener new header mouse handler j scroll pane scrollpane new j scroll pane table scrollpane get viewport set background table get background split set top component scrollpane create description j scroll pane info pane new j scroll pane info box new plugin info box info pane set preferred size new dimension 500 100 split set bottom component info pane swing utilities invoke later new runnable public void run split set divider location 0 75 add border layout center split create buttons box buttons new box box layout x axis buttons add new install button buttons add box create horizontal strut 12 buttons add new selectall button buttons add box create glue buttons add new size label add border layout south buttons installpanel installpanel pluginmanager borderlayout setborder emptyborder jsplitpane jsplitpane jsplitpane vertical_split jtable pluginmodel plugintablemodel setshowgrid setintercellspacing setrowheight getrowheight setpreferredscrollableviewportsize setrequestfocusenabled getselectionmodel setselectionmode listselectionmodel single_selection setdefaultrenderer textrenderer defaulttablecellrenderer getdefaultrenderer tablecolumn getcolumnmodel getcolumn tablecolumn getcolumnmodel getcolumn tablecolumn getcolumnmodel getcolumn tablecolumn getcolumnmodel getcolumn tablecolumn getcolumnmodel getcolumn setpreferredwidth setminwidth setmaxwidth setresizable setpreferredwidth setpreferredwidth setpreferredwidth setpreferredwidth jtableheader gettableheader setreorderingallowed addmouselistener headermousehandler jscrollpane jscrollpane getviewport setbackground getbackground settopcomponent jscrollpane infopane jscrollpane infobox plugininfobox infopane setpreferredsize setbottomcomponent infopane swingutilities invokelater setdividerlocation borderlayout boxlayout x_axis installbutton createhorizontalstrut selectallbutton createglue sizelabel borderlayout swing utilities invoke later new runnable public void run split set divider location 0 75 swingutilities invokelater setdividerlocation update model method public void update model plugin model clear info box set text j edit get property plugin manager list download vfs manager run inawt thread new runnable public void run info box set text null plugin model update updatemodel updatemodel pluginmodel infobox settext jedit getproperty vfsmanager runinawtthread infobox settext pluginmodel public void run info box set text null plugin model update infobox settext pluginmodel format size method private string format size int size number format df number format get instance df set maximum fraction digits 1 df set minimum fraction digits 0 string size text if size 1048576 size text size 1024 kb else size text df format size 1048576d mb return size text formatsize formatsize numberformat numberformat getinstance setmaximumfractiondigits setminimumfractiondigits sizetext sizetext sizetext sizetext get column class method public class get column class int column index switch column index case 0 return boolean class case 1 case 2 case 3 case 4 return object class default throw new error column out of range getcolumnclass getcolumnclass columnindex columnindex get column count method public int get column count return 5 getcolumncount getcolumncount get column name method public string get column name int column switch column case 0 return case 1 return j edit get property install plugins info name case 2 return j edit get property install plugins info category case 3 return j edit get property install plugins info version case 4 return j edit get property install plugins info size default throw new error column out of range getcolumnname getcolumnname jedit getproperty jedit getproperty jedit getproperty jedit getproperty get row count method public int get row count return entries size getrowcount getrowcount get value at method public object get value at int row index int column index object obj entries get row index if obj instanceof string if column index 1 return obj else return null else entry entry entry obj switch column index case 0 return new boolean entry install case 1 return entry name case 2 return entry set case 3 return entry version case 4 return format size entry size default throw new error column out of range getvalueat getvalueat rowindex columnindex rowindex columnindex columnindex formatsize is cell editable method public boolean is cell editable int row index int column index return column index 0 iscelleditable iscelleditable rowindex columnindex columnindex set select all method public void set select all boolean b if is downloading list return int length get row count for int i 0 i length i if b set value at boolean true i 0 else entry entry entry entries get i entry parents new linked list entry install false fire table changed new table model event this setselectall setselectall isdownloadinglist getrowcount setvalueat linkedlist firetablechanged tablemodelevent set sort type method public void set sort type int type sort type type sort type setsorttype setsorttype sorttype set value at method public void set value at object a value int row int column if column 0 return object obj entries get row if obj instanceof string return entry entry entry obj vector deps entry plugin get compatible branch deps boolean value boolean a value boolean value if value if entry parents size 0 string args entry name entry get parent string int result gui utilities confirm window plugin manager dependency args j option pane ok cancel option j option pane warning message if result j option pane ok option return iterator parents iter entry parents iterator while parents iter has next entry parents iter next install false fire table rows updated 0 get row count 1 for int i 0 i deps size i plugin list dependency dep plugin list dependency deps element at i if dep what equals plugin for int j 0 j entries size j entry temp entry entries get j if temp plugin dep plugin if value temp parents add entry set value at boolean true j 0 else temp parents remove entry entry install boolean true equals a value fire table cell updated row column setvalueat setvalueat avalue getcompatiblebranch avalue booleanvalue getparentstring guiutilities joptionpane ok_cancel_option joptionpane warning_message joptionpane ok_option parentsiter parentsiter hasnext parentsiter firetablerowsupdated getrowcount pluginlist pluginlist elementat setvalueat avalue firetablecellupdated sort method public void sort int type this sort type type if is downloading list return collections sort entries new entry compare type fire table changed new table model event this sorttype isdownloadinglist entrycompare firetablechanged tablemodelevent is downloading list method private boolean is downloading list return entries size 1 entries get 0 instanceof string isdownloadinglist isdownloadinglist clear method public void clear entries new array list fire table changed new table model event this arraylist firetablechanged tablemodelevent update method public void update plugin list plugin list window get plugin list if plugin list null return entries new array list for int i 0 i plugin list plugin sets size i plugin list plugin set set plugin list plugin set plugin list plugin sets get i for int j 0 j set plugins size j plugin list plugin plugin plugin list plugin plugin list plugin hash get set plugins get j plugin list branch branch plugin get compatible branch string installed version plugin get installed version if updates if branch null branch can satisfy dependencies installed version null misc utilities compare strings branch version installed version false 0 entries add new entry plugin set name else if installed version null plugin can be installed entries add new entry plugin set name sort sort type fire table changed new table model event this pluginlist pluginlist getpluginlist pluginlist arraylist pluginlist pluginsets pluginlist pluginset pluginlist pluginset pluginlist pluginsets pluginlist pluginlist pluginlist pluginhash pluginlist getcompatiblebranch installedversion getinstalledversion cansatisfydependencies installedversion miscutilities comparestrings installedversion installedversion canbeinstalled sorttype firetablechanged tablemodelevent entry plugin list plugin plugin string set plugin list branch branch plugin get compatible branch boolean download source j edit get boolean property plugin manager download source int size download source branch download source size branch download size this name plugin name this author plugin author this version branch version this size size this date branch date this description plugin description this set set this install false this plugin plugin pluginlist pluginlist getcompatiblebranch downloadsource jedit getbooleanproperty downloadsource downloadsource downloadsourcesize downloadsize string get parent string string buffer buf new string buffer iterator iter parents iterator while iter has next buf append entry iter next name if iter has next buf append n return buf to string getparentstring stringbuffer stringbuffer hasnext hasnext tostring public plugin info box set editable false set line wrap true set wrap style word true table get selection model add list selection listener this plugininfobox seteditable setlinewrap setwrapstyleword getselectionmodel addlistselectionlistener public void value changed list selection event e string text if table get selected row count 1 entry entry entry plugin model entries get table get selected row text j edit get property install plugins info new string entry author entry date entry description set text text set caret position 0 valuechanged listselectionevent getselectedrowcount pluginmodel getselectedrow jedit getproperty settext setcaretposition public size label size 0 set text j edit get property install plugins total size format size size plugin model add table model listener this sizelabel settext jedit getproperty totalsize formatsize pluginmodel addtablemodellistener public void table changed table model event e if e get type table model event update if plugin model is downloading list return size 0 int length plugin model get row count for int i 0 i length i entry entry entry plugin model entries get i if entry install size entry size set text j edit get property install plugins total size format size size tablechanged tablemodelevent gettype tablemodelevent pluginmodel isdownloadinglist pluginmodel getrowcount pluginmodel settext jedit getproperty totalsize formatsize public selectall button super j edit get property install plugins select all add action listener this plugin model add table model listener this set enabled false selectallbutton jedit getproperty addactionlistener pluginmodel addtablemodellistener setenabled public void action performed action event evt plugin model set select all is selected actionperformed actionevent pluginmodel setselectall isselected public void table changed table model event e if plugin model is downloading list return set enabled plugin model get row count 0 if e get type table model event update int length plugin model get row count for int i 0 i length i if boolean plugin model get value at i 0 boolean value set selected false return if length 0 set selected true tablechanged tablemodelevent pluginmodel isdownloadinglist setenabled pluginmodel getrowcount gettype tablemodelevent pluginmodel getrowcount pluginmodel getvalueat booleanvalue setselected setselected public install button super j edit get property install plugins install plugin model add table model listener this add action listener this set enabled false installbutton jedit getproperty pluginmodel addtablemodellistener addactionlistener setenabled public void action performed action event evt if plugin model is downloading list return boolean download source j edit get boolean property plugin manager download source boolean install user j edit get boolean property plugin manager install user roster roster new roster string install directory if install user install directory misc utilities construct path j edit get settings directory jars else install directory misc utilities construct path j edit getj edit home jars int length plugin model get row count int instcount 0 for int i 0 i length i entry entry entry plugin model entries get i if entry install entry plugin install roster install directory download source if updates entry plugin get compatible branch satisfy dependencies roster install directory download source instcount if roster is empty return boolean cancel false if updates roster get operation count instcount if gui utilities confirm window install plugins depend null j option pane ok cancel option j option pane warning message j option pane cancel option cancel true if cancel new plugin manager progress window roster roster perform operations inawt thread window plugin model update actionperformed actionevent pluginmodel isdownloadinglist downloadsource jedit getbooleanproperty downloadsource installuser jedit getbooleanproperty installuser installdirectory installuser installdirectory miscutilities constructpath jedit getsettingsdirectory installdirectory miscutilities constructpath jedit getjedithome pluginmodel getrowcount pluginmodel installdirectory downloadsource getcompatiblebranch satisfydependencies installdirectory downloadsource isempty getoperationcount guiutilities joptionpane ok_cancel_option joptionpane warning_message joptionpane cancel_option pluginmanagerprogress performoperationsinawtthread pluginmodel public void table changed table model event e if plugin model is downloading list return if e get type table model event update int length plugin model get row count for int i 0 i length i if boolean plugin model get value at i 0 boolean value set enabled true return set enabled false tablechanged tablemodelevent pluginmodel isdownloadinglist gettype tablemodelevent pluginmodel getrowcount pluginmodel getvalueat booleanvalue setenabled setenabled private int type public entry compare int type this type type entrycompare public int compare object o1 object o2 install panel entry e1 install panel entry o1 install panel entry e2 install panel entry o2 if type name return e1 name compare to ignore case e2 name else int result if result e1 set compare to ignore case e2 set 0 return e1 name compare to ignore case e2 name return result installpanel installpanel installpanel installpanel comparetoignorecase comparetoignorecase comparetoignorecase public void mouse clicked mouse event evt switch table get table header column at point evt get point case 1 plugin model sort entry compare name break case 2 plugin model sort entry compare category break default mouseclicked mouseevent gettableheader columnatpoint getpoint pluginmodel entrycompare pluginmodel entrycompare private default table cell renderer tcr public text renderer default table cell renderer tcr this tcr tcr defaulttablecellrenderer textrenderer defaulttablecellrenderer public component get table cell renderer component j table table object value boolean is selected boolean has focus int row int column return tcr get table cell renderer component table value is selected false row column gettablecellrenderercomponent jtable isselected hasfocus gettablecellrenderercomponent isselected private font selector font public quick notepad option pane super quick notepad plugin name fontselector quicknotepadoptionpane quicknotepadplugin public void init show path new j check box j edit get property quick notepad plugin option prefix show filepath title j edit get property quick notepad plugin option prefix show filepath equals true add component show path path name new j text field j edit get property quick notepad plugin option prefix filepath j button pick path new j button j edit get property quick notepad plugin option prefix choose file pick path add action listener this j panel path panel new j panel new border layout 0 0 path panel add path name border layout center path panel add pick path border layout east add component j edit get property quick notepad plugin option prefix file path panel font new font selector make font add component j edit get property quick notepad plugin option prefix choose font font _init showpath jcheckbox jedit getproperty quicknotepadplugin option_prefix jedit getproperty quicknotepadplugin option_prefix addcomponent showpath pathname jtextfield jedit getproperty quicknotepadplugin option_prefix jbutton pickpath jbutton jedit getproperty quicknotepadplugin option_prefix pickpath addactionlistener jpanel pathpanel jpanel borderlayout pathpanel pathname borderlayout pathpanel pickpath borderlayout addcomponent jedit getproperty quicknotepadplugin option_prefix pathpanel fontselector makefont addcomponent jedit getproperty quicknotepadplugin option_prefix public void save j edit set property quick notepad plugin option prefix filepath path name get text font font font get font j edit set property quick notepad plugin option prefix font font get family j edit set property quick notepad plugin option prefix fontsize string value of font get size j edit set property quick notepad plugin option prefix fontstyle string value of font get style j edit set property quick notepad plugin option prefix show filepath string value of show path is selected _save jedit setproperty quicknotepadplugin option_prefix pathname gettext _font getfont jedit setproperty quicknotepadplugin option_prefix _font getfamily jedit setproperty quicknotepadplugin option_prefix valueof _font getsize jedit setproperty quicknotepadplugin option_prefix valueof _font getstyle jedit setproperty quicknotepadplugin option_prefix valueof showpath isselected begin action listener implementation public void action performed action event evt string paths gui utilities showvfs file dialog null null j file chooser open dialog false if paths null path name set text paths 0 actionlistener actionperformed actionevent guiutilities showvfsfiledialog jfilechooser open_dialog pathname settext helper method to get font from plugin properties static public font make font int style size string family j edit get property quick notepad plugin option prefix font try size integer parse int j edit get property quick notepad plugin option prefix fontsize catch number format exception nf size 14 try style integer parse int j edit get property quick notepad plugin option prefix fontstyle catch number format exception nf style font plain return new font family style size makefont jedit getproperty quicknotepadplugin option_prefix parseint jedit getproperty quicknotepadplugin option_prefix numberformatexception parseint jedit getproperty quicknotepadplugin option_prefix numberformatexception vfs directory entry table model constructor public vfs directory entry table model ext attrs new array list vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel extattrs arraylist set root method public void set root vfs vfs array list list ext attrs clear add extended attributes vfs if files null files length 0 fire table rows deleted 0 files length 1 files new entry list size for int i 0 i files length i files i new entry vfs directory entry list get i 0 if files length 0 fire table rows inserted 0 files length 1 fire table structure changed setroot setroot arraylist extattrs addextendedattributes firetablerowsdeleted directoryentry firetablerowsinserted firetablestructurechanged expand method public int expand vfs vfs entry entry array list list int start index 1 for int i 0 i files length i if files i entry start index i collapse vfs start index add extended attributes vfs entry expanded true if list null entry new files new entry files length list size system arraycopy files 0 new files 0 start index 1 for int i 0 i list size i new files start index i 1 new entry vfs directory entry list get i entry level 1 system arraycopy files start index 1 new files start index list size 1 files length start index 1 this files new files fire table rows inserted start index 1 start index list size 1 fire table rows updated start index start index fire table structure changed return start index arraylist startindex startindex startindex addextendedattributes newfiles newfiles startindex newfiles startindex directoryentry startindex newfiles startindex startindex newfiles firetablerowsinserted startindex startindex firetablerowsupdated startindex startindex firetablestructurechanged startindex collapse method public void collapse vfs vfs int index entry entry files index if entry expanded return entry expanded false int last index index 1 while last index files length entry e files last index if e level entry level break else last index if e expanded remove extended attributes vfs manager getvfs for path e dir entry path remove extended attributes vfs entry new files new entry files length last index index 1 system arraycopy files 0 new files 0 index 1 system arraycopy files last index new files index 1 files length last index files new files fire table rows updated index index fire table rows deleted index 1 last index fire table structure changed lastindex lastindex lastindex lastindex removeextendedattributes vfsmanager getvfsforpath direntry removeextendedattributes newfiles lastindex newfiles lastindex newfiles lastindex newfiles firetablerowsupdated firetablerowsdeleted lastindex firetablestructurechanged get column count method public int get column count return 1 ext attrs size getcolumncount getcolumncount extattrs get row count method public int get row count if files null return 0 else return files length getrowcount getrowcount get column name method public string get column name int col if col 0 return j edit get property vfs browser name else return j edit get property vfs browser get extended attribute col 1 getcolumnname getcolumnname jedit getproperty jedit getproperty getextendedattribute get column class method public class get column class int col return entry class getcolumnclass getcolumnclass get value at method public object get value at int row int col if files null return null else return files row getvalueat getvalueat get extended attribute method public string get extended attribute int index return extended attribute ext attrs get index name getextendedattribute getextendedattribute extendedattribute extattrs add extended attributes method private void add extended attributes vfs vfs string attrs vfs get extended attributes vfs attr loop for int i 0 i attrs length i iterator iter ext attrs iterator while iter has next extended attribute attr extended attribute iter next if attrs i equals attr name attr ref continue vfs attr loop this vfs has an extended attribute which is not in the list add it to the end with a ref count of 1 ext attrs add new extended attribute attrs i addextendedattributes addextendedattributes getextendedattributes vfs_attr_loop extattrs hasnext extendedattribute extendedattribute vfs_attr_loop extattrs extendedattribute remove extended attributes method private void remove extended attributes vfs vfs string attrs vfs get extended attributes vfs attr loop for int i 0 i attrs length i iterator iter ext attrs iterator while iter has next extended attribute attr extended attribute iter next if attrs i equals attr name if attr ref 0 we no longer have any dirs using this extended attribute iter remove continue vfs attr loop this vfs has an extended attribute which is not in the list log log log warning this we forgot about attrs i removeextendedattributes removeextendedattributes getextendedattributes vfs_attr_loop extattrs hasnext extendedattribute extendedattribute vfs_attr_loop entry vfs directory entry dir entry int level this dir entry dir entry this level level directoryentry direntry direntry direntry extended attribute string name this name name ref 1 extendedattribute get version method returns the j edit version as a human readable string public static string get version return misc utilities build to version get build getversion jedit getversion miscutilities buildtoversion getbuild get build method returns the internal version misc utilities compare strings can be used to compare different internal versions public static string get build major minor 99 prex 99 final bug fix return 04 02 99 00 getbuild miscutilities comparestrings getbuild main method the main method of the j edit application this should never be invoked directly param args the command line arguments public static void main string args check for java 1 3 or later string java version system get property java version if java version compare to 1 3 0 system err println you are running java version java version system err println j edit requires java 1 3 or later system exit 1 later on we need to know if certain code is called from the main thread main thread thread current thread settings directory jedit macos users expect the app to keep running after all windows are closed background operating system is macos parse command line boolean end opts false int level log warning string port file server boolean restore true boolean new view true boolean new plain view false boolean gui true open initial view boolean load plugins true boolean run startup scripts true boolean quit false boolean wait false string user dir system get property user dir script to run string script file null for int i 0 i args length i string arg args i if arg null continue else if arg length 0 args i null else if arg starts with end opts if arg equals end opts true else if arg equals usage version system err println usage system exit 1 else if arg equals version version system exit 1 else if arg starts with log try level integer parse int arg substring log length catch number format exception nf system err println malformed option arg else if arg equals nosettings settings directory null else if arg starts with settings settings directory arg substring 10 else if arg starts with noserver port file null else if arg equals server port file server else if arg starts with server port file arg substring 8 else if arg starts with background background true else if arg starts with nobackground background false else if arg equals gui gui true else if arg equals nogui gui false else if arg equals newview new view true else if arg equals newplainview new plain view true else if arg equals reuseview new plain view new view false else if arg equals restore restore true else if arg equals norestore restore false else if arg equals plugins load plugins true else if arg equals noplugins load plugins false else if arg equals startupscripts run startup scripts true else if arg equals nostartupscripts run startup scripts false else if arg starts with run script file arg substring 5 else if arg equals wait wait true else if arg equals quit quit true else system err println unknown option arg usage system exit 1 args i null we need these initializations very early on if settings directory null settings directory misc utilities construct path system get property user home settings directory settings directory misc utilities resolve symlinks settings directory if settings directory null port file null port file misc utilities construct path settings directory port file else port file null log init true level try connecting to another running j edit instance if port file null new file port file exists int port key try buffered reader in new buffered reader new file reader port file string check in read line if check equals b throw new exception wrong port file format port integer parse int in read line key integer parse int in read line socket socket new socket inet address get by name 127 0 0 1 port data output stream out new data output stream socket get output stream out write int key string script if quit script socket close n j edit exit null true n else script make server script wait restore new view new plain view args script file out writeutf script log log log debug j edit class waiting for server block until its closed try socket get input stream read catch exception e in close out close system exit 0 catch exception e ok this one seems to confuse newbies endlessly so log it as notice not error log log log notice j edit class an error occurred while connecting to the j edit server instance log log log notice j edit class this probably means that j edit crashed and or exited abnormally log log log notice j edit class the last time it was run log log log notice j edit class if you don t know what this means don t worry log log log notice j edit class e if quit if no server running and user runs jedit quit just exit system exit 0 don t show splash screen if there is a file named nosplash in the settings directory if new file settings directory nosplash exists gui utilities show splash screen initialize settings directory writer stream if settings directory null file settingsdirectory new file settings directory if settingsdirectory exists settingsdirectory mkdirs file macrosdirectory new file settings directory macros if macrosdirectory exists macrosdirectory mkdir string log path misc utilities construct path settings directory activity log backup settings file new file log path try stream new buffered writer new file writer log path write a warning message string line sep system get property line separator stream write log file created on new date stream write line sep stream write important stream write line sep stream write because updating this file after every log message would kill stream write line sep stream write performance it will be incomplete unless you invoke the stream write line sep stream write utilities troubleshooting update activity log on disk command stream write line sep catch exception e e print stack trace stream null else stream null log set log writer stream log log log notice j edit class j edit version get version log log log message j edit class settings directory is settings directory get things rolling init misc init system properties gui utilities advance splash progress gui utilities init bean shell init if j edit home null init site properties init user properties initialize server if port file null server new edit server port file if server isok server null else if background background false log log log warning j edit class you cannot specify both the background and noserver switches do more stuff initplaf vfs manager init init resources search and replace load gui utilities advance splash progress if load plugins init plugins history model load history buffer history load kill ring load properties changed gui utilities advance splash progress buffer sort sort buffers get boolean property sort buffers sort by name get boolean property sort by name reload modes gui utilities advance splash progress initialize java 1 4 specific code if operating system has java14 try class loader loader j edit class get class loader class clazz if loader null clazz loader load class org gjt sp jedit java14 else clazz class for name org gjt sp jedit java14 java lang reflect method meth clazz get method init new class 0 meth invoke null new object 0 catch exception e log log log error j edit class e system exit 1 activate plugins that must be activated at startup for int i 0 i jars size i pluginjar jars element at i activate plugin if necessary load macros and run startup scripts after plugins and settings are loaded macros load macros macros get macro action set init key bindings if run startup scripts j edit home null string path misc utilities construct path j edit home startup file file new file path if file exists run startup scripts file if run startup scripts settings directory null string path misc utilities construct path settings directory startup file file new file path if file exists file mkdirs else run startup scripts file run script specified with run parameter if script file null script file misc utilities construct path user dir script file try bean shell get name space set variable args args catch util eval error e log log log error j edit class e jedit javaversion getproperty javaversion compareto javaversion jedit mainthread currentthread settingsdirectory operatingsystem ismacos endopts portfile newview newplainview loadplugins runstartupscripts userdir getproperty scriptfile startswith endopts endopts startswith parseint numberformatexception settingsdirectory startswith settingsdirectory startswith portfile portfile startswith portfile startswith startswith newview newplainview newplainview newview loadplugins loadplugins runstartupscripts runstartupscripts startswith scriptfile settingsdirectory settingsdirectory miscutilities constructpath getproperty settingsdirectory settingsdirectory miscutilities resolvesymlinks settingsdirectory settingsdirectory portfile portfile miscutilities constructpath settingsdirectory portfile portfile jedit portfile portfile bufferedreader bufferedreader filereader portfile readline parseint readline parseint readline inetaddress getbyname dataoutputstream dataoutputstream getoutputstream writeint jedit makeserverscript newview newplainview scriptfile jedit getinputstream jedit jedit jedit jedit jedit jedit jedit settingsdirectory guiutilities showsplashscreen settingsdirectory _settingsdirectory settingsdirectory _settingsdirectory _settingsdirectory _macrosdirectory settingsdirectory _macrosdirectory _macrosdirectory logpath miscutilities constructpath settingsdirectory backupsettingsfile logpath bufferedwriter filewriter logpath linesep getproperty linesep linesep linesep linesep linesep printstacktrace setlogwriter jedit jedit getversion jedit settingsdirectory initmisc initsystemproperties guiutilities advancesplashprogress guiutilities beanshell jedithome initsiteproperties inituserproperties portfile editserver portfile jedit vfsmanager initresources searchandreplace guiutilities advancesplashprogress loadplugins initplugins historymodel loadhistory bufferhistory killring propertieschanged guiutilities advancesplashprogress sortbuffers getbooleanproperty sortbuffers sortbyname getbooleanproperty sortbyname reloadmodes guiutilities advancesplashprogress operatingsystem hasjava14 classloader jedit getclassloader loadclass forname getmethod jedit elementat activatepluginifnecessary loadmacros getmacroactionset initkeybindings runstartupscripts jedithome miscutilities constructpath jedithome runstartupscripts runstartupscripts settingsdirectory miscutilities constructpath settingsdirectory runstartupscripts scriptfile scriptfile miscutilities constructpath userdir scriptfile beanshell getnamespace setvariable utilevalerror jedit get properties method returns the properties object which contains all known j edit properties note that as of j edit 4 2pre10 this returns a new collection not the existing properties instance since j edit 3 1pre4 public static final properties get properties return prop mgr get properties getproperties jedit jedit jedit getproperties propmgr getproperties get property method fetches a property returning null if it s not defined param name the property public static final string get property string name return prop mgr get property name getproperty getproperty propmgr getproperty get property method fetches a property returning the default value if it s not defined param name the property param def the default value public static final string get property string name string def string value prop mgr get property name if value null return def else return value getproperty getproperty propmgr getproperty get property method returns the property with the specified name p the elements of the code args code array are substituted into the value of the property in place of strings of the form code i n i code where code i n i code is an index in the array p you can find out more about this feature by reading the documentation for the code format code method of the code java text message format code class param name the property param args the positional parameters public static final string get property string name object args if name null return null if args null return get property name else string value get property name if value null return null else return message format format value args getproperty messageformat getproperty getproperty getproperty messageformat get boolean property method returns the value of a boolean property param name the property public static final boolean get boolean property string name return get boolean property name false getbooleanproperty getbooleanproperty getbooleanproperty get boolean property method returns the value of a boolean property param name the property param def the default value public static final boolean get boolean property string name boolean def string value get property name if value null return def else if value equals true value equals yes value equals on return true else if value equals false value equals no value equals off return false else return def getbooleanproperty getbooleanproperty getproperty get integer property method returns the value of an integer property param name the property param def the default value since j edit 4 0pre1 public static final int get integer property string name int def string value get property name if value null return def else try return integer parse int value trim catch number format exception nf return def getintegerproperty jedit getintegerproperty getproperty parseint numberformatexception get double property method public static double get double property string name double def string value get property name if value null return def else try return double parse double value trim catch number format exception nf return def getdoubleproperty getdoubleproperty getproperty parsedouble numberformatexception get font property method returns the value of a font property the family is stored in the code i name i code property the font size is stored in the code i name i size code property and the font style is stored in code i name i style code for example if code i name i code is code view gutter font code the properties will be named code view gutter font code code view gutter fontsize code and code view gutter fontstyle code param name the property since j edit 4 0pre1 public static final font get font property string name return get font property name null getfontproperty jedit getfontproperty getfontproperty get font property method returns the value of a font property the family is stored in the code i name i code property the font size is stored in the code i name i size code property and the font style is stored in code i name i style code for example if code i name i code is code view gutter font code the properties will be named code view gutter font code code view gutter fontsize code and code view gutter fontstyle code param name the property param def the default value since j edit 4 0pre1 public static final font get font property string name font def string family get property name string size string get property name size string style string get property name style if family null size string null style string null return def else int size style try size integer parse int size string catch number format exception nf return def try style integer parse int style string catch number format exception nf return def return new font family style size getfontproperty jedit getfontproperty getproperty sizestring getproperty stylestring getproperty sizestring stylestring parseint sizestring numberformatexception parseint stylestring numberformatexception get color property method returns the value of a color property param name the property name since j edit 4 0pre1 public static color get color property string name return get color property name color black getcolorproperty jedit getcolorproperty getcolorproperty get color property method returns the value of a color property param name the property name param def the default value since j edit 4 0pre1 public static color get color property string name color def string value get property name if value null return def else return gui utilities parse color value def getcolorproperty jedit getcolorproperty getproperty guiutilities parsecolor set color property method sets the value of a color property param name the property name param value the value since j edit 4 0pre1 public static void set color property string name color value set property name gui utilities get color hex string value setcolorproperty jedit setcolorproperty setproperty guiutilities getcolorhexstring set property method sets a property to a new value param name the property param value the new value public static final void set property string name string value prop mgr set property name value setproperty setproperty propmgr setproperty set temporary property method sets a property to a new value properties set using this method are not saved to the user properties list param name the property param value the new value since j edit 2 3final public static final void set temporary property string name string value prop mgr set temporary property name value settemporaryproperty jedit settemporaryproperty propmgr settemporaryproperty set boolean property method sets a boolean property param name the property param value the value public static final void set boolean property string name boolean value set property name value true false setbooleanproperty setbooleanproperty setproperty set integer property method sets the value of an integer property param name the property param value the value since j edit 4 0pre1 public static final void set integer property string name int value set property name string value of value setintegerproperty jedit setintegerproperty setproperty valueof set double property method public static final void set double property string name double value set property name string value of value setdoubleproperty setdoubleproperty setproperty valueof set font property method sets the value of a font property the family is stored in the code i name i code property the font size is stored in the code i name i size code property and the font style is stored in code i name i style code for example if code i name i code is code view gutter font code the properties will be named code view gutter font code code view gutter fontsize code and code view gutter fontstyle code param name the property param value the value since j edit 4 0pre1 public static final void set font property string name font value set property name value get family set integer property name size value get size set integer property name style value get style setfontproperty jedit setfontproperty setproperty getfamily setintegerproperty getsize setintegerproperty getstyle unset property method unsets clears a property param name the property public static final void unset property string name prop mgr unset property name unsetproperty unsetproperty propmgr unsetproperty reset property method resets a property to its default value param name the property since j edit 2 5pre3 public static final void reset property string name prop mgr reset property name resetproperty jedit resetproperty propmgr resetproperty properties changed method reloads various settings from the properties public static void properties changed init key bindings autosave set interval get integer property autosave 30 save caret get boolean property save caret ui defaults defaults ui manager get defaults give all text areas the same font font font get font property view font defaults put text field font font defaults put text area font font defaults put text pane font font enable disable tooltips tool tip manager shared instance set enabled j edit get boolean property show tooltips init proxy we do this here instead of adding buffers to the bus buffer buffer buffers first while buffer null buffer reset cached properties buffer properties changed buffer buffer next history model properties changed kill ring properties changed edit bus send new properties changed null propertieschanged propertieschanged initkeybindings setinterval getintegerproperty savecaret getbooleanproperty savecaret uidefaults uimanager getdefaults getfontproperty textfield textarea textpane tooltipmanager sharedinstance setenabled jedit getbooleanproperty showtooltips initproxy buffersfirst resetcachedproperties propertieschanged historymodel propertieschanged killring propertieschanged editbus propertieschanged get not loaded pluginja rs method returns a list of plugin ja rs that are not currently loaded by examining the user and system plugin directories since j edit 3 2pre1 public static string get not loaded pluginja rs vector return value new vector if j edit home null string system plugin dir misc utilities construct path j edit home jars string list new file system plugin dir list if list null get not loaded pluginja rs return value system plugin dir list if settings directory null string user plugin dir misc utilities construct path settings directory jars string list new file user plugin dir list if list null get not loaded pluginja rs return value user plugin dir list string returnvalue new string return value size return value copy into returnvalue return returnvalue getnotloadedpluginjars jars jedit getnotloadedpluginjars returnvalue jedithome systemplugindir miscutilities constructpath jedithome systemplugindir getnotloadedpluginjars returnvalue systemplugindir settingsdirectory userplugindir miscutilities constructpath settingsdirectory userplugindir getnotloadedpluginjars returnvalue userplugindir _returnvalue returnvalue returnvalue copyinto _returnvalue _returnvalue get plugin method returns the plugin with the specified class name public static edit plugin get plugin string name return get plugin name false getplugin editplugin getplugin getplugin get plugin string boolean method returns the plugin with the specified class name if code load if necessary code is true the plugin will be activated in case it has not yet been started since j edit 4 2pre4 public static edit plugin get plugin string name boolean load if necessary edit plugin plugins get plugins edit plugin plugin null for int i 0 i plugins length i if plugins i get class name equals name plugin plugins i if load if necessary if plugin instanceof edit plugin deferred plugin get pluginjar activate plugin plugin plugin get pluginjar get plugin break return plugin getplugin loadifnecessary jedit editplugin getplugin loadifnecessary editplugin getplugins editplugin getclassname loadifnecessary editplugin getpluginjar activateplugin getpluginjar getplugin get plugins method returns an array of installed plugins public static edit plugin get plugins vector vector new vector for int i 0 i jars size i edit plugin plugin pluginjar jars element at i get plugin if plugin null vector add plugin edit plugin array new edit plugin vector size vector copy into array return array getplugins editplugin getplugins editplugin elementat getplugin editplugin editplugin copyinto get pluginja rs method returns an array of installed plugins since j edit 4 2pre1 public static pluginjar get pluginja rs pluginjar array new pluginjar jars size jars copy into array return array getpluginjars jedit getpluginjars copyinto get pluginjar method returns the jar with the specified path name param path the path name since j edit 4 2pre1 public static pluginjar get pluginjar string path for int i 0 i jars size i pluginjar jar pluginjar jars element at i if jar get path equals path return jar return null getpluginjar jedit getpluginjar elementat getpath add pluginjar method loads the plugin jar with the specified path some notes about this method ul li calling this at a time other than j edit startup can have unpredictable results if the plugin has not been updated for the j edit 4 2 plugin api li you must make sure yourself the plugin is not already loaded li after loading you just make sure all the plugin s dependencies are satisified before activating the plugin using the link pluginjar check dependencies method ul param path the jar file path since j edit 4 2pre1 public static void add pluginjar string path backwards compatibility pluginjar jar new edit plugin jar new file path jars add element jar jar init edit bus send new plugin update jar plugin update loaded false if is main thread edit bus send new dynamic menu changed plugins init key bindings addpluginjar jedit jedit checkdependencies jedit addpluginjar editplugin addelement editbus pluginupdate pluginupdate ismainthread editbus dynamicmenuchanged initkeybindings add pluginja rs from directory method loads all plugins in a directory param directory the directory since j edit 4 2pre1 private static void add pluginja rs from directory string directory log log log notice j edit class loading plugins from directory file file new file directory if file exists file is directory return string plugins file list if plugins null return for int i 0 i plugins length i string plugin plugins i if plugin to lower case ends with jar continue string path misc utilities construct path directory plugin remove this when 4 1 plugin api is deprecated if plugin equals edit buddy jar plugin equals plugin manager jar plugin equals firewall jar plugin equals tidy jar plugin equals drag and drop jar plugin error path plugin error obsolete null continue add pluginjar path addpluginjarsfromdirectory jedit addpluginjarsfromdirectory jedit isdirectory tolowercase endswith miscutilities constructpath editbuddy pluginmanager draganddrop pluginerror addpluginjar remove pluginjar method unloads the given plugin jar with the specified path note that calling this at a time other than j edit shutdown can have unpredictable results if the plugin has not been updated for the j edit 4 2 plugin api param jar the code pluginjar code instance param exit set to true if j edit is exiting enables some shortcuts so the editor can close faster since j edit 4 2pre1 public static void remove pluginjar pluginjar jar boolean exit if exit jar uninit true else jar uninit false jars remove element jar init key bindings edit bus send new plugin update jar plugin update unloaded exit if is main thread exit edit bus send new dynamic menu changed plugins removepluginjar jedit jedit jedit jedit removepluginjar removeelement initkeybindings editbus pluginupdate pluginupdate ismainthread editbus dynamicmenuchanged get action context method returns the action context used to store editor actions since j edit 4 2pre1 public static action context get action context return action context getactioncontext jedit actioncontext getactioncontext actioncontext add action set method adds a new action set to j edit s list plugins probably won t need to call this method since j edit 4 0pre1 public static void add action set action set action set action context add action set action set addactionset jedit jedit addactionset actionset actionset actioncontext addactionset actionset remove action set method removes an action set from j edit s list plugins probably won t need to call this method since j edit 4 2pre1 public static void remove action set action set action set action context remove action set action set removeactionset jedit jedit removeactionset actionset actionset actioncontext removeactionset actionset get built in action set method returns the set of commands built into j edit since j edit 4 2pre1 public static action set get built in action set return built in action set getbuiltinactionset jedit jedit actionset getbuiltinactionset builtinactionset get action sets method returns all registered action sets since j edit 4 0pre1 public static action set get action sets return action context get action sets getactionsets jedit actionset getactionsets actioncontext getactionsets get action method returns the specified action param name the action name public static edit action get action string name return action context get action name getaction editaction getaction actioncontext getaction get action set for action method returns the action set that contains the specified action param action the action since j edit 4 2pre1 public static action set get action set for action string action return action context get action set for action action getactionsetforaction jedit actionset getactionsetforaction actioncontext getactionsetforaction get action set for action method deprecated use the form that takes a string instead public static action set get action set for action edit action action return action context get action set for action action get name getactionsetforaction actionset getactionsetforaction editaction actioncontext getactionsetforaction getname get actions method deprecated call get action names instead public static edit action get actions string names action context get action names edit action actions new edit action names length for int i 0 i actions length i actions i action context get action names i if actions i null log log log error j edit class wtf names i return actions getactions getactionnames editaction getactions actioncontext getactionnames editaction editaction actioncontext getaction jedit get action names method returns all registered action names public static string get action names return action context get action names getactionnames getactionnames actioncontext getactionnames reload modes method reloads all edit modes since j edit 3 2pre2 public static void reload modes try to guess the eventual size to avoid unnecessary copying modes new vector 50 load the global catalog if j edit home null load mode catalog modes catalog true else load mode catalog misc utilities construct path j edit home modes catalog false load user catalog if settings directory null file user mode dir new file misc utilities construct path settings directory modes if user mode dir exists user mode dir mkdirs file user catalog new file misc utilities construct path settings directory modes catalog if user catalog exists create dummy catalog file writer out null try out new file writer user catalog out write j edit get property default catalog out close catch io exception io log log log error j edit class io finally try if out null out close catch io exception e load mode catalog user catalog get path false buffer buffer buffers first while buffer null this reloads the token marker and sends a message which causes edit panes to repaint their text areas buffer set mode buffer buffer next reloadmodes jedit reloadmodes jedithome loadmodecatalog loadmodecatalog miscutilities constructpath jedithome settingsdirectory usermodedir miscutilities constructpath settingsdirectory usermodedir usermodedir usercatalog miscutilities constructpath settingsdirectory usercatalog filewriter filewriter usercatalog jedit getproperty defaultcatalog ioexception jedit ioexception loadmodecatalog usercatalog getpath buffersfirst setmode get mode method returns the edit mode with the specified name param name the edit mode public static mode get mode string name for int i 0 i modes size i mode mode mode modes element at i if mode get name equals name return mode return null getmode getmode elementat getname get modes method returns an array of installed edit modes public static mode get modes mode array new mode modes size modes copy into array return array getmodes getmodes copyinto open files method opens the file names specified in the argument array this handles line and marker arguments just like the command line parser param parent the parent directory param args the file names to open since j edit 3 2pre4 public static buffer open files view view string parent string args buffer ret val null buffer last buffer null for int i 0 i args length i string arg args i if arg null continue else if arg starts with line arg starts with marker if last buffer null goto marker view last buffer arg continue last buffer open file null parent arg false null if ret val null last buffer null ret val last buffer if view null ret val null view set buffer ret val return ret val openfiles jedit openfiles retval lastbuffer startswith startswith lastbuffer gotomarker lastbuffer lastbuffer openfile retval lastbuffer retval lastbuffer retval setbuffer retval retval open file method opens a file note that as of j edit 2 5pre1 this may return null if the buffer could not be opened param view the view to open the file in param path the file path since j edit 2 4pre1 public static buffer open file view view string path return open file view null path false new hashtable openfile jedit jedit openfile openfile open file method deprecated the open file forms with the read only parameter should not be used the read only prameter is no longer supported public static buffer open file view view string parent string path boolean read only boolean new file return open file view parent path new file new hashtable openfile openfile readonly readonly openfile readonly newfile openfile newfile open file method deprecated the open file forms with the read only parameter should not be used the read only prameter is no longer supported public static buffer open file view view string parent string path boolean read only boolean new file hashtable props return open file view parent path new file props openfile openfile readonly readonly openfile readonly newfile openfile newfile open file method opens a file this may return null if the buffer could not be opened for some reason param view the view to open the file in param parent the parent directory of the file param path the path name of the file param new file true if the file should not be loaded from disk be prompted if it should be reloaded param props buffer local properties to set in the buffer since j edit 3 2pre10 public static buffer open file view view string parent string path boolean new file hashtable props perspective manager set perspective dirty true if view null parent null parent view get buffer get directory if misc utilities isurl path if misc utilities get protocol ofurl path equals file path path substring 5 path misc utilities construct path parent path buffer new buffer synchronized buffer list lock buffer buffer get buffer path if buffer null if view null view set buffer buffer return buffer if props null props new hashtable buffer history entry entry buffer history get entry path if entry null save caret props get buffer caret null props put buffer caret new integer entry caret if entry selection null get selection converts from string to selection props put buffer selection entry get selection if entry null props get buffer encoding null if entry encoding null props put buffer encoding entry encoding new buffer new buffer path new file false props if new buffer load view false return null add buffer to list new buffer edit bus send new buffer update new buffer view buffer update created if view null view set buffer new buffer return new buffer openfile newfile jedit openfile newfile perspectivemanager setperspectivedirty getbuffer getdirectory miscutilities miscutilities getprotocolofurl miscutilities constructpath newbuffer bufferlistlock getbuffer setbuffer bufferhistory bufferhistory getentry savecaret getselection getselection newbuffer newfile newbuffer addbuffertolist newbuffer editbus bufferupdate newbuffer bufferupdate setbuffer newbuffer newbuffer open temporary method opens a temporary buffer a temporary buffer is like a normal buffer except that an event is not fired the the buffer is not added to the buffers list param view the view to open the file in param parent the parent directory of the file param path the path name of the file param new file true if the file should not be loaded from disk since j edit 3 2pre10 public static buffer open temporary view view string parent string path boolean new file if view null parent null parent view get buffer get directory if misc utilities isurl path if misc utilities get protocol ofurl path equals file path path substring 5 path misc utilities construct path parent path synchronized buffer list lock buffer buffer get buffer path if buffer null return buffer buffer new buffer path new file true new hashtable if buffer load view false return null else return buffer opentemporary newfile jedit opentemporary newfile getbuffer getdirectory miscutilities miscutilities getprotocolofurl miscutilities constructpath bufferlistlock getbuffer newfile commit temporary method adds a temporary buffer to the buffer list this must be done before allowing the user to interact with the buffer in any way param buffer the buffer public static void commit temporary buffer buffer if buffer is temporary return perspective manager set perspective dirty true add buffer to list buffer buffer commit temporary send full range of events to avoid breaking plugins edit bus send new buffer update buffer null buffer update created edit bus send new buffer update buffer null buffer update load started edit bus send new buffer update buffer null buffer update loaded committemporary committemporary istemporary perspectivemanager setperspectivedirty addbuffertolist committemporary editbus bufferupdate bufferupdate editbus bufferupdate bufferupdate load_started editbus bufferupdate bufferupdate new file method creates a new untitled file param view the view to create the file in public static buffer new file view view string path if view null view get buffer null path view get buffer get directory vfs vfs vfs manager getvfs for path path don t want new file to create a read only buffer if current file is on sql vfs or something if vfs get capabilities vfs write cap 0 path system get property user home else path null return new file view path newfile newfile getbuffer getbuffer getdirectory vfsmanager getvfsforpath getcapabilities write_cap getproperty newfile new file method creates a new untitled file param view the view to create the file in param dir the directory to create the file in since j edit 3 1pre2 public static buffer new file view view string dir if only one new file is open which is clean just close it which will create an untitled 1 if dir null buffers first null buffers first buffers last buffers first is untitled buffers first is dirty close buffer view buffers first return the newly created untitled 1 return buffers first find the highest untitled n file int untitled count 0 buffer buffer buffers first while buffer null if buffer get name starts with untitled try untitled count math max untitled count integer parse int buffer get name substring 9 catch number format exception nf buffer buffer next return open file view dir untitled untitled count 1 true null newfile jedit newfile buffersfirst buffersfirst bufferslast buffersfirst isuntitled buffersfirst isdirty closebuffer buffersfirst buffersfirst untitledcount buffersfirst getname startswith untitledcount untitledcount parseint getname numberformatexception openfile untitledcount close buffer method closes a buffer if there are unsaved changes the user is prompted if they should be saved first param view the view param buffer the buffer return true if the buffer was really closed false otherwise public static boolean close buffer view view buffer buffer wait for pending i o requests if buffer is performingio vfs manager wait for requests if vfs manager error occurred return false if buffer is dirty object args buffer get name int result gui utilities confirm view notsaved args j option pane yes no cancel option j option pane warning message if result j option pane yes option if buffer save view null true return false vfs manager wait for requests if buffer get boolean property bufferio request error occurred return false else if result j option pane no option return false closebuffer view buffer return true closebuffer closebuffer isperformingio vfsmanager waitforrequests vfsmanager erroroccurred isdirty getname guiutilities joptionpane yes_no_cancel_option joptionpane warning_message joptionpane yes_option vfsmanager waitforrequests getbooleanproperty bufferiorequest error_occurred joptionpane no_option _closebuffer closebuffer method closes the buffer even if it has unsaved changes param view the view may be null param buffer the buffer exception null pointer exception if the buffer is null since j edit 2 2pre1 public static void closebuffer view view buffer buffer if buffer is closed can happen if the user presses c w twice real quick and the buffer has unsaved changes return perspective manager set perspective dirty true if buffer is new file if view null view get edit pane save caret info integer caret integer buffer get property buffer caret int caret caret null 0 caret int value buffer history set entry buffer get path caret selection buffer get property buffer selection buffer get string property buffer encoding string path buffer get symlink path if vfs manager getvfs for path path get capabilities vfs case insensitive cap 0 path path to lower case buffer hash remove path remove buffer from list buffer buffer close display manager buffer closed buffer edit bus send new buffer update buffer view buffer update closed create a new file when the last is closed if buffers first null buffers last null new file view _closebuffer nullpointerexception jedit _closebuffer isclosed perspectivemanager setperspectivedirty isnewfile geteditpane savecaretinfo _caret getproperty _caret _caret intvalue bufferhistory setentry getpath getproperty getstringproperty getsymlinkpath vfsmanager getvfsforpath getcapabilities case_insensitive_cap tolowercase bufferhash removebufferfromlist displaymanager bufferclosed editbus bufferupdate bufferupdate buffersfirst bufferslast newfile close all buffers method closes all open buffers param view the view public static boolean close all buffers view view return close all buffers view false closeallbuffers closeallbuffers closeallbuffers close all buffers method closes all open buffers param view the view param is exiting this must be false unless this method is being called by the exit method public static boolean close all buffers view view boolean is exiting if view null view get edit pane save caret info boolean dirty false buffer buffer buffers first while buffer null if buffer is dirty dirty true break buffer buffer next if dirty boolean ok new close dialog view isok if ok return false wait for pending i o requests vfs manager wait for requests if vfs manager error occurred return false close remaining buffers the close dialog only deals with dirty ones buffer buffers first zero it here so that buffer tabs doesn t have any problems buffers first buffers last null buffer hash clear buffer count 0 while buffer null if buffer is new file integer caret integer buffer get property buffer caret int caret caret null 0 caret int value buffer history set entry buffer get path caret selection buffer get property buffer selection buffer get string property buffer encoding buffer close display manager buffer closed buffer if is exiting edit bus send new buffer update buffer view buffer update closed buffer buffer next if is exiting new file view perspective manager set perspective dirty true return true closeallbuffers isexiting closeallbuffers isexiting geteditpane savecaretinfo buffersfirst isdirty closedialog vfsmanager waitforrequests vfsmanager erroroccurred buffersfirst buffertabs buffersfirst bufferslast bufferhash buffercount isnewfile _caret getproperty _caret _caret intvalue bufferhistory setentry getpath getproperty getstringproperty displaymanager bufferclosed isexiting editbus bufferupdate bufferupdate isexiting newfile perspectivemanager setperspectivedirty save all buffers method saves all open buffers param view the view since j edit 4 2pre1 public static void save all buffers view view save all buffers view j edit get boolean property confirm save all saveallbuffers jedit saveallbuffers saveallbuffers jedit getbooleanproperty confirmsaveall save all buffers method saves all open buffers param view the view param confirm if true a confirmation dialog will be shown first since j edit 2 7pre2 public static void save all buffers view view boolean confirm if confirm int result gui utilities confirm view saveall null j option pane yes no option j option pane question message if result j option pane yes option return buffer current view get buffer buffer buffer buffers first while buffer null if buffer is dirty if buffer is new file view set buffer buffer buffer save view null true buffer buffer next view set buffer current saveallbuffers jedit saveallbuffers guiutilities joptionpane yes_no_option joptionpane question_message joptionpane yes_option getbuffer buffersfirst isdirty isnewfile setbuffer setbuffer reload all buffers method reloads all open buffers param view the view param confirm if true a confirmation dialog will be shown first if any buffers are dirty since j edit 2 7pre2 public static void reload all buffers final view view boolean confirm boolean has dirty false buffer buffers j edit get buffers for int i 0 i buffers length has dirty false i has dirty buffers i is dirty if confirm has dirty int result gui utilities confirm view reload all null j option pane yes no option j option pane question message if result j option pane yes option return save caret info buffer load will load it view view views first while view null edit pane panes view get edit panes for int i 0 i panes length i panes i save caret info view view next for int i 0 i buffers length i buffer buffer buffers i buffer load view true reloadallbuffers jedit reloadallbuffers hasdirty jedit getbuffers hasdirty hasdirty isdirty hasdirty guiutilities joptionpane yes_no_option joptionpane question_message joptionpane yes_option _view viewsfirst _view editpane _view geteditpanes savecaretinfo _view _view getbuffer method returns the buffer with the specified path name the path name must be an absolute canonical path param path the path name see misc utilities construct path string string see misc utilities resolve symlinks string see get buffer string since j edit 4 2pre7 public static buffer getbuffer string path paths on case insensitive filesystems are stored as lower case in the hash if vfs manager getvfs for path path get capabilities vfs case insensitive cap 0 path path to lower case synchronized buffer list lock return buffer buffer hash get path _getbuffer miscutilities constructpath miscutilities resolvesymlinks getbuffer jedit _getbuffer vfsmanager getvfsforpath getcapabilities case_insensitive_cap tolowercase bufferlistlock bufferhash get buffer method returns the buffer with the specified path name the path name must be an absolute path this method automatically resolves symbolic links if performance is critical cache the canonical path and call link getbuffer string instead param path the path name see misc utilities construct path string string see misc utilities resolve symlinks string public static buffer get buffer string path return getbuffer misc utilities resolve symlinks path getbuffer _getbuffer miscutilities constructpath miscutilities resolvesymlinks getbuffer _getbuffer miscutilities resolvesymlinks get buffers method returns an array of open buffers public static buffer get buffers synchronized buffer list lock buffer buffers new buffer buffer count buffer buffer buffers first for int i 0 i buffer count i buffers i buffer buffer buffer next return buffers getbuffers getbuffers bufferlistlock buffercount buffersfirst buffercount get buffer count method returns the number of open buffers public static int get buffer count return buffer count getbuffercount getbuffercount buffercount get first buffer method returns the first buffer public static buffer get first buffer return buffers first getfirstbuffer getfirstbuffer buffersfirst get last buffer method returns the last buffer public static buffer get last buffer return buffers last getlastbuffer getlastbuffer bufferslast check buffer status method checks each buffer s status on disk and shows the dialog box informing the user that buffers changed on disk if necessary param view the view since j edit 4 2pre1 public static void check buffer status view view still need to call the status check even if the option is off so that the write protection is updated if it changes on disk boolean show dialog setting get boolean property auto reload dialog auto reload changed buffers boolean auto reload setting get boolean property auto reload the problem with this is that if we have two edit panes looking at the same buffer and the file is reloaded both will jump to the same location view view views first while view null edit pane edit panes view get edit panes for int i 0 i edit panes length i edit panes i save caret info view view next buffer buffer buffers first int states new int buffer count int i 0 boolean show false while buffer null states i buffer check file status view switch states i case buffer file changed if auto reload setting show dialog setting buffer is dirty buffer load view true fall through case buffer file deleted show true break buffer buffer next i if show show dialog setting new files changed dialog view states auto reload setting checkbufferstatus jedit checkbufferstatus showdialogsetting getbooleanproperty autoreloaddialog autoreloadsetting getbooleanproperty autoreload _view viewsfirst _view editpane editpanes _view geteditpanes editpanes editpanes savecaretinfo _view _view buffersfirst buffercount checkfilestatus file_changed autoreloadsetting showdialogsetting isdirty file_deleted showdialogsetting fileschangeddialog autoreloadsetting get input handler method returns the current input handler key binding to action mapping see org gjt sp jedit gui input handler public static input handler get input handler return input handler getinputhandler inputhandler inputhandler getinputhandler inputhandler new view method creates a new view param view an existing view since j edit 3 2pre2 public static view new view view view return new view view null false newview jedit newview newview new view method creates a new view of a buffer param view an existing view param buffer the buffer public static view new view view view buffer buffer return new view view buffer false newview newview newview new view method creates a new view of a buffer param view an existing view param buffer the buffer param plain view if true the view will not have dockable windows or tool bars since 4 1pre2 public static view new view view view buffer buffer boolean plain view view view config config if view null plain view view is plain view config view get view config else config new view view config plain view return new view view buffer config newview plainview newview plainview viewconfig plainview isplainview getviewconfig viewconfig plainview newview new view method creates a new view param view an existing view param buffer a buffer to display or null param config encapsulates the view geometry split configuration and if the view is a plain view since j edit 4 2pre1 public static view new view view view buffer buffer view view config config perspective manager set perspective dirty true try if view null view show wait cursor view get edit pane save caret info view new view new view buffer config add view to list new view if config plain view dockable window manager wm new view get dockable window manager if config top null config top length 0 wm show dockable window config top if config left null config left length 0 wm show dockable window config left if config bottom null config bottom length 0 wm show dockable window config bottom if config right null config right length 0 wm show dockable window config right new view pack if config width 0 config height 0 rectangle desired new rectangle config x config y config width config height if operating system isx11 debug geometry workaround new gui utilities unix workaround new view view desired config ext state else new view set bounds desired gui utilities set extended state new view config ext state else gui utilities center on screen new view edit bus send new view update new view view update created new view set visible true show tip of the day if new view views first new view get text area request focus don t show the welcome message if j edit was started with the nosettings switch if settings directory null get boolean property first time new help viewer else if j edit get boolean property tip show new tip of the day new view set boolean property first time false else gui utilities request focus new view new view get text area return new view finally if view null view hide wait cursor newview jedit newview viewconfig perspectivemanager setperspectivedirty showwaitcursor geteditpane savecaretinfo newview addviewtolist newview plainview dockablewindowmanager newview getdockablewindowmanager showdockablewindow showdockablewindow showdockablewindow showdockablewindow newview operatingsystem geometry_workaround guiutilities unixworkaround newview extstate newview setbounds guiutilities setextendedstate newview extstate guiutilities centeronscreen newview editbus viewupdate newview viewupdate newview setvisible newview viewsfirst newview gettextarea requestfocus jedit settingsdirectory getbooleanproperty firsttime helpviewer jedit getbooleanproperty tipoftheday newview setbooleanproperty firsttime guiutilities requestfocus newview newview gettextarea newview hidewaitcursor close view method closes a view j edit will exit if this was the last open view public static void close view view view close view view true closeview jedit closeview closeview get views method returns an array of all open views public static view get views view views new view view count view view views first for int i 0 i view count i views i view view view next return views getviews getviews viewcount viewsfirst viewcount get view count method returns the number of open views public static int get view count return view count getviewcount getviewcount viewcount get first view method returns the first view public static view get first view return views first getfirstview getfirstview viewsfirst get last view method returns the last view public static view get last view return views last getlastview getlastview viewslast get active view method returns the currently focused view since j edit 4 1pre1 public static view get active view if active view null eg user just closed a view and didn t focus another return views first else return active view getactiveview jedit getactiveview activeview viewsfirst activeview is main thread method returns true if the currently running thread is the main thread since j edit 4 2pre1 public static boolean is main thread return thread current thread main thread ismainthread jedit ismainthread currentthread mainthread is background mode method returns true if j edit was started with the code background code command line switch since j edit 4 0pre4 public static boolean is background mode enabled return background isbackgroundmode jedit jedit isbackgroundmodeenabled show memory status dialog method performs garbage collection and displays a dialog box showing memory status param view the view since j edit 4 0pre1 public static void show memory dialog view view runtime rt runtime get runtime int before int rt free memory 1024 system gc int after int rt free memory 1024 int total int rt total memory 1024 j progress bar progress new j progress bar 0 total progress set value total after progress set string painted true progress set string j edit get property memory status use new object new integer total after new integer total object message new object 4 message 0 get property memory status gc new object new integer after before message 1 box create vertical strut 12 message 2 progress message 3 box create vertical strut 6 j option pane show message dialog view message j edit get property memory status title j option pane information message showmemorystatusdialog jedit showmemorydialog getruntime freememory freememory totalmemory jprogressbar jprogressbar setvalue setstringpainted setstring jedit getproperty getproperty createverticalstrut createverticalstrut joptionpane showmessagedialog jedit getproperty joptionpane information_message getj edit home method returns the j edit install directory public static string getj edit home return j edit home getjedithome jedit getjedithome jedithome get settings directory method returns the path of the directory where user specific settings are stored this will be code null code if j edit was started with the code nosettings code command line switch do not blindly use this method without checking for a code null code return value first public static string get settings directory return settings directory getsettingsdirectory jedit getsettingsdirectory settingsdirectory getjar cache directory method returns the directory where plugin cache files are stored since j edit 4 2pre1 public static string getjar cache directory return jar cache directory getjarcachedirectory jedit getjarcachedirectory jarcachedirectory backup settings file method backs up the specified file in the settings directory you should call this on any settings files your plugin writes param file the file since j edit 4 0pre1 public static void backup settings file file file if settings directory null return string backup dir misc utilities construct path settings directory settings backup file dir new file backup dir if dir exists dir mkdirs sweet save backup will create backup dir if it doesn t exist misc utilities save backup file 5 null backup dir backupsettingsfile jedit backupsettingsfile settingsdirectory backupdir miscutilities constructpath settingsdirectory backupdir savebackup backupdir miscutilities savebackup backupdir save settings method saves all user preferences to disk public static void save settings if settings directory null return abbrevs save favoritesvfs save favorites history model save history registers save registers search and replace save buffer history save kill ring save file file1 new file misc utilities construct path settings directory properties save file file2 new file misc utilities construct path settings directory properties if file2 exists file2 last modified props mod time log log log warning j edit class file2 changed on disk will not save user properties else backup settings file file2 try output stream out new file output stream file1 prop mgr save user props out file2 delete file1 rename to file2 catch io exception io log log log error j edit class io props mod time file2 last modified savesettings savesettings settingsdirectory savefavorites historymodel savehistory saveregisters searchandreplace bufferhistory killring miscutilities constructpath settingsdirectory miscutilities constructpath settingsdirectory lastmodified propsmodtime jedit backupsettingsfile outputstream fileoutputstream propmgr saveuserprops renameto ioexception jedit propsmodtime lastmodified exit method exits cleanly from j edit prompting the user if any unsaved files should be saved first param view the view from which this exit was called param really exit if background mode is enabled and this parameter is true then j edit will close all open views instead of exiting entirely public static void exit view view boolean really exit close dialog view close call need a view if view null view active view wait for pending i o requests vfs manager wait for requests send editor exit requested edit bus send new editor exit requested view even if really exit is false we still exit properly if background mode is off really exit background perspective manager save perspective false close all buffers if close all buffers view really exit return if we are running in background mode and really exit was not specified then return here if really exit in this case we can t directly call view close we have to call close view for all open views view views first while view null close view view false view view next save settings in case user kills the backgrounded j edit process save settings else save view properties here if view null view close stop autosave timer autosave stop stop server if server null server stop server stop all plugins pluginjar plugins get pluginja rs for int i 0 i plugins length i remove pluginjar plugins i true send editor exiting edit bus send new editor exiting null save settings save settings close activity log stream log close stream byebye system exit 0 jedit reallyexit jedit reallyexit activeview vfsmanager waitforrequests editorexitrequested editbus editorexitrequested reallyexit reallyexit perspectivemanager saveperspective closeallbuffers reallyexit reallyexit reallyexit closeview viewsfirst closeview jedit savesettings stopserver getpluginjars removepluginjar editorexiting editbus editorexiting savesettings closestream get edit server method returns the edit server instance you can use this to find out the port number j edit is listening on since j edit 4 2pre10 public static edit server get edit server return server geteditserver jedit jedit editserver geteditserver update position method if buffer sorting is enabled this repositions the buffer static void update position string old path buffer buffer if vfs manager getvfs for path old path get capabilities vfs case insensitive cap 0 old path old path to lower case buffer hash remove old path string path buffer get symlink path if vfs manager getvfs for path path get capabilities vfs case insensitive cap 0 path path to lower case buffer hash put path buffer if sort buffers remove buffer from list buffer add buffer to list buffer updateposition updateposition oldpath vfsmanager getvfsforpath oldpath getcapabilities case_insensitive_cap oldpath oldpath tolowercase bufferhash oldpath getsymlinkpath vfsmanager getvfsforpath getcapabilities case_insensitive_cap tolowercase bufferhash sortbuffers removebufferfromlist addbuffertolist add mode method do not call this method it is only public so that classes in the org gjt sp jedit syntax package can access it param mode the edit mode public static void add mode mode mode log log log debug j edit class adding edit mode mode get name modes add element mode addmode addmode jedit getname addelement load mode method loads an xml defined edit mode from the specified reader param mode the edit mode package private static void load mode mode mode final string file name string mode get property file log log log notice j edit class loading edit mode file name final xml parser parser new xml parser x mode handler xmh new x mode handler mode get name public void error string what object subst int line parser get line number int column parser get column number string msg if subst null msg j edit get property xmode error what else msg j edit get property xmode error what new string subst to string if subst instanceof throwable log log log error this subst object args file name new integer line new integer column msg gui utilities error null xmode error args public token marker get token marker string mode name mode mode get mode mode name if mode null return null else return mode get token marker mode set token marker xmh get token marker reader grammar null parser set handler xmh try grammar new buffered reader new file reader file name parser parse null null grammar mode set properties xmh get mode properties catch throwable e log log log error j edit class e if e instanceof xml exception xml exception xe xml exception e int line xe get line string message xe get message object args file name new integer line null message gui utilities error null xmode error args finally try if grammar null grammar close catch io exception io log log log error j edit class io loadmode loadmode filename getproperty jedit filename xmlparser xmlparser xmodehandler xmodehandler getname getlinenumber getcolumnnumber jedit getproperty jedit getproperty tostring filename guiutilities tokenmarker gettokenmarker modename getmode modename gettokenmarker settokenmarker gettokenmarker sethandler bufferedreader filereader filename setproperties getmodeproperties jedit xmlexception xmlexception xmlexception getline getmessage filename guiutilities ioexception jedit public void error string what object subst int line parser get line number int column parser get column number string msg if subst null msg j edit get property xmode error what else msg j edit get property xmode error what new string subst to string if subst instanceof throwable log log log error this subst object args file name new integer line new integer column msg gui utilities error null xmode error args getlinenumber getcolumnnumber jedit getproperty jedit getproperty tostring filename guiutilities public token marker get token marker string mode name mode mode get mode mode name if mode null return null else return mode get token marker tokenmarker gettokenmarker modename getmode modename gettokenmarker add plugin props method static void add plugin props properties map prop mgr add plugin props map addpluginprops addpluginprops propmgr addpluginprops remove plugin props method static void remove plugin props properties map prop mgr remove plugin props map removepluginprops removepluginprops propmgr removepluginprops plugin error method static void plugin error string path string message prop object args synchronized plugin error lock if plugin errors null plugin errors new vector error list dialog error entry new entry new error list dialog error entry path message prop args for int i 0 i plugin errors size i if plugin errors get i equals new entry return plugin errors add element new entry if startup done swing utilities invoke later new runnable public void run show plugin error dialog pluginerror pluginerror messageprop pluginerrorlock pluginerrors pluginerrors errorlistdialog errorentry newentry errorlistdialog errorentry messageprop pluginerrors pluginerrors newentry pluginerrors addelement newentry startupdone swingutilities invokelater showpluginerrordialog swing utilities invoke later new runnable public void run show plugin error dialog swingutilities invokelater showpluginerrordialog set active view method static void set active view view view j edit active view view setactiveview setactiveview jedit activeview private j edit jedit usage method private static void usage system out println usage jedit options files system out println file marker marker positions caret at marker marker system out println file line line positions caret at line number line system out println end of options system out println background run in background mode system out println nobackground disable background mode default system out println gui only if running in background mode open initial view default system out println nogui only if running in background mode don t open initial view system out println log level log messages with level equal to or higher than this to system out println standard error level must be between 1 and 9 default is 7 system out println newplainview client instance opens a new plain view system out println newview client instance opens a new view default system out println plugins load plugins default system out println noplugins don t load any plugins system out println restore restore previously open files default system out println norestore don t restore previously open files system out println reuseview client instance reuses existing view system out println quit quit a running instance system out println run script run the specified bean shell script system out println server read write server info from to home jedit server default system out println server name read write server info from to home jedit name system out println noserver don t start edit server system out println settings path load user specific settings from path system out println nosettings don t load user specific settings system out println startupscripts run startup scripts default system out println nostartupscripts don t run startup scripts system out println usage print this message and exit system out println version print j edit version and exit system out println wait wait until the user closes the specified buffer in the server system out println instance does nothing if passed to the initial j edit instance system out println system out println report bugs to slava pestov slava jedit org beanshell jedit jedit version method private static void version system out println j edit get version jedit getversion make server script method creates a bean shell script that can be sent to a running edit server private static string make server script boolean wait boolean restore boolean new view boolean new plain view string args string script file string buffer script new string buffer string user dir system get property user dir script append parent script append misc utilities chars to escapes user dir script append n script append args new string script append args length script append n for int i 0 i args length i script append args script append i script append if args i null script append null else script append script append misc utilities chars to escapes args i script append script append n script append view j edit get last view n script append buffer edit server handle client restore new view new plain view parent args n script append if buffer null wait n script append tbuffer set wait socket socket n script append tdo not close socket true n script append n script append if view j edit get last view wait n script append tj edit get last view set wait socket socket n script append tdo not close socket true n script append n script append if do not close socket void n script append tsocket close n if script file null script file misc utilities construct path user dir script file script append bean shell run script view misc utilities chars to escapes script file null this namespace n return script to string makeserverscript beanshell makeserverscript newview newplainview scriptfile stringbuffer stringbuffer userdir getproperty miscutilities charstoescapes userdir miscutilities charstoescapes jedit getlastview editserver handleclient newview newplainview setwaitsocket tdonotclosesocket jedit getlastview tjedit getlastview setwaitsocket tdonotclosesocket donotclosesocket scriptfile scriptfile miscutilities constructpath userdir scriptfile beanshell runscript miscutilities charstoescapes scriptfile tostring init misc method initialise various objects register protocol handlers private static void init misc jars new vector action context new action context public void invoke action event object evt edit action action view view gui utilities get view component evt get source boolean action bar visible if view get action bar null view get action bar is showing action bar visible false else action bar visible view get action bar is visible view get input handler invoke action action if action bar visible xxx action bar might not be temp action bar action bar view get action bar if action bar null view remove tool bar action bar buffer hash new hash map input handler new default input handler null add our protocols to java net url s list system get properties put java protocol handler pkgs org gjt sp jedit proto system get property java protocol handler pkgs set the user agent string used by the java net http handler string user agent j edit get version java system get property java version system get property java vendor system get property os arch system get properties put http agent user agent determine installation directory if the jedit home property is set use that then look for jedit jar in the classpath if that fails assume this is the web start version j edit home system get property jedit home if j edit home null string classpath system get property java class path int index classpath to lower case index of jedit jar int start classpath last index of file path separator index 1 if started with java jar jedit jar if classpath equals ignore case jedit jar j edit home system get property user dir else if index start j edit home classpath substring start index 1 else check if web start if j edit class get resource modes catalog null modes bundled in hence web start j edit home null else use user dir as last resort j edit home system get property user dir log log log warning j edit class jedit jar not in class path log log log warning j edit class assuming j edit is installed in j edit home log log log warning j edit class override with jedit home system property j edit home misc utilities resolve symlinks j edit home log log log message j edit class j edit home directory is j edit home if settings directory null jar cache directory misc utilities construct path settings directory jars cache new file jar cache directory mkdirs if j edit home null log log log debug j edit class web start mode add an edit bus component that will reload edit modes and macros if they are changed from within the editor edit bus add to bus new settings reloader perhaps if xerces wasn t slightly brain damaged we would not need this swing utilities invoke later new runnable public void run thread current thread set context class loader new jar class loader initmisc initmisc actioncontext actioncontext invokeaction eventobject editaction guiutilities getview getsource actionbarvisible getactionbar getactionbar isshowing actionbarvisible actionbarvisible getactionbar isvisible getinputhandler invokeaction actionbarvisible actionbar actionbar getactionbar actionbar removetoolbar actionbar bufferhash hashmap inputhandler defaultinputhandler getproperties getproperty useragent jedit getversion getproperty getproperty getproperty getproperties useragent jedithome getproperty jedithome getproperty tolowercase indexof lastindexof pathseparator equalsignorecase jedithome getproperty jedithome jedit getresource jedithome jedithome getproperty jedit jedit jedit jedithome jedit jedithome miscutilities resolvesymlinks jedithome jedit jedit jedithome settingsdirectory jarcachedirectory miscutilities constructpath settingsdirectory jarcachedirectory jedithome jedit editbus editbus addtobus settingsreloader swingutilities invokelater currentthread setcontextclassloader jarclassloader public void invoke action event object evt edit action action view view gui utilities get view component evt get source boolean action bar visible if view get action bar null view get action bar is showing action bar visible false else action bar visible view get action bar is visible view get input handler invoke action action if action bar visible xxx action bar might not be temp action bar action bar view get action bar if action bar null view remove tool bar action bar invokeaction eventobject editaction guiutilities getview getsource actionbarvisible getactionbar getactionbar isshowing actionbarvisible actionbarvisible getactionbar isvisible getinputhandler invokeaction actionbarvisible actionbar actionbar getactionbar actionbar removetoolbar actionbar public void run thread current thread set context class loader new jar class loader currentthread setcontextclassloader jarclassloader init system properties method load system properties private static void init system properties prop mgr new property manager try prop mgr load system props j edit class get resource as stream org gjt sp jedit jedit props prop mgr load system props j edit class get resource as stream org gjt sp jedit jedit gui props prop mgr load system props j edit class get resource as stream org gjt sp jedit jedit keys props catch exception e log log log error j edit class error while loading system properties log log log error j edit class one of the following property files could not be loaded n jedit props n jedit gui props n jedit keys props n jedit jar is probably corrupt log log log error j edit class e system exit 1 initsystemproperties initsystemproperties propmgr propertymanager propmgr loadsystemprops jedit getresourceasstream propmgr loadsystemprops jedit getresourceasstream jedit_gui propmgr loadsystemprops jedit getresourceasstream jedit_keys jedit jedit jedit_gui jedit_keys jedit init site properties method load site properties private static void init site properties site properties are loaded as default properties overwriting j edit s system properties string site settings directory misc utilities construct path j edit home properties file site settings new file site settings directory if site settings exists site settings is directory return string snippets site settings list if snippets null return misc utilities quicksort snippets new misc utilities stringi case compare for int i 0 i snippets length i string snippet snippets i if snippet to lower case ends with props continue try string path misc utilities construct path site settings directory snippet log log log debug j edit class loading site snippet path prop mgr load site props new file input stream new file path catch file not found exception fnf log log log debug j edit class fnf catch io exception e log log log error j edit class cannot load site snippet snippet log log log error j edit class e initsiteproperties initsiteproperties jedit sitesettingsdirectory miscutilities constructpath jedithome sitesettings sitesettingsdirectory sitesettings sitesettings isdirectory sitesettings miscutilities miscutilities stringicasecompare tolowercase endswith miscutilities constructpath sitesettingsdirectory jedit propmgr loadsiteprops fileinputstream filenotfoundexception jedit ioexception jedit jedit init resources method private static void init resources built in action set new action set null null null j edit class get resource actions xml built in action set set label get property action set j edit built in action set load action context add action set built in action set dockable window manager load dockable windows null j edit class get resource dockables xml null service manager load services null j edit class get resource services xml null initresources initresources builtinactionset actionset jedit getresource builtinactionset setlabel getproperty jedit builtinactionset actioncontext addactionset builtinactionset dockablewindowmanager loaddockablewindows jedit getresource servicemanager loadservices jedit getresource init plugins method loads plugins private static void init plugins if j edit home null add pluginja rs from directory misc utilities construct path j edit home jars if settings directory null file jars directory new file settings directory jars if jars directory exists jars directory mkdir add pluginja rs from directory jars directory get path pluginjar jars get pluginja rs for int i 0 i jars length i jars i check dependencies initplugins initplugins jedithome addpluginjarsfromdirectory miscutilities constructpath jedithome settingsdirectory jarsdirectory settingsdirectory jarsdirectory jarsdirectory addpluginjarsfromdirectory jarsdirectory getpath getpluginjars checkdependencies init user properties method loads user properties private static void init user properties if settings directory null file file new file misc utilities construct path settings directory properties props mod time file last modified try prop mgr load user props new file input stream file catch file not found exception fnf log log log debug j edit class fnf catch exception e log log log error j edit class e inituserproperties inituserproperties settingsdirectory miscutilities constructpath settingsdirectory propsmodtime lastmodified propmgr loaduserprops fileinputstream filenotfoundexception jedit jedit font style to string method private static string font style to string int style if style 0 return plain else if style font bold return bold else if style font italic return italic else if style font bold font italic return bolditalic else throw new runtime exception invalid style style fontstyletostring fontstyletostring runtimeexception font to string method private static string font to string font font return font get family font style to string font get style font get size fonttostring fonttostring getfamily fontstyletostring getstyle getsize initplaf method sets the swing look and feel private static void initplaf font primary font j edit get font property metal primary font if primary font null string primary font string font to string primary font system get properties put swing plaf metal control font primary font string system get properties put swing plaf metal menu font primary font string font secondary font j edit get font property metal secondary font if secondary font null string secondary font string font to string secondary font system get properties put swing plaf metal system font secondary font string system get properties put swing plaf metal user font secondary font string try string lf get property look and feel if lf null lf length 0 ui manager set look and feel lf else if operating system is macos ui manager set look and feel ui manager get system look and feel class name else ui manager set look and feel ui manager get cross platform look and feel class name catch exception e log log log error j edit class e ui defaults defaults ui manager get defaults give all swing components our colors if j edit get boolean property text colors color background new javax swing plaf colorui resource j edit get color property view bg color color foreground new javax swing plaf colorui resource j edit get color property view fg color color caret color new javax swing plaf colorui resource j edit get color property view caret color color selection color new javax swing plaf colorui resource j edit get color property view selection color string prefixes text field text area list table for int i 0 i prefixes length i string prefix prefixes i defaults put prefix disabled background background defaults put prefix background background defaults put prefix disabled foreground foreground defaults put prefix foreground foreground defaults put prefix caret foreground caret color defaults put prefix selection foreground foreground defaults put prefix selection background selection color defaults put prefix inactive foreground foreground defaults put tree background background defaults put tree foreground foreground defaults put tree text background background defaults put tree text foreground foreground defaults put tree selection foreground foreground defaults put tree selection background selection color defaults remove split pane border defaults remove split pane divider border primaryfont jedit getfontproperty primaryfont primaryfontstring fonttostring primaryfont getproperties controlfont primaryfontstring getproperties menufont primaryfontstring secondaryfont jedit getfontproperty secondaryfont secondaryfontstring fonttostring secondaryfont getproperties systemfont secondaryfontstring getproperties userfont secondaryfontstring getproperty lookandfeel uimanager setlookandfeel operatingsystem ismacos uimanager setlookandfeel uimanager getsystemlookandfeelclassname uimanager setlookandfeel uimanager getcrossplatformlookandfeelclassname jedit uidefaults uimanager getdefaults jedit getbooleanproperty textcolors coloruiresource jedit getcolorproperty bgcolor coloruiresource jedit getcolorproperty fgcolor caretcolor coloruiresource jedit getcolorproperty caretcolor selectioncolor coloruiresource jedit getcolorproperty selectioncolor textfield textarea disabledbackground disabledforeground caretforeground caretcolor selectionforeground selectionbackground selectioncolor inactiveforeground textbackground textforeground selectionforeground selectionbackground selectioncolor splitpane splitpanedivider run startup scripts method runs scripts in a directory private static void run startup scripts file directory if directory is directory return file snippets directory list files if snippets null return misc utilities quicksort snippets new misc utilities stringi case compare for int i 0 i snippets length i file snippet snippets i macros handler handler macros get handler for path name snippet get path if handler null continue try macros macro new macro handler create macro snippet get name snippet get path handler run macro null new macro false catch exception e log log log error j edit class e runstartupscripts runstartupscripts isdirectory listfiles miscutilities miscutilities stringicasecompare gethandlerforpathname getpath newmacro createmacro getname getpath runmacro newmacro jedit init proxy method private static void init proxy boolean socks enabled j edit get boolean property socks enabled if socks enabled log log log debug j edit class socks proxy disabled system get properties remove socks proxy host system get properties remove socks proxy port else string socks host j edit get property firewall socks host if socks host null system set property socks proxy host socks host log log log debug j edit class socks proxy enabled socks host string socks port j edit get property firewall socks port if socks port null system set property socks proxy port socks port boolean http enabled j edit get boolean property firewall enabled if http enabled log log log debug j edit class http proxy disabled system get properties remove proxy set system get properties remove proxy host system get properties remove proxy port system get properties remove http proxy host system get properties remove http proxy port system get properties remove http non proxy hosts authenticator set default null else set proxy host string host j edit get property firewall host if host null return system set property http proxy host host log log log debug j edit class http proxy enabled host set proxy port string port j edit get property firewall port if port null system set property http proxy port port set non proxy hosts list string non proxy hosts j edit get property firewall non proxy hosts if non proxy hosts null system set property http non proxy hosts non proxy hosts set proxy authentication string username j edit get property firewall user string password j edit get property firewall password null not supported if password null password if username null username length 0 log log log debug j edit class http proxy without user authenticator set default new firewall authenticator null else log log log debug j edit class http proxy user username password authentication pw new password authentication username password to char array authenticator set default new firewall authenticator pw initproxy initproxy socksenabled jedit getbooleanproperty socksenabled jedit getproperties socksproxyhost getproperties socksproxyport sockshost jedit getproperty sockshost setproperty socksproxyhost sockshost jedit sockshost socksport jedit getproperty socksport setproperty socksproxyport socksport httpenabled jedit getbooleanproperty httpenabled jedit getproperties proxyset getproperties proxyhost getproperties proxyport getproperties proxyhost getproperties proxyport getproperties nonproxyhosts setdefault jedit getproperty setproperty proxyhost jedit jedit getproperty setproperty proxyport nonproxyhosts jedit getproperty nonproxyhosts nonproxyhosts setproperty nonproxyhosts nonproxyhosts jedit getproperty jedit getproperty jedit setdefault firewallauthenticator jedit passwordauthentication passwordauthentication tochararray setdefault firewallauthenticator password authentication pw public firewall authenticator password authentication pw this pw pw passwordauthentication firewallauthenticator passwordauthentication protected password authentication get password authentication return pw passwordauthentication getpasswordauthentication finish startup method private static void finish startup final boolean gui final boolean restore final string user dir final string args swing utilities invoke later new runnable public void run buffer buffer open files null user dir args int count get buffer count if count 0 new file null view view null boolean restore files restore j edit get boolean property restore get buffer count 0 j edit get boolean property restore cli if gui count 0 view perspective manager load perspective restore files if view null view new view null buffer else if buffer null view set buffer buffer start i o threads edit bus send new editor started null vfs manager start start edit server if server null server start gui utilities hide splash screen log log log message j edit class startup complete report any plugin errors if plugin errors null show plugin error dialog startup done true in one case not a single awt class will have been touched splash screen off nogui nobackground switches on command line toolkit get default toolkit finishstartup finishstartup userdir swingutilities invokelater openfiles userdir getbuffercount newfile restorefiles jedit getbooleanproperty getbuffercount jedit getbooleanproperty perspectivemanager loadperspective restorefiles newview setbuffer editbus editorstarted vfsmanager guiutilities hidesplashscreen jedit pluginerrors showpluginerrordialog startupdone getdefaulttoolkit swing utilities invoke later new runnable public void run buffer buffer open files null user dir args int count get buffer count if count 0 new file null view view null boolean restore files restore j edit get boolean property restore get buffer count 0 j edit get boolean property restore cli if gui count 0 view perspective manager load perspective restore files if view null view new view null buffer else if buffer null view set buffer buffer start i o threads edit bus send new editor started null vfs manager start start edit server if server null server start gui utilities hide splash screen log log log message j edit class startup complete report any plugin errors if plugin errors null show plugin error dialog startup done true in one case not a single awt class will have been touched splash screen off nogui nobackground switches on command line toolkit get default toolkit swingutilities invokelater openfiles userdir getbuffercount newfile restorefiles jedit getbooleanproperty getbuffercount jedit getbooleanproperty perspectivemanager loadperspective restorefiles newview setbuffer editbus editorstarted vfsmanager guiutilities hidesplashscreen jedit pluginerrors showpluginerrordialog startupdone getdefaulttoolkit show plugin error dialog method private static void show plugin error dialog if plugin errors null return string caption get property plugin error caption plugin errors size 1 1 frame frame plugin manager get instance null frame views first frame plugin manager get instance new error list dialog frame get property plugin error title caption plugin errors true plugin errors null showpluginerrordialog showpluginerrordialog pluginerrors getproperty pluginerrors pluginmanager getinstance viewsfirst pluginmanager getinstance errorlistdialog getproperty pluginerrors pluginerrors get not loaded pluginja rs method private static void get not loaded pluginja rs vector return value string dir string list loop for int i 0 i list length i string name list i if name to lower case ends with jar continue loop string path misc utilities construct path dir name for int j 0 j jars size j pluginjar jar pluginjar jars element at j string jar path jar get path string jar name misc utilities get file name jar path if path equals jar path continue loop else if new file jar path exists name equals jar name continue loop return value add element path getnotloadedpluginjars getnotloadedpluginjars returnvalue tolowercase endswith miscutilities constructpath elementat jarpath getpath jarname miscutilities getfilename jarpath jarpath jarpath jarname returnvalue addelement goto marker method private static void goto marker final view view final buffer buffer final string marker vfs manager run inawt thread new runnable public void run int pos handle line number if marker starts with line try int line integer parse int marker substring 6 pos buffer get line start offset line 1 catch exception e return handle marker else if marker starts with marker if marker length 9 return marker m buffer get marker marker char at 8 if m null return pos m get position can t happen else throw new internal error if view null view get buffer buffer view get text area set caret position pos else buffer set integer property buffer caret pos buffer unset property buffer scroll vert gotomarker gotomarker vfsmanager runinawtthread startswith parseint getlinestartoffset startswith getmarker charat getposition internalerror getbuffer gettextarea setcaretposition setintegerproperty unsetproperty scroll_vert public void run int pos handle line number if marker starts with line try int line integer parse int marker substring 6 pos buffer get line start offset line 1 catch exception e return handle marker else if marker starts with marker if marker length 9 return marker m buffer get marker marker char at 8 if m null return pos m get position can t happen else throw new internal error if view null view get buffer buffer view get text area set caret position pos else buffer set integer property buffer caret pos buffer unset property buffer scroll vert startswith parseint getlinestartoffset startswith getmarker charat getposition internalerror getbuffer gettextarea setcaretposition setintegerproperty unsetproperty scroll_vert add buffer to list method private static void add buffer to list buffer buffer synchronized buffer list lock string symlink path buffer get symlink path if vfs manager getvfs for path symlink path get capabilities vfs case insensitive cap 0 symlink path symlink path to lower case if only one clean untitled buffer is open we replace it if view count 1 buffers first null buffers first buffers last buffers first is untitled buffers first is dirty buffer old buffers first buffers first buffers first buffers last buffer display manager buffer closed old buffers first edit bus send new buffer update old buffers first null buffer update closed buffer hash clear buffer hash put symlink path buffer return buffer count buffer hash put symlink path buffer if buffers first null buffers first buffers last buffer return sort buffer list else if sort buffers string str11 str12 if sort by name str11 buffer get name str12 buffer get directory else str11 buffer get directory str12 buffer get name buffer buffer buffers first while buffer null string str21 str22 if sort by name str21 buffer get name str22 buffer get directory else str21 buffer get directory str22 buffer get name int comp misc utilities compare strings str11 str21 true if comp 0 comp 0 misc utilities compare strings str12 str22 true 0 buffer next buffer buffer prev buffer prev buffer prev buffer if buffer buffers first buffer prev next buffer else buffers first buffer return buffer buffer next buffer prev buffers last fixes the hang that can occur if we save as to a new filename which requires re sorting buffer next null buffers last next buffer buffers last buffer addbuffertolist addbuffertolist bufferlistlock symlinkpath getsymlinkpath vfsmanager getvfsforpath symlinkpath getcapabilities case_insensitive_cap symlinkpath symlinkpath tolowercase viewcount buffersfirst buffersfirst bufferslast buffersfirst isuntitled buffersfirst isdirty oldbuffersfirst buffersfirst buffersfirst bufferslast displaymanager bufferclosed oldbuffersfirst editbus bufferupdate oldbuffersfirst bufferupdate bufferhash bufferhash symlinkpath buffercount bufferhash symlinkpath buffersfirst buffersfirst bufferslast sortbuffers sortbyname getname getdirectory getdirectory getname _buffer buffersfirst _buffer sortbyname _buffer getname _buffer getdirectory _buffer getdirectory _buffer getname miscutilities comparestrings miscutilities comparestrings _buffer _buffer _buffer _buffer buffersfirst buffersfirst _buffer _buffer bufferslast bufferslast bufferslast remove buffer from list method private static void remove buffer from list buffer buffer synchronized buffer list lock buffer count boolean case insensitive filesystem operating system isdos derived operating system is macos string path buffer get path if case insensitive filesystem path path to lower case buffer hash remove path if buffer buffers first buffer buffers last buffers first buffers last null return if buffer buffers first buffers first buffer next buffer next prev null else buffer prev next buffer next if buffer buffers last buffers last buffers last prev buffer prev next null else buffer next prev buffer prev fixes the hang that can occur if we save as to a new filename which requires re sorting buffer next buffer prev null removebufferfromlist removebufferfromlist bufferlistlock buffercount caseinsensitivefilesystem operatingsystem isdosderived operatingsystem ismacos getpath caseinsensitivefilesystem tolowercase bufferhash buffersfirst bufferslast buffersfirst bufferslast buffersfirst buffersfirst bufferslast bufferslast bufferslast add view to list method private static void add view to list view view view count if views first null views first views last view else view prev views last views last next view views last view addviewtolist addviewtolist viewcount viewsfirst viewsfirst viewslast viewslast viewslast viewslast remove view from list method private static void remove view from list view view view count if views first views last views first views last null return if view views first views first view next view next prev null else view prev next view next if view views last views last views last prev view prev next null else view next prev view prev removeviewfromlist removeviewfromlist viewcount viewsfirst viewslast viewsfirst viewslast viewsfirst viewsfirst viewslast viewslast viewslast close view method close view used by exit private static void close view view view boolean call exit perspective manager set perspective dirty true if views first views last call exit exit view false exit does editor event save else edit bus send new view update view view update closed view close remove view from list view if view active view active view null closeview closeview closeview callexit perspectivemanager setperspectivedirty viewsfirst viewslast callexit editbus viewupdate viewupdate removeviewfromlist activeview activeview load mode catalog method loads a mode catalog file since j edit 3 2pre2 private static void load mode catalog string path boolean resource log log log message j edit class loading mode catalog file path mode catalog handler handler new mode catalog handler misc utilities get parent of path path resource xml parser parser new xml parser parser set handler handler reader in null try input stream in if resource in j edit class get resource as stream path else in new file input stream path in new buffered reader new input stream reader in parser parse null null in catch xml exception xe int line xe get line string message xe get message log log log error j edit class path line message catch exception e log log log error j edit class e finally try if in null in close catch io exception io log log log error j edit class io loadmodecatalog jedit loadmodecatalog jedit modecataloghandler modecataloghandler miscutilities getparentofpath xmlparser xmlparser sethandler inputstream _in _in jedit getresourceasstream _in fileinputstream bufferedreader inputstreamreader _in xmlexception getline getmessage jedit jedit ioexception jedit init key bindings method loads all key bindings from the properties since 3 1pre1 private static void init key bindings input handler remove all key bindings action set action sets get action sets for int i 0 i action sets length i action sets i init key bindings initkeybindings initkeybindings inputhandler removeallkeybindings actionset actionsets getactionsets actionsets actionsets initkeybindings firewall option pane constructor public firewall option pane super firewall firewalloptionpane firewalloptionpane init method public void init checkbox add component http enabled new j check box j edit get property options firewall http enabled proxy host add component j edit get property options firewall http host http host new j text field j edit get property firewall host 15 proxy port add component j edit get property options firewall http port http port new j text field j edit get property firewall port 15 proxy username add component j edit get property options firewall http user http user new j text field j edit get property firewall user 15 proxy password add component j edit get property options firewall http password http pass new j password field j edit get property firewall password 15 no proxy for add component j edit get property options firewall http non proxy http non proxy new j text field j edit get property firewall non proxy hosts 15 boolean enabled j edit get boolean property firewall enabled http enabled set selected enabled http host set enabled enabled http port set enabled enabled http user set enabled enabled http pass set enabled enabled http non proxy set enabled enabled http enabled add action listener new action handler checkbox add component socks enabled new j check box j edit get property options firewall socks enabled proxy host add component j edit get property options firewall socks host socks host new j text field j edit get property firewall socks host 15 proxy port add component j edit get property options firewall socks port socks port new j text field j edit get property firewall socks port 15 enabled j edit get boolean property firewall socks enabled socks enabled set selected enabled socks host set enabled enabled socks port set enabled enabled socks enabled add action listener new action handler _init _init addcomponent httpenabled jcheckbox jedit getproperty addcomponent jedit getproperty httphost jtextfield jedit getproperty addcomponent jedit getproperty httpport jtextfield jedit getproperty addcomponent jedit getproperty httpuser jtextfield jedit getproperty addcomponent jedit getproperty httppass jpasswordfield jedit getproperty addcomponent jedit getproperty nonproxy httpnonproxy jtextfield jedit getproperty nonproxyhosts jedit getbooleanproperty httpenabled setselected httphost setenabled httpport setenabled httpuser setenabled httppass setenabled httpnonproxy setenabled httpenabled addactionlistener actionhandler addcomponent socksenabled jcheckbox jedit getproperty addcomponent jedit getproperty sockshost jtextfield jedit getproperty addcomponent jedit getproperty socksport jtextfield jedit getproperty jedit getbooleanproperty socksenabled setselected sockshost setenabled socksport setenabled socksenabled addactionlistener actionhandler save method public void save j edit set boolean property firewall enabled http enabled is selected j edit set property firewall host http host get text j edit set property firewall port http port get text j edit set property firewall user http user get text j edit set property firewall password new string http pass get password j edit set property firewall non proxy hosts http non proxy get text j edit set boolean property firewall socks enabled socks enabled is selected j edit set property firewall socks host socks host get text j edit set property firewall socks port socks port get text _save _save jedit setbooleanproperty httpenabled isselected jedit setproperty httphost gettext jedit setproperty httpport gettext jedit setproperty httpuser gettext jedit setproperty httppass getpassword jedit setproperty nonproxyhosts httpnonproxy gettext jedit setbooleanproperty socksenabled isselected jedit setproperty sockshost gettext jedit setproperty socksport gettext public void action performed action event evt http host set enabled http enabled is selected http port set enabled http enabled is selected http user set enabled http enabled is selected http pass set enabled http enabled is selected http non proxy set enabled http enabled is selected socks host set enabled socks enabled is selected socks port set enabled socks enabled is selected actionperformed actionevent httphost setenabled httpenabled isselected httpport setenabled httpenabled isselected httpuser setenabled httpenabled isselected httppass setenabled httpenabled isselected httpnonproxy setenabled httpenabled isselected sockshost setenabled socksenabled isselected socksport setenabled socksenabled isselected class command line reader extends filter reader public command line reader reader in super in commandlinereader filterreader commandlinereader public int read throws io exception int b if state sent semi state last charnl return n skip cr while b in read r if b n if state last charnl b state sent semi else state last charnl else state normal return b ioexception sentsemi lastcharnl lastcharnl sentsemi lastcharnl this is a degenerate implementation i don t know how to keep this from blocking if we try to read more than one char there is no available for readers public int read char buff int off int len throws io exception int b read if b 1 return 1 eof not zero read apparently else buff off char b return 1 ioexception test it public static void main string args throws exception reader in new command line reader new input stream reader system in while true system out println in read commandlinereader inputstreamreader update every time method public boolean update every time return false updateeverytime updateeverytime update method public void update j menu menu vector macro vector macros get macro hierarchy int count menu get menu component count create macros menu menu macro vector 0 if count menu get menu component count j menu item mi new j menu item j edit get property no macros label mi set enabled false menu add mi jmenu macrovector getmacrohierarchy getmenucomponentcount createmacrosmenu macrovector getmenucomponentcount jmenuitem jmenuitem jedit getproperty setenabled create macros menu method private void create macros menu j menu menu vector vector int start vector menu items new vector for int i start i vector size i object obj vector element at i if obj instanceof string menu items add new enhanced menu item j edit get property obj label string obj j edit get action context else if obj instanceof vector vector subvector vector obj string name string subvector element at 0 j menu submenu new j menu name create macros menu submenu subvector 1 if submenu get menu component count 0 menu items add submenu collections sort menu items new misc utilities menu item compare for int i 0 i menu items size i menu add j menu item menu items get i createmacrosmenu createmacrosmenu jmenu menuitems elementat menuitems enhancedmenuitem jedit getproperty jedit getactioncontext elementat jmenu jmenu createmacrosmenu getmenucomponentcount menuitems menuitems miscutilities menuitemcompare menuitems jmenuitem menuitems reload method reloads the buffer from disk asking for confirmation if the buffer has unsaved changes param view the view since j edit 2 7pre2 public void reload view view if get flag dirty string args path int result gui utilities confirm view changedreload args j option pane yes no option j option pane warning message if result j option pane yes option return view get edit pane save caret info load view true jedit getflag guiutilities joptionpane yes_no_option joptionpane warning_message joptionpane yes_option geteditpane savecaretinfo load method loads the buffer from disk even if it is loaded already param view the view param reload if true user will not be asked to recover autosave file if any since 2 5pre1 public boolean load final view view final boolean reload if is performingio gui utilities error view buffer multiple io null return false set boolean property bufferio request error occurred false set flag loading true view text areas temporarily blank out while a buffer is being loaded to indicate to the user that there is no data available yet if get flag temporary edit bus send new buffer update this view buffer update load started final boolean load autosave if reload get flag new file if file null mod time file last modified only on initial load if reload autosave file null autosave file exists load autosave recover autosave view else if autosave file null autosave file delete load autosave false if load autosave vfs vfs vfs manager getvfs for path path if check file for load view vfs path set flag loading false return false have to check again since above might set new file flag if reload get flag new file if vfs load view this path set flag loading false return false else load autosave false do some stuff once loading is finished runnable runnable new runnable public void run string new path get string property bufferio request new path segment seg segment get property bufferio request load data integer array end offsets integer array get property bufferio request end offsets if seg null seg new segment new char 1024 0 0 if end offsets null end offsets new integer array end offsets add 1 try write lock for reload command fire pre content removed 0 0 get line count 1 get length content mgr remove 0 get length line mgr content removed 0 0 get line count 1 get length position mgr content removed 0 get length fire content removed 0 0 get line count 1 get length theoretically a segment could have seg offset 0 but segment buffer never does that content mgr setcontent seg array seg count line mgr contentinserted end offsets position mgr content inserted 0 seg count fire content inserted 0 0 end offsets get size 1 seg count 1 finally write unlock unset property bufferio request load data unset property bufferio request end offsets unset property bufferio request new path undo mgr clear undo mgr set limit j edit get integer property buffer undo count 100 if get flag temporary finish loading set flag loading false if reloading a file clear dirty flag if reload set dirty false if load autosave new path null set path new path if load autosave is false we loaded an autosave file so we set dirty to true note that we don t use set dirty because a that would send an unnecessary message b it would also set the autosave dirty flag which will make the autosave thread write out a redundant autosave file if load autosave set flag dirty true send some edit bus messages if get flag temporary edit bus send new buffer update buffer this view buffer update loaded edit bus send new buffer update buffer this view buffer update markers changed if get flag temporary runnable run else vfs manager run inawt thread runnable return true isperformingio guiutilities setbooleanproperty bufferiorequest error_occurred setflag getflag editbus bufferupdate bufferupdate load_started loadautosave getflag new_file modtime lastmodified autosavefile autosavefile loadautosave recoverautosave autosavefile autosavefile loadautosave loadautosave vfsmanager getvfsforpath checkfileforload setflag new_file getflag new_file setflag loadautosave newpath getstringproperty bufferiorequest new_path getproperty bufferiorequest load_data integerarray endoffsets integerarray getproperty bufferiorequest end_offsets endoffsets endoffsets integerarray endoffsets writelock fireprecontentremoved getlinecount getlength contentmgr getlength linemgr contentremoved getlinecount getlength positionmgr contentremoved getlength firecontentremoved getlinecount getlength segmentbuffer contentmgr _setcontent linemgr _contentinserted endoffsets positionmgr contentinserted firecontentinserted endoffsets getsize writeunlock unsetproperty bufferiorequest load_data unsetproperty bufferiorequest end_offsets unsetproperty bufferiorequest new_path undomgr undomgr setlimit jedit getintegerproperty undocount getflag finishloading setflag setdirty loadautosave newpath setpath newpath loadautosave setdirty autosave_dirty loadautosave setflag editbus getflag editbus bufferupdate bufferupdate editbus bufferupdate bufferupdate markers_changed getflag vfsmanager runinawtthread public void run string new path get string property bufferio request new path segment seg segment get property bufferio request load data integer array end offsets integer array get property bufferio request end offsets if seg null seg new segment new char 1024 0 0 if end offsets null end offsets new integer array end offsets add 1 try write lock for reload command fire pre content removed 0 0 get line count 1 get length content mgr remove 0 get length line mgr content removed 0 0 get line count 1 get length position mgr content removed 0 get length fire content removed 0 0 get line count 1 get length theoretically a segment could have seg offset 0 but segment buffer never does that content mgr setcontent seg array seg count line mgr contentinserted end offsets position mgr content inserted 0 seg count fire content inserted 0 0 end offsets get size 1 seg count 1 finally write unlock unset property bufferio request load data unset property bufferio request end offsets unset property bufferio request new path undo mgr clear undo mgr set limit j edit get integer property buffer undo count 100 if get flag temporary finish loading set flag loading false if reloading a file clear dirty flag if reload set dirty false if load autosave new path null set path new path if load autosave is false we loaded an autosave file so we set dirty to true note that we don t use set dirty because a that would send an unnecessary message b it would also set the autosave dirty flag which will make the autosave thread write out a redundant autosave file if load autosave set flag dirty true send some edit bus messages if get flag temporary edit bus send new buffer update buffer this view buffer update loaded edit bus send new buffer update buffer this view buffer update markers changed newpath getstringproperty bufferiorequest new_path getproperty bufferiorequest load_data integerarray endoffsets integerarray getproperty bufferiorequest end_offsets endoffsets endoffsets integerarray endoffsets writelock fireprecontentremoved getlinecount getlength contentmgr getlength linemgr contentremoved getlinecount getlength positionmgr contentremoved getlength firecontentremoved getlinecount getlength segmentbuffer contentmgr _setcontent linemgr _contentinserted endoffsets positionmgr contentinserted firecontentinserted endoffsets getsize writeunlock unsetproperty bufferiorequest load_data unsetproperty bufferiorequest end_offsets unsetproperty bufferiorequest new_path undomgr undomgr setlimit jedit getintegerproperty undocount getflag finishloading setflag setdirty loadautosave newpath setpath newpath loadautosave setdirty autosave_dirty loadautosave setflag editbus getflag editbus bufferupdate bufferupdate editbus bufferupdate bufferupdate markers_changed insert file method loads a file from disk and inserts it into this buffer param view the view since 4 0pre1 public boolean insert file final view view string path if is performingio gui utilities error view buffer multiple io null return false set boolean property bufferio request error occurred false path misc utilities construct path this path path buffer buffer j edit get buffer path if buffer null view get text area set selected text buffer get text 0 buffer get length return true vfs vfs vfs manager getvfs for path path this returns false if initial sanity checks if the file is a directory etc fail return vfs insert view this path insertfile insertfile isperformingio guiutilities setbooleanproperty bufferiorequest error_occurred miscutilities constructpath jedit getbuffer gettextarea setselectedtext gettext getlength vfsmanager getvfsforpath autosave method autosaves this buffer public void autosave if autosave file null get flag autosave dirty get flag dirty get flag loading get flag io return set flag autosave dirty false vfs manager run in work thread new bufferio request bufferio request autosave null this null vfs manager get filevfs autosave file get path autosavefile getflag autosave_dirty getflag getflag getflag setflag autosave_dirty vfsmanager runinworkthread bufferiorequest bufferiorequest vfsmanager getfilevfs autosavefile getpath save as method prompts the user for a file to save this buffer to param view the view param rename true if the buffer s path should be changed false if only a copy should be saved to the specified filename since j edit 2 6pre5 public boolean save as view view boolean rename string files gui utilities showvfs file dialog view path vfs browser save dialog false files should have length 1 since the dialog type is save dialog if files null return false return save view files 0 rename saveas jedit saveas guiutilities showvfsfiledialog vfsbrowser save_dialog save_dialog save method saves this buffer to the specified path name or the current path name if it s null param view the view param path the path name to save the buffer to or null to use the existing path public boolean save view view string path return save view path true save method saves this buffer to the specified path name or the current path name if it s null param view the view param path the path name to save the buffer to or null to use the existing path param rename true if the buffer s path should be changed false if only a copy should be saved to the specified filename since j edit 2 6pre5 public boolean save final view view string path final boolean rename if is performingio gui utilities error view buffer multiple io null return false set boolean property bufferio request error occurred false if path null get flag new file return save as view rename if path null file null long new mod time file last modified if new mod time mod time j edit get boolean property view check mod status object args this path int result gui utilities confirm view filechanged save args j option pane yes no option j option pane warning message if result j option pane yes option return false edit bus send new buffer update this view buffer update saving set flag io true final string old path this path final string old symlink path this symlink path final string new path path null this path path vfs vfs vfs manager getvfs for path new path if check file for save view vfs new path set flag io false return false if vfs save view this new path set flag io false return false once save is complete do a few other things vfs manager run inawt thread new runnable public void run set flag io false finish saving view old path old symlink path new path rename get boolean property bufferio request error occurred return true jedit isperformingio guiutilities setbooleanproperty bufferiorequest error_occurred getflag new_file saveas newmodtime lastmodified newmodtime modtime jedit getbooleanproperty checkmodstatus guiutilities joptionpane yes_no_option joptionpane warning_message joptionpane yes_option editbus bufferupdate bufferupdate setflag oldpath oldsymlinkpath symlinkpath newpath vfsmanager getvfsforpath newpath checkfileforsave newpath setflag newpath setflag vfsmanager runinawtthread setflag finishsaving oldpath oldsymlinkpath newpath getbooleanproperty bufferiorequest error_occurred public void run set flag io false finish saving view old path old symlink path new path rename get boolean property bufferio request error occurred setflag finishsaving oldpath oldsymlinkpath newpath getbooleanproperty bufferiorequest error_occurred public static final int file deleted 2 check if the buffer has changed on disk return one of code not changed code code changed code or code deleted code since j edit 4 2pre1 public int check file status view view don t do these checks while a save is in progress because for a moment new mod time will be greater than old mod time due to the multithreading only supported on local file system if get flag io get flag loading file null get flag new file boolean new read only file exists file can write if new read only get flag read only set flag read only new read only edit bus send new buffer update this null buffer update dirty changed long old mod time mod time long new mod time file last modified if new mod time old mod time mod time new mod time if file exists set flag new file true set dirty true return file deleted else return file changed return file not changed file_deleted not_changed jedit checkfilestatus newmodtime oldmodtime getflag getflag getflag new_file newreadonly canwrite newreadonly getflag read_only setflag read_only newreadonly editbus bufferupdate bufferupdate dirty_changed oldmodtime modtime newmodtime lastmodified newmodtime oldmodtime modtime newmodtime setflag new_file setdirty file_deleted file_changed file_not_changed get last modified method returns the last time j edit modified the file on disk this method is thread safe public long get last modified return mod time getlastmodified jedit getlastmodified modtime set last modified method sets the last time j edit modified the file on disk param mod time the new modification time public void set last modified long mod time this mod time mod time setlastmodified jedit modtime setlastmodified modtime modtime modtime getvfs method returns the virtual filesystem responsible for loading and saving this buffer this method is thread safe public vfs getvfs return vfs manager getvfs for path path vfsmanager getvfsforpath get autosave file method returns the autosave file for this buffer this may be null if the file is non local public file get autosave file return autosave file getautosavefile getautosavefile autosavefile get name method returns the name of this buffer this method is thread safe public string get name return name getname getname get path method returns the path name of this buffer this method is thread safe public string get path return path getpath getpath get symlink path method if this file is a symbolic link returns the link destination otherwise returns the file s path this method is thread safe since j edit 4 2pre1 public string get symlink path return symlink path getsymlinkpath jedit getsymlinkpath symlinkpath get directory method returns the directory containing this buffer since j edit 4 1pre11 public string get directory return directory getdirectory jedit getdirectory is closed method returns true if this buffer has been closed with link org gjt sp jedit j edit close buffer view buffer this method is thread safe public boolean is closed return get flag closed isclosed jedit closebuffer isclosed getflag is loaded method returns true if the buffer is loaded this method is thread safe public boolean is loaded return get flag loading isloaded isloaded getflag is performingio method returns true if the buffer is currently performing i o this method is thread safe since j edit 2 7pre1 public boolean is performingio return get flag loading get flag io isperformingio jedit isperformingio getflag getflag is new file method returns whether this buffer lacks a corresponding version on disk this method is thread safe public boolean is new file return get flag new file isnewfile isnewfile getflag new_file set new file method sets the new file flag param new file the new file flag public void set new file boolean new file set flag new file new file if new file set flag untitled false setnewfile newfile setnewfile newfile setflag new_file newfile newfile setflag is untitled method returns true if this file is untitled this method is thread safe public boolean is untitled return get flag untitled isuntitled isuntitled getflag is dirty method returns whether there have been unsaved changes to this buffer this method is thread safe public boolean is dirty return get flag dirty isdirty isdirty getflag is read only method returns true if this file is read only false otherwise this method is thread safe public boolean is read only return get flag read only get flag read only override isreadonly isreadonly getflag read_only getflag read_only_override is editable method returns true if this file is editable false otherwise a file may become uneditable if it is read only or if i o is in progress this method is thread safe since j edit 2 7pre1 public boolean is editable return get flag read only get flag read only override get flag io get flag loading iseditable jedit iseditable getflag read_only getflag read_only_override getflag getflag set read only method sets the read only flag param read only the read only flag public void set read only boolean read only set flag read only override read only setreadonly readonly setreadonly readonly setflag read_only_override readonly set dirty method sets the dirty changed since last save flag of this buffer public void set dirty boolean d boolean old d get flag dirty boolean editable is editable if d if editable set flag dirty true set flag autosave dirty true else set flag dirty false set flag autosave dirty false if autosave file null autosave file delete fixes dirty flag not being reset on save insert undo redo undo if get flag undo in progress this ensures that undo can clear the dirty flag properly when all edits up to a save are undone undo mgr buffer saved if d old d editable edit bus send new buffer update this null buffer update dirty changed setdirty setdirty old_d getflag iseditable setflag setflag autosave_dirty setflag setflag autosave_dirty autosavefile autosavefile getflag undo_in_progress undomgr buffersaved old_d editbus bufferupdate bufferupdate dirty_changed is temporary method returns if this is a temporary buffer this method is thread safe see j edit open temporary view string string boolean see j edit commit temporary buffer since j edit 2 2pre7 public boolean is temporary return get flag temporary istemporary jedit opentemporary jedit committemporary jedit istemporary getflag get icon method returns this buffer s icon since j edit 2 6pre6 public icon get icon if get flag dirty return gui utilities load icon dirty gif else if get flag read only get flag read only override return gui utilities load icon readonly gif else if get flag new file return gui utilities load icon new gif else return gui utilities load icon normal gif geticon jedit geticon getflag guiutilities loadicon getflag read_only getflag read_only_override guiutilities loadicon getflag new_file guiutilities loadicon guiutilities loadicon read lock method the buffer is guaranteed not to change between calls to link read lock and link read unlock public void read lock lock read lock readlock readlock readunlock readlock readlock read unlock method the buffer is guaranteed not to change between calls to link read lock and link read unlock public void read unlock lock read unlock readunlock readlock readunlock readunlock readunlock write lock method attempting to obtain read lock will block between calls to link write lock and link write unlock public void write lock lock write lock writelock writelock writeunlock writelock writelock write unlock method attempting to obtain read lock will block between calls to link write lock and link write unlock public void write unlock lock write unlock writeunlock writelock writeunlock writeunlock writeunlock get length method returns the number of characters in the buffer this method is thread safe public int get length no need to lock since this just returns a value and that s it return content mgr get length getlength getlength contentmgr getlength get line count method returns the number of physical lines in the buffer this method is thread safe since j edit 3 1pre1 public int get line count no need to lock since this just returns a value and that s it return line mgr get line count getlinecount jedit getlinecount linemgr getlinecount get line of offset method returns the line containing the specified offset this method is thread safe param offset the offset since j edit 4 0pre1 public int get line of offset int offset try read lock if offset 0 offset get length throw new array index out of bounds exception offset return line mgr get line of offset offset finally read unlock getlineofoffset jedit getlineofoffset readlock getlength arrayindexoutofboundsexception linemgr getlineofoffset readunlock get line start offset method returns the start offset of the specified line this method is thread safe param line the line return the start offset of the specified line since j edit 4 0pre1 public int get line start offset int line try read lock if line 0 line line mgr get line count throw new array index out of bounds exception line else if line 0 return 0 return line mgr get line end offset line 1 finally read unlock getlinestartoffset jedit getlinestartoffset readlock linemgr getlinecount arrayindexoutofboundsexception linemgr getlineendoffset readunlock get line end offset method returns the end offset of the specified line this method is thread safe param line the line return the end offset of the specified line invalid since j edit 4 0pre1 public int get line end offset int line try read lock if line 0 line line mgr get line count throw new array index out of bounds exception line return line mgr get line end offset line finally read unlock getlineendoffset jedit getlineendoffset readlock linemgr getlinecount arrayindexoutofboundsexception linemgr getlineendoffset readunlock get line length method returns the length of the specified line this method is thread safe param line the line since j edit 4 0pre1 public int get line length int line try read lock return get line end offset line get line start offset line 1 finally read unlock getlinelength jedit getlinelength readlock getlineendoffset getlinestartoffset readunlock invalidate cached screen line counts method invalidates all cached screen line count information since j edit 4 2pre7 public void invalidate cached screen line counts line mgr invalidate screen line counts invalidatecachedscreenlinecounts jedit invalidatecachedscreenlinecounts linemgr invalidatescreenlinecounts get line text method returns the text on the specified line this method is thread safe param line the line return the text or null if the line is invalid since j edit 4 0pre1 public string get line text int line if line 0 line line mgr get line count throw new array index out of bounds exception line try read lock int start line 0 0 line mgr get line end offset line 1 int end line mgr get line end offset line return get text start end start 1 finally read unlock getlinetext jedit getlinetext linemgr getlinecount arrayindexoutofboundsexception readlock linemgr getlineendoffset linemgr getlineendoffset gettext readunlock get line text method returns the specified line in a code segment code p using a classname segment classname is generally more efficient than using a classname string classname because it results in less memory allocation and array copying p this method is thread safe param line the line since j edit 4 0pre1 public void get line text int line segment segment if line 0 line line mgr get line count throw new array index out of bounds exception line try read lock int start line 0 0 line mgr get line end offset line 1 int end line mgr get line end offset line get text start end start 1 segment finally read unlock getlinetext jedit getlinetext linemgr getlinecount arrayindexoutofboundsexception readlock linemgr getlineendoffset linemgr getlineendoffset gettext readunlock get text method returns the specified text range this method is thread safe param start the start offset param length the number of characters to get public string get text int start int length try read lock if start 0 length 0 start length content mgr get length throw new array index out of bounds exception start length return content mgr get text start length finally read unlock gettext gettext readlock contentmgr getlength arrayindexoutofboundsexception contentmgr gettext readunlock get text method returns the specified text range in a code segment code p using a classname segment classname is generally more efficient than using a classname string classname because it results in less memory allocation and array copying p this method is thread safe param start the start offset param length the number of characters to get param seg the segment to copy the text to public void get text int start int length segment seg try read lock if start 0 length 0 start length content mgr get length throw new array index out of bounds exception start length content mgr get text start length seg finally read unlock gettext gettext readlock contentmgr getlength arrayindexoutofboundsexception contentmgr gettext readunlock insert method inserts a string into the buffer param offset the offset param str the string since j edit 4 0pre1 public void insert int offset string str if str null return int len str length if len 0 return if is read only throw new runtime exception buffer read only try write lock if offset 0 offset content mgr get length throw new array index out of bounds exception offset content mgr insert offset str integer array clear for int i 0 i len i if str char at i n integer array add i 1 if get flag undo in progress undo mgr content inserted offset len str get flag dirty content inserted offset len integer array finally write unlock jedit isreadonly runtimeexception writelock contentmgr getlength arrayindexoutofboundsexception contentmgr integerarray charat integerarray getflag undo_in_progress undomgr contentinserted getflag contentinserted integerarray writeunlock insert method inserts a string into the buffer param offset the offset param seg the segment since j edit 4 0pre1 public void insert int offset segment seg if seg count 0 return if is read only throw new runtime exception buffer read only try write lock if offset 0 offset content mgr get length throw new array index out of bounds exception offset content mgr insert offset seg integer array clear for int i 0 i seg count i if seg array seg offset i n integer array add i 1 if get flag undo in progress undo mgr content inserted offset seg count seg to string get flag dirty content inserted offset seg count integer array finally write unlock jedit isreadonly runtimeexception writelock contentmgr getlength arrayindexoutofboundsexception contentmgr integerarray integerarray getflag undo_in_progress undomgr contentinserted tostring getflag contentinserted integerarray writeunlock remove method removes the specified rang efrom the buffer param offset the start offset param length the number of characters to remove public void remove int offset int length if length 0 return if is read only throw new runtime exception buffer read only try set flag transaction true write lock if offset 0 length 0 offset length content mgr get length throw new array index out of bounds exception offset length int start line line mgr get line of offset offset int end line line mgr get line of offset offset length int num lines end line start line if get flag undo in progress get flag loading undo mgr content removed offset length get text offset length get flag dirty fire pre content removed start line offset num lines length content mgr remove offset length line mgr content removed start line offset num lines length position mgr content removed offset length fire content removed start line offset num lines length otherwise it will be delivered later if get flag undo in progress inside compound edit fire transaction complete set dirty true finally set flag transaction false write unlock isreadonly runtimeexception setflag writelock contentmgr getlength arrayindexoutofboundsexception startline linemgr getlineofoffset endline linemgr getlineofoffset numlines endline startline getflag undo_in_progress getflag undomgr contentremoved gettext getflag fireprecontentremoved startline numlines contentmgr linemgr contentremoved startline numlines positionmgr contentremoved firecontentremoved startline numlines getflag undo_in_progress insidecompoundedit firetransactioncomplete setdirty setflag writeunlock undo method undoes the most recent edit since j edit 4 0pre1 public void undo j edit text area text area if undo mgr null return if is editable text area get toolkit beep return try write lock set flag undo in progress true int caret undo mgr undo if caret 1 text area get toolkit beep else text area set caret position caret fire transaction complete finally set flag undo in progress false write unlock jedit jedittextarea textarea undomgr iseditable textarea gettoolkit writelock setflag undo_in_progress undomgr textarea gettoolkit textarea setcaretposition firetransactioncomplete setflag undo_in_progress writeunlock redo method redoes the most recently undone edit since j edit 2 7pre2 public void redo j edit text area text area if undo mgr null return if is editable toolkit get default toolkit beep return try write lock set flag undo in progress true int caret undo mgr redo if caret 1 text area get toolkit beep else text area set caret position caret fire transaction complete finally set flag undo in progress false write unlock jedit jedittextarea textarea undomgr iseditable getdefaulttoolkit writelock setflag undo_in_progress undomgr textarea gettoolkit textarea setcaretposition firetransactioncomplete setflag undo_in_progress writeunlock is transaction in progress method returns if an undo or compound edit is currently in progress if this method returns true then eventually a link org gjt sp jedit buffer buffer change listener transaction complete buffer buffer event will get fired since j edit 4 0pre6 public boolean is transaction in progress return get flag transaction get flag undo in progress inside compound edit istransactioninprogress bufferchangelistener transactioncomplete jedit istransactioninprogress getflag getflag undo_in_progress insidecompoundedit begin compound edit method starts a compound edit all edits from now on until link end compound edit are called will be merged into one this can be used to make a complex operation undoable in one step nested calls to link begin compound edit behave as expected requiring the same number of link end compound edit calls to end the edit see end compound edit public void begin compound edit why if get flag temporary return try write lock undo mgr begin compound edit finally write unlock begincompoundedit endcompoundedit begincompoundedit endcompoundedit endcompoundedit begincompoundedit getflag writelock undomgr begincompoundedit writeunlock end compound edit method ends a compound edit all edits performed since link begin compound edit was called can now be undone in one step by calling link undo j edit text area see begin compound edit public void end compound edit why if get flag temporary return try write lock undo mgr end compound edit if inside compound edit fire transaction complete finally write unlock endcompoundedit begincompoundedit jedittextarea begincompoundedit endcompoundedit getflag writelock undomgr endcompoundedit insidecompoundedit firetransactioncomplete writeunlock inside compound edit method returns if a compound edit is currently active since j edit 3 1pre1 public boolean inside compound edit return undo mgr inside compound edit insidecompoundedit jedit insidecompoundedit undomgr insidecompoundedit listener buffer change listener listener int priority this listener listener this priority priority bufferchangelistener add buffer change listener method adds a buffer change listener param listener the listener param priority listeners with high priority get the event before listeners with normal priority since j edit 4 2pre2 public void add buffer change listener buffer change listener listener int priority listener l new listener listener priority for int i 0 i buffer listeners size i listener l listener buffer listeners get i if l priority priority buffer listeners insert element at l i return buffer listeners add element l addbufferchangelistener high_priority normal_priority jedit addbufferchangelistener bufferchangelistener bufferlisteners _l bufferlisteners _l bufferlisteners insertelementat bufferlisteners addelement add buffer change listener method adds a buffer change listener param listener the listener since j edit 4 0pre1 public void add buffer change listener buffer change listener listener add buffer change listener listener normal priority addbufferchangelistener jedit addbufferchangelistener bufferchangelistener addbufferchangelistener normal_priority remove buffer change listener method removes a buffer change listener param listener the listener since j edit 4 0pre1 public void remove buffer change listener buffer change listener listener for int i 0 i buffer listeners size i if listener buffer listeners get i listener listener buffer listeners remove element at i return removebufferchangelistener jedit removebufferchangelistener bufferchangelistener bufferlisteners bufferlisteners bufferlisteners removeelementat get buffer change listeners method returns an array of registered buffer change listeners since j edit 4 1pre3 public buffer change listener get buffer change listeners buffer change listener return value new buffer change listener buffer listeners size for int i 0 i return value length i return value i listener buffer listeners get i listener return return value getbufferchangelisteners jedit bufferchangelistener getbufferchangelisteners bufferchangelistener returnvalue bufferchangelistener bufferlisteners returnvalue returnvalue bufferlisteners returnvalue properties changed method reloads settings from the properties this should be called after the code syntax code or code folding code buffer local properties are changed public void properties changed string folding get string property folding fold handler handler fold handler get fold handler folding if handler null set fold handler handler else if folding null log log log warning this path invalid folding property folding set fold handler new dummy fold handler edit bus send new buffer update this null buffer update properties changed propertieschanged propertieschanged getstringproperty foldhandler foldhandler getfoldhandler setfoldhandler setfoldhandler dummyfoldhandler editbus bufferupdate bufferupdate properties_changed get tab size method returns the tab size used in this buffer this is equivalent to calling code get property tab size code this method is thread safe public int get tab size int tab size get integer property tab size 8 if tab size 0 return 8 else return tab size gettabsize getproperty tabsize gettabsize tabsize getintegerproperty tabsize tabsize tabsize get indent size method returns the indent size used in this buffer this is equivalent to calling code get property indent size code this method is thread safe since j edit 2 7pre1 public int get indent size int indent size get integer property indent size 8 if indent size 0 return 8 else return indent size getindentsize getproperty indentsize jedit getindentsize indentsize getintegerproperty indentsize indentsize indentsize get property method returns the value of a buffer local property p using this method is generally discouraged because it returns an code object code which must be cast to another type in order to be useful and this can cause problems if the object is of a different type than what the caller expects p the following methods should be used instead ul li link get string property string li li link get boolean property string li li link get integer property string int li li link get regexp property string int gnu regexp re syntax li ul this method is thread safe param name the property name for backwards compatibility this is an code object code not a code string code public object get property object name synchronized property lock first try the buffer local properties prop value o prop value properties get name if o null return o value for backwards compatibility if name instanceof string return null now try mode mode property if mode null object ret val mode get property string name if ret val null return null properties put name new prop value ret val true return ret val else now try buffer property string value j edit get property buffer name if value null return null try returning it as an integer first object ret val try ret val new integer value catch number format exception nf ret val value properties put name new prop value ret val true return ret val getproperty getstringproperty getbooleanproperty getintegerproperty getregexpproperty resyntax getproperty propertylock propvalue propvalue retval getproperty retval propvalue retval retval jedit getproperty retval retval numberformatexception retval propvalue retval retval set property method sets the value of a buffer local property param name the property name param value the property value since j edit 4 0pre1 public void set property string name object value if value null properties remove name else prop value test prop value properties get name if test null properties put name new prop value value false else if test value equals value do nothing else test value value test default value false setproperty jedit setproperty propvalue propvalue propvalue defaultvalue unset property method clears the value of a buffer local property param name the property name since j edit 4 0pre1 public void unset property string name properties remove name unsetproperty jedit unsetproperty get string property method returns the value of a string property this method is thread safe param name the property name since j edit 4 0pre1 public string get string property string name object obj get property name if obj null return obj to string else return null getstringproperty jedit getstringproperty getproperty tostring set string property method sets a string property param name the property name param value the value since j edit 4 0pre1 public void set string property string name string value set property name value setstringproperty jedit setstringproperty setproperty get boolean property method returns the value of a boolean property this method is thread safe param name the property name since j edit 4 0pre1 public boolean get boolean property string name object obj get property name if obj instanceof boolean return boolean obj boolean value else if true equals obj on equals obj yes equals obj return true else return false getbooleanproperty jedit getbooleanproperty getproperty booleanvalue set boolean property method sets a boolean property param name the property name param value the value since j edit 4 0pre1 public void set boolean property string name boolean value set property name value boolean true boolean false setbooleanproperty jedit setbooleanproperty setproperty get integer property method returns the value of an integer property this method is thread safe param name the property name since j edit 4 0pre1 public int get integer property string name int default value boolean default value flag object obj prop value value prop value properties get name if value null obj value value default value flag value default value else obj get property name will be cached from now on default value flag true if obj null return default value else if obj instanceof number return number obj int value else try int return value integer parse int obj to string trim properties put name new prop value new integer return value default value flag return return value catch exception e return default value getintegerproperty jedit getintegerproperty defaultvalue defaultvalueflag propvalue propvalue defaultvalueflag defaultvalue getproperty defaultvalueflag defaultvalue intvalue returnvalue parseint tostring propvalue returnvalue defaultvalueflag returnvalue defaultvalue set integer property method sets an integer property param name the property name param value the value since j edit 4 0pre1 public void set integer property string name int value set property name new integer value setintegerproperty jedit setintegerproperty setproperty get regexp property method returns the value of a property as a regular expression this method is thread safe param name the property name param cflags regular expression compilation flags param syntax regular expression syntax since j edit 4 1pre9 public re get regexp property string name int cflags re syntax syntax throws re exception synchronized property lock boolean default value flag object obj prop value value prop value properties get name if value null obj value value default value flag value default value else obj get property name will be cached from now on default value flag true if obj null return null else if obj instanceof re return re obj else re re new re obj to string cflags syntax properties put name new prop value re default value flag return re getregexpproperty jedit getregexpproperty resyntax reexception propertylock defaultvalueflag propvalue propvalue defaultvalueflag defaultvalue getproperty defaultvalueflag tostring propvalue defaultvalueflag get rule set at offset method returns the syntax highlighting ruleset at the specified offset since j edit 4 1pre1 public parser rule set get rule set at offset int offset int line get line of offset offset offset get line start offset line if offset 0 offset default token handler tokens new default token handler mark tokens line tokens token token text utilities get token at offset tokens get tokens offset return token rules getrulesetatoffset jedit parserruleset getrulesetatoffset getlineofoffset getlinestartoffset defaulttokenhandler defaulttokenhandler marktokens textutilities gettokenatoffset gettokens get keyword map at offset method returns the syntax highlighting keyword map in effect at the specified offset used by the b complete word b command to complete keywords param offset the offset since j edit 4 0pre3 public keyword map get keyword map at offset int offset return get rule set at offset offset get keywords getkeywordmapatoffset jedit keywordmap getkeywordmapatoffset getrulesetatoffset getkeywords get context sensitive property method some settings like comment start and end strings can vary between different parts of a buffer html text and inline java script for example param offset the offset param name the property name since j edit 4 0pre3 public string get context sensitive property int offset string name parser rule set rules get rule set at offset offset object value null hashtable ruleset props rules get properties if ruleset props null value ruleset props get name if value null value j edit get mode rules get mode name get property name if value null value mode get property name if value null return null else return string value of value getcontextsensitiveproperty javascript jedit getcontextsensitiveproperty parserruleset getrulesetatoffset rulesetprops getproperties rulesetprops rulesetprops jedit getmode getmodename getproperty getproperty valueof prop value object value boolean default value if value null throw new null pointer exception this value value this default value default value propvalue defaultvalue nullpointerexception defaultvalue defaultvalue for debugging purposes public string to string return value to string tostring tostring toggle word wrap method toggles word wrap between the three available modes this is used by the status bar param view we show a message in the view s status bar since j edit 4 1pre3 public void toggle word wrap view view string wrap get string property wrap if wrap equals none wrap soft else if wrap equals soft wrap hard else if wrap equals hard wrap none view get status set message and clear j edit get property view status wrap changed new string wrap set property wrap wrap properties changed togglewordwrap jedit togglewordwrap getstringproperty getstatus setmessageandclear jedit getproperty setproperty propertieschanged toggle line separator method toggles the line separator between the three available settings this is used by the status bar param view we show a message in the view s status bar since j edit 4 1pre3 public void toggle line separator view view string status null string line sep get string property line separator if n equals line sep status windows line sep r n else if r n equals line sep status mac line sep r else if r equals line sep status unix line sep n view get status set message and clear j edit get property view status linesep changed new string j edit get property line sep status set property line separator line sep set dirty true properties changed togglelineseparator jedit togglelineseparator linesep getstringproperty lineseparator linesep linesep linesep linesep linesep linesep getstatus setmessageandclear jedit getproperty jedit getproperty linesep setproperty lineseparator linesep setdirty propertieschanged get mode method returns this buffer s edit mode this method is thread safe public mode get mode return mode getmode getmode set mode method sets this buffer s edit mode note that calling this before a buffer is loaded will have no effect in that case set the mode property to the name of the mode a bit inelegant i know param mode the mode name since j edit 4 2pre1 public void set mode string mode set mode j edit get mode mode setmode jedit setmode setmode jedit getmode set mode method sets this buffer s edit mode note that calling this before a buffer is loaded will have no effect in that case set the mode property to the name of the mode a bit inelegant i know param mode the mode public void set mode mode mode this protects against stupid people like me doing stuff like buffer set mode j edit get mode if mode null throw new null pointer exception mode must be non null this mode mode text mode text equals mode get name set token marker mode get token marker reset cached properties properties changed setmode setmode setmode jedit getmode nullpointerexception textmode getname settokenmarker gettokenmarker resetcachedproperties propertieschanged set mode method sets this buffer s edit mode by calling the accept method of each registered edit mode public void set mode string user mode get string property mode if user mode null mode m j edit get mode user mode if m null set mode m return string nogz name name substring 0 name length name ends with gz 3 0 mode modes j edit get modes string first line get line text 0 this must be in reverse order so that modes from the user catalog get checked first for int i modes length 1 i 0 i if modes i accept nogz name first line set mode modes i return mode default mode j edit get mode j edit get property buffer default mode if default mode null default mode j edit get mode text set mode default mode setmode setmode usermode getstringproperty usermode jedit getmode usermode setmode nogzname endswith jedit getmodes firstline getlinetext nogzname firstline setmode defaultmode jedit getmode jedit getproperty defaultmode defaultmode defaultmode jedit getmode setmode defaultmode mark tokens method returns the syntax tokens for the specified line param line index the line number param token handler the token handler that will receive the syntax tokens since j edit 4 1pre1 public void mark tokens int line index token handler token handler segment seg if swing utilities is event dispatch thread seg this seg else seg new segment if line index 0 line index line mgr get line count throw new array index out of bounds exception line index int first invalid line context line mgr get first invalid line context int start if text mode first invalid line context 1 start line index else start math min first invalid line context line index if debug token marker debug log log log debug this tokenize from start to line index token marker line context old context null token marker line context context null for int i start i line index i get line text i seg old context line mgr get line context i token marker line context prev context i 0 text mode null line mgr get line context i 1 context token marker mark tokens prev context i line index token handler dummy token handler instance seg line mgr set line context i context int line count line mgr get line count if line count 1 line index line mgr set first invalid line context 1 else if old context context line mgr set first invalid line context line index 1 else if first invalid line context 1 do nothing else line mgr set first invalid line context math max first invalid line context line index 1 marktokens lineindex tokenhandler jedit marktokens lineindex tokenhandler tokenhandler swingutilities iseventdispatchthread lineindex lineindex linemgr getlinecount arrayindexoutofboundsexception lineindex firstinvalidlinecontext linemgr getfirstinvalidlinecontext textmode firstinvalidlinecontext lineindex firstinvalidlinecontext lineindex token_marker_debug lineindex tokenmarker linecontext oldcontext tokenmarker linecontext lineindex getlinetext oldcontext linemgr getlinecontext tokenmarker linecontext prevcontext textmode linemgr getlinecontext tokenmarker marktokens prevcontext lineindex tokenhandler dummytokenhandler linemgr setlinecontext linecount linemgr getlinecount linecount lineindex linemgr setfirstinvalidlinecontext oldcontext linemgr setfirstinvalidlinecontext lineindex firstinvalidlinecontext linemgr setfirstinvalidlinecontext firstinvalidlinecontext lineindex remove trailing white space method removes trailing whitespace from all lines in the specified list param lines the line numbers since j edit 3 2pre1 public void remove trailing white space int lines try begin compound edit for int i 0 i lines length i int pos line start line end tail get line text lines i seg blank line if seg count 0 continue line start seg offset line end seg offset seg count 1 for pos line end pos line start pos if character is whitespace seg array pos break tail line end pos no whitespace if tail 0 continue remove get line end offset lines i 1 tail tail finally end compound edit removetrailingwhitespace jedit removetrailingwhitespace begincompoundedit linestart lineend getlinetext linestart lineend lineend linestart iswhitespace lineend getlineendoffset endcompoundedit shift indent left method shifts the indent of each line in the specified list to the left param lines the line numbers since j edit 3 2pre1 public void shift indent left int lines int tab size get tab size int indent size get indent size boolean no tabs get boolean property no tabs try begin compound edit for int i 0 i lines length i int line start get line start offset lines i string line get line text lines i int white space misc utilities get leading white space line if white space 0 continue int white space width math max 0 misc utilities get leading white space width line tab size indent size insert line start white space misc utilities create white space white space width no tabs 0 tab size remove line start white space finally end compound edit shiftindentleft jedit shiftindentleft tabsize gettabsize indentsize getindentsize notabs getbooleanproperty notabs begincompoundedit linestart getlinestartoffset getlinetext whitespace miscutilities getleadingwhitespace whitespace whitespacewidth miscutilities getleadingwhitespacewidth tabsize indentsize linestart whitespace miscutilities createwhitespace whitespacewidth notabs tabsize linestart whitespace endcompoundedit shift indent right method shifts the indent of each line in the specified list to the right param lines the line numbers since j edit 3 2pre1 public void shift indent right int lines try begin compound edit int tab size get tab size int indent size get indent size boolean no tabs get boolean property no tabs for int i 0 i lines length i int line start get line start offset lines i string line get line text lines i int white space misc utilities get leading white space line silly usability hack if lines length 1 white space 0 continue int white space width misc utilities get leading white space width line tab size indent size insert line start white space misc utilities create white space white space width no tabs 0 tab size remove line start white space finally end compound edit shiftindentright jedit shiftindentright begincompoundedit tabsize gettabsize indentsize getindentsize notabs getbooleanproperty notabs linestart getlinestartoffset getlinetext whitespace miscutilities getleadingwhitespace whitespace whitespacewidth miscutilities getleadingwhitespacewidth tabsize indentsize linestart whitespace miscutilities createwhitespace whitespacewidth notabs tabsize linestart whitespace endcompoundedit indent lines method indents all specified lines param start the first line to indent param end the last line to indent since j edit 3 1pre3 public void indent lines int start int end try begin compound edit for int i start i end i indent line i true finally end compound edit indentlines jedit indentlines begincompoundedit indentline endcompoundedit indent lines method indents all specified lines param lines the line numbers since j edit 3 2pre1 public void indent lines int lines try begin compound edit for int i 0 i lines length i indent line lines i true finally end compound edit indentlines jedit indentlines begincompoundedit indentline endcompoundedit indent line method deprecated use link indent line int boolean instead public boolean indent line int line index boolean can increase indent boolean can decrease indent return indent line line index can decrease indent indentline indentline indentline lineindex canincreaseindent candecreaseindent indentline lineindex candecreaseindent indent line method indents the specified line param line index the line number to indent param can decrease indent if true the indent can be decreased as a result of this set this to false for tab key return true if indentation took place false otherwise since j edit 4 2pre2 public boolean indent line int line index boolean can decrease indent int whitespace chars new int 1 int current indent get current indent for line line index whitespace chars int ideal indent get ideal indent for line line index if ideal indent 1 ideal indent current indent can decrease indent ideal indent current indent return false do it try begin compound edit int start get line start offset line index remove start whitespace chars 0 insert start misc utilities create white space ideal indent get boolean property no tabs 0 get tab size finally end compound edit return true indentline lineindex candecreaseindent jedit indentline lineindex candecreaseindent whitespacechars currentindent getcurrentindentforline lineindex whitespacechars idealindent getidealindentforline lineindex idealindent idealindent currentindent candecreaseindent idealindent currentindent begincompoundedit getlinestartoffset lineindex whitespacechars miscutilities createwhitespace idealindent getbooleanproperty notabs gettabsize endcompoundedit get current indent for line method returns the line s current leading indent param line index the line number param whitespace chars if this is non null the number of whitespace characters is stored at the 0 index since j edit 4 2pre2 public int get current indent for line int line index int whitespace chars get line text line index seg int tab size get tab size int current indent 0 loop for int i 0 i seg count i char c seg array seg offset i switch c case current indent if whitespace chars null whitespace chars 0 break case t current indent tab size current indent tab size if whitespace chars null whitespace chars 0 break default break loop return current indent getcurrentindentforline lineindex whitespacechars jedit getcurrentindentforline lineindex whitespacechars getlinetext lineindex tabsize gettabsize currentindent currentindent whitespacechars whitespacechars currentindent tabsize currentindent tabsize whitespacechars whitespacechars currentindent get ideal indent for line method returns the ideal leading indent for the specified line this will apply the various auto indent rules param line index the line number public int get ideal indent for line int line index final string explicit start final string explicit end if line index 0 return 1 get properties string open brackets get string property indent open brackets if open brackets null open brackets string close brackets get string property indent close brackets if close brackets null close brackets re indent next linere try indent next linere get regexp property indent next line re reg icase re search matcher re syntax jedit catch re exception re indent next linere null log log log error this invalid indent next line regexp log log log error this re re indent next linesre try indent next linesre get regexp property indent next lines re reg icase re search matcher re syntax jedit catch re exception re indent next linesre null log log log error this invalid indent next lines regexp log log log error this re boolean double bracket indent get boolean property double bracket indent boolean line up closing bracket get boolean property line up closing bracket int tab size get tab size int indent size get indent size get indent attributes of previous line int prev line index get prior non empty line line index if prev line index 1 return 1 string prev line get line text prev line index on the previous line if bob 1 if bob 0 else if bob 1 boolean prev line start true false after initial indent int indent 0 indent width tab expanded int prev line brackets 0 additional bracket indent int prev line close bracket index 1 for finding whether we re in this kind of construct if cond1 while cond2 if cond3 so we know to indent the next line under the 1st if int prev line unclosed paren index 1 index of the last unclosed parenthesis int prev line paren weight 0 open parens close parens stack open parens new stack for int i 0 i prev line length i char c prev line char at i switch c case if prev line start indent break case t if prev line start indent tab size indent tab size break default prev line start false if close brackets index of c 1 if prev line region matches false i explicit end 0 3 i 2 else prev line brackets if prev line brackets 0 if line up closing bracket prev line brackets 0 prev line close bracket index i else if open brackets index of c 1 if prev line region matches false i explicit start 0 3 i 2 else prev line brackets else if c open parens push new integer i prev line paren weight else if c if open parens size 0 open parens pop prev line paren weight break if open parens size 0 prev line unclosed paren index integer open parens pop int value if debug indent debug log log log debug this determined previous line log log log debug this indent indent prev line brackets prev line brackets prev line close bracket index prev line close bracket index get indent attributes for current line string line get line text line index on the current line 1 else if bob 1 if bob 0 int line brackets 0 additional bracket indent int close bracket index 1 for lining up closing and opening brackets for int i 0 i line length i char c line char at i if close brackets index of c 1 if line region matches false i explicit end 0 3 i 2 else close bracket index i line brackets else if open brackets index of c 1 if line region matches false i explicit start 0 3 i 2 else if line brackets 0 line brackets if debug indent debug log log log debug this determined current line log log log debug this line brackets line brackets close bracket index close bracket index deep indenting if get boolean property deep indent if prev line paren weight 0 indent prev line unclosed paren index 1 for int i 0 i prev line length i if prev line char at i t indent tab size 1 return indent else if prev line paren weight 0 int open paren offset text utilities find matching bracket this prev line index prev line last index of if open paren offset 0 int start line get line of offset open paren offset int start line paren weight get line paren weight start line if start line paren weight 1 indent get current indent for line start line null else indent get open paren indent start line line index no parenthesis on previous line prev line paren weight 0 so the normal indenting rules are used handle brackets if prev line brackets 0 indent indent size prev line brackets if line up closing bracket if line brackets 0 int open bracket index text utilities find matching bracket this line index close bracket index if open bracket index 1 int open line index get line of offset open bracket index string open line get line text open line index log log log debug this paren weight of open line is get line paren weight open line index if get line paren weight open line index 0 open bracket index text utilities find matching bracket this open line index open line index of log log log debug this open bracket index open bracket index open line get line text get line of offset open bracket index log log log debug this open line open line indent misc utilities get leading white space width open line tab size log log log debug this indent indent else return 1 else if prev line brackets 0 int offset text utilities find matching bracket this prev line index prev line close bracket index if offset 1 string close line get line text get line of offset offset indent misc utilities get leading white space width close line tab size else return 1 handle regexps if line brackets 0 if the previous line matches indent next line or indent next lines add a level of indent if line brackets 0 double bracket indent indent next linesre null indent next linesre is match prev line if debug indent debug log log log debug this matches indent next lines indent indent size else if indent next linere null if line brackets 0 double bracket indent indent next linere is match prev line indent indent size we don t want if foo decreased indent else if prev line brackets 0 while prior lines match indent next line remove a level of indent this correctly handles constructs like if foo if bar if baz put indent here int prev prev line index if prev line close bracket index 1 int offset text utilities find matching bracket this prev line index prev line close bracket index if offset 1 return 1 prev prev line index get line of offset offset else prev prev line index get prior non empty line prev line index while prev prev line index 1 if indent next linere is match get line text prev prev line index indent get current indent for line prev prev line index null else break if debug indent debug log log log debug this prev prev line index matches indent next line prev prev line index get prior non empty line prev prev line index return indent getidealindentforline lineindex getidealindentforline lineindex explicit_start explicit_end lineindex openbrackets getstringproperty indentopenbrackets openbrackets openbrackets closebrackets getstringproperty indentclosebrackets closebrackets closebrackets indentnextlinere indentnextlinere getregexpproperty indentnextline reg_icase researchmatcher re_syntax_jedit reexception indentnextlinere indentnextline indentnextlinesre indentnextlinesre getregexpproperty indentnextlines reg_icase researchmatcher re_syntax_jedit reexception indentnextlinesre indentnextlines doublebracketindent getbooleanproperty doublebracketindent lineupclosingbracket getbooleanproperty lineupclosingbracket tabsize gettabsize indentsize getindentsize prevlineindex getpriornonemptyline lineindex prevlineindex prevline getlinetext prevlineindex prevlinestart prevlinebrackets prevlineclosebracketindex prevlineunclosedparenindex prevlineparenweight openparens closeparens openparens prevline prevline charat prevlinestart prevlinestart tabsize tabsize prevlinestart closebrackets indexof prevline regionmatches explicit_end prevlinebrackets prevlinebrackets lineupclosingbracket prevlinebrackets prevlineclosebracketindex openbrackets indexof prevline regionmatches explicit_start prevlinebrackets openparens prevlineparenweight openparens openparens prevlineparenweight openparens prevlineunclosedparenindex openparens intvalue indent_debug prevlinebrackets prevlinebrackets prevlineclosebracketindex prevlineclosebracketindex getlinetext lineindex linebrackets closebracketindex charat closebrackets indexof regionmatches explicit_end closebracketindex linebrackets openbrackets indexof regionmatches explicit_start linebrackets linebrackets indent_debug linebrackets linebrackets closebracketindex closebracketindex getbooleanproperty deepindent prevlineparenweight prevlineunclosedparenindex prevline prevline charat tabsize prevlineparenweight openparenoffset textutilities findmatchingbracket prevlineindex prevline lastindexof openparenoffset startline getlineofoffset openparenoffset startlineparenweight getlineparenweight startline startlineparenweight getcurrentindentforline startline getopenparenindent startline lineindex prevlineparenweight prevlinebrackets indentsize prevlinebrackets lineupclosingbracket linebrackets openbracketindex textutilities findmatchingbracket lineindex closebracketindex openbracketindex openlineindex getlineofoffset openbracketindex openline getlinetext openlineindex parenweight openline getlineparenweight openlineindex getlineparenweight openlineindex openbracketindex textutilities findmatchingbracket openlineindex openline indexof openbracketindex openbracketindex openline getlinetext getlineofoffset openbracketindex openline openline miscutilities getleadingwhitespacewidth openline tabsize prevlinebrackets textutilities findmatchingbracket prevlineindex prevlineclosebracketindex closeline getlinetext getlineofoffset miscutilities getleadingwhitespacewidth closeline tabsize linebrackets indentnextline indentnextlines linebrackets doublebracketindent indentnextlinesre indentnextlinesre ismatch prevline indent_debug indentnextlines indentsize indentnextlinere linebrackets doublebracketindent indentnextlinere ismatch prevline indentsize prevlinebrackets indentnextline prevprevlineindex prevlineclosebracketindex textutilities findmatchingbracket prevlineindex prevlineclosebracketindex prevprevlineindex getlineofoffset prevprevlineindex getpriornonemptyline prevlineindex prevprevlineindex indentnextlinere ismatch getlinetext prevprevlineindex getcurrentindentforline prevprevlineindex indent_debug prevprevlineindex indentnextline prevprevlineindex getpriornonemptyline prevprevlineindex get line paren weight method returns the number of open parenthesis minus the number of close parenthesis param line the line number since j edit 4 2pre9 private int get line paren weight int line string line text get line text line int paren weight 0 for int i 0 i line text length i char c line text char at i switch c case paren weight break case paren weight break default return paren weight getlineparenweight jedit getlineparenweight linetext getlinetext parenweight linetext linetext charat parenweight parenweight parenweight get open paren indent method returns the appropriate indent based on open parenthesis on previous lines param start line the line where parens were last balanced param target line the line we re finding the indent for private int get open paren indent int start line int target line stack open parens new stack string line text for int line index start line line index target line line index line text get line text line index for int i 0 i line text length i char c line text char at i switch c case open parens push new integer i break case if open parens size 0 open parens pop break default int indent get current indent for line start line null if open parens size 0 indent integer open parens pop int value return indent getopenparenindent startline targetline getopenparenindent startline targetline openparens linetext lineindex startline lineindex targetline lineindex linetext getlinetext lineindex linetext linetext charat openparens openparens openparens getcurrentindentforline startline openparens openparens intvalue get virtual width method returns the virtual column number taking tabs into account of the specified position param line the line number param column the column number since j edit 4 1pre1 public int get virtual width int line int column try read lock int start get line start offset line get text start column seg return misc utilities get virtual width seg get tab size finally read unlock getvirtualwidth jedit getvirtualwidth readlock getlinestartoffset gettext miscutilities getvirtualwidth gettabsize readunlock get offset of virtual column method returns the offset of a virtual column number taking tabs into account relative to the start of the line in question param line the line number param column the virtual column number param total virtual width if this array is non null the total virtual width will be stored in its first location if this method returns 1 return 1 if the column is out of bounds since j edit 4 1pre1 public int get offset of virtual column int line int column int total virtual width try read lock get line text line seg return misc utilities get offset of virtual column seg get tab size column total virtual width finally read unlock getoffsetofvirtualcolumn totalvirtualwidth jedit getoffsetofvirtualcolumn totalvirtualwidth readlock getlinetext miscutilities getoffsetofvirtualcolumn gettabsize totalvirtualwidth readunlock insert at column method like the link insert int string method but inserts the string at the specified virtual column inserts spaces as appropriate if the line is shorter than the column param line the line number param col the virtual column number param str the string public void insert at column int line int col string str try write lock int total new int 1 int offset get offset of virtual column line col total if offset 1 offset get line end offset line 1 str misc utilities create white space col total 0 0 str else offset get line start offset line insert offset str finally write unlock insertatcolumn insertatcolumn writelock getoffsetofvirtualcolumn getlineendoffset miscutilities createwhitespace getlinestartoffset writeunlock insert indented method inserts a string into the buffer indenting each line of the string to match the indent of the first line param offset the offset param text the text return the number of characters of indent inserted on each new line this is used by the abbreviations code since j edit 4 2pre14 public int insert indented int offset string text try begin compound edit obtain the leading indent for later use int first line get line of offset offset string line text get line text first line int leading indent misc utilities get leading white space width line text get tab size string white space misc utilities create white space leading indent get boolean property no tabs 0 get tab size insert offset text int last line get line of offset offset text length note that if first line last line loop does not execute for int i first line 1 i last line i insert get line start offset i white space return white space length finally end compound edit insertindented jedit insertindented begincompoundedit firstline getlineofoffset linetext getlinetext firstline leadingindent miscutilities getleadingwhitespacewidth linetext gettabsize whitespace miscutilities createwhitespace leadingindent getbooleanproperty notabs gettabsize lastline getlineofoffset firstline lastline firstline lastline getlinestartoffset whitespace whitespace endcompoundedit put property method deprecated call code set property code instead public void put property object name object value for backwards compatibility if name instanceof string return set property string name value putproperty setproperty putproperty setproperty put boolean property method deprecated call code set boolean property code instead public void put boolean property string name boolean value set boolean property name value putbooleanproperty setbooleanproperty putbooleanproperty setbooleanproperty public static class token list extends default token handler public token get first token return get tokens tokenlist defaulttokenhandler getfirsttoken gettokens deprecated use the other form of code mark tokens code instead public token list mark tokens int line index token list list new token list mark tokens line index list return list marktokens tokenlist marktokens lineindex tokenlist tokenlist marktokens lineindex get root elements method deprecated public element get root elements return new element get default root element getrootelements getrootelements getdefaultrootelement get paragraph element method deprecated public element get paragraph element int offset return new line element this get line of offset offset getparagraphelement getparagraphelement lineelement getlineofoffset get default root element method deprecated use code get line of offset code code get line start offset code and code get line end offset code instead public element get default root element return new root element this getdefaultrootelement getlineofoffset getlinestartoffset getlineendoffset getdefaultrootelement rootelement insert string method deprecated call code insert code instead public void insert string int offset string str attribute set attr insert offset str insertstring insertstring attributeset get file method deprecated do not call this method use link get path instead public file get file return file getfile getpath getfile get current ident for line method deprecated use the correctly spelled get current indent for line instead public int get current ident for line int line index int whitespace chars return get current indent for line line index whitespace chars getcurrentidentforline getcurrentindentforline getcurrentidentforline lineindex whitespacechars getcurrentindentforline lineindex whitespacechars is fold start method returns if the specified line begins a fold since j edit 3 1pre1 public boolean is fold start int line return line get line count 1 get fold level line get fold level line 1 isfoldstart jedit isfoldstart getlinecount getfoldlevel getfoldlevel is fold end method returns if the specified line ends a fold since j edit 4 2pre5 public boolean is fold end int line return line get line count 1 get fold level line get fold level line 1 isfoldend jedit isfoldend getlinecount getfoldlevel getfoldlevel invalidate cached fold levels method invalidates all cached fold level information since j edit 4 1pre11 public void invalidate cached fold levels line mgr set first invalid fold level 0 fire fold level changed 0 get line count invalidatecachedfoldlevels jedit invalidatecachedfoldlevels linemgr setfirstinvalidfoldlevel firefoldlevelchanged getlinecount get fold level method returns the fold level of the specified line param line a physical line index since j edit 3 1pre1 public int get fold level int line if line 0 line line mgr get line count throw new array index out of bounds exception line if fold handler instanceof dummy fold handler return 0 int first invalid fold level line mgr get first invalid fold level if first invalid fold level 1 line first invalid fold level return line mgr get fold level line else if debug fold debug log log log debug this invalid fold levels from first invalid fold level to line int new fold level 0 boolean changed false for int i first invalid fold level i line i new fold level fold handler get fold level this i seg if new fold level line mgr get fold level i if debug fold debug log log log debug this i fold level changed changed true line mgr set fold level i new fold level if line line mgr get line count 1 line mgr set first invalid fold level 1 else line mgr set first invalid fold level line 1 if changed if debug fold debug log log log debug this fold level changed first invalid fold level line fire fold level changed first invalid fold level line return new fold level getfoldlevel jedit getfoldlevel linemgr getlinecount arrayindexoutofboundsexception foldhandler dummyfoldhandler firstinvalidfoldlevel linemgr getfirstinvalidfoldlevel firstinvalidfoldlevel firstinvalidfoldlevel linemgr getfoldlevel fold_debug firstinvalidfoldlevel newfoldlevel firstinvalidfoldlevel newfoldlevel foldhandler getfoldlevel newfoldlevel linemgr getfoldlevel fold_debug linemgr setfoldlevel newfoldlevel linemgr getlinecount linemgr setfirstinvalidfoldlevel linemgr setfirstinvalidfoldlevel fold_debug firstinvalidfoldlevel firefoldlevelchanged firstinvalidfoldlevel newfoldlevel get fold at line method returns an array the first element is the start line the second element is the end line of the fold containing the specified line number param line the line number since j edit 4 0pre3 public int get fold at line int line int start end if is fold start line start line int fold level get fold level line line while get fold level line fold level line if line get line count break end line 1 else start line int fold level get fold level line while get fold level start fold level if start 0 break else start end line while get fold level end fold level end if end get line count break end while get line length end 0 end start end return new int start end getfoldatline jedit getfoldatline isfoldstart foldlevel getfoldlevel getfoldlevel foldlevel getlinecount foldlevel getfoldlevel getfoldlevel foldlevel getfoldlevel foldlevel getlinecount getlinelength get fold handler method returns the current buffer s fold handler since j edit 4 2pre1 public fold handler get fold handler return fold handler getfoldhandler jedit foldhandler getfoldhandler foldhandler set fold handler method sets the buffer s fold handler since j edit 4 2pre2 public void set fold handler fold handler fold handler fold handler old fold handler this fold handler if fold handler equals old fold handler return this fold handler fold handler line mgr set first invalid fold level 0 fire fold handler changed setfoldhandler jedit setfoldhandler foldhandler foldhandler foldhandler oldfoldhandler foldhandler foldhandler oldfoldhandler foldhandler foldhandler linemgr setfirstinvalidfoldlevel firefoldhandlerchanged create position method creates a floating position param offset the offset public position create position int offset try read lock if offset 0 offset content mgr get length throw new array index out of bounds exception offset return position mgr create position offset finally read unlock createposition createposition readlock contentmgr getlength arrayindexoutofboundsexception positionmgr createposition readunlock get markers method returns a vector of markers since j edit 3 2pre1 public vector get markers return markers getmarkers jedit getmarkers get marker status prompt method returns the status prompt for the given marker action only intended to be called from code actions xml code since j edit 4 2pre2 public string get marker status prompt string action return j edit get property view status action new string get marker name string getmarkerstatusprompt jedit getmarkerstatusprompt jedit getproperty getmarkernamestring get marker name string method returns a string of all set markers used by the status bar eg a b since j edit 4 2pre2 public string get marker name string string buffer buf new string buffer for int i 0 i markers size i marker marker marker markers element at i if marker get shortcut 0 if buf length 0 buf append buf append marker get shortcut if buf length 0 return j edit get property view status no markers else return buf to string getmarkernamestring jedit getmarkernamestring stringbuffer stringbuffer elementat getshortcut getshortcut jedit getproperty tostring add or remove marker method if a marker is set on the line of the position it is removed otherwise a new marker with the specified shortcut is added param pos the position of the marker param shortcut the shortcut 0 if none since j edit 3 2pre5 public void add or remove marker char shortcut int pos int line get line of offset pos if get marker at line line null remove marker line else add marker shortcut pos addorremovemarker jedit addorremovemarker getlineofoffset getmarkeratline removemarker addmarker add marker method adds a marker to this buffer param pos the position of the marker param shortcut the shortcut 0 if none since j edit 3 2pre1 public void add marker char shortcut int pos marker markern new marker this shortcut pos boolean added false don t sort markers while buffer is being loaded if get flag loading if j edit get boolean property persistent markers set dirty true markern create position for int i 0 i markers size i marker marker marker markers element at i if shortcut 0 marker get shortcut shortcut marker set shortcut 0 if marker get position pos markers remove element at i i for int i 0 i markers size i marker marker marker markers element at i if marker get position pos markers insert element at markern i added true break if added markers add element markern if get flag loading get flag temporary edit bus send new buffer update this null buffer update markers changed addmarker jedit addmarker getflag jedit getbooleanproperty persistentmarkers setdirty createposition elementat getshortcut setshortcut getposition removeelementat elementat getposition insertelementat addelement getflag getflag editbus bufferupdate bufferupdate markers_changed get marker in range method returns the first marker within the specified range param start the start offset param end the end offset since j edit 4 0pre4 public marker get marker in range int start int end for int i 0 i markers size i marker marker marker markers element at i int pos marker get position if pos start pos end return marker return null getmarkerinrange jedit getmarkerinrange elementat getposition get marker at line method returns the first marker at the specified line or code null code if there is none param line the line number since j edit 3 2pre2 public marker get marker at line int line for int i 0 i markers size i marker marker marker markers element at i if get line of offset marker get position line return marker return null getmarkeratline jedit getmarkeratline elementat getlineofoffset getposition remove marker method removes all markers at the specified line param line the line number since j edit 3 2pre2 public void remove marker int line for int i 0 i markers size i marker marker marker markers element at i if get line of offset marker get position line if j edit get boolean property persistent markers set dirty true marker remove position markers remove element at i i edit bus send new buffer update this null buffer update markers changed removemarker jedit removemarker elementat getlineofoffset getposition jedit getbooleanproperty persistentmarkers setdirty removeposition removeelementat editbus bufferupdate bufferupdate markers_changed remove all markers method removes all defined markers since j edit 2 6pre1 public void remove all markers if j edit get boolean property persistent markers set dirty true for int i 0 i markers size i marker markers element at i remove position markers remove all elements if get flag loading edit bus send new buffer update this null buffer update markers changed removeallmarkers jedit removeallmarkers jedit getbooleanproperty persistentmarkers setdirty elementat removeposition removeallelements getflag editbus bufferupdate bufferupdate markers_changed get marker method returns the marker with the specified shortcut param shortcut the shortcut since j edit 3 2pre2 public marker get marker char shortcut enumeration e markers elements while e has more elements marker marker marker e next element if marker get shortcut shortcut return marker return null getmarker jedit getmarker hasmoreelements nextelement getshortcut set wait socket method this socket is closed when the buffer is closed public void set wait socket socket wait socket this wait socket wait socket setwaitsocket setwaitsocket waitsocket waitsocket waitsocket get next method returns the next buffer in the list public buffer get next return next getnext getnext get prev method returns the previous buffer in the list public buffer get prev return prev getprev getprev get index method returns the position of this buffer in the buffer list public int get index int count 0 buffer buffer prev for if buffer null break count buffer buffer prev return count getindex getindex to string method returns a string representation of this buffer this simply returns the path name public string to string return name directory tostring tostring getlinemanager method plugins and macros should not call this method since j edit 4 2pre3 public line manager getlinemanager return line mgr _getlinemanager jedit linemanager _getlinemanager linemgr buffer constructor buffer string path boolean new file boolean temp hashtable props lock new read write lock property lock new object content mgr new content manager line mgr new line manager position mgr new position manager integer array new integer array undo mgr new undo manager this buffer listeners new vector seg new segment markers new vector properties new hash map need to convert entries of props to prop value instances enumeration e props keys while e has more elements object key e next element object value props get key properties put key new prop value value false fill in defaults for these from system properties if the corresponding buffer xxx properties not set if get property encoding null properties put encoding new prop value system get property file encoding false if get property linesep null properties put linesep new prop value system get property line separator false set flag temporary temp this must be called before any edit bus messages are sent set path path magic untitled is only set if new file param to constructor is set new file is also set if file doesn t exist on disk this is so that we can tell apart files created with j edit new file and those that just don t exist on disk why do we need to tell the difference between the two j edit add buffer to list checks if the only opened buffer is an untitled buffer and if so replaces it with the buffer to add we don t want this behavior to occur with files that don t exist on disk only untitled ones set flag untitled new file set flag new file new file newfile readwritelock propertylock contentmgr contentmanager linemgr linemanager positionmgr positionmanager integerarray integerarray undomgr undomanager bufferlisteners hashmap propvalue hasmoreelements nextelement propvalue getproperty propvalue getproperty getproperty propvalue getproperty setflag editbus setpath newfile new_file jedit newfile jedit addbuffertolist setflag newfile setflag new_file newfile commit temporary method void commit temporary set flag temporary false finish loading committemporary committemporary setflag finishloading reset cached properties method void reset cached properties need to reset properties that were cached defaults since the defaults might have changed iterator iter properties values iterator while iter has next prop value value prop value iter next if value default value iter remove resetcachedproperties resetcachedproperties hasnext propvalue propvalue defaultvalue close method void close set flag closed true if autosave file null autosave file delete notify clients with wait if wait socket null try wait socket get output stream write 0 wait socket get output stream flush wait socket get input stream close wait socket get output stream close wait socket close catch io exception io log log log error this io setflag autosavefile autosavefile waitsocket waitsocket getoutputstream waitsocket getoutputstream waitsocket getinputstream waitsocket getoutputstream waitsocket ioexception set flag method private void set flag int flag boolean value if value flags 1 flag else flags 1 flag setflag setflag get flag method private boolean get flag int flag int mask 1 flag return flags mask mask getflag getflag set path method private void set path string path this path path vfs vfs vfs manager getvfs for path path if vfs get capabilities vfs write cap 0 set flag read only true this name vfs get file name path this directory vfs get parent of path path if vfs instanceof filevfs file new file path symlink path misc utilities resolve symlinks path if we don t do this the autosave file won t be deleted after a save as if autosave file null autosave file delete autosave file new file file get parent name else i wonder if the lack of this broke anything in the past file null autosave file null symlink path path setpath setpath vfsmanager getvfsforpath getcapabilities write_cap setflag read_only getfilename getparentofpath symlinkpath miscutilities resolvesymlinks autosavefile autosavefile autosavefile getparent autosavefile symlinkpath recover autosave method private boolean recover autosave final view view if autosave file can read return false this method might get called at startup gui utilities hide splash screen final object args autosave file get path int result gui utilities confirm view autosave found args j option pane yes no option j option pane warning message if result j option pane yes option vfs manager get filevfs load view this autosave file get path show this message when all i o requests are complete vfs manager run inawt thread new runnable public void run gui utilities message view autosave loaded args return true else return false recoverautosave recoverautosave autosavefile canread guiutilities hidesplashscreen autosavefile getpath guiutilities joptionpane yes_no_option joptionpane warning_message joptionpane yes_option vfsmanager getfilevfs autosavefile getpath vfsmanager runinawtthread guiutilities vfs manager run inawt thread new runnable public void run gui utilities message view autosave loaded args vfsmanager runinawtthread guiutilities check file for load method private boolean check file for load view view vfs vfs string path if vfs get capabilities vfs low latency cap 0 object session vfs createvfs session path view if session null return false try vfs directory entry file vfs getdirectoryentry session path view if file null set new file true return true if file can read vfs manager error view path ioerror no read null set new file false return false set flag read only file can write if file type vfs directory entry file vfs manager error view path ioerror open directory null set new file false return false catch io exception io vfs manager error view path ioerror new string io to string return false finally try vfs endvfssession session view catch io exception io vfs manager error view path ioerror new string io to string return false return true checkfileforload checkfileforload getcapabilities low_latency_cap createvfssession directoryentry _getdirectoryentry setnewfile canread vfsmanager setnewfile setflag read_only canwrite directoryentry vfsmanager setnewfile ioexception vfsmanager tostring _endvfssession ioexception vfsmanager tostring check file for save method private boolean check file for save view view vfs vfs string path if vfs get capabilities vfs low latency cap 0 object session vfs createvfs session path view if session null return false try vfs directory entry file vfs getdirectoryentry session path view if file null return true if file type vfs directory entry file vfs manager error view path ioerror save directory null return false catch io exception io vfs manager error view path ioerror new string io to string return false finally try vfs endvfssession session view catch io exception io vfs manager error view path ioerror new string io to string return false return true checkfileforsave checkfileforsave getcapabilities low_latency_cap createvfssession directoryentry _getdirectoryentry directoryentry vfsmanager ioexception vfsmanager tostring _endvfssession ioexception vfsmanager tostring finish loading method private void finish loading parse buffer local properties aha this is probably the only way to fix this fold handler old fold handler fold handler set mode if fold handler old fold handler on a reload the fold handler doesn t change but we still need to re collapse folds don t do this on initial fold handler creation line mgr set first invalid fold level 0 fire fold handler changed create marker positions for int i 0 i markers size i marker marker marker markers element at i marker remove position int pos marker get position if pos get length marker set position get length else if pos 0 marker set position 0 marker create position finishloading finishloading parsebufferlocalproperties foldhandler oldfoldhandler foldhandler setmode foldhandler oldfoldhandler linemgr setfirstinvalidfoldlevel firefoldhandlerchanged elementat removeposition getposition getlength setposition getlength setposition createposition finish saving method private void finish saving view view string old path string old symlink path string path boolean rename boolean error set the buffer s path caveat won t work if save called with a relative path but i don t think anyone calls it like that anyway if error path equals old path buffer buffer j edit get buffer path if rename if we save a file with the same name as one that s already open we presume that we can close the existing file since the user would have confirmed the overwrite in the save as dialog box anyway if buffer null can t happen buffer get path equals old path buffer set dirty false j edit close buffer view buffer set path path else if we saved over an already open file using save a copy as then reload the existing buffer if buffer null can t happen buffer get path equals old path buffer load view true update this buffer for the new path if rename if file null mod time file last modified if error we do a write lock so that the autosave which grabs a read lock is not executed between the deletion of the autosave file and clearing of the dirty flag try write lock if autosave file null autosave file delete set flag autosave dirty false set flag read only false set flag new file false set flag untitled false set flag dirty false this ensures that undo can clear the dirty flag properly when all edits up to a save are undone undo mgr buffer saved finally write unlock parse buffer local properties if get path equals old path j edit update position old symlink path this set mode else if user adds mode buffer local property string new mode get string property mode if new mode null new mode equals get mode get name set mode else properties changed edit bus send new buffer update buffer this view buffer update dirty changed new message type introduced in 4 0pre4 edit bus send new buffer update buffer this view buffer update saved finishsaving finishsaving oldpath oldsymlinkpath oldpath jedit getbuffer getpath oldpath setdirty jedit closebuffer setpath getpath oldpath modtime lastmodified writelock autosavefile autosavefile setflag autosave_dirty setflag read_only setflag new_file setflag setflag undomgr buffersaved writeunlock parsebufferlocalproperties getpath oldpath jedit updateposition oldsymlinkpath setmode newmode getstringproperty newmode newmode getmode getname setmode propertieschanged editbus bufferupdate bufferupdate dirty_changed editbus bufferupdate bufferupdate parse buffer local properties method private void parse buffer local properties int last line math min 9 get line count 1 parse buffer local properties get text 0 get line end offset last line 1 first line for last 10 lines make sure not to overlap with the first 10 int first line math max last line 1 get line count 10 if first line get line count int length get line end offset get line count 1 get line start offset first line 1 parse buffer local properties get text get line start offset first line length parsebufferlocalproperties parsebufferlocalproperties lastline getlinecount parsebufferlocalproperties gettext getlineendoffset lastline firstline lastline getlinecount firstline getlinecount getlineendoffset getlinecount getlinestartoffset firstline parsebufferlocalproperties gettext getlinestartoffset firstline parse buffer local properties method private void parse buffer local properties string prop string buffer buf new string buffer string name null boolean escape false for int i 0 i prop length i char c prop char at i switch c case if escape escape false buf append break if name null use the low level property setting code so that if we have a buffer local property with the same value as a default later changes in the default don t affect the buffer local property properties put name new prop value buf to string false name null buf set length 0 break case if escape escape false buf append break name buf to string buf set length 0 break case if escape buf append escape escape break case n if escape buf append n escape false break case r if escape buf append r escape false break case t if escape buf append t escape false break default buf append c break parsebufferlocalproperties parsebufferlocalproperties stringbuffer stringbuffer charat propvalue tostring setlength tostring setlength set token marker method private void set token marker token marker token marker token marker old token marker this token marker this token marker token marker don t do this on initial token marker if old token marker null token marker old token marker line mgr set first invalid line context 0 settokenmarker settokenmarker tokenmarker tokenmarker tokenmarker oldtokenmarker tokenmarker tokenmarker tokenmarker oldtokenmarker tokenmarker oldtokenmarker linemgr setfirstinvalidlinecontext get prior non empty line method auto indent needs this private int get prior non empty line int line index int return value 1 for int i line index 1 i 0 i get line text i seg if seg count 0 return value i for int j 0 j seg count j char ch seg array seg offset j if character is whitespace ch return i didn t find a line that contains non whitespace chars so return index of prior whitespace line return return value getpriornonemptyline getpriornonemptyline lineindex returnvalue lineindex getlinetext returnvalue iswhitespace returnvalue content inserted method private void content inserted int offset int length integer array end offsets try set flag transaction true int start line line mgr get line of offset offset int num lines end offsets get size line mgr content inserted start line offset num lines length end offsets position mgr content inserted offset length set dirty true if get flag loading fire content inserted start line offset num lines length if get flag undo in progress inside compound edit fire transaction complete finally set flag transaction false contentinserted contentinserted integerarray endoffsets setflag startline linemgr getlineofoffset numlines endoffsets getsize linemgr contentinserted startline numlines endoffsets positionmgr contentinserted setdirty getflag firecontentinserted startline numlines getflag undo_in_progress insidecompoundedit firetransactioncomplete setflag get listener method private buffer change listener get listener int index return listener buffer listeners element at index listener getlistener bufferchangelistener getlistener bufferlisteners elementat fire fold level changed method private void fire fold level changed int start int end for int i 0 i buffer listeners size i try get listener i fold level changed this start end catch throwable t log log log error this exception while sending buffer event to get listener i log log log error this t firefoldlevelchanged firefoldlevelchanged bufferlisteners getlistener foldlevelchanged getlistener fire content inserted method private void fire content inserted int start line int offset int num lines int length for int i 0 i buffer listeners size i try get listener i content inserted this start line offset num lines length catch throwable t log log log error this exception while sending buffer event to get listener i log log log error this t firecontentinserted firecontentinserted startline numlines bufferlisteners getlistener contentinserted startline numlines getlistener fire content removed method private void fire content removed int start line int offset int num lines int length for int i 0 i buffer listeners size i try get listener i content removed this start line offset num lines length catch throwable t log log log error this exception while sending buffer event to get listener i log log log error this t firecontentremoved firecontentremoved startline numlines bufferlisteners getlistener contentremoved startline numlines getlistener fire pre content removed method private void fire pre content removed int start line int offset int num lines int length for int i 0 i buffer listeners size i try get listener i pre content removed this start line offset num lines length catch throwable t log log log error this exception while sending buffer event to get listener i log log log error this t fireprecontentremoved fireprecontentremoved startline numlines bufferlisteners getlistener precontentremoved startline numlines getlistener fire transaction complete method private void fire transaction complete for int i 0 i buffer listeners size i try get listener i transaction complete this catch throwable t log log log error this exception while sending buffer event to get listener i log log log error this t firetransactioncomplete firetransactioncomplete bufferlisteners getlistener transactioncomplete getlistener fire fold handler changed method private void fire fold handler changed for int i 0 i buffer listeners size i try get listener i fold handler changed this catch throwable t log log log error this exception while sending buffer event to get listener i log log log error this t firefoldhandlerchanged firefoldhandlerchanged bufferlisteners getlistener foldhandlerchanged getlistener get search dialog method public static search dialog get search dialog view view if debug disable search dialog pool return new search dialog view else return search dialog view hash get view getsearchdialog searchdialog getsearchdialog disable_search_dialog_pool searchdialog searchdialog viewhash preload search dialog method preloads the search dialog for the given for so that it can be quickly displayed later since j edit 4 2pre3 public static void preload search dialog view view if debug disable search dialog pool return search dialog dialog new search dialog view view hash put view dialog preloadsearchdialog jedit preloadsearchdialog disable_search_dialog_pool searchdialog searchdialog viewhash show search dialog method displays a search and replace dialog box reusing an existing one if necessary param view the view param search string the search string param search in one of current buffer all buffers or directory since j edit 4 0pre6 public static void show search dialog view view string search string int search in search dialog dialog get search dialog view dialog set search string search string search in gui utilities request focus dialog dialog find ugly workaround if operating system is unix operating system is macos dialog set visible false dialog set visible true dialog to front dialog request focus showsearchdialog searchstring searchin current_buffer all_buffers jedit showsearchdialog searchstring searchin searchdialog getsearchdialog setsearchstring searchstring searchin guiutilities requestfocus operatingsystem isunix operatingsystem ismacos setvisible setvisible tofront requestfocus set search string method sets the search string since j edit 4 0pre5 public void set search string string search string int search in find set text null replace set text null if search string null search current buffer set selected true else if search string index of n 1 find set text search string find select all search current buffer set selected true else if search in current buffer search selection set selected true hyper search set selected true if search in current buffer if search selection is selected might be already selected see above search current buffer set selected true this property is only loaded and saved if the current buffer file set is selected otherwise it defaults to on hyper search set selected j edit get boolean property search hypersearch toggle else if search in all buffers search all buffers set selected true hyper search set selected true else if search in directory search file set fileset search and replace get search file set if fileset instanceof directory list set filter set text directory list set fileset get file filter directory set text directory list set fileset get directory search sub directories set selected directory list set fileset is recursive hyper search set selected true search directory set selected true update enabled setsearchstring jedit setsearchstring searchstring searchin settext settext searchstring searchcurrentbuffer setselected searchstring indexof settext searchstring selectall searchcurrentbuffer setselected searchin current_buffer searchselection setselected hypersearch setselected searchin current_buffer searchselection isselected searchcurrentbuffer setselected hypersearch setselected jedit getbooleanproperty searchin all_buffers searchallbuffers setselected hypersearch setselected searchin searchfileset searchandreplace getsearchfileset directorylistset settext directorylistset getfilefilter settext directorylistset getdirectory searchsubdirectories setselected directorylistset isrecursive hypersearch setselected searchdirectory setselected updateenabled ok method public void ok try set cursor cursor get predefined cursor cursor wait cursor if save false return if search selection is selected view get text area get selection count 0 gui utilities error view search no selection null return if hyper search is selected search selection is selected if search and replace hyper search view search selection is selected close or keep dialog else if search and replace find view close or keep dialog else to front request focus find request focus finally set cursor cursor get predefined cursor cursor default cursor setcursor getpredefinedcursor wait_cursor searchselection isselected gettextarea getselectioncount guiutilities hypersearch isselected searchselection isselected searchandreplace hypersearch searchselection isselected closeorkeepdialog searchandreplace closeorkeepdialog tofront requestfocus requestfocus setcursor getpredefinedcursor default_cursor cancel method public void cancel save true gui utilities save geometry this search set visible false guiutilities savegeometry setvisible handle message method public void handle message eb message msg if msg instanceof search settings changed if saving load handlemessage handlemessage ebmessage searchsettingschanged dispose method public void dispose edit bus remove from bus this view hash remove view super dispose editbus removefrombus viewhash search dialog constructor creates a new search and replace dialog box param view the view param search string the search string private search dialog view view super view j edit get property search title false this view view j panel content new j panel new border layout content set border new empty border 0 12 12 12 set content pane content j panel center panel new j panel new border layout center panel add border layout north create field panel center panel add border layout center create search settings panel content add border layout center center panel content add border layout south create multi file panel content add border layout east create buttons panel pack j edit unset property search width j edit unset property search d width j edit unset property search height j edit unset property search d height gui utilities load geometry this search load edit bus add to bus this searchdialog searchstring searchdialog jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane jpanel centerpanel jpanel borderlayout centerpanel borderlayout createfieldpanel centerpanel borderlayout createsearchsettingspanel borderlayout centerpanel borderlayout createmultifilepanel borderlayout createbuttonspanel jedit unsetproperty jedit unsetproperty jedit unsetproperty jedit unsetproperty guiutilities loadgeometry editbus addtobus create field panel method private j panel create field panel button action handler action handler new button action handler j panel field panel new j panel new variable grid layout variable grid layout fixed num columns 1 field panel set border new empty border 0 0 12 12 j label label new j label j edit get property search find label set displayed mnemonic j edit get property search find mnemonic char at 0 find new history text field find find set columns 25 find add action listener action handler label set label for find label set border new empty border 12 0 2 0 field panel add label field panel add find label new j label j edit get property search replace label set displayed mnemonic j edit get property search replace mnemonic char at 0 label set border new empty border 12 0 0 0 field panel add label button group grp new button group replace action handler replace action handler new replace action handler we use a custom j radio button subclass that returns false for is focus traversable so that the user can tab from the search field to the replace field with one keystroke box replace mode box new box box layout x axis string replace new myj radio button j edit get property search string replace btn string replace add action listener replace action handler grp add string replace replace mode box add string replace replace mode box add box create horizontal strut 12 bean shell replace new myj radio button j edit get property search beanshell replace btn bean shell replace add action listener replace action handler grp add bean shell replace replace mode box add bean shell replace field panel add replace mode box field panel add box create vertical strut 3 replace new history text field replace replace add action listener action handler label set label for replace field panel add replace return field panel createfieldpanel jpanel createfieldpanel buttonactionhandler actionhandler buttonactionhandler jpanel fieldpanel jpanel variablegridlayout variablegridlayout fixed_num_columns fieldpanel setborder emptyborder jlabel jlabel jedit getproperty setdisplayedmnemonic jedit getproperty charat historytextfield setcolumns addactionlistener actionhandler setlabelfor setborder emptyborder fieldpanel fieldpanel jlabel jedit getproperty setdisplayedmnemonic jedit getproperty charat setborder emptyborder fieldpanel buttongroup buttongroup replaceactionhandler replaceactionhandler replaceactionhandler jradiobutton isfocustraversable replacemodebox boxlayout x_axis stringreplace myjradiobutton jedit getproperty stringreplace addactionlistener replaceactionhandler stringreplace replacemodebox stringreplace replacemodebox createhorizontalstrut beanshellreplace myjradiobutton jedit getproperty beanshellreplace addactionlistener replaceactionhandler beanshellreplace replacemodebox beanshellreplace fieldpanel replacemodebox fieldpanel createverticalstrut historytextfield addactionlistener actionhandler setlabelfor fieldpanel fieldpanel create search settings panel method private j panel create search settings panel j panel search settings new j panel new variable grid layout variable grid layout fixed num columns 3 search settings set border new empty border 0 0 12 12 settings action handler action handler new settings action handler button group fileset new button group button group direction new button group search settings add new j label j edit get property search fileset search settings add new j label j edit get property search settings search settings add new j label j edit get property search direction search selection new j radio button j edit get property search selection search selection set mnemonic j edit get property search selection mnemonic char at 0 fileset add search selection search settings add search selection search selection add action listener action handler keep dialog new j check box j edit get property search keep keep dialog set mnemonic j edit get property search keep mnemonic char at 0 search settings add keep dialog search back new j radio button j edit get property search back search back set mnemonic j edit get property search back mnemonic char at 0 direction add search back search settings add search back search back add action listener action handler search current buffer new j radio button j edit get property search current search current buffer set mnemonic j edit get property search current mnemonic char at 0 fileset add search current buffer search settings add search current buffer search current buffer add action listener action handler ignore case new j check box j edit get property search case ignore case set mnemonic j edit get property search case mnemonic char at 0 search settings add ignore case ignore case add action listener action handler search forward new j radio button j edit get property search forward search forward set mnemonic j edit get property search forward mnemonic char at 0 direction add search forward search settings add search forward search forward add action listener action handler search all buffers new j radio button j edit get property search all search all buffers set mnemonic j edit get property search all mnemonic char at 0 fileset add search all buffers search settings add search all buffers search all buffers add action listener action handler regexp new j check box j edit get property search regexp regexp set mnemonic j edit get property search regexp mnemonic char at 0 search settings add regexp regexp add action listener action handler wrap new j check box j edit get property search wrap wrap set mnemonic j edit get property search wrap mnemonic char at 0 search settings add wrap wrap add action listener action handler search directory new j radio button j edit get property search directory search directory set mnemonic j edit get property search directory mnemonic char at 0 fileset add search directory search settings add search directory search directory add action listener action handler hyper search new j check box j edit get property search hypersearch hyper search set mnemonic j edit get property search hypersearch mnemonic char at 0 search settings add hyper search hyper search add action listener action handler return search settings createsearchsettingspanel jpanel createsearchsettingspanel jpanel searchsettings jpanel variablegridlayout variablegridlayout fixed_num_columns searchsettings setborder emptyborder settingsactionhandler actionhandler settingsactionhandler buttongroup buttongroup buttongroup buttongroup searchsettings jlabel jedit getproperty searchsettings jlabel jedit getproperty searchsettings jlabel jedit getproperty searchselection jradiobutton jedit getproperty searchselection setmnemonic jedit getproperty charat searchselection searchsettings searchselection searchselection addactionlistener actionhandler keepdialog jcheckbox jedit getproperty keepdialog setmnemonic jedit getproperty charat searchsettings keepdialog searchback jradiobutton jedit getproperty searchback setmnemonic jedit getproperty charat searchback searchsettings searchback searchback addactionlistener actionhandler searchcurrentbuffer jradiobutton jedit getproperty searchcurrentbuffer setmnemonic jedit getproperty charat searchcurrentbuffer searchsettings searchcurrentbuffer searchcurrentbuffer addactionlistener actionhandler ignorecase jcheckbox jedit getproperty ignorecase setmnemonic jedit getproperty charat searchsettings ignorecase ignorecase addactionlistener actionhandler searchforward jradiobutton jedit getproperty searchforward setmnemonic jedit getproperty charat searchforward searchsettings searchforward searchforward addactionlistener actionhandler searchallbuffers jradiobutton jedit getproperty searchallbuffers setmnemonic jedit getproperty charat searchallbuffers searchsettings searchallbuffers searchallbuffers addactionlistener actionhandler jcheckbox jedit getproperty setmnemonic jedit getproperty charat searchsettings addactionlistener actionhandler jcheckbox jedit getproperty setmnemonic jedit getproperty charat searchsettings addactionlistener actionhandler searchdirectory jradiobutton jedit getproperty searchdirectory setmnemonic jedit getproperty charat searchdirectory searchsettings searchdirectory searchdirectory addactionlistener actionhandler hypersearch jcheckbox jedit getproperty hypersearch setmnemonic jedit getproperty charat searchsettings hypersearch hypersearch addactionlistener actionhandler searchsettings create multi file panel method private j panel create multi file panel j panel multifile new j panel grid bag layout layout new grid bag layout multifile set layout layout grid bag constraints cons new grid bag constraints cons gridy cons gridwidth cons gridheight 1 cons anchor grid bag constraints west cons fill grid bag constraints horizontal multi file action handler action listener new multi file action handler filter new history text field search filter filter add action listener action listener cons insets new insets 0 0 3 0 j label label new j label j edit get property search filter field swing constants right label set border new empty border 0 0 0 12 label set displayed mnemonic j edit get property search filter field mnemonic char at 0 label set label for filter cons weightx 0 0f layout set constraints label cons multifile add label cons gridwidth 2 cons insets new insets 0 0 3 6 cons weightx 1 0f layout set constraints filter cons multifile add filter cons gridwidth 1 cons weightx 0 0f cons insets new insets 0 0 3 0 synchronize new j button j edit get property search synchronize synchronize set mnemonic j edit get property search synchronize mnemonic char at 0 synchronize add action listener action listener layout set constraints synchronize cons multifile add synchronize cons gridy directory new history text field search directory directory set columns 25 directory add action listener action listener label new j label j edit get property search directory field swing constants right label set border new empty border 0 0 0 12 label set displayed mnemonic j edit get property search directory field mnemonic char at 0 label set label for directory cons insets new insets 0 0 3 0 cons weightx 0 0f layout set constraints label cons multifile add label cons insets new insets 0 0 3 6 cons weightx 1 0f cons gridwidth 2 layout set constraints directory cons multifile add directory choose new j button j edit get property search choose choose set mnemonic j edit get property search choose mnemonic char at 0 cons insets new insets 0 0 3 0 cons weightx 0 0f cons gridwidth 1 layout set constraints choose cons multifile add choose choose add action listener action listener cons insets new insets 0 0 0 0 cons gridy cons gridwidth 3 search sub directories new j check box j edit get property search subdirs layout set constraints search sub directories cons multifile add search sub directories return multifile createmultifilepanel jpanel createmultifilepanel jpanel jpanel gridbaglayout gridbaglayout setlayout gridbagconstraints gridbagconstraints gridbagconstraints gridbagconstraints multifileactionhandler actionlistener multifileactionhandler historytextfield addactionlistener actionlistener jlabel jlabel jedit getproperty filterfield swingconstants setborder emptyborder setdisplayedmnemonic jedit getproperty filterfield charat setlabelfor setconstraints setconstraints jbutton jedit getproperty setmnemonic jedit getproperty charat addactionlistener actionlistener setconstraints historytextfield setcolumns addactionlistener actionlistener jlabel jedit getproperty directoryfield swingconstants setborder emptyborder setdisplayedmnemonic jedit getproperty directoryfield charat setlabelfor setconstraints setconstraints jbutton jedit getproperty setmnemonic jedit getproperty charat setconstraints addactionlistener actionlistener searchsubdirectories jcheckbox jedit getproperty setconstraints searchsubdirectories searchsubdirectories create buttons panel method private box create buttons panel box box new box box layout y axis button action handler action handler new button action handler box add box create vertical strut 12 j panel grid new j panel new grid layout 5 1 0 12 find btn new j button j edit get property search find btn get root pane set default button find btn grid add find btn find btn add action listener action handler replace btn new j button j edit get property search replace btn replace btn set mnemonic j edit get property search replace btn mnemonic char at 0 grid add replace btn replace btn add action listener action handler replace and find btn new j button j edit get property search replace and find btn replace and find btn set mnemonic j edit get property search replace and find btn mnemonic char at 0 grid add replace and find btn replace and find btn add action listener action handler replace all btn new j button j edit get property search replace all btn replace all btn set mnemonic j edit get property search replace all btn mnemonic char at 0 grid add replace all btn replace all btn add action listener action handler close btn new j button j edit get property common close grid add close btn close btn add action listener action handler grid set maximum size grid get preferred size box add grid box add box create glue return box createbuttonspanel createbuttonspanel boxlayout y_axis buttonactionhandler actionhandler buttonactionhandler createverticalstrut jpanel jpanel gridlayout findbtn jbutton jedit getproperty findbtn getrootpane setdefaultbutton findbtn findbtn findbtn addactionlistener actionhandler replacebtn jbutton jedit getproperty replacebtn replacebtn setmnemonic jedit getproperty replacebtn charat replacebtn replacebtn addactionlistener actionhandler replaceandfindbtn jbutton jedit getproperty replaceandfindbtn replaceandfindbtn setmnemonic jedit getproperty replaceandfindbtn charat replaceandfindbtn replaceandfindbtn addactionlistener actionhandler replaceallbtn jbutton jedit getproperty replaceallbtn replaceallbtn setmnemonic jedit getproperty replaceallbtn charat replaceallbtn replaceallbtn addactionlistener actionhandler closebtn jbutton jedit getproperty closebtn closebtn addactionlistener actionhandler setmaximumsize getpreferredsize createglue update enabled method private void update enabled wrap set enabled hyper search is selected search selection is selected boolean reverse enabled hyper search is selected search current buffer is selected regexp is selected search back set enabled reverse enabled search forward set enabled reverse enabled if reverse enabled search forward set selected true filter set enabled search all buffers is selected search directory is selected directory set enabled search directory is selected choose set enabled search directory is selected search sub directories set enabled search directory is selected synchronize set enabled search all buffers is selected search directory is selected find btn set enabled search selection is selected hyper search is selected replace and find btn set enabled hyper search is selected search selection is selected updateenabled updateenabled setenabled hypersearch isselected searchselection isselected reverseenabled hypersearch isselected searchcurrentbuffer isselected isselected searchback setenabled reverseenabled searchforward setenabled reverseenabled reverseenabled searchforward setselected setenabled searchallbuffers isselected searchdirectory isselected setenabled searchdirectory isselected setenabled searchdirectory isselected searchsubdirectories setenabled searchdirectory isselected setenabled searchallbuffers isselected searchdirectory isselected findbtn setenabled searchselection isselected hypersearch isselected replaceandfindbtn setenabled hypersearch isselected searchselection isselected save method param cancel if true we don t bother the user with warning messages private boolean save boolean cancel try prevents us from handling search settings changed as a result of below saving true search and replace set ignore case ignore case is selected search and replace set regexp regexp is selected search and replace set reverse search search back is selected search and replace set auto wrap around wrap is selected string filter this filter get text this filter add current to history if filter length 0 filter search file set fileset search and replace get search file set boolean recurse search sub directories is selected if search selection is selected fileset new current buffer set else if search current buffer is selected fileset new current buffer set j edit set boolean property search hypersearch toggle hyper search is selected else if search all buffers is selected fileset new all buffer set filter else if search directory is selected string directory this directory get text this directory add current to history directory misc utilities construct path view get buffer get directory directory if vfs manager getvfs for path directory get capabilities vfs low latency cap 0 if cancel return false int ret val gui utilities confirm search dialog this remote dir search null j option pane yes no option j option pane warning message if ret val j option pane yes option return false if fileset instanceof directory list set directory list set dset directory list set fileset dset set directory directory dset set file filter filter dset set recursive recurse edit bus send new search settings changed null else fileset new directory list set directory filter recurse else can t happen fileset null j edit set boolean property search subdirs toggle recurse j edit set boolean property search keep dialog toggle keep dialog is selected search and replace set search file set fileset replace add current to history search and replace set replace string replace get text if find get text length 0 if cancel get toolkit beep return false find add current to history search and replace set search string find get text return true finally saving false searchsettingschanged searchandreplace setignorecase ignorecase isselected searchandreplace setregexp isselected searchandreplace setreversesearch searchback isselected searchandreplace setautowraparound isselected gettext addcurrenttohistory searchfileset searchandreplace getsearchfileset searchsubdirectories isselected searchselection isselected currentbufferset searchcurrentbuffer isselected currentbufferset jedit setbooleanproperty hypersearch isselected searchallbuffers isselected allbufferset searchdirectory isselected gettext addcurrenttohistory miscutilities constructpath getbuffer getdirectory vfsmanager getvfsforpath getcapabilities low_latency_cap retval guiutilities searchdialog joptionpane yes_no_option joptionpane warning_message retval joptionpane yes_option directorylistset directorylistset directorylistset setdirectory setfilefilter setrecursive editbus searchsettingschanged directorylistset jedit setbooleanproperty jedit setbooleanproperty keepdialog keepdialog isselected searchandreplace setsearchfileset addcurrenttohistory searchandreplace setreplacestring gettext gettext gettoolkit addcurrenttohistory searchandreplace setsearchstring gettext synchronize multi file settings method private void synchronize multi file settings directory set text view get buffer get directory search file set fileset search and replace get search file set if fileset instanceof all buffer set filter set text all buffer set fileset get file filter else filter set text misc utilities get file extension view get buffer get name synchronizemultifilesettings synchronizemultifilesettings settext getbuffer getdirectory searchfileset searchandreplace getsearchfileset allbufferset settext allbufferset getfilefilter settext miscutilities getfileextension getbuffer getname close or keep dialog method private void close or keep dialog if keep dialog is selected windows bug workaround in case a yes no confirm was shown but if hyper search results window is floating the workaround causes problems if hyper search is selected to front request focus find request focus return else gui utilities save geometry this search set visible false closeorkeepdialog closeorkeepdialog keepdialog isselected hypersearch hypersearch isselected tofront requestfocus requestfocus guiutilities savegeometry setvisible load method private void load ignore case set selected search and replace get ignore case regexp set selected search and replace get regexp wrap set selected search and replace get auto wrap around if search and replace get reverse search search back set selected true else search forward set selected true if search and replace get bean shell replace replace set model replace script bean shell replace set selected true else replace set model replace string replace set selected true search file set fileset search and replace get search file set history model model filter get model if model get size 0 filter set text model get item 0 else filter set text misc utilities get file extension view get buffer get name model directory get model if model get size 0 directory set text model get item 0 else directory set text view get buffer get directory search sub directories set selected j edit get boolean property search subdirs toggle if fileset instanceof directory list set filter set text directory list set fileset get file filter directory set text directory list set fileset get directory search sub directories set selected directory list set fileset is recursive else if fileset instanceof all buffer set filter set text all buffer set fileset get file filter directory add current to history keep dialog set selected j edit get boolean property search keep dialog toggle ignorecase setselected searchandreplace getignorecase setselected searchandreplace getregexp setselected searchandreplace getautowraparound searchandreplace getreversesearch searchback setselected searchforward setselected searchandreplace getbeanshellreplace setmodel beanshellreplace setselected setmodel stringreplace setselected searchfileset searchandreplace getsearchfileset historymodel getmodel getsize settext getitem settext miscutilities getfileextension getbuffer getname getmodel getsize settext getitem settext getbuffer getdirectory searchsubdirectories setselected jedit getbooleanproperty directorylistset settext directorylistset getfilefilter settext directorylistset getdirectory searchsubdirectories setselected directorylistset isrecursive allbufferset settext allbufferset getfilefilter addcurrenttohistory keepdialog setselected jedit getbooleanproperty keepdialog class myj radio button extends j radio button myj radio button string label super label myjradiobutton jradiobutton myjradiobutton public boolean is focus traversable return false isfocustraversable public void action performed action event evt replace set model bean shell replace is selected replace script replace search and replace set bean shell replace bean shell replace is selected actionperformed actionevent setmodel beanshellreplace isselected searchandreplace setbeanshellreplace beanshellreplace isselected public void action performed action event evt object source evt get source if source search current buffer hyper search set selected false else if source search selection source search all buffers source search directory hyper search set selected true save true update enabled actionperformed actionevent getsource searchcurrentbuffer hypersearch setselected searchselection searchallbuffers searchdirectory hypersearch setselected updateenabled public void action performed action event evt if evt get source choose string dirs gui utilities showvfs file dialog view directory get text vfs browser choose directory dialog false if dirs null directory set text dirs 0 else if evt get source synchronize synchronize multi file settings else source is directory or filter field just as if enter was pressed in another text field ok actionperformed actionevent getsource guiutilities showvfsfiledialog gettext vfsbrowser choose_directory_dialog settext getsource synchronizemultifilesettings public void action performed action event evt object source evt get source if source close btn cancel else if source find btn source find source replace ok else if source replace and find btn save false if search and replace replace view ok else get toolkit beep else if source replace all btn if search selection is selected view get text area get selection count 0 gui utilities error view search no selection null return set cursor cursor get predefined cursor cursor wait cursor if save false set cursor cursor get predefined cursor cursor default cursor get toolkit beep return if search selection is selected if search and replace replace view close or keep dialog else get toolkit beep else if search and replace replace all view close or keep dialog else get toolkit beep set cursor cursor get predefined cursor cursor default cursor actionperformed actionevent getsource closebtn findbtn replaceandfindbtn searchandreplace gettoolkit replaceallbtn searchselection isselected gettextarea getselectioncount guiutilities setcursor getpredefinedcursor wait_cursor setcursor getpredefinedcursor default_cursor gettoolkit searchselection isselected searchandreplace closeorkeepdialog gettoolkit searchandreplace replaceall closeorkeepdialog gettoolkit setcursor getpredefinedcursor default_cursor create a new instance of the class manager class manager instnaces are now associated with the interpreter see bsh interpreter get class manager see bsh interpreter set class loader class loader public static bsh class manager create class manager interpreter interpreter bsh class manager manager do we have the necessary jdk1 2 packages and optional package if capabilities class exists java lang ref weak reference capabilities class exists java util hash map capabilities class exists bsh classpath class manager impl try try to load the module don t refer to it directly here or we re dependent upon it class clas class for name bsh classpath class manager impl manager bsh class manager clas new instance catch exception e throw new interpreter error error loading classmanager e else manager new bsh class manager if interpreter null interpreter new interpreter manager declaring interpreter interpreter return manager getclassmanager setclassloader classloader bshclassmanager createclassmanager bshclassmanager classexists weakreference classexists hashmap classexists classmanagerimpl forname classmanagerimpl bshclassmanager newinstance interpretererror bshclassmanager declaringinterpreter public boolean class exists string name return class for name name null classexists classforname load the specified class by name taking into account added classpath and reloaded classes etc return the class or null public class class for name string name if is class being defined name throw new interpreter error attempting to load class in the process of being defined name class clas null try clas plain class for name name catch class not found exception e ignore try scripted class if clas null clas load source class name return clas classforname isclassbeingdefined interpretererror plainclassforname classnotfoundexception loadsourceclass move me to classpath class manager impl protected class load source class string name string file name name replace java input stream in get resource as stream file name if in null return null try system out println loading class from source file file name declaring interpreter eval new input stream reader in catch eval error e ignore system err println e try return plain class for name name catch class not found exception e system err println class not found in source file name return null classmanagerimpl loadsourceclass filename inputstream getresourceasstream filename filename declaringinterpreter inputstreamreader evalerror plainclassforname classnotfoundexception perform a plain class for name or call the externally provided classloader if a bsh class manager implementation is loaded the call will be delegated to it to allow for additional hooks p this simply wraps that bottom level class lookup call and provides a central point for monitoring and handling certain java version dependent bugs etc see class for name string return the class public class plain class for name string name throws class not found exception class c null try if external class loader null c external class loader load class name else c class for name name cache class info name c original note jdk under win is throwing these to warn about lower case upper case possible mismatch e g bsh console bsh console update prior to 1 3 we were squeltching no class def found errors which was very annoying i cannot reproduce the original problem and this was never a valid solution if there are legacy v ms that have problems we can include a more specific test for them here catch no class def found error e throw no class def found name e return c forname bshclassmanager classforname plainclassforname classnotfoundexception externalclassloader externalclassloader loadclass forname cacheclassinfo noclassdeffounderrors vms noclassdeffounderror noclassdeffound get a resource url using the bean shell classpath param path should be an absolute path public url get resource string path if external class loader null classloader wants no leading slash return external class loader get resource path substring 1 else return interpreter class get resource path beanshell getresource externalclassloader externalclassloader getresource getresource get a resource stream using the bean shell classpath param path should be an absolute path public input stream get resource as stream string path if external class loader null classloader wants no leading slash return external class loader get resource as stream path substring 1 else return interpreter class get resource as stream path beanshell inputstream getresourceasstream externalclassloader externalclassloader getresourceasstream getresourceasstream cache info about whether name is a class or not param value if value is non null cache the class if value is null set the flag that it is not a class to speed later resolution public void cache class info string name class value if value null absolute class cache put name value else absolute non classes put name novalue cacheclassinfo absoluteclasscache absolutenonclasses cache a resolved possibly overloaded method based on the argument types used to invoke it subject to classloader change static and object methods are cached separately to support fast lookup in the general case where either will do public void cache resolved method class clas class types method method if interpreter debug interpreter debug cache resolved method putting clas method signature key sk new signature key clas method get name types if modifier is static method get modifiers resolved static methods put sk method else resolved object methods put sk method cacheresolvedmethod cacheresolvedmethod signaturekey signaturekey getname isstatic getmodifiers resolvedstaticmethods resolvedobjectmethods return a previously cached resolved method param only static specifies that only a static method may be returned return the method or null protected method get resolved method class clas string method name class types boolean only static signature key sk new signature key clas method name types try static and then object if allowed note that the java compiler should not allow both method method method resolved static methods get sk if method null only static method method resolved object methods get sk if interpreter debug if method null interpreter debug get resolved method cache miss clas method name else interpreter debug get resolved method cache hit clas method return method onlystatic getresolvedmethod methodname onlystatic signaturekey signaturekey methodname resolvedstaticmethods onlystatic resolvedobjectmethods getresolvedmethod methodname getresolvedmethod clear the caches in bsh class manager see public void reset for external usage protected void clear caches absolute non classes new hashtable absolute class cache new hashtable resolved object methods new hashtable resolved static methods new hashtable bshclassmanager clearcaches absolutenonclasses absoluteclasscache resolvedobjectmethods resolvedstaticmethods set an external class loader bean shell will use this at the same point it would otherwise use the plain class for name i e if no explicit classpath management is done from the script add class path set class path reload classes then bean shell will only use the supplied classloader if additional classpath management is done then bean shell will perform that in addition to the supplied external classloader however bean shell is not currently able to reload classes supplied through the external classloader public void set class loader class loader externalcl external class loader externalcl class loader changed beanshell forname addclasspath setclasspath reloadclasses beanshell beanshell beanshell setclassloader classloader externalclassloader classloaderchanged public void add class path url path throws io exception addclasspath ioexception clear all loaders and start over no class loading public void reset clear caches clearcaches set a new base classpath and create a new base classloader this means all types change public void set class path url cp throws util eval error throw cm unavailable setclasspath utilevalerror cmunavailable overlay the entire path with a new class loader set the base path to the user path base path no point in including the boot class path can t reload thos public void reload all classes throws util eval error throw cm unavailable reloadallclasses utilevalerror cmunavailable reloading classes means creating a new classloader and using it whenever we are asked for classes in the appropriate space for this we use a discrete files class loader public void reload classes string class names throws util eval error throw cm unavailable discretefilesclassloader reloadclasses classnames utilevalerror cmunavailable reload all classes in the specified package e g com sun tools the special package name unpackaged can be used to refer to unpackaged classes public void reload package string pack throws util eval error throw cm unavailable reloadpackage utilevalerror cmunavailable support for import hide details in here as opposed to name space protected void do super import throws util eval error throw cm unavailable namespace dosuperimport utilevalerror cmunavailable a super import import operation has been performed protected boolean has super import return false hassuperimport return the name or null if none is found throw an class path exception containing detail if name is ambigous protected string get class name by unq name string name throws util eval error throw cm unavailable classpathexception getclassnamebyunqname utilevalerror cmunavailable public void add listener listener l addlistener public void add listener listener l public void remove listener listener l addlistener removelistener public void remove listener listener l public void dump print writer pw pw println bsh class manager no class manager removelistener printwriter bshclassmanager flag the class name as being in the process of being defined the class manager will not attempt to load it note this implementation is temporary we currently keep a flat namespace of the base name of classes i e bean shell cannot be in the process of defining two classes in different packages with the same base name to remove this limitation requires that we work through namespace imports in an analogous or using the same path as regular class import resolution this workaround should handle most cases so we ll try it for now protected void defining class string class name string base name name suffix class name 1 int i base name index of if i 1 base name base name substring i 1 string cur string defining classes base names get base name if cur null throw new interpreter error defining class problem class name bean shell cannot yet simultaneously define two or more dependant classes of the same name attempt to define class name while defining cur defining classes put class name novalue defining classes base names put base name class name beanshell definingclass classname basename classname basename indexof basename basename definingclassesbasenames basename interpretererror classname beanshell classname definingclasses classname definingclassesbasenames basename classname protected boolean is class being defined string class name return defining classes get class name null isclassbeingdefined classname definingclasses classname this method is a temporary workaround used with defining class it is to be removed at some point protected string get class being defined string class name string base name name suffix class name 1 return string defining classes base names get base name definingclass getclassbeingdefined classname basename classname definingclassesbasenames basename indicate that the specified class name has been defined and may be loaded normally protected void done defining class string class name string base name name suffix class name 1 defining classes remove class name defining classes base names remove base name donedefiningclass classname basename classname definingclasses classname definingclassesbasenames basename public class define class string name byte code class loader cl this get class get class loader class clas try clas class reflect invoke object method cl define class new object name code new primitive int 0 offset new primitive code length len interpreter null call stack null simple node null catch exception e e print stack trace throw new interpreter error unable to define class e absolute non classes remove name may have been axed previously return clas defineclass classloader getclass getclassloader invokeobjectmethod defineclass callstack simplenode printstacktrace interpretererror absolutenonclasses protected void class loader changed classloaderchanged annotate the no class def found error with some info about the class we were trying to load protected static error no class def found string class name error e return new no class def found error a class required by class class name could not be loaded n e to string noclassdeffounderror noclassdeffound classname noclassdeffounderror classname tostring protected static util eval error cm unavailable return new capabilities unavailable class loading features unavailable utilevalerror cmunavailable classloading public static interface listener public void class loader changed classloaderchanged signature key class clas string method name class types this clas clas this method name method name this types types signaturekey methodname methodname methodname public int hash code if hash code 0 hash code clas hash code method name hash code if types null no args method return hash code for int i 0 i types length i int hc types i null 21 types i hash code hash code hash code i 1 hc return hash code hashcode hashcode hashcode hashcode methodname hashcode hashcode hashcode hashcode hashcode hashcode public boolean equals object o signature key target signature key o if types null return target types null if clas target clas return false if method name equals target method name return false if types length target types length return false for int i 0 i types length i if types i null if target types i null return false else if types i equals target types i return false return true signaturekey signaturekey methodname methodname string descriptor bsh type int id super id bshtype used by the grammar to indicate dimensions of array types during parsing public void add array dimension array dims addarraydimension arraydims simple node get type node return simple node jjt get child 0 simplenode gettypenode simplenode jjtgetchild returns a class descriptor for this type if the type is an ambiguous name object type evaluation is attempted through the namespace in order to resolve imports if it is not found and the name is non compound we assume the default package for the name public string get type descriptor call stack callstack interpreter interpreter string default package return cached type if available if descriptor null return descriptor string descriptor first node will either be primitive type or ambiguous name simple node node get type node if node instanceof bsh primitive type descriptor get type descriptor bsh primitive type node type else string clas name bsh ambiguous name node text bsh class manager bcm interpreter get class manager note incorrect here we are using the hack in bsh class manager that allows lookup by base name we need to eliminate this limitation by working through imports see notes in class manager string defining class bcm get class being defined clas name class clas null if defining class null try clas bsh ambiguous name node to class callstack interpreter catch eval error e throw new interpreter error unable to resolve type e ignore and try default package system out println bsh type node class not found else clas name defining class if clas null system out println found clas clas descriptor get type descriptor clas else if default package null name is compound clas name descriptor l clas name replace else descriptor l default package replace clas name for int i 0 i array dims i descriptor descriptor this descriptor descriptor system out println bsh type returning descriptor descriptor return descriptor gettypedescriptor callstack defaultpackage primitivetype ambiguousname simplenode gettypenode bshprimitivetype gettypedescriptor bshprimitivetype clasname bshambiguousname bshclassmanager getclassmanager definingclass getclassbeingdefined clasname definingclass bshambiguousname toclass evalerror interpretererror bshtype clasname definingclass gettypedescriptor defaultpackage iscompound clasname clasname defaultpackage clasname arraydims bshtype public class get type call stack callstack interpreter interpreter throws eval error return cached type if available if type null return type first node will either be primitive type or ambiguous name simple node node get type node if node instanceof bsh primitive type base type bsh primitive type node get type else base type bsh ambiguous name node to class callstack interpreter if array dims 0 try get the type by constructing a prototype array with arbitrary zero length in each dimension int dims new int array dims int array default zeros object obj array new instance base type dims type obj get class catch exception e throw new eval error couldn t construct array type this callstack else type base type hack sticking to first interpreter that resolves this see comments on type instance variable interpreter get class manager add listener this return type gettype callstack evalerror primitivetype ambiguousname simplenode gettypenode bshprimitivetype basetype bshprimitivetype gettype basetype bshambiguousname toclass arraydims arraydims newinstance basetype getclass evalerror basetype getclassmanager addlistener base type is used during evaluation of full type and retained for the case where we are an array type in the case where we are not an array this will be the same as type public class get base type return base type basetype getbasetype basetype if we are an array type this will be non zero and indicate the dimensionality of the array e g 2 for string public int get array dims return array dims getarraydims arraydims public void class loader changed type null base type null classloaderchanged basetype public static string get type descriptor class clas if clas boolean type return z if clas character type return c if clas byte type return b if clas short type return s if clas integer type return i if clas long type return j if clas float type return f if clas double type return d if clas void type return v is get name ok test with 1 1 string name clas get name replace if name starts with name ends with return name else return l name replace gettypedescriptor getname getname startswith endswith construct a new xml parsing exception param message the error message from the parser param system id the uri of the entity containing the error param line the line number where the error appeared param column the column number where the error appeared public xml exception string message string system id int line int column this message message this system id system id this line line this column column systemid xmlexception systemid systemid systemid get the error message from the parser return a string describing the error public string get message return message getmessage get the uri of the entity containing the error return the uri as a string public string get system id return system id getsystemid systemid get the line number containing the error return the line number as an integer public int get line return line getline get the column number containing the error return the column number as an integer public int get column return column getcolumn fold level changed method called when line fold levels change param buffer the buffer in question param start the start line number param end the end line number since j edit 4 0pre1 public void fold level changed buffer buffer int start int end foldlevelchanged jedit foldlevelchanged content inserted method called when text is inserted into the buffer param buffer the buffer in question param start line the first line param offset the start offset from the beginning of the buffer param num lines the number of lines inserted param length the number of characters inserted since j edit 4 0pre1 public void content inserted buffer buffer int start line int offset contentinserted startline numlines jedit contentinserted startline pre content removed method called when text is about to be removed from the buffer but is still present param buffer the buffer in question param start line the first line param offset the start offset from the beginning of the buffer param num lines the number of lines to be removed param length the number of characters to be removed since j edit 4 2pre1 public void pre content removed buffer buffer int start line int offset precontentremoved startline numlines jedit precontentremoved startline content removed method called when text is removed from the buffer param buffer the buffer in question param start line the first line param offset the start offset from the beginning of the buffer param num lines the number of lines removed param length the number of characters removed since j edit 4 0pre1 public void content removed buffer buffer int start line int offset contentremoved startline numlines jedit contentremoved startline transaction complete method called after an undo or compound edit has finished the text area uses this event to queue up and collapse cleanup operations so they are only run once during a long transaction such as a replace all operation param buffer the buffer in question since j edit 4 0pre6 transactioncomplete jedit fold handler changed method called to notify the text area that folds need to be collapsed if the collapse folds property is set this method is called after the buffer has been loaded and also if the user changes the fold handler param buffer the buffer in question since j edit 4 2pre2 foldhandlerchanged collapsefolds jedit public class type bsh formal parameter int id super id bshformalparameter public string get type descriptor call stack callstack interpreter interpreter string default package if jjt get num children 0 return bsh type jjt get child 0 get type descriptor callstack interpreter default package else this will probably not get used return ljava lang object object type gettypedescriptor callstack defaultpackage jjtgetnumchildren bshtype jjtgetchild gettypedescriptor defaultpackage evaluate the type public object eval call stack callstack interpreter interpreter throws eval error if jjt get num children 0 type bsh type jjt get child 0 get type callstack interpreter else type untyped return type callstack evalerror jjtgetnumchildren bshtype jjtgetchild gettype class bsh array initializer extends simple node bsh array initializer int id super id bsharrayinitializer simplenode bsharrayinitializer public object eval call stack callstack interpreter interpreter throws eval error throw new eval error array initializer has no base type this callstack callstack evalerror evalerror construct the array from the initializer syntax param base type the base class type of the array no dimensionality param dimensions the top number of dimensions of the array e g 2 for a string public object eval class base type int dimensions call stack callstack interpreter interpreter throws eval error int num initializers jjt get num children allocate the array to store the initializers int dima new int dimensions description of the array the other dimensions default to zero and are assigned when the values are set dima 0 num initializers object initializers array new instance base type dima evaluate the initializers for int i 0 i num initializers i simple node node simple node jjt get child i object current initializer if node instanceof bsh array initializer if dimensions 2 throw new eval error invalid location for intializer position i this callstack current initializer bsh array initializer node eval base type dimensions 1 callstack interpreter else current initializer node eval callstack interpreter if current initializer primitive void throw new eval error void in array initializer position i this callstack unwrap primitive to the wrapper type object value if current initializer instanceof primitive primitive prim value primitive current initializer todo to get cast and boxing working e g e g byte ia 1 2 if the base type is a wrapper type then we need to get the primitive type class for the base type here in order for the cast to allow it then boxing will happen naturally in the array set e g integer ia 1 2 if primitive is wrapper type base type base type primitive get primitive type for type base type don t deal with object types here unless above if base type is primitive try prim value prim value cast to type base type types cast catch util eval error e e print stack trace interpreter debug error e throw type error base type prim value i callstack value prim value get value else value current initializer store the value in the array try array set initializers i value catch illegal argument exception e interpreter debug illegal arg e throw type error base type current initializer i callstack catch array store exception e i think this can happen interpreter debug arraystore e throw type error base type current initializer i callstack return initializers basetype basetype callstack evalerror numinitializers jjtgetnumchildren numinitializers newinstance basetype numinitializers simplenode simplenode jjtgetchild currentinitializer bsharrayinitializer evalerror currentinitializer bsharrayinitializer basetype currentinitializer currentinitializer evalerror currentinitializer primvalue currentinitializer basetype iswrappertype basetype basetype getprimitivetypefortype basetype basetype isprimitive primvalue primvalue casttotype basetype utilevalerror printstacktrace throwtypeerror basetype primvalue primvalue getvalue currentinitializer illegalargumentexception throwtypeerror basetype currentinitializer arraystoreexception throwtypeerror basetype currentinitializer private void throw type error class base type object initializer int arg num call stack callstack throws eval error string rhs type if initializer instanceof primitive rhs type primitive initializer get type get name else rhs type reflect normalize class name initializer get class throw new eval error incompatible type rhs type in initializer of array type base type at position arg num this callstack throwtypeerror basetype argnum callstack evalerror rhstype rhstype gettype getname rhstype normalizeclassname getclass evalerror rhstype basetype argnum constructor mirror list handler mirror list mirrors string path this mirrors mirrors this path path state stack new stack mirrorlisthandler mirrorlist statestack resolve entity method public object resolve entity string public id string system id if mirrors dtd equals system id this will result in a slight speed up since we don t need to read the dtd anyway as a elfred is non validating return new string reader return null resolveentity resolveentity publicid systemid systemid aelfred stringreader attribute method public void attribute string aname string value boolean is specified aname aname null null aname intern value value null null value intern if aname id id value isspecified doctype decl method public void doctype decl string name string public id string system id throws exception if mirrors equals name return log log log error this path doctype must be mirrors doctypedecl doctypedecl publicid systemid char data method public void char data char c int off int len string tag peek element string text new string c off len if tag description description text else if tag location location text else if tag country country text else if tag continent continent text chardata chardata peekelement start element method public void start element string tag tag push element tag if tag mirror mirror new mirror list mirror startelement startelement pushelement mirrorlist end element method public void end element string tag if tag null return else tag tag intern pop element if tag mirror mirror id id mirror description description mirror location location mirror country country mirror continent continent mirrors add mirror endelement endelement popelement start document method public void start document try push element null catch exception e e print stack trace startdocument startdocument pushelement printstacktrace end document method public void end document mirrors finished enddocument enddocument private string push element string name name name null null name intern state stack push name return name pushelement statestack private string peek element return string state stack peek peekelement statestack private string pop element return string state stack pop popelement statestack set bounds method it is a bad idea to override this but we need to get the component event before the first repaint public void set bounds int x int y int width int height if x getx y gety width get width height get height return super set bounds x y width height text area recalculate visible lines if text area get buffer is loaded text area recalculate last physical line text area properties changed text area update max horizontal scroll width text area scroll bars initialized true setbounds setbounds getwidth getheight setbounds textarea recalculatevisiblelines textarea getbuffer isloaded textarea recalculatelastphysicalline textarea propertieschanged textarea updatemaxhorizontalscrollwidth textarea scrollbarsinitialized is managing focus method returns if this component can be traversed by pressing the tab key this returns false public boolean is managing focus return false ismanagingfocus ismanagingfocus get focus traversal keys enabled method makes the tab key work in java 1 4 since j edit 3 2pre4 public boolean get focus traversal keys enabled return false getfocustraversalkeysenabled jedit getfocustraversalkeysenabled get styles method returns the syntax styles used to paint colorized text entry i n i will be used to paint tokens with id i n i see org gjt sp jedit syntax token public final syntax style get styles return styles getstyles syntaxstyle getstyles set styles method sets the syntax styles used to paint colorized text entry i n i will be used to paint tokens with id i n i param styles the syntax styles see org gjt sp jedit syntax token public final void set styles syntax style styles assumed this is called after a font render context is set up changing font render context settings without a set styles call will not reset cached monospaced font info fonts clear this styles styles styles token null new syntax style get foreground null get font for int i 0 i styles length i styles i set char width get char width styles i get font repaint setstyles setstyles syntaxstyle setstyles syntaxstyle getforeground getfont setcharwidth getcharwidth getfont get caret color method returns the caret color public final color get caret color return caret color getcaretcolor getcaretcolor caretcolor set caret color method sets the caret color param caret color the caret color public final void set caret color color caret color this caret color caret color if text area get buffer null text area invalidate line text area get caret line setcaretcolor caretcolor setcaretcolor caretcolor caretcolor caretcolor textarea getbuffer textarea invalidateline textarea getcaretline get selection color method returns the selection color public final color get selection color return selection color getselectioncolor getselectioncolor selectioncolor set selection color method sets the selection color param selection color the selection color public final void set selection color color selection color this selection color selection color if text area get buffer null text area invalidate selected lines setselectioncolor selectioncolor setselectioncolor selectioncolor selectioncolor selectioncolor textarea getbuffer textarea invalidateselectedlines get multiple selection color method returns the multiple selection color since j edit 4 2pre1 public final color get multiple selection color return multiple selection color getmultipleselectioncolor jedit getmultipleselectioncolor multipleselectioncolor set multiple selection color method sets the multiple selection color param multiple selection color the multiple selection color since j edit 4 2pre1 public final void set multiple selection color color multiple selection color this multiple selection color multiple selection color if text area get buffer null text area invalidate selected lines setmultipleselectioncolor multipleselectioncolor jedit setmultipleselectioncolor multipleselectioncolor multipleselectioncolor multipleselectioncolor textarea getbuffer textarea invalidateselectedlines get line highlight color method returns the line highlight color public final color get line highlight color return line highlight color getlinehighlightcolor getlinehighlightcolor linehighlightcolor set line highlight color method sets the line highlight color param line highlight color the line highlight color public final void set line highlight color color line highlight color this line highlight color line highlight color if text area get buffer null text area invalidate line text area get caret line setlinehighlightcolor linehighlightcolor setlinehighlightcolor linehighlightcolor linehighlightcolor linehighlightcolor textarea getbuffer textarea invalidateline textarea getcaretline is line highlight enabled method returns true if line highlight is enabled false otherwise public final boolean is line highlight enabled return line highlight islinehighlightenabled islinehighlightenabled linehighlight set line highlight enabled method enables or disables current line highlighting param line highlight true if current line highlight should be enabled false otherwise public final void set line highlight enabled boolean line highlight this line highlight line highlight if text area get buffer null text area invalidate selected lines setlinehighlightenabled linehighlight setlinehighlightenabled linehighlight linehighlight linehighlight textarea getbuffer textarea invalidateselectedlines get structure highlight color method returns the structure highlight color since j edit 4 2pre3 public final color get structure highlight color return structure highlight color getstructurehighlightcolor jedit getstructurehighlightcolor structurehighlightcolor set structure highlight color method sets the structure highlight color param structure highlight color the bracket highlight color since j edit 4 2pre3 public final void set structure highlight color color structure highlight color this structure highlight color structure highlight color structure matcher match match text area get structure match if match null text area invalidate line range match start line match end line setstructurehighlightcolor structurehighlightcolor jedit setstructurehighlightcolor structurehighlightcolor structurehighlightcolor structurehighlightcolor structurematcher textarea getstructurematch textarea invalidatelinerange startline endline is structure highlight enabled method returns true if structure highlighting is enabled false otherwise since j edit 4 2pre3 public final boolean is structure highlight enabled return structure highlight isstructurehighlightenabled jedit isstructurehighlightenabled structurehighlight set structure highlight enabled method enables or disables structure highlighting param structure highlight true if structure highlighting should be enabled false otherwise since j edit 4 2pre3 public final void set structure highlight enabled boolean structure highlight this structure highlight structure highlight structure matcher match match text area get structure match if match null text area invalidate line range match start line match end line setstructurehighlightenabled structurehighlight jedit setstructurehighlightenabled structurehighlight structurehighlight structurehighlight structurematcher textarea getstructurematch textarea invalidatelinerange startline endline is block caret enabled method returns true if the caret should be drawn as a block false otherwise public final boolean is block caret enabled return block caret isblockcaretenabled isblockcaretenabled blockcaret set block caret enabled method sets if the caret should be drawn as a block false otherwise param block caret true if the caret should be drawn as a block false otherwise public final void set block caret enabled boolean block caret this block caret block caret extension mgr remove extension caret extension if block caret add extension block caret layer caret extension else add extension caret layer caret extension if text area get buffer null text area invalidate line text area get caret line setblockcaretenabled blockcaret setblockcaretenabled blockcaret blockcaret blockcaret extensionmgr removeextension caretextension blockcaret addextension block_caret_layer caretextension addextension caret_layer caretextension textarea getbuffer textarea invalidateline textarea getcaretline geteol marker color method returns the eol marker color public final color geteol marker color return eol marker color geteolmarkercolor geteolmarkercolor eolmarkercolor seteol marker color method sets the eol marker color param eol marker color the eol marker color public final void seteol marker color color eol marker color this eol marker color eol marker color repaint seteolmarkercolor eolmarkercolor seteolmarkercolor eolmarkercolor eolmarkercolor eolmarkercolor geteol markers painted method returns true if eol markers are drawn false otherwise public final boolean geteol markers painted return eol markers geteolmarkerspainted geteolmarkerspainted eolmarkers seteol markers painted method sets if eol markers are to be drawn param eol markers true if eol markers should be drawn false otherwise public final void seteol markers painted boolean eol markers this eol markers eol markers repaint seteolmarkerspainted eolmarkers seteolmarkerspainted eolmarkers eolmarkers eolmarkers get wrap guide color method returns the wrap guide color public final color get wrap guide color return wrap guide color getwrapguidecolor getwrapguidecolor wrapguidecolor set wrap guide color method sets the wrap guide color param wrap guide color the wrap guide color public final void set wrap guide color color wrap guide color this wrap guide color wrap guide color repaint setwrapguidecolor wrapguidecolor setwrapguidecolor wrapguidecolor wrapguidecolor wrapguidecolor is wrap guide painted method returns true if the wrap guide is drawn false otherwise since j edit 4 0pre4 public final boolean is wrap guide painted return wrap guide iswrapguidepainted jedit iswrapguidepainted wrapguide set wrap guide painted method sets if the wrap guide is to be drawn param wrap guide true if the wrap guide should be drawn false otherwise public final void set wrap guide painted boolean wrap guide this wrap guide wrap guide repaint setwrapguidepainted wrapguide setwrapguidepainted wrapguide wrapguide wrapguide get fold line style method returns the fold line style the first element is the style for lines with a fold level greater than 3 the remaining elements are for fold levels 1 to 3 public final syntax style get fold line style return fold line style getfoldlinestyle syntaxstyle getfoldlinestyle foldlinestyle set fold line style method sets the fold line style the first element is the style for lines with a fold level greater than 3 the remaining elements are for fold levels 1 to 3 param fold line style the fold line style public final void set fold line style syntax style fold line style this fold line style fold line style repaint setfoldlinestyle foldlinestyle setfoldlinestyle syntaxstyle foldlinestyle foldlinestyle foldlinestyle set anti alias enabled method sets if anti aliasing should be enabled has no effect when running on java 1 1 since j edit 3 2pre6 public void set anti alias enabled boolean anti alias this anti alias anti alias update rendering hints setantialiasenabled jedit setantialiasenabled antialias antialias antialias updaterenderinghints is anti alias enabled method returns if anti aliasing is enabled since j edit 3 2pre6 public boolean is anti alias enabled return anti alias isantialiasenabled jedit isantialiasenabled antialias set fractional font metrics enabled method sets if fractional font metrics should be enabled has no effect when running on java 1 1 since j edit 3 2pre6 public void set fractional font metrics enabled boolean frac font metrics this frac font metrics frac font metrics update rendering hints setfractionalfontmetricsenabled jedit setfractionalfontmetricsenabled fracfontmetrics fracfontmetrics fracfontmetrics updaterenderinghints is fractional font metrics enabled method returns if fractional font metrics are enabled since j edit 3 2pre6 public boolean is fractional font metrics enabled return frac font metrics isfractionalfontmetricsenabled jedit isfractionalfontmetricsenabled fracfontmetrics get font render context method returns the font render context since j edit 4 0pre4 public font render context get font render context return font render context getfontrendercontext jedit fontrendercontext getfontrendercontext fontrendercontext add extension method adds a text area extension which can perform custom painting and tool tip handling param extension the extension since j edit 4 0pre4 public void add extension text area extension extension extension mgr add extension default layer extension repaint addextension jedit addextension textareaextension extensionmgr addextension default_layer add extension method adds a text area extension which can perform custom painting and tool tip handling param layer the layer to add the extension to note that more than extension can share the same layer param extension the extension since j edit 4 0pre4 public void add extension int layer text area extension extension extension mgr add extension layer extension repaint addextension jedit addextension textareaextension extensionmgr addextension remove extension method removes a text area extension it will no longer be asked to perform custom painting and tool tip handling param extension the extension since j edit 4 0pre4 public void remove extension text area extension extension extension mgr remove extension extension repaint removeextension jedit removeextension textareaextension extensionmgr removeextension get extensions method returns an array of registered text area extensions useful for debugging purposes since j edit 4 1pre5 public text area extension get extensions return extension mgr get extensions getextensions jedit textareaextension getextensions extensionmgr getextensions get tool tip text method returns the tool tip to display at the specified location param evt the mouse event public string get tool tip text mouse event evt if text area get buffer is loaded return null return extension mgr get tool tip text evt getx evt gety gettooltiptext gettooltiptext mouseevent textarea getbuffer isloaded extensionmgr gettooltiptext get font metrics method returns the font metrics used by this component public font metrics get font metrics return fm getfontmetrics fontmetrics getfontmetrics set font method sets the font for this component this is overridden to update the cached font metrics and to recalculate which lines are visible param font the font public void set font font font super set font font fm get font metrics font text area recalculate visible lines if text area get buffer null text area get buffer is loaded text area recalculate last physical line text area properties changed setfont setfont setfont getfontmetrics textarea recalculatevisiblelines textarea getbuffer textarea getbuffer isloaded textarea recalculatelastphysicalline textarea propertieschanged get string width method returns the width of the given string in pixels using the text area s current font since j edit 4 2final public float get string width string str if text area char width 0 return text area char width str length else return float get font get string bounds str get font render context get width getstringwidth jedit getstringwidth textarea charwidth textarea charwidth getfont getstringbounds getfontrendercontext getwidth paint component method repaints the text param gfx the graphics context public void paint component graphics gfx graphics2d gfx graphics2d gfx gfx set rendering hints rendering hints font render context gfx get font render context rectangle clip rect gfx get clip bounds gfx set color get background gfx fill rect clip rect x clip rect y clip rect width clip rect height buffer buffer text area get buffer if buffer is loaded return int height fm get height if height 0 return int first invalid clip rect y height because the clip rect s height is usually an even multiple of the font height we subtract 1 from it otherwise one too many lines will always be painted int last invalid clip rect y clip rect height 1 height if debug paint timer last invalid first invalid 1 log log log debug this repainting last invalid first invalid lines int y clip rect y clip rect y height extension mgr paint screen line range text area gfx first invalid last invalid y height text area update max horizontal scroll width text area display manager notifyscreenlinechanges paintcomponent _gfx paintcomponent _gfx _gfx setrenderinghints renderinghints fontrendercontext getfontrendercontext cliprect getclipbounds setcolor getbackground fillrect cliprect cliprect cliprect cliprect textarea getbuffer isloaded getheight firstinvalid cliprect cliprect lastinvalid cliprect cliprect paint_timer lastinvalid firstinvalid lastinvalid firstinvalid cliprect cliprect extensionmgr paintscreenlinerange textarea firstinvalid lastinvalid textarea updatemaxhorizontalscrollwidth textarea displaymanager _notifyscreenlinechanges next tab stop method implementation of tab expander interface returns next tab stop after a specified point param x the x co ordinate param tab offset ignored return the next tab stop after i x i public float next tab stop float x int tab offset int ntabs int x text area tab size return ntabs 1 text area tab size nexttabstop tabexpander taboffset nexttabstop taboffset textarea tabsize textarea tabsize get preferred size method returns the painter s preferred size public dimension get preferred size dimension dim new dimension char foo new char 80 for int i 0 i foo length i foo i dim width int get string width new string foo dim height fm get height 25 return dim getpreferredsize getpreferredsize getstringwidth getheight get minimum size method returns the painter s minimum size public dimension get minimum size return get preferred size getminimumsize getminimumsize getpreferredsize text area painter constructor creates a new painter do not create instances of this class directly text area painter j edit text area text area enable events awt event focus event mask awt event key event mask awt event mouse event mask this text area text area fonts new hash map extension mgr new extension manager set autoscrolls true set opaque true set request focus enabled false set cursor cursor get predefined cursor cursor text cursor font render context new font render context null false false add extension line background layer new paint line background add extension selection layer new paint selection add extension wrap guide layer new paint wrap guide add extension bracket highlight layer new structure matcher highlight text area add extension text layer new paint text caret extension new paint caret textareapainter textareapainter jedittextarea textarea enableevents awtevent focus_event_mask awtevent key_event_mask awtevent mouse_event_mask textarea textarea hashmap extensionmgr extensionmanager setautoscrolls setopaque setrequestfocusenabled setcursor getpredefinedcursor text_cursor fontrendercontext fontrendercontext addextension line_background_layer paintlinebackground addextension selection_layer paintselection addextension wrap_guide_layer paintwrapguide addextension bracket_highlight_layer structurematcher textarea addextension text_layer painttext caretextension paintcaret update rendering hints method private void update rendering hints hash map hints new hash map if anti alias hints put rendering hints key rendering rendering hints value render quality hints put rendering hints key antialiasing rendering hints value antialias on hints put rendering hints key text antialiasing rendering hints value text antialias on else hints put rendering hints key antialiasing rendering hints value antialias off hints put rendering hints key text antialiasing rendering hints value text antialias off hints put rendering hints key fractionalmetrics frac font metrics rendering hints value fractionalmetrics on rendering hints value fractionalmetrics off rendering hints new rendering hints hints font render context new font render context null anti alias frac font metrics updaterenderinghints updaterenderinghints hashmap hashmap antialias renderinghints key_rendering renderinghints value_render_quality renderinghints key_antialiasing renderinghints value_antialias_on renderinghints key_text_antialiasing renderinghints value_text_antialias_on renderinghints key_antialiasing renderinghints value_antialias_off renderinghints key_text_antialiasing renderinghints value_text_antialias_off renderinghints key_fractionalmetrics fracfontmetrics renderinghints value_fractionalmetrics_on renderinghints value_fractionalmetrics_off renderinghints renderinghints fontrendercontext fontrendercontext antialias fracfontmetrics get char width method private int get char width font font integer return value integer fonts get font if return value null int min width integer max value int max width integer min value font metrics fm get font metrics font int widths fm get widths for int i 0 i widths length i int width widths i if width 0 font can display char i continue min width math min width min width max width math max width max width string str iwiwiwiau1234 double width1 font create glyph vector text area get painter get font render context str get logical bounds get width double width2 str length max width if min width max width int width1 int width2 log log log debug this using monospaced font optimization font return value new integer max width else log log log debug this not using monospaced font optimization font log log log debug this minimum width min width maximum width max width width 1 width1 width 2 width2 return value new integer 0 fonts put font return value return return value int value getcharwidth getcharwidth returnvalue returnvalue minwidth max_value maxwidth min_value fontmetrics getfontmetrics getwidths candisplay minwidth minwidth maxwidth maxwidth createglyphvector textarea getpainter getfontrendercontext getlogicalbounds getwidth maxwidth minwidth maxwidth returnvalue maxwidth minwidth maxwidth returnvalue returnvalue returnvalue intvalue paint valid line method public void paint valid line graphics2d gfx int screen line int physical line int start int end int y minimise access methods j edit text area text area text area painter this text area buffer buffer text area get buffer paint line highlight and collapsed fold highlight boolean collapsed fold physical line buffer get line count 1 buffer is fold start physical line text area display manager is line visible physical line 1 syntax style fold line style null if collapsed fold int level buffer get fold level physical line 1 if buffer get fold handler instanceof indent fold handler level math max 1 level buffer get indent size if level 3 level 0 fold line style text area painter this fold line style level int caret text area get caret position boolean paint line highlight is line highlight enabled caret start caret end text area selection size 0 color bg color if paint line highlight bg color line highlight color else if collapsed fold bg color fold line style get background color if bg color null bg color get background else bg color get background if paint line highlight collapsed fold gfx set color bg color gfx fill rect 0 y get width fm get height paint token backgrounds chunk cache line info line info text area chunk cache get line info screen line if line info chunks null float base line y fm get height fm get leading fm get descent chunk paint chunk backgrounds line info chunks gfx text area get horizontal offset base line paintvalidline paintvalidline screenline physicalline jedittextarea textarea textareapainter textarea textarea getbuffer collapsedfold physicalline getlinecount isfoldstart physicalline textarea displaymanager islinevisible physicalline syntaxstyle foldlinestyle collapsedfold getfoldlevel physicalline getfoldhandler indentfoldhandler getindentsize foldlinestyle textareapainter foldlinestyle textarea getcaretposition paintlinehighlight islinehighlightenabled textarea bgcolor paintlinehighlight bgcolor linehighlightcolor collapsedfold bgcolor foldlinestyle getbackgroundcolor bgcolor bgcolor getbackground bgcolor getbackground paintlinehighlight collapsedfold setcolor bgcolor fillrect getwidth getheight chunkcache lineinfo lineinfo textarea chunkcache getlineinfo screenline lineinfo baseline getheight getleading getdescent paintchunkbackgrounds lineinfo textarea gethorizontaloffset baseline paint valid line method public void paint valid line graphics2d gfx int screen line int physical line int start int end int y if text area selection size 0 return gfx set color text area is multiple selection enabled get multiple selection color get selection color for int i text area selection size 1 i 0 i paint selection gfx screen line physical line y selection text area selection get i paintvalidline paintvalidline screenline physicalline textarea setcolor textarea ismultipleselectionenabled getmultipleselectioncolor getselectioncolor textarea paintselection screenline physicalline textarea paint selection method private void paint selection graphics2d gfx int screen line int physical line int y selection s int selection start and end text area get selection start and end screen line physical line s if selection start and end null return int x1 selection start and end 0 int x2 selection start and end 1 gfx fill rect x1 y x2 x1 fm get height paintselection paintselection screenline physicalline selectionstartandend textarea getselectionstartandend screenline physicalline selectionstartandend selectionstartandend selectionstartandend fillrect getheight public void paint screen line range graphics2d gfx int first line int last line int physical lines int start int end int y int line height if text area get display manager wrap margin 0 is wrap guide painted gfx set color get wrap guide color int x text area get horizontal offset text area get display manager wrap margin gfx draw line x y x y last line first line 1 line height paintscreenlinerange firstline lastline physicallines lineheight textarea getdisplaymanager wrapmargin iswrapguidepainted setcolor getwrapguidecolor textarea gethorizontaloffset textarea getdisplaymanager wrapmargin drawline lastline firstline lineheight public string get tool tip text int x int y if text area get display manager wrap margin 0 is wrap guide painted int wrap guide pos text area get display manager wrap margin text area get horizontal offset if math abs x wrap guide pos 5 return string value of text area get buffer get property max line len return null gettooltiptext textarea getdisplaymanager wrapmargin iswrapguidepainted wrapguidepos textarea getdisplaymanager wrapmargin textarea gethorizontaloffset wrapguidepos valueof textarea getbuffer getproperty maxlinelen public void paint valid line graphics2d gfx int screen line int physical line int start int end int y chunk cache line info line info text area chunk cache get line info screen line font default font get font color default color get foreground gfx set font default font gfx set color default color int x text area get horizontal offset int originalx x float base line y fm get height fm get leading fm get descent if line info chunks null x chunk paint chunk list line info chunks gfx text area get horizontal offset base line debug disable glyph vector buffer buffer text area get buffer if line info last subregion gfx set font default font gfx set color eol marker color gfx draw string math max x text area get horizontal offset text area get display manager wrap margin text area char width base line x text area char width else if physical line buffer get line count 1 buffer is fold start physical line text area display manager is line visible physical line 1 int level buffer get fold level physical line 1 if buffer get fold handler instanceof indent fold handler level math max 1 level buffer get indent size if level 3 level 0 syntax style fold line style text area painter this fold line style level font font fold line style get font gfx set font font gfx set color fold line style get foreground color int next line int next screen line screen line 1 if next screen line text area get visible lines next line text area chunk cache get line info next screen line physical line else next line text area display manager get next visible line physical line if next line 1 next line text area get line count int count next line physical line 1 string str count lines float width get string width str gfx draw string str x base line x width else if eol markers gfx set font default font gfx set color eol marker color gfx draw string x base line x text area char width line info width x originalx paintvalidline screenline physicalline chunkcache lineinfo lineinfo textarea chunkcache getlineinfo screenline defaultfont getfont defaultcolor getforeground setfont defaultfont setcolor defaultcolor textarea gethorizontaloffset baseline getheight getleading getdescent lineinfo paintchunklist lineinfo textarea gethorizontaloffset baseline disable_glyph_vector textarea getbuffer lineinfo lastsubregion setfont defaultfont setcolor eolmarkercolor drawstring textarea gethorizontaloffset textarea getdisplaymanager wrapmargin textarea charwidth baseline textarea charwidth physicalline getlinecount isfoldstart physicalline textarea displaymanager islinevisible physicalline getfoldlevel physicalline getfoldhandler indentfoldhandler getindentsize syntaxstyle foldlinestyle textareapainter foldlinestyle foldlinestyle getfont setfont setcolor foldlinestyle getforegroundcolor nextline nextscreenline screenline nextscreenline textarea getvisiblelines nextline textarea chunkcache getlineinfo nextscreenline physicalline nextline textarea displaymanager getnextvisibleline physicalline nextline nextline textarea getlinecount nextline physicalline getstringwidth drawstring baseline eolmarkers setfont defaultfont setcolor eolmarkercolor drawstring baseline textarea charwidth lineinfo public void paint valid line graphics2d gfx int screen line int physical line int start int end int y if text area is caret visible return int caret text area get caret position if caret start caret end return int offset caret text area get line start offset physical line text area offset toxy physical line offset text area return value int caretx text area return value x int height fm get height gfx set color caret color if text area is overwrite enabled gfx draw line caretx y height 1 caretx text area char width y height 1 else if block caret gfx draw rect caretx y text area char width 1 height 1 else gfx draw line caretx y caretx y height 1 paintvalidline screenline physicalline textarea iscaretvisible textarea getcaretposition textarea getlinestartoffset physicalline textarea offsettoxy physicalline textarea returnvalue textarea returnvalue getheight setcolor caretcolor textarea isoverwriteenabled drawline textarea charwidth blockcaret drawrect textarea charwidth drawline add translation method adds a keyboard translation param key1 translate this key param key2 into this key since j edit 4 2pre3 public static void add translation key key1 key key2 trans map put key1 key2 addtranslation jedit addtranslation transmap translate key event method pass this an event from link key event workaround process key event java awt event key event since j edit 4 2pre3 public static key translate key event key event evt int modifiers evt get modifiers key return value null switch evt getid case key event key pressed int key code evt get key code if key code key event vk 0 key code key event vk 9 key code key event vk a key code key event vk z if debug alternative dispatcher return null else return value new key modifiers to string modifiers 0 character to lower case char key code else if key code key event vk tab evt consume return value new key modifiers to string modifiers key code 0 else if key code key event vk space for space or s space we pass the key typed since international keyboards sometimes produce a key pressed space but not a key typed space eg if you have to do a space to insert if modifiers input event shift mask 0 return value null else return value new key modifiers to string modifiers 0 else return value new key modifiers to string modifiers key code 0 break case key event key typed char ch evt get key char switch ch case n case t case b return null case if modifiers input event shift mask 0 return null int ignore mods if debug alt key pressed disabled on macos a can be user input ignore mods input event shift mask input event alt graph mask input event alt mask else on macos a can be user input ignore mods input event shift mask input event alt graph mask if modifiers input event alt graph mask 0 evt get when key event workaround last key time 750 key event workaround modifiers ignore mods 0 if debug alternative dispatcher return value new key modifiers to string modifiers 0 ch else return null else if ch return value new key modifiers to string modifiers 0 ch else return value new key null 0 ch break default return null i guess translated events do not have the evt field set so consuming won t work i don t think this is a problem as nothing uses translation anyway key trans key trans map get return value if trans null return return value else return trans translatekeyevent keyeventworkaround processkeyevent keyevent jedit translatekeyevent keyevent getmodifiers returnvalue keyevent key_pressed keycode getkeycode keycode keyevent vk_0 keycode keyevent vk_9 keycode keyevent vk_a keycode keyevent vk_z alternative_dispatcher returnvalue modifierstostring tolowercase keycode keycode keyevent vk_tab returnvalue modifierstostring keycode keycode keyevent vk_space key_pressed key_typed inputevent shift_mask returnvalue returnvalue modifierstostring returnvalue modifierstostring keycode keyevent key_typed getkeychar inputevent shift_mask ignoremods alt_key_pressed_disabled ignoremods inputevent shift_mask inputevent alt_graph_mask inputevent alt_mask ignoremods inputevent shift_mask inputevent alt_graph_mask inputevent alt_graph_mask getwhen keyeventworkaround lastkeytime keyeventworkaround ignoremods alternative_dispatcher returnvalue modifierstostring returnvalue modifierstostring returnvalue transmap returnvalue returnvalue parse key method converts a string to a keystroke the string should be of the form i modifiers i i shortcut i where i modifiers i is any combination of a for alt c for control s for shift or m for meta and i shortcut i is either a single character or a keycode name from the code key event code class without the code vk code prefix param key stroke a string description of the key stroke since j edit 4 2pre3 public static key parse key string key stroke if key stroke null return null int index key stroke index of int modifiers 0 if index 1 for int i 0 i index i switch character to upper case key stroke char at i case a modifiers a break case c modifiers c break case m modifiers m break case s modifiers s break string key key stroke substring index 1 if key length 1 return new key modifiers to string modifiers 0 key char at 0 else if key length 0 log log log error default input handler class invalid key stroke key stroke return null else if key equals space return new key modifiers to string modifiers 0 else int ch try ch key event class get field vk concat key get int null catch exception e log log log error default input handler class invalid key stroke key stroke return null return new key modifiers to string modifiers ch 0 parsekey keyevent vk_ keystroke jedit parsekey keystroke keystroke keystroke indexof touppercase keystroke charat keystroke modifierstostring charat defaultinputhandler keystroke modifierstostring keyevent getfield vk_ getint defaultinputhandler keystroke modifierstostring set modifier mapping method changes the mapping between symbolic modifier key names code c code code a code code m code code s code and java modifier flags you can map more than one java modifier to a symobolic modifier for example p code pre set modifier mapping input event ctrl mask input event alt mask input event meta mask 0 input event shift mask pre code p you cannot map a java modifer to more than one symbolic modifier param c the modifier s to map the code c code modifier to param a the modifier s to map the code a code modifier to param m the modifier s to map the code m code modifier to param s the modifier s to map the code s code modifier to since j edit 4 2pre3 public static void set modifier mapping int c int a int m int s int duplicate mapping c a c m c s a m a s m s if duplicate mapping input event ctrl mask 0 throw new illegal argument exception ctrl is mapped to more than one modifier if duplicate mapping input event alt mask 0 throw new illegal argument exception alt is mapped to more than one modifier if duplicate mapping input event meta mask 0 throw new illegal argument exception meta is mapped to more than one modifier if duplicate mapping input event shift mask 0 throw new illegal argument exception shift is mapped to more than one modifier key event translator c c key event translator a a key event translator m m key event translator s s setmodifiermapping setmodifiermapping inputevent ctrl_mask inputevent alt_mask inputevent meta_mask inputevent shift_mask jedit setmodifiermapping duplicatemapping duplicatemapping inputevent ctrl_mask illegalargumentexception duplicatemapping inputevent alt_mask illegalargumentexception duplicatemapping inputevent meta_mask illegalargumentexception duplicatemapping inputevent shift_mask illegalargumentexception keyeventtranslator keyeventtranslator keyeventtranslator keyeventtranslator get symbolic modifier name method returns a the symbolic modifier name for the specified java modifier flag param mod a modifier constant from code input event code since j edit 4 2pre3 public static char get symbolic modifier name int mod if mod c 0 return c else if mod a 0 return a else if mod m 0 return m else if mod s 0 return s else return 0 getsymbolicmodifiername inputevent jedit getsymbolicmodifiername modifiers to string method public static string modifiers to string int mods string buffer buf null if mods input event ctrl mask 0 if buf null buf new string buffer buf append get symbolic modifier name input event ctrl mask if mods input event alt mask 0 if buf null buf new string buffer buf append get symbolic modifier name input event alt mask if mods input event meta mask 0 if buf null buf new string buffer buf append get symbolic modifier name input event meta mask if mods input event shift mask 0 if buf null buf new string buffer buf append get symbolic modifier name input event shift mask if buf null return null else return buf to string modifierstostring modifierstostring stringbuffer inputevent ctrl_mask stringbuffer getsymbolicmodifiername inputevent ctrl_mask inputevent alt_mask stringbuffer getsymbolicmodifiername inputevent alt_mask inputevent meta_mask stringbuffer getsymbolicmodifiername inputevent meta_mask inputevent shift_mask stringbuffer getsymbolicmodifiername inputevent shift_mask tostring get modifier string method returns a string containing symbolic modifier names set in the specified event param evt the event since j edit 4 2pre3 public static string get modifier string input event evt string buffer buf new string buffer if evt is control down buf append get symbolic modifier name input event ctrl mask if evt is alt down buf append get symbolic modifier name input event alt mask if evt is meta down buf append get symbolic modifier name input event meta mask if evt is shift down buf append get symbolic modifier name input event shift mask return buf length 0 null buf to string getmodifierstring jedit getmodifierstring inputevent stringbuffer stringbuffer iscontroldown getsymbolicmodifiername inputevent ctrl_mask isaltdown getsymbolicmodifiername inputevent alt_mask ismetadown getsymbolicmodifiername inputevent meta_mask isshiftdown getsymbolicmodifiername inputevent shift_mask tostring public key string modifiers int key char input this modifiers modifiers this key key this input input public int hash code return key input hashcode public boolean equals object o if o instanceof key key k key o if misc utilities objects equal modifiers k modifiers key k key input k input return true return false miscutilities objectsequal public string to string return modifiers null modifiers integer to string key 16 integer to string input 16 tostring tostring tostring creates a new edit pane update message param edit pane the edit pane param what what happened public edit pane update edit pane edit pane object what super edit pane if what null throw new null pointer exception what must be non null this what what editpane editpaneupdate editpane editpane editpane nullpointerexception returns what caused this edit pane update public object get what return what getwhat returns the edit pane involved public edit pane get edit pane return edit pane get source editpane geteditpane editpane getsource public string param string return what what super param string paramstring paramstring class reflect error extends exception public reflect error super reflecterror reflecterror public reflect error super public reflect error string s super s reflecterror reflecterror boyer moore search matcher constructor creates a new string literal matcher public boyer moore search matcher string pattern boolean ignore case this pattern pattern to char array if ignore case for int i 0 i this pattern length i this pattern i character to upper case this pattern i this ignore case ignore case pattern end this pattern length 1 boyermooresearchmatcher boyermooresearchmatcher ignorecase tochararray ignorecase touppercase ignorecase ignorecase pattern_end next match method returns the offset of the first match of the specified text within this matcher param text the text to search in param start true if the start of the segment is the beginning of the buffer param end true if the end of the segment is the end of the buffer param first time if false and the search string matched at the start offset with length zero automatically find next match param reverse if true searching will be performed in a backward direction return an array where the first element is the start offset of the match and the second element is the end offset of the match since j edit 4 2pre4 public search matcher match next match char indexed text boolean start boolean end boolean first time boolean reverse int pos match text reverse if pos 1 return null else return value start pos return value end pos pattern length return return value nextmatch firsttime jedit searchmatcher nextmatch charindexed firsttime returnvalue returnvalue returnvalue public int match char indexed text boolean reverse lazily create skip and suffix arrays for either the search pattern or the reversed search pattern int skip suffix if reverse if back skip null back skip generate skip array true back suffix generate suffix array true skip back skip suffix back suffix else if fwd skip null fwd skip generate skip array false fwd suffix generate suffix array false skip fwd skip suffix fwd suffix position variable for pattern test position int pos position variable for pattern start int anchor 0 last possible start position of a match with this pattern this is negative if the pattern is longer than the text causing the search loop below to immediately fail int last anchor reverse search offset pattern length 1 length pattern length char ch 0 int bad char int good suffix the search works by starting the anchor first character of the pattern at the initial offset as long as the anchor is far enough from the enough of the text for the pattern to match and until the pattern matches we compare the pattern to the text from the last character to the first character in reverse order where a character in the pattern mismatches we use the two heuristics based on the mismatch character and its position in the pattern to determine the furthest we can move the anchor without missing any potential pattern matches search while text is valid for pos pattern end pos 0 pos ch text char at pos if ignore case ch character to upper case ch pattern test if reverse ch pattern pattern end pos ch pattern pos character mismatch determine how many characters to skip heuristic 1 bad char pos skip get skip index ch heuristic 2 good suffix suffix pos skip the greater of the two distances provided by the heuristics int skip index bad char good suffix bad char good suffix anchor skip index text move skip index go back to the while loop continue search match return the position of its first character return anchor mismatch return 1 as defined by api return 1 charindexed back_skip back_skip generateskiparray back_suffix generatesuffixarray back_skip back_suffix fwd_skip fwd_skip generateskiparray fwd_suffix generatesuffixarray fwd_skip fwd_suffix last_anchor reversesearch bad_char good_suffix isvalid pattern_end charat ignorecase touppercase pattern_end bad_char getskipindex good_suffix skip_index bad_char good_suffix bad_char good_suffix skip_index skip_index private int generate skip array boolean reverse initialize the skip array to all zeros int skip new int 256 leave the table cleanly initialized for an empty pattern if pattern length 0 return skip int pos 0 do skip get skip index pattern reverse pattern end pos pos pos while pos pattern length return skip generateskiparray getskipindex pattern_end sparse private static final int get skip index char ch return int ch 0x000000ff getskipindex private int generate suffix array boolean reverse int m pattern length int j m 1 int suffix new int j int tmp new int j tmp m j for int i m i 0 i while j m pattern reverse pattern end i 1 i 1 pattern reverse pattern end j 1 j 1 if suffix j 0 suffix j j i j tmp j tmp i 1 j int k tmp 0 for j 0 j m j the code above builds a 1 indexed suffix array but we shift it to be 0 indexed ignoring the original 0 th element if j 0 suffix j 1 suffix j 0 k suffix j if j k k tmp k return suffix generatesuffixarray pattern_end pattern_end public tar input stream input stream is this is tar buffer default blksize tar buffer default rcdsize tarinputstream inputstream tarbuffer default_blksize tarbuffer default_rcdsize public tar input stream input stream is int block size this is block size tar buffer default rcdsize tarinputstream inputstream blocksize blocksize tarbuffer default_rcdsize public tar input stream input stream is int block size int record size super is this buffer new tar buffer is block size record size this read buf null this one buf new byte 1 this debug false this has hiteof false this e factory null tarinputstream inputstream blocksize recordsize tarbuffer blocksize recordsize readbuf onebuf hashiteof efactory sets the debugging flag param debugf true to turn on debugging public void set debug boolean debugf this debug debugf setdebug sets the debugging flag param debugf true to turn on debugging public void set entry factory entry factory factory this e factory factory setentryfactory entryfactory efactory sets the debugging flag in this stream s tar buffer param debugf true to turn on debugging public void set buffer debug boolean debug this buffer set debug debug tarbuffer setbufferdebug setdebug closes this stream calls the tar buffer s close method public void close throws io exception this buffer close tarbuffer ioexception get the record size being used by this stream s tar buffer return the tar buffer record size public int get record size return this buffer get record size tarbuffer tarbuffer getrecordsize getrecordsize get the available data that can be read from the current entry in the archive this does not indicate how much data is left in the entire archive only in the current entry this value is determined from the entry s size header field and the amount of data already read from the current entry return the number of available bytes for the current entry public int available throws io exception return this entry size this entry offset ioexception entrysize entryoffset skip bytes in the input buffer this skips bytes in the current entry s data not the entire archive and will stop at the end of the current entry s data if the number to skip extends beyond that point param num to skip the number of bytes to skip public void skip int num to skip throws io exception review this is horribly inefficient but it ensures that we properly skip over bytes via the tar buffer byte skip buf new byte 8 1024 for int num num to skip num 0 int num read this read skip buf 0 num skip buf length skip buf length num if num read 1 break num num read numtoskip numtoskip ioexception tarbuffer skipbuf numtoskip numread skipbuf skipbuf skipbuf numread numread since we do not support marking just yet we return false return false public boolean mark supported return false marksupported since we do not support marking just yet we do nothing param mark limit the limit to mark public void mark int mark limit marklimit marklimit since we do not support marking just yet we do nothing public void reset get the next entry in this tar archive this will skip over any remaining data in the current entry if there is one and place the input stream at the header of the next entry and read the header and instantiate a new tar entry from the header bytes and return that entry if there are no more entries in the archive null will be returned to indicate that the end of the archive has been reached return the next tar entry in the archive or null public tar entry get next entry throws io exception if this has hiteof return null if this curr entry null int num to skip this entry size this entry offset if this debug system err println tar input stream skip currentry this curr entry get name sz this entry size off this entry offset skipping num to skip bytes if num to skip 0 this skip num to skip this read buf null byte header buf this buffer read record if header buf null if this debug system err println read null record this has hiteof true else if this buffer iseof record header buf if this debug system err println read eof record this has hiteof true if this has hiteof this curr entry null else try if this e factory null this curr entry new tar entry header buf else this curr entry this e factory create entry header buf if header buf 257 u header buf 258 s header buf 259 t header buf 260 a header buf 261 r throw new invalid header exception header magic is not ustar but header buf 257 header buf 258 header buf 259 header buf 260 header buf 261 or dec int header buf 257 int header buf 258 int header buf 259 int header buf 260 int header buf 261 if this debug system err println tar input stream set currentry this curr entry get name size this curr entry get size this entry offset 0 review how do we resolve this discrepancy this entry size int this curr entry get size catch invalid header exception ex this entry size 0 this entry offset 0 this curr entry null throw new invalid header exception bad header in block this buffer get current block num record this buffer get current record num ex get message return this curr entry tarentry tarentry tarentry getnextentry ioexception hashiteof currentry numtoskip entrysize entryoffset tarinputstream currentry getname entrysize entryoffset numtoskip numtoskip numtoskip readbuf headerbuf readrecord headerbuf hashiteof iseofrecord headerbuf hashiteof hashiteof currentry efactory currentry tarentry headerbuf currentry efactory createentry headerbuf headerbuf headerbuf headerbuf headerbuf headerbuf invalidheaderexception headerbuf headerbuf headerbuf headerbuf headerbuf headerbuf headerbuf headerbuf headerbuf headerbuf tarinputstream currentry getname currentry getsize entryoffset entrysize currentry getsize invalidheaderexception entrysize entryoffset currentry invalidheaderexception getcurrentblocknum getcurrentrecordnum getmessage currentry reads a byte from the current tar archive entry this method simply calls read byte int int return the byte read or 1 at eof public int read throws io exception int num this read this one buf 0 1 if num 1 return num else return int this one buf 0 ioexception onebuf onebuf reads bytes from the current tar archive entry this method simply calls read byte int int param buf the buffer into which to place bytes read return the number of bytes read or 1 at eof public int read byte buf throws io exception return this read buf 0 buf length ioexception reads bytes from the current tar archive entry this method is aware of the boundaries of the current entry in the archive and will deal with them as if they were this stream s start and eof param buf the buffer into which to place bytes read param offset the offset at which to place bytes read param num to read the number of bytes to read return the number of bytes read or 1 at eof public int read byte buf int offset int num to read throws io exception int total read 0 if this entry offset this entry size return 1 if num to read this entry offset this entry size num to read this entry size this entry offset if this read buf null int sz num to read this read buf length this read buf length num to read system arraycopy this read buf 0 buf offset sz if sz this read buf length this read buf null else int new len this read buf length sz byte new buf new byte new len system arraycopy this read buf sz new buf 0 new len this read buf new buf total read sz num to read sz offset sz for num to read 0 byte rec this buffer read record if rec null unexpected eof throw new io exception unexpected eof with num to read bytes unread int sz num to read int rec len rec length if rec len sz system arraycopy rec 0 buf offset sz this read buf new byte rec len sz system arraycopy rec sz this read buf 0 rec len sz else sz rec len system arraycopy rec 0 buf offset rec len total read sz num to read sz offset sz this entry offset total read return total read numtoread numtoread ioexception totalread entryoffset entrysize numtoread entryoffset entrysize numtoread entrysize entryoffset readbuf numtoread readbuf readbuf numtoread readbuf readbuf readbuf newlen readbuf newbuf newlen readbuf newbuf newlen readbuf newbuf totalread numtoread numtoread readrecord ioexception numtoread numtoread reclen reclen readbuf reclen readbuf reclen reclen reclen totalread numtoread entryoffset totalread totalread copies the contents of the current tar archive entry directly into an output stream param out the output stream into which to write the entry s data public void copy entry contents output stream out throws io exception byte buf new byte 32 1024 for int num read this read buf 0 buf length if num read 1 break out write buf 0 num read outputstream copyentrycontents outputstream ioexception numread numread numread interface entry factory public tar entry create entry string name entryfactory tarentry createentry create entry string name public tar entry create entry file path throws invalid header exception createentry tarentry createentry invalidheaderexception throws invalid header exception public tar entry create entry byte header buf throws invalid header exception invalidheaderexception tarentry createentry headerbuf invalidheaderexception public tar entry create entry string name return new tar entry name tarentry createentry tarentry public tar entry create entry file path throws invalid header exception return new tar entry path tarentry createentry invalidheaderexception tarentry public tar entry create entry byte header buf throws invalid header exception return new tar entry header buf tarentry createentry headerbuf invalidheaderexception tarentry headerbuf color well button constructor public color well button color color set icon new color well color set margin new insets 2 2 2 2 add action listener new action handler according to krisk this looks better on os x if operating system is macoslf put client property j button button type toolbar colorwellbutton colorwellbutton seticon colorwell setmargin addactionlistener actionhandler operatingsystem ismacoslf putclientproperty jbutton buttontype get selected color method public color get selected color return color well get icon color getselectedcolor getselectedcolor colorwell geticon set selected color method public void set selected color color color color well get icon color color repaint setselectedcolor setselectedcolor colorwell geticon color color color well color color this color color colorwell public int get icon width return 35 geticonwidth public int get icon height return 10 geticonheight public void paint icon component c graphics g int x int y if color null return g set color color g fill rect x y get icon width get icon height g set color color darker g draw rect x y get icon width 1 get icon height 1 painticon setcolor fillrect geticonwidth geticonheight setcolor drawrect geticonwidth geticonheight public void action performed action event evt j dialog parent gui utilities get parent dialog color well button this j dialog dialog if parent null dialog new color picker dialog parent j edit get property color chooser title true else dialog new color picker dialog j option pane get frame for component color well button this j edit get property color chooser title true dialog pack dialog set visible true actionperformed actionevent jdialog guiutilities getparentdialog colorwellbutton jdialog colorpickerdialog jedit getproperty colorchooser colorpickerdialog joptionpane getframeforcomponent colorwellbutton jedit getproperty colorchooser setvisible public color picker dialog frame parent string title boolean modal super parent title modal init colorpickerdialog public color picker dialog dialog parent string title boolean modal super parent title modal get content pane set layout new border layout init colorpickerdialog getcontentpane setlayout borderlayout public void ok color c chooser get color if c null set selected color c set visible false getcolor setselectedcolor setvisible public void cancel set visible false setvisible public void action performed action event evt if evt get source ok ok else cancel actionperformed actionevent getsource private void init color c get selected color if c null chooser new j color chooser else chooser new j color chooser c get content pane add border layout center chooser box buttons new box box layout x axis buttons add box create glue ok new j button j edit get property common ok ok add action listener this buttons add ok buttons add box create horizontal strut 6 get root pane set default button ok cancel new j button j edit get property common cancel cancel add action listener this buttons add cancel buttons add box create glue get content pane add border layout south buttons pack set location relative to get parent getselectedcolor jcolorchooser jcolorchooser getcontentpane borderlayout boxlayout x_axis createglue jbutton jedit getproperty addactionlistener createhorizontalstrut getrootpane setdefaultbutton jbutton jedit getproperty addactionlistener createglue getcontentpane borderlayout setlocationrelativeto getparent mouse option pane constructor public mouse option pane super mouse mouseoptionpane mouseoptionpane init method protected void init text drag and drop drag and drop new j check box j edit get property options mouse drag and drop drag and drop set selected j edit get boolean property view drag and drop add component drag and drop non word character selection behavior join non word chars new j check box j edit get property options mouse join non word chars join non word chars set selected j edit get boolean property view join non word chars add component join non word chars middle mouse button click pastes register middle mouse paste new j check box j edit get property options mouse middle mouse paste middle mouse paste set selected j edit get boolean property view middle mouse paste add component middle mouse paste gutter mouse actions int c click action keys length string click action names new string c for int i 0 i c i click action names i j edit get property options mouse gutter click action keys i c click modifier keys length string click modifier names new string c for int i 0 i c i click modifier names i j edit get property options mouse gutter click modifier keys i gutter click actions new j combo box c for int i 0 i c i j combo box cb new j combo box click action names gutter click actions i cb string val j edit get property view gutter click modifier keys i for int j 0 j click action keys length j if val equals click action keys j cb set selected index j add component click modifier names i cb _init _init draganddrop jcheckbox jedit getproperty draganddrop draganddrop setselected jedit getbooleanproperty draganddrop addcomponent draganddrop joinnonwordchars jcheckbox jedit getproperty joinnonwordchars joinnonwordchars setselected jedit getbooleanproperty joinnonwordchars addcomponent joinnonwordchars middlemousepaste jcheckbox jedit getproperty middlemousepaste middlemousepaste setselected jedit getbooleanproperty middlemousepaste addcomponent middlemousepaste clickactionkeys clickactionnames clickactionnames jedit getproperty clickactionkeys clickmodifierkeys clickmodifiernames clickmodifiernames jedit getproperty clickmodifierkeys gutterclickactions jcombobox jcombobox jcombobox clickactionnames gutterclickactions jedit getproperty clickmodifierkeys clickactionkeys clickactionkeys setselectedindex addcomponent clickmodifiernames save method public void save j edit set boolean property view drag and drop drag and drop is selected j edit set boolean property view join non word chars join non word chars is selected j edit set boolean property view middle mouse paste middle mouse paste is selected int c click modifier keys length for int i 0 i c i int idx gutter click actions i get selected index j edit set property view gutter click modifier keys i click action keys idx _save _save jedit setbooleanproperty draganddrop draganddrop isselected jedit setbooleanproperty joinnonwordchars joinnonwordchars isselected jedit setbooleanproperty middlemousepaste middlemousepaste isselected clickmodifierkeys gutterclickactions getselectedindex jedit setproperty clickmodifierkeys clickactionkeys get print job method private static printer job get print job string job name job printer job get printer job format new hash print request attribute set string settings j edit get settings directory if settings null string print spec path misc utilities construct path settings printspec file file print spec new file print spec path if file print spec exists try file input stream file in new file input stream file print spec object input stream ob in new object input stream file in format hash print request attribute set ob in read object catch exception e log log log error bufferprinter1 4 class e for backwards compatibility the color variable is stored also as a property if j edit get boolean property print color format add chromaticity color else format add chromaticity monochrome no need to always keep the same job name for every printout format add new job name job name null return job getprintjob printerjob getprintjob jobname printerjob getprinterjob hashprintrequestattributeset jedit getsettingsdirectory printspecpath miscutilities constructpath fileprintspec printspecpath fileprintspec fileinputstream filein fileinputstream fileprintspec objectinputstream obin objectinputstream filein hashprintrequestattributeset obin readobject bufferprinter1_4 jedit getbooleanproperty jobname jobname page setup method public static void page setup view view printer job prn job get print job page setup only if prn job page dialog format null save print spec pagesetup pagesetup printerjob prnjob getprintjob pagesetuponly prnjob pagedialog saveprintspec print method public static void print final view view final buffer buffer boolean selection job get print job buffer get path boolean header j edit get boolean property print header boolean footer j edit get boolean property print footer boolean line numbers j edit get boolean property print line numbers boolean color j edit get boolean property print color font font j edit get font property print font buffer printable printable new buffer printable job format view buffer font header footer line numbers color job set printable printable if job print dialog format return save print spec printable print getprintjob getpath jedit getbooleanproperty jedit getbooleanproperty linenumbers jedit getbooleanproperty linenumbers jedit getbooleanproperty jedit getfontproperty bufferprintable bufferprintable linenumbers setprintable printdialog saveprintspec get page format method public static page format get page format convert from print request attribute set to the page format printer job prn job get print job page format pf prn job default page paper pap pf get paper media size name media media size name format get media class media size ms media size get media size for name media media printable area mediaarea media printable area format get media printable area class if mediaarea null pap set imageable area double mediaarea getx media printable area inch 72 double mediaarea gety media printable area inch 72 double mediaarea get width media printable area inch 72 double mediaarea get height media printable area inch 72 if ms null pap set size double ms getx media size inch 72 double ms gety media size inch 72 pf set paper pap orientation requested orientation orientation requested format get orientation requested class if orientation null if orientation get value orientation requested landscape get value pf set orientation page format landscape else if orientation get value orientation requested reverse landscape get value pf set orientation page format reverse landscape else if orientation get value orientation requested portrait get value pf set orientation page format portrait else if orientation get value orientation requested reverse portrait get value doesnt exist pf set orientation page format reverse portrait then just do the next best thing pf set orientation page format portrait return pf getpageformat pageformat getpageformat printrequestattributeset pageformat printerjob prnjob getprintjob pageformat prnjob defaultpage getpaper mediasizename mediasizename mediasize mediasize getmediasizeforname mediaprintablearea mediaprintablearea mediaprintablearea setimageablearea mediaprintablearea mediaprintablearea getwidth mediaprintablearea getheight mediaprintablearea setsize mediasize mediasize setpaper orientationrequested orientationrequested orientationrequested getvalue orientationrequested getvalue setorientation pageformat getvalue orientationrequested reverse_landscape getvalue setorientation pageformat reverse_landscape getvalue orientationrequested getvalue setorientation pageformat getvalue orientationrequested reverse_portrait getvalue setorientation pageformat reverse_portrait setorientation pageformat save print spec method private static void save print spec string settings j edit get settings directory if settings null return string print spec path misc utilities construct path settings printspec file file print spec new file print spec path try file output stream file out new file output stream file print spec object output stream ob out new object output stream file out ob out write object format for backwards compatibility the color variable is stored also as a property chromaticity cc chromaticity format get chromaticity class if cc null j edit set boolean property print color cc get value chromaticity color get value catch exception e e print stack trace saveprintspec saveprintspec jedit getsettingsdirectory printspecpath miscutilities constructpath fileprintspec printspecpath fileoutputstream fileout fileoutputstream fileprintspec objectoutputstream obout objectoutputstream fileout obout writeobject jedit setbooleanproperty getvalue getvalue printstacktrace all buffer set constructor creates a new all buffer set param glob the filename glob since j edit 2 7pre3 public all buffer set string glob this glob glob allbufferset jedit allbufferset get file filter method returns the filename filter since j edit 2 7pre3 public string get file filter return glob getfilefilter jedit getfilefilter get code method returns the bean shell code that will recreate this file set since j edit 2 7pre3 public string get code return new all buffer set misc utilities chars to escapes glob getcode beanshell jedit getcode allbufferset miscutilities charstoescapes getfiles method protected string getfiles component comp buffer buffers j edit get buffers array list return value new array list buffers length re filter try filter new re misc utilities glob tore glob catch exception e log log log error this e return null for int i 0 i buffers length i buffer buffer buffers i if filter is match buffer get name return value add buffer get path return string return value to array new string return value size _getfiles _getfiles jedit getbuffers arraylist returnvalue arraylist miscutilities globtore ismatch getname returnvalue getpath returnvalue toarray returnvalue string var name bsh enhanced for statement int id super id varname bshenhancedforstatement public object eval call stack callstack interpreter interpreter throws eval error class element type null simple node expression statement null name space enclosing name space callstack top simple node first node simple node jjt get child 0 int node count jjt get num children if first node instanceof bsh type element type bsh type first node get type callstack interpreter expression simple node jjt get child 1 if node count 2 statement simple node jjt get child 2 else expression first node if node count 1 statement simple node jjt get child 1 block name space each name space new block name space enclosing name space callstack swap each name space final object iteratee expression eval callstack interpreter if iteratee primitive null throw new eval error the collection array map iterator or enumeration portion of a for statement cannot be null this callstack collection manager cm collection manager get collection manager if cm is bsh iterable iteratee throw new eval error can t iterate over type iteratee get class this callstack bsh iterator iterator cm get bsh iterator iteratee object return control primitive void while iterator has next try if element type null each name space set typed variable var name element type iterator next false else each name space set variable var name iterator next false catch util eval error e throw e to eval error for loop iterator variable var name this callstack boolean breakout false switch eats a multi level break here if statement null not empty statement object ret statement eval callstack interpreter if ret instanceof return control switch return control ret kind case return return control ret breakout true break case continue break case break breakout true break if breakout break callstack swap enclosing name space return return control callstack evalerror elementtype simplenode namespace enclosingnamespace simplenode firstnode simplenode jjtgetchild nodecount jjtgetnumchildren firstnode bshtype elementtype bshtype firstnode gettype simplenode jjtgetchild nodecount simplenode jjtgetchild firstnode nodecount simplenode jjtgetchild blocknamespace eachnamespace blocknamespace enclosingnamespace eachnamespace evalerror collectionmanager collectionmanager getcollectionmanager isbshiterable evalerror getclass bshiterator getbshiterator returncontrol hasnext elementtype eachnamespace settypedvariable varname elementtype eachnamespace setvariable varname utilevalerror toevalerror varname returncontrol returncontrol returncontrol enclosingnamespace returncontrol action bar constructor public action bar final view view boolean temp set layout new box layout this box layout x axis this view view this temp temp add box create horizontal strut 2 j label label new j label j edit get property view action prompt add label add box create horizontal strut 12 add action new action text field action set enter adds to history false dimension max action get preferred size max width integer max value action set maximum size max action add action listener new action handler action get document add document listener new document handler if temp close new rollover button gui utilities load icon closebox gif close add action listener new action handler close set tool tip text j edit get property view action close tooltip add close if temp is true hide search bar after user is done with it this temp temp actionbar actionbar setlayout boxlayout boxlayout x_axis createhorizontalstrut jlabel jlabel jedit getproperty createhorizontalstrut actiontextfield setenteraddstohistory getpreferredsize max_value setmaximumsize addactionlistener actionhandler getdocument adddocumentlistener documenthandler rolloverbutton guiutilities loadicon addactionlistener actionhandler settooltiptext jedit getproperty get field method public history text field get field return action getfield historytextfield getfield go to action bar method public void go to action bar repeat count view get input handler get repeat count action set text null action request focus gotoactionbar gotoactionbar repeatcount getinputhandler getrepeatcount settext requestfocus invoke method private void invoke string cmd if popup null cmd popup list get selected value to string else cmd action get text trim int index cmd index of if index 1 action add current to history string prop name cmd substring 0 index trim string prop value cmd substring index 1 trim string code construct a bean shell snippet instead of invoking directly so that user can record property changes in macros if prop name starts with buffer if prop name equals buffer mode code buffer set mode misc utilities chars to escapes prop value else code buffer set string property misc utilities chars to escapes prop name substring buffer length misc utilities chars to escapes prop value code code nbuffer properties changed else if prop name starts with buffer code j edit set property misc utilities chars to escapes prop name substring 1 misc utilities chars to escapes prop value n j edit properties changed else code j edit set property misc utilities chars to escapes prop name misc utilities chars to escapes prop value n j edit properties changed macros recorder recorder view get macro recorder if recorder null recorder record code bean shell eval view namespace code cmd null else if cmd length 0 string completions get completions cmd if completions length 0 cmd completions 0 else cmd null if popup null popup dispose popup null final string final cmd cmd final edit action act final cmd null null j edit get action final cmd if temp view remove tool bar action bar this swing utilities invoke later new runnable public void run view get text area request focus if act null if final cmd null view get status set message and clear j edit get property view action no completions else view get input handler set repeat count repeat count view get input handler invoke action act getselectedvalue tostring gettext indexof addcurrenttohistory propname propvalue beanshell propname startswith propname setmode miscutilities charstoescapes propvalue setstringproperty miscutilities charstoescapes propname miscutilities charstoescapes propvalue propertieschanged propname startswith jedit setproperty miscutilities charstoescapes propname miscutilities charstoescapes propvalue jedit propertieschanged jedit setproperty miscutilities charstoescapes propname miscutilities charstoescapes propvalue jedit propertieschanged getmacrorecorder beanshell getcompletions finalcmd editaction finalcmd jedit getaction finalcmd removetoolbar actionbar swingutilities invokelater gettextarea requestfocus finalcmd getstatus setmessageandclear jedit getproperty getinputhandler setrepeatcount repeatcount getinputhandler invokeaction public void run view get text area request focus if act null if final cmd null view get status set message and clear j edit get property view action no completions else view get input handler set repeat count repeat count view get input handler invoke action act gettextarea requestfocus finalcmd getstatus setmessageandclear jedit getproperty getinputhandler setrepeatcount repeatcount getinputhandler invokeaction get completions method private string get completions string str str str to lower case string actions j edit get action names array list return value new array list actions length for int i 0 i actions length i if actions i to lower case index of str 1 return value add actions i return string return value to array new string return value size getcompletions getcompletions tolowercase jedit getactionnames arraylist returnvalue arraylist tolowercase indexof returnvalue returnvalue toarray returnvalue complete method private void complete boolean insert longest prefix string text action get text trim string completions get completions text if completions length 1 if insert longest prefix action set text completions 0 else if completions length 0 if insert longest prefix string prefix misc utilities get longest prefix completions true if prefix index of text 1 action set text prefix if popup null popup set model completions else popup new completion popup completions return if popup null popup dispose popup null insertlongestprefix gettext getcompletions insertlongestprefix settext insertlongestprefix miscutilities getlongestprefix indexof settext setmodel completionpopup public void action performed action event evt if evt get source close view remove tool bar action bar this else invoke actionperformed actionevent getsource removetoolbar actionbar insert update method public void insert update document event evt if popup null complete false insertupdate insertupdate documentevent remove update method public void remove update document event evt if popup null complete false removeupdate removeupdate documentevent changed update method public void changed update document event evt changedupdate changedupdate documentevent action text field super action set select all on focus true actiontextfield setselectallonfocus public boolean is managing focus return false ismanagingfocus public boolean get focus traversal keys enabled return false getfocustraversalkeysenabled public void process key event key event evt evt key event workaround process key event evt if evt null return switch evt getid case key event key typed char ch evt get key char if non digit character is digit ch super process key event evt repeat true repeat count integer parse int action get text else non digit true if repeat pass to view evt else super process key event evt break case key event key pressed int key code evt get key code if evt is action key evt is control down evt is alt down evt is meta down key code key event vk back space key code key event vk delete key code key event vk enter key code key event vk tab key code key event vk escape non digit true if repeat pass to view evt break else if key code key event vk tab complete true evt consume else if key code key event vk escape evt consume if popup null popup dispose popup null action request focus else if temp view remove tool bar action bar this view get edit pane focus on text area break else if key code key event vk up key code key event vk down popup null popup list process key event evt break super process key event evt break processkeyevent keyevent keyeventworkaround processkeyevent keyevent key_typed getkeychar nondigit isdigit processkeyevent repeatcount parseint gettext nondigit passtoview processkeyevent keyevent key_pressed keycode getkeycode isactionkey iscontroldown isaltdown ismetadown keycode keyevent vk_back_space keycode keyevent vk_delete keycode keyevent vk_enter keycode keyevent vk_tab keycode keyevent vk_escape nondigit passtoview keycode keyevent vk_tab keycode keyevent vk_escape requestfocus removetoolbar actionbar geteditpane focusontextarea keycode keyevent vk_up keycode keyevent vk_down processkeyevent processkeyevent private void pass to view final key event evt if temp view remove tool bar action bar this view get text area request focus swing utilities invoke later new runnable public void run view get text area request focus view get input handler set repeat count repeat count view process key event evt view action bar passtoview keyevent removetoolbar actionbar gettextarea requestfocus swingutilities invokelater gettextarea requestfocus getinputhandler setrepeatcount repeatcount processkeyevent action_bar public void run view get text area request focus view get input handler set repeat count repeat count view process key event evt view action bar gettextarea requestfocus getinputhandler setrepeatcount repeatcount processkeyevent action_bar public void add notify super add notify repeat non digit false addnotify addnotify nondigit completion popup constructor completion popup string actions super view set content pane new j panel new border layout returns if this component can be traversed by pressing the tab key this returns false public boolean is managing focus return false makes the tab key work in java 1 4 public boolean get focus traversal keys enabled return false list new completion list actions list set visible row count 8 list add mouse listener new mouse handler list set selected index 0 list set selection mode list selection model single selection stupid scrollbar policy is an attempt to work around bugs people have been seeing with ibm s jdk 7 sep 2000 j scroll pane scroller new j scroll pane list j scroll pane vertical scrollbar always j scroll pane horizontal scrollbar never get content pane add scroller border layout center gui utilities request focus this list pack point p new point 0 get height swing utilities convert point to screen p action set location p set visible true key handler key handler new key handler add key listener key handler list add key listener key handler completionpopup completionpopup setcontentpane jpanel borderlayout ismanagingfocus getfocustraversalkeysenabled completionlist setvisiblerowcount addmouselistener mousehandler setselectedindex setselectionmode listselectionmodel single_selection jscrollpane jscrollpane jscrollpane vertical_scrollbar_always jscrollpane horizontal_scrollbar_never getcontentpane borderlayout guiutilities requestfocus getheight swingutilities convertpointtoscreen setlocation setvisible keyhandler keyhandler keyhandler addkeylistener keyhandler addkeylistener keyhandler returns if this component can be traversed by pressing the tab key this returns false public boolean is managing focus return false ismanagingfocus makes the tab key work in java 1 4 public boolean get focus traversal keys enabled return false getfocustraversalkeysenabled set model method void set model string actions list set list data actions list set selected index 0 setmodel setmodel setlistdata setselectedindex class mouse handler extends mouse adapter public void mouse clicked mouse event evt invoke mousehandler mouseadapter mouseclicked mouseevent class completion list extends j list completion list object data super data completionlist jlist completionlist we need this public not protected public void process key event key event evt super process key event evt processkeyevent keyevent processkeyevent class key handler extends key adapter public void key typed key event evt action process key event evt keyhandler keyadapter keytyped keyevent processkeyevent public void key pressed key event evt int key code evt get key code if key code key event vk escape action process key event evt else if key code key event vk enter invoke else if key code key event vk up int selected list get selected index if selected 0 list set selected index list get model get size 1 evt consume else if key code key event vk down int selected list get selected index if selected list get model get size 1 list set selected index 0 evt consume keypressed keyevent keycode getkeycode keycode keyevent vk_escape processkeyevent keycode keyevent vk_enter keycode keyevent vk_up getselectedindex setselectedindex getmodel getsize keycode keyevent vk_down getselectedindex getmodel getsize setselectedindex creates an re filter reader when reading from this stream occurrences of patterns matching the supplied regular expression will be replaced with the supplied replacement text the metacharacters 0 through 9 may be used to refer to the full match or subexpression matches param stream the reader to be filtered param expr the regular expression to search for param replace the text pattern to replace matches with public re filter reader reader stream re expr string replace super stream this stream new char indexed reader stream 0 this expr expr this replace replace refilterreader refilterreader charindexedreader reads the next character from the stream per the general contract of reader read returns 1 on error or end of stream public int read if we have buffered replace data use it if buffer null bufpos buffer length return int buffer char at bufpos check if input is at a valid position if stream is valid return 1 re match mymatch new re match expr get num subs offset 0 if expr match stream mymatch mymatch end 0 mymatch index mymatch finish stream stream move mymatch to string length offset mymatch to string length buffer mymatch substitute into replace bufpos 1 if buffer length 0 return buffer char at 0 char ch stream char at 0 if ch char indexed out of bounds return 1 stream move 1 offset return ch charat isvalid rematch rematch getnumsubs tostring tostring substituteinto charat charat charindexed out_of_bounds returns false re filter reader does not support mark and reset methods public boolean mark supported return false refilterreader marksupported reads from the stream into the provided array public int read char b int off int len int i int ok 0 while len 0 i read if i 1 return ok 0 1 ok b off char i ok return ok reads from the stream into the provided array public int read char b return read b 0 b length final class re token end sub extends re token re token end sub int sub index super sub index retokenendsub retoken retokenendsub subindex subindex boolean match char indexed input re match mymatch mymatch end sub index mymatch index return next input mymatch charindexed rematch subindex void dump string buffer os handled by re stringbuffer io progress monitor constructor public io progress monitor super new border layout caption new j label update caption add border layout north caption threads new thread progress vfs manager getio thread pool get thread count box box new box box layout y axis for int i 0 i threads length i if i 0 box add box create vertical strut 6 threads i new thread progress i box add threads i j panel thread panel new j panel new border layout thread panel set border new empty border 6 6 6 6 thread panel add border layout north box add border layout center new j scroll pane thread panel work thread handler new work thread handler ioprogressmonitor ioprogressmonitor borderlayout jlabel updatecaption borderlayout threadprogress vfsmanager getiothreadpool getthreadcount boxlayout y_axis createverticalstrut threadprogress jpanel threadpanel jpanel borderlayout threadpanel setborder emptyborder threadpanel borderlayout borderlayout jscrollpane threadpanel workthreadhandler workthreadhandler add notify method public void add notify vfs manager getio thread pool add progress listener work thread handler super add notify addnotify addnotify vfsmanager getiothreadpool addprogresslistener workthreadhandler addnotify remove notify method public void remove notify vfs manager getio thread pool remove progress listener work thread handler super remove notify removenotify removenotify vfsmanager getiothreadpool removeprogresslistener workthreadhandler removenotify update caption method private void update caption string args string value of vfs manager getio thread pool get request count caption set text j edit get property io progress monitor caption args updatecaption updatecaption valueof vfsmanager getiothreadpool getrequestcount settext jedit getproperty public void status update final work thread pool pool final int index swing utilities invoke later new runnable public void run update caption threads index update statusupdate workthreadpool swingutilities invokelater updatecaption public void run update caption threads index update updatecaption public void progress update final work thread pool pool final int index swing utilities invoke later new runnable public void run update caption threads index update progressupdate workthreadpool swingutilities invokelater updatecaption public void run update caption threads index update updatecaption thread progress constructor public thread progress int index super new border layout 12 12 this index index box box new box box layout y axis box add box create glue box add progress new j progress bar progress set string painted true box add box create glue thread progress this add border layout center box abort new j button j edit get property io progress monitor abort abort add action listener new action handler thread progress this add border layout east abort update threadprogress threadprogress borderlayout boxlayout y_axis createglue jprogressbar setstringpainted createglue threadprogress borderlayout jbutton jedit getproperty addactionlistener actionhandler threadprogress borderlayout update method public void update work thread thread vfs manager getio thread pool get thread index if thread is request running abort set enabled true string status thread get status if status null status progress set string status progress set maximum thread get progress maximum system err println value thread get progress value progress set value thread get progress value else abort set enabled false progress set string j edit get property io progress monitor idle progress set value 0 workthread vfsmanager getiothreadpool getthread isrequestrunning setenabled getstatus setstring setmaximum getprogressmaximum getprogressvalue setvalue getprogressvalue setenabled setstring jedit getproperty setvalue public void action performed action event evt if evt get source abort int result gui utilities confirm io progress monitor this abort null j option pane yes no option j option pane question message if result j option pane yes option vfs manager getio thread pool get thread index abort current request actionperformed actionevent getsource guiutilities ioprogressmonitor joptionpane yes_no_option joptionpane question_message joptionpane yes_option vfsmanager getiothreadpool getthread abortcurrentrequest canon path method returns the canonical form of the specified path name currently only expands a leading code code b for local path names only b param path the path name since j edit 4 0pre2 public static string canon path string path if path length 0 return path if path starts with file path path substring file length else if path starts with file path path substring file length else if isurl path return path if file separator char get rid of mixed paths on windows path path replace also get rid of trailing spaces on windows int trim path length while path char at trim 1 trim path path substring 0 trim else if operating system is macos do the same on os x path path replace if path starts with file separator path path substring 2 string home system get property user home if home ends with file separator return home path else return home file separator path else if path equals return system get property user home else return path canonpath jedit canonpath startswith startswith separatorchar charat operatingsystem ismacos startswith getproperty endswith getproperty resolve symlinks method resolves any symbolic links in the path name specified using code file get canonical path code b for local path names only b since j edit 4 2pre1 public static string resolve symlinks string path if isurl path return path 2 aug 2003 os 2 java has a broken get canonical path if operating system isos2 return path 18 nov 2003 calling this on a drive letter on windows causes drive access if operating system isdos derived if path length 2 path length 3 if path char at 1 return path try return new file path get canonical path catch io exception io return path resolvesymlinks getcanonicalpath jedit resolvesymlinks getcanonicalpath operatingsystem operatingsystem isdosderived charat getcanonicalpath ioexception is absolute path method returns if the specified path name is an absolute path or url since j edit 4 1pre11 public static boolean is absolute path string path if isurl path return true else if path starts with path starts with file separator path equals return true else if operating system isdos derived if path length 2 path char at 1 return true if path length 2 path char at 1 path char at 2 path char at 2 return true if path starts with path starts with return true not sure if this is correct for openvms else if operating system is unix operating system isvms nice and simple if path length 0 path char at 0 return true return false isabsolutepath jedit isabsolutepath startswith startswith operatingsystem isdosderived charat charat charat charat startswith startswith operatingsystem isunix operatingsystem charat construct path method constructs an absolute path name from a directory and another path name this method is vfs aware param parent the directory param path the path name public static string construct path string parent string path if is absolute path path return canon path path have to handle this case specially on windows insert between eg a and myfile txt if operating system isdos derived if path length 2 path char at 1 return path else if path length 2 path char at 1 path char at 2 path path substring 0 2 path substring 2 return canon path path string dd file separator string d file separator if parent null parent system get property user dir for if path equals return parent else if path equals return get parent of path parent else if path starts with dd path starts with parent get parent of path parent path path substring 3 else if path starts with d path starts with path path substring 2 else break if operating system isdos derived isurl parent path starts with parent parent substring 0 2 vfs vfs vfs manager getvfs for path parent return canon path vfs construct path parent path constructpath constructpath isabsolutepath canonpath operatingsystem isdosderived charat charat charat canonpath getproperty getparentofpath startswith startswith getparentofpath startswith startswith operatingsystem isdosderived startswith vfsmanager getvfsforpath canonpath constructpath construct path method constructs an absolute path name from three path components this method is vfs aware param parent the parent directory param path1 the first path param path2 the second path public static string construct path string parent string path1 string path2 return construct path construct path parent path1 path2 constructpath constructpath constructpath constructpath concat path method like link construct path except code path code will be appended to code parent code even if it is absolute b for local path names only b param path param parent public static string concat path string parent string path parent canon path parent path canon path path make all child paths relative if path starts with file separator path path substring 1 else if path length 3 path char at 1 path path replace file separator char if parent null parent system get property user dir if parent ends with file separator return parent path else return parent file separator path concatpath constructpath concatpath canonpath canonpath startswith charat separatorchar getproperty endswith get file extension method returns the extension of the specified filename or an empty string if there is none param name the file name or path public static string get file extension string name int fs index math max name index of name index of file separator char int index name index of fs index if index 1 return else return name substring index getfileextension getfileextension fsindex indexof indexof separatorchar indexof fsindex get file name method returns the last component of the specified path this method is vfs aware param path the path name public static string get file name string path return vfs manager getvfs for path path get file name path getfilename getfilename vfsmanager getvfsforpath getfilename get file name no extension method returns the last component of the specified path name without the trailing extension if there is one param path the path name since j edit 4 0pre8 public static string get file name no extension string path string name get file name path int index name index of if index 1 return name else return name substring 0 index getfilenamenoextension jedit getfilenamenoextension getfilename indexof get file parent method deprecated call get parent of path instead public static string get file parent string path return get parent of path path getfileparent getparentofpath getfileparent getparentofpath get parent of path method returns the parent of the specified path this method is vfs aware param path the path name since j edit 2 6pre5 public static string get parent of path string path return vfs manager getvfs for path path get parent of path path getparentofpath jedit getparentofpath vfsmanager getvfsforpath getparentofpath get file protocol method deprecated call get protocol ofurl instead public static string get file protocol string url return get protocol ofurl url getfileprotocol getprotocolofurl getfileprotocol getprotocolofurl get protocol ofurl method returns the protocol specified by a url param url the url since j edit 2 6pre5 public static string get protocol ofurl string url return url substring 0 url index of getprotocolofurl jedit getprotocolofurl indexof isurl method checks if the specified string is a url param str the string to check return true if the string is a url false otherwise public static boolean isurl string str int fs index math max str index of file separator char str index of if fs index 0 etc passwd return false else if fs index 2 c autoexec bat return false int c index str index of if c index 1 d windows or doesn t contain at all return false string protocol str substring 0 c index vfs vfs vfs manager getvfs for protocol protocol if vfs null vfs instanceof urlvfs return true try new url str return true catch malformedurl exception mf return false fsindex indexof separatorchar indexof fsindex fsindex cindex indexof cindex cindex vfsmanager getvfsforprotocol malformedurlexception save backup method saves a backup optionally numbered of a file param file a local file param backups the number of backups must be 1 if 1 backup files will be numbered param backup prefix the backup file name prefix param backup suffix the backup file name suffix param backup directory the directory where to save backups if null they will be saved in the same directory as the file itself since j edit 4 0pre1 public static void save backup file file int backups string backup prefix string backup suffix string backup directory save backup file backups backup prefix backup suffix backup directory 0 savebackup backupprefix backupsuffix backupdirectory jedit savebackup backupprefix backupsuffix backupdirectory savebackup backupprefix backupsuffix backupdirectory save backup method saves a backup optionally numbered of a file param file a local file param backups the number of backups must be 1 if 1 backup files will be numbered param backup prefix the backup file name prefix param backup suffix the backup file name suffix param backup directory the directory where to save backups if null they will be saved in the same directory as the file itself param backup time distance the minimum time in minutes when a backup version 1 shall be moved into version 2 if 0 backups are always moved since j edit 4 2pre5 public static void save backup file file int backups string backup prefix string backup suffix string backup directory int backup time distance if backup prefix null backup prefix if backup suffix null backup suffix string name file get name if backups is 1 create file if backups 1 file backup file new file backup directory backup prefix name backup suffix long mod time backup file last modified if backup file was created less than backup time distance ago we do not create the backup if system current time millis mod time backup time distance backup file delete file rename to backup file if backups 1 move old n files create 1 file else delete a backup created using above method new file backup directory backup prefix name backup suffix backups backup suffix delete file first backup new file backup directory backup prefix name backup suffix 1 backup suffix long mod time first backup last modified if backup file was created less than backup time distance ago we do not create the backup if system current time millis mod time backup time distance for int i backups 1 i 0 i file backup new file backup directory backup prefix name backup suffix i backup suffix backup rename to new file backup directory backup prefix name backup suffix i 1 backup suffix file rename to new file backup directory backup prefix name backup suffix 1 backup suffix savebackup backupprefix backupsuffix backupdirectory backuptimedistance jedit savebackup backupprefix backupsuffix backupdirectory backuptimedistance backupprefix backupprefix backupsuffix backupsuffix getname backupfile backupdirectory backupprefix backupsuffix modtime backupfile lastmodified backuptimedistance currenttimemillis modtime backuptimedistance backupfile renameto backupfile backupdirectory backupprefix backupsuffix backupsuffix firstbackup backupdirectory backupprefix backupsuffix backupsuffix modtime firstbackup lastmodified backuptimedistance currenttimemillis modtime backuptimedistance backupdirectory backupprefix backupsuffix backupsuffix renameto backupdirectory backupprefix backupsuffix backupsuffix renameto backupdirectory backupprefix backupsuffix backupsuffix file to class method converts a file name to a class name all slash characters are replaced with periods and the trailing class is removed param name the file name public static string file to class string name char cls name name to char array for int i cls name length 6 i 0 i if cls name i cls name i return new string cls name 0 cls name length 6 filetoclass filetoclass clsname tochararray clsname clsname clsname clsname clsname class to file method converts a class name to a file name all periods are replaced with slashes and the class extension is added param name the class name public static string class to file string name return name replace concat class classtofile classtofile get leading white space method returns the number of leading white space characters in the specified string param str the string public static int get leading white space string str int whitespace 0 loop for whitespace str length switch str char at whitespace case case t whitespace break default break loop return whitespace getleadingwhitespace getleadingwhitespace charat get trailing white space method returns the number of trailing whitespace characters in the specified string param str the string since j edit 2 5pre5 public static int get trailing white space string str int whitespace 0 loop for int i str length 1 i 0 i switch str char at i case case t whitespace break default break loop return whitespace gettrailingwhitespace jedit gettrailingwhitespace charat get leading white space width method returns the width of the leading white space in the specified string param str the string param tab size the tab size public static int get leading white space width string str int tab size int whitespace 0 loop for int i 0 i str length i switch str char at i case whitespace break case t whitespace tab size whitespace tab size break default break loop return whitespace getleadingwhitespacewidth tabsize getleadingwhitespacewidth tabsize charat tabsize tabsize get virtual width method returns the virtual column number taking tabs into account of the specified offset in the segment param seg the segment param tab size the tab size since j edit 4 1pre1 public static int get virtual width segment seg int tab size int virtual position 0 for int i 0 i seg count i char ch seg array seg offset i if ch t virtual position tab size virtual position tab size else virtual position return virtual position getvirtualwidth tabsize jedit getvirtualwidth tabsize virtualposition virtualposition tabsize virtualposition tabsize virtualposition virtualposition get offset of virtual column method returns the array offset of a virtual column number taking tabs into account in the segment param seg the segment param tab size the tab size param column the virtual column number param total virtual width if this array is non null the total virtual width will be stored in its first location if this method returns 1 return 1 if the column is out of bounds since j edit 4 1pre1 public static int get offset of virtual column segment seg int tab size int column int total virtual width int virtual position 0 for int i 0 i seg count i char ch seg array seg offset i if ch t int tab width tab size virtual position tab size if virtual position column return i else virtual position tab width else if virtual position column return i else virtual position if total virtual width null total virtual width 0 virtual position return 1 getoffsetofvirtualcolumn tabsize totalvirtualwidth jedit getoffsetofvirtualcolumn tabsize totalvirtualwidth virtualposition tabwidth tabsize virtualposition tabsize virtualposition virtualposition tabwidth virtualposition virtualposition totalvirtualwidth totalvirtualwidth virtualposition create white space method creates a string of white space with the specified length p to get a whitespace string tuned to the current buffer s settings call this method as follows pre my whitespace misc utilities create white space my length buffer get boolean property no tabs 0 buffer get tab size pre param len the length param tab size the tab size or 0 if tabs are not to be used public static string create white space int len int tab size return create white space len tab size 0 createwhitespace mywhitespace miscutilities createwhitespace mylength getbooleanproperty notabs gettabsize tabsize createwhitespace tabsize createwhitespace tabsize create white space method creates a string of white space with the specified length p to get a whitespace string tuned to the current buffer s settings call this method as follows pre my whitespace misc utilities create white space my length buffer get boolean property no tabs 0 buffer get tab size pre param len the length param tab size the tab size or 0 if tabs are not to be used param start the start offset for tab alignment since j edit 4 2pre1 public static string create white space int len int tab size int start string buffer buf new string buffer if tab size 0 while len 0 buf append else if len 1 buf append else int count len start tab size tab size if count 0 len start while count 0 buf append t count len tab size while count 0 buf append return buf to string createwhitespace mywhitespace miscutilities createwhitespace mylength getbooleanproperty notabs gettabsize tabsize jedit createwhitespace tabsize stringbuffer stringbuffer tabsize tabsize tabsize tabsize tostring glob tore method converts a unix style glob to a regular expression p becomes becomes aa bb becomes aa bb param glob the glob pattern public static string glob tore string glob final object neg new object final object group new object stack state new stack string buffer buf new string buffer boolean backslash false for int i 0 i glob length i char c glob char at i if backslash buf append buf append c backslash false continue switch c case backslash true break case buf append break case case case case buf append buf append c break case buf append break case if backslash buf append else buf append break case buf append if i 1 glob length glob char at i 1 buf append state push neg else state push group break case if state is empty state peek group buf append else buf append break case if state is empty buf append if state pop neg buf append else buf append break default buf append c return buf to string globtore globtore stringbuffer stringbuffer charat charat isempty isempty tostring escapes to chars method converts n and t escapes in the specified string to newlines and tabs param str the string since j edit 2 3pre1 public static string escapes to chars string str string buffer buf new string buffer for int i 0 i str length i char c str char at i switch c case if i str length 1 buf append break c str char at i switch c case n buf append n break case t buf append t break default buf append c break break default buf append c return buf to string escapestochars jedit escapestochars stringbuffer stringbuffer charat charat tostring chars to escapes method escapes newlines tabs backslashes and quotes in the specified string param str the string since j edit 2 3pre1 public static string chars to escapes string str return chars to escapes str n t charstoescapes jedit charstoescapes charstoescapes chars to escapes method escapes the specified characters in the specified string param str the string param to escape any characters that require escaping since j edit 4 1pre3 public static string chars to escapes string str string to escape string buffer buf new string buffer for int i 0 i str length i char c str char at i if to escape index of c 1 if c n buf append n else if c t buf append t else buf append buf append c else buf append c return buf to string charstoescapes toescape jedit charstoescapes toescape stringbuffer stringbuffer charat toescape indexof tostring compare versions method deprecated call code compare strings code instead public static int compare versions string v1 string v2 return compare strings v1 v2 false compareversions comparestrings compareversions comparestrings compare strings method compares two strings p unlike function string compare to function this method correctly recognizes and handles embedded numbers for example it places my file 2 before my file 10 p param str1 the first string param str2 the second string param ignore case if true case will be ignored return negative if str1 lt str2 0 if both are the same positive if str1 gt str2 since j edit 4 0pre1 public static int compare strings string str1 string str2 boolean ignore case char char1 str1 to char array char char2 str2 to char array int len math min char1 length char2 length for int i 0 j 0 i len j len i j char ch1 char1 i char ch2 char2 j if character is digit ch1 character is digit ch2 ch1 0 ch2 0 int i i 1 int j j 1 for i char1 length i if character is digit char1 i i break for j char2 length j if character is digit char2 j j break int len1 i i int len2 j j if len1 len2 return 1 else if len1 len2 return 1 else for int k 0 k len1 k ch1 char1 i k ch2 char2 j k if ch1 ch2 return ch1 ch2 i i 1 j j 1 else if ignore case ch1 character to lower case ch1 ch2 character to lower case ch2 if ch1 ch2 return ch1 ch2 return char1 length char2 length comparestrings compareto ignorecase jedit comparestrings ignorecase tochararray tochararray isdigit isdigit _i _j _i _i isdigit _i _i _j _j isdigit _j _j _i _j _i _j ignorecase tolowercase tolowercase strings equal method deprecated call code objects equal code instead public static boolean strings equal string s1 string s2 return objects equal s1 s2 stringsequal objectsequal stringsequal objectsequal objects equal method returns if two strings are equal this correctly handles null pointers as opposed to calling code o1 equals o2 code since j edit 4 2pre1 public static boolean objects equal object o1 object o2 if o1 null if o2 null return true else return false else if o2 null return false else return o1 equals o2 objectsequal jedit objectsequal chars to entities method converts lt gt amp in the string to their html entity equivalents param str the string since j edit 4 2pre1 public static string chars to entities string str string buffer buf new string buffer str length for int i 0 i str length i char ch str char at i switch ch case buf append lt break case buf append gt break case buf append amp break default buf append ch break return buf to string charstoentities jedit charstoentities stringbuffer stringbuffer charat tostring formats the given file size into a nice string 123 bytes 10 6 kb 1 2 mb param length the size since j edit 4 2pre1 public static string format file size long length if length 1024 return length bytes else if length 1024 1024 return kb format format double length 1024 else return mb format format double length 1024 1024 jedit formatfilesize kb_format mb_format get longest prefix method returns the longest common prefix in the given set of strings param str the strings param ignore case if true case insensitive since j edit 4 2pre2 public static string get longest prefix list str boolean ignore case if str size 0 return int prefix length 0 loop for string s str get 0 to string if prefix length s length break loop char ch s char at prefix length for int i 1 i str size i s str get i to string if prefix length s length break loop if compare chars s char at prefix length ch ignore case break loop prefix length return str get 0 to string substring 0 prefix length getlongestprefix ignorecase jedit getlongestprefix ignorecase prefixlength tostring prefixlength charat prefixlength tostring prefixlength comparechars charat prefixlength ignorecase prefixlength tostring prefixlength get longest prefix method returns the longest common prefix in the given set of strings param str the strings param ignore case if true case insensitive since j edit 4 2pre2 public static string get longest prefix string str boolean ignore case return get longest prefix object str ignore case getlongestprefix ignorecase jedit getlongestprefix ignorecase getlongestprefix ignorecase get longest prefix method returns the longest common prefix in the given set of strings param str the strings calls code to string code on each object param ignore case if true case insensitive since j edit 4 2pre6 public static string get longest prefix object str boolean ignore case if str length 0 return int prefix length 0 string first str 0 to string loop for if prefix length first length break loop char ch first char at prefix length for int i 1 i str length i string s str i to string if prefix length s length break loop if compare chars s char at prefix length ch ignore case break loop prefix length return first substring 0 prefix length getlongestprefix tostring ignorecase jedit getlongestprefix ignorecase prefixlength tostring prefixlength charat prefixlength tostring prefixlength comparechars charat prefixlength ignorecase prefixlength prefixlength quicksort method sorts the specified array equivalent to calling code arrays sort code param obj the array param compare compares the objects since j edit 4 0pre4 public static void quicksort object obj comparator compare arrays sort obj compare jedit quicksort method sorts the specified vector param vector the vector param compare compares the objects since j edit 4 0pre4 public static void quicksort vector vector comparator compare collections sort vector compare jedit quicksort method sorts the specified list param list the list param compare compares the objects since j edit 4 0pre4 public static void quicksort list list comparator compare collections sort list compare jedit quicksort method sorts the specified array equivalent to calling code arrays sort code param obj the array param compare compares the objects public static void quicksort object obj compare compare arrays sort obj compare quicksort method sorts the specified vector param vector the vector param compare compares the objects public static void quicksort vector vector compare compare collections sort vector compare public interface compare extends comparator int compare object obj1 object obj2 public int compare object obj1 object obj2 return compare strings obj1 to string obj2 to string false comparestrings tostring tostring public int compare object obj1 object obj2 return compare strings obj1 to string obj2 to string true comparestrings tostring tostring public int compare object obj1 object obj2 return compare strings j menu item obj1 get text j menu item obj2 get text true comparestrings jmenuitem gettext jmenuitem gettext build to version method converts an internal version number build into a human readable form param build the build public static string build to version string build if build length 11 return unknown version build first 2 chars are the major version number int major integer parse int build substring 0 2 second 2 are the minor number int minor integer parse int build substring 3 5 then the pre release status int beta integer parse int build substring 6 8 finally the bug fix release int bugfix integer parse int build substring 9 11 return major minor beta 99 pre beta bugfix 0 bugfix final buildtoversion buildtoversion parseint parseint parseint parseint is tools jar available method if on jdk 1 2 or higher make sure that tools jar is available this method should be called by plugins requiring the classes in this library p tools jar is searched for in the following places ol li the classpath that was used when j edit was started li j edit s jars folder in the user s home li j edit s system jars folder li i java home i lib in this case tools jar is added to j edit s list of known jars using j edit add pluginjar so that it gets loaded through jar class loader ol p on older jdk s this method does not perform any checks and returns code true code even though there is no tools jar return code false code if and only if on jdk 1 2 and tools jar could not be found in this case it prints some warnings on log too about the places where it was searched for since j edit 3 2 2 public static boolean is tools jar available log log log debug misc utilities class searching for tools jar vector paths new vector 1 check whether tools jar is in the system classpath paths add element system classpath system get property java class path try either class sun tools javac main or com sun tools javac main must be there try class for name sun tools javac main catch class not found exception e1 class for name com sun tools javac main log log log debug misc utilities class is in classpath fine return true catch class not found exception e log log log debug misc utilities class is not in system classpath 2 check whether it is in the j edit user settings jars folder string settings dir j edit get settings directory if settings dir null string tools path construct path settings dir jars tools jar paths add element tools path if new file tools path exists log log log debug misc utilities class is in the user s jars folder fine j edit will load it automatically return true 3 check whether it is in j edit s system jars folder string j edit dir j edit getj edit home if j edit dir null string tools path construct path j edit dir jars tools jar paths add element tools path if new file tools path exists log log log debug misc utilities class is in j edit s system jars folder fine j edit will load it automatically return true 4 check whether it is in java home lib string tools path system get property java home if tools path to lower case ends with file separator jre tools path tools path substring 0 tools path length 4 tools path construct path tools path lib tools jar paths add element tools path if new file tools path exists log log log warning misc utilities class could not find tools jar n i checked the following locations n paths to string return false load it if not yet done pluginjar jar j edit get pluginjar tools path if jar null log log log debug misc utilities class adding tools path to j edit plugins j edit add pluginjar tools path else log log log debug misc utilities class has been loaded before return true istoolsjaravailable jedit jedit jedit jedit jedit addpluginjar jarclassloader jedit istoolsjaravailable miscutilities addelement getproperty forname classnotfoundexception forname miscutilities classnotfoundexception miscutilities jedit settingsdir jedit getsettingsdirectory settingsdir toolspath constructpath settingsdir addelement toolspath toolspath miscutilities jedit jedit jeditdir jedit getjedithome jeditdir toolspath constructpath jeditdir addelement toolspath toolspath miscutilities jedit jedit toolspath getproperty toolspath tolowercase endswith toolspath toolspath toolspath toolspath constructpath toolspath addelement toolspath toolspath miscutilities tostring jedit getpluginjar toolspath miscutilities toolspath jedit jedit addpluginjar toolspath miscutilities parse permissions method parse a unix style permission string rwxrwxrwx param s the string must be 9 characters long since j edit 4 1pre8 public static int parse permissions string s int permissions 0 if s length 9 if s char at 0 r permissions 0400 if s char at 1 w permissions 0200 if s char at 2 x permissions 0100 else if s char at 2 s permissions 04100 else if s char at 2 s permissions 04000 if s char at 3 r permissions 040 if s char at 4 w permissions 020 if s char at 5 x permissions 010 else if s char at 5 s permissions 02010 else if s char at 5 s permissions 02000 if s char at 6 r permissions 04 if s char at 7 w permissions 02 if s char at 8 x permissions 01 else if s char at 8 t permissions 01001 else if s char at 8 t permissions 01000 return permissions parsepermissions jedit parsepermissions charat charat charat charat charat charat charat charat charat charat charat charat charat charat charat get encodings method returns a list of supported character encodings on java 1 3 returns a fixed list on java 1 4 uses reflection to call an nio api since j edit 4 2pre5 public static string get encodings list return value new array list if operating system has java14 try class clazz class for name java nio charset charset method method clazz get method available charsets new class 0 map map map method invoke null new object 0 iterator iter map key set iterator return value add utf 8 y while iter has next return value add iter next catch exception e log log log error misc utilities class e else string tokenizer st new string tokenizer j edit get property encodings while st has more tokens return value add st next token return string return value to array new string return value size getencodings jedit getencodings returnvalue arraylist operatingsystem hasjava14 forname getmethod availablecharsets keyset returnvalue utf_8_y hasnext returnvalue miscutilities stringtokenizer stringtokenizer jedit getproperty hasmoretokens returnvalue nexttoken returnvalue toarray returnvalue is supported encoding method returns if the given character encoding is supported uses reflection to call a java 1 4 api on java 1 4 and always returns true on java 1 3 since j edit 4 2pre7 public static boolean is supported encoding string encoding if operating system has java14 try class clazz class for name java nio charset charset method method clazz get method is supported new class string class return boolean method invoke null new object encoding boolean value catch exception e log log log error misc utilities class e return true issupportedencoding jedit issupportedencoding operatingsystem hasjava14 forname getmethod issupported booleanvalue miscutilities throwable to string method returns a string containing the stack trace of the given throwable since j edit 4 2pre6 public static string throwable to string throwable t string writer s new string writer t print stack trace new print writer s return s to string throwabletostring jedit throwabletostring stringwriter stringwriter printstacktrace printwriter tostring private members private misc utilities miscutilities compare chars should this be public private static boolean compare chars char ch1 char ch2 boolean ignore case if ignore case return character to upper case ch1 character to upper case ch2 else return ch1 ch2 comparechars comparechars ignorecase ignorecase touppercase touppercase start method public void start if osok osok delegate new delegate ns application app ns application shared application macros register handler new apple script handler application app2 new application app2 add application listener delegate app2 set enabled preferences menu true app2 set enabled about menu true app set delegate delegate app set services provider delegate nsapplication nsapplication sharedapplication registerhandler applescripthandler addapplicationlistener setenabledpreferencesmenu setenabledaboutmenu setdelegate setservicesprovider handle message method public void handle message eb message message if osok set type creator codes for files if message instanceof buffer update delegate handle file codes buffer update message else if message instanceof properties changed boolean b j edit get boolean property macos plugin use selection j edit get boolean property macos plugin default use selection if b j edit set color property view selection color ui manager get color text highlight this is necessary to have a file opened from the finder before j edit is running set as the currently active buffer else if started message instanceof view update delegate handle open file view update message handlemessage handlemessage ebmessage bufferupdate handlefilecodes bufferupdate propertieschanged jedit getbooleanproperty macosplugin useselection jedit getbooleanproperty macosplugin useselection jedit setcolorproperty selectioncolor uimanager getcolor texthighlight jedit viewupdate handleopenfile viewupdate osok method private boolean osok final string osname j edit get property macos plugin depend os name final string mrjversion j edit get property macos plugin depend mrj version if system get property os name equals osname according to slava this is better log log log error this j edit get property macos plugin dialog osname message return false if misc utilities compare strings system get property mrj version mrjversion false 0 swing utilities invoke later new runnable public void run gui utilities error null macos plugin dialog mrjversion new object mrjversion return false return true jedit getproperty macosplugin jedit getproperty macosplugin getproperty jedit getproperty macosplugin miscutilities comparestrings getproperty swingutilities invokelater guiutilities macosplugin system get property mrj version mrjversion false 0 swing utilities invoke later new runnable public void run gui utilities error null macos plugin dialog mrjversion new object mrjversion getproperty swingutilities invokelater guiutilities macosplugin eval selection method evaluates the text selected in the specified text area since j edit 2 7pre2 public static void eval selection view view j edit text area text area string command text area get selected text if command null view get toolkit beep return object return value eval view global command if return value null text area set selected text return value to string evalselection jedit evalselection jedittextarea textarea textarea getselectedtext gettoolkit returnvalue returnvalue textarea setselectedtext returnvalue tostring show evaluate dialog method prompts for a bean shell expression to evaluate since j edit 2 7pre2 public static void show evaluate dialog view view string command gui utilities input view beanshell eval input null if command null if command ends with command command int repeat view get input handler get repeat count if view get macro recorder null view get macro recorder record repeat command object return value null try for int i 0 i repeat i return value eval view global command catch throwable e log log log error bean shell class e handle exception view null e if return value null string args return value to string gui utilities message view beanshell eval args showevaluatedialog beanshell jedit showevaluatedialog guiutilities endswith getinputhandler getrepeatcount getmacrorecorder getmacrorecorder returnvalue returnvalue _eval beanshell handleexception returnvalue returnvalue tostring guiutilities show evaluate lines dialog method evaluates the specified script for each selected line since j edit 4 0pre1 public static void show evaluate lines dialog view view string command gui utilities input view beanshell eval line null j edit text area text area view get text area buffer buffer view get buffer if command null command length 0 return selection selection text area get selection if selection length 0 view get toolkit beep return if command ends with command command string script int lines text area get selected lines n for int i 0 i lines length i n n line lines i n index line lines 0 n start buffer get line start offset line n end buffer get line end offset line n text buffer get text start end start 1 n new text command n if new text null n n buffer remove start end start 1 n buffer insert start string value of new text n n n if view get macro recorder null view get macro recorder record 1 script try buffer begin compound edit bean shell eval view global script finally buffer end compound edit text area select none showevaluatelinesdialog jedit showevaluatelinesdialog guiutilities jedittextarea textarea gettextarea getbuffer textarea getselection gettoolkit endswith textarea getselectedlines getlinestartoffset getlineendoffset gettext newtext newtext valueof newtext getmacrorecorder getmacrorecorder begincompoundedit beanshell endcompoundedit textarea selectnone run script method runs a bean shell script errors are shown in a dialog box p if the code in code parameter is non null the script is read from that stream otherwise it is read from the file identified by code path code p the code script path code bean shell variable is set to the path name of the script param view the view within the script references to code buffer code code text area code and code edit pane code are determined with reference to this parameter param path the script file s vfs path param in the reader to read the script from or code null code param own namespace if set to code false code methods and variables defined in the script will be available to all future uses of bean shell if set to code true code they will be lost as soon as the script finishes executing j edit uses a value of code false code when running startup scripts and a value of code true code when running all other macros since j edit 4 0pre7 public static void run script view view string path reader in boolean own namespace try runscript view path in own namespace catch throwable e log log log error bean shell class e handle exception view path e runscript beanshell scriptpath beanshell textarea editpane ownnamespace beanshell jedit jedit runscript ownnamespace _runscript ownnamespace beanshell handleexception run script method runs a bean shell script errors are shown in a dialog box p if the code in code parameter is non null the script is read from that stream otherwise it is read from the file identified by code path code p the code script path code bean shell variable is set to the path name of the script param view the view within the script references to code buffer code code text area code and code edit pane code are determined with reference to this parameter param path the script file s vfs path param in the reader to read the script from or code null code param namespace the namespace to run the script in since j edit 4 2pre5 public static void run script view view string path reader in name space namespace try runscript view path in namespace catch throwable e log log log error bean shell class e handle exception view path e runscript beanshell scriptpath beanshell textarea editpane jedit runscript namespace _runscript beanshell handleexception runscript method runs a bean shell script errors are passed to the caller p if the code in code parameter is non null the script is read from that stream otherwise it is read from the file identified by code path code p the code script path code bean shell variable is set to the path name of the script param view the view within the script references to code buffer code code text area code and code edit pane code are determined with reference to this parameter param path the script file s vfs path param in the reader to read the script from or code null code param own namespace if set to code false code methods and variables defined in the script will be available to all future uses of bean shell if set to code true code they will be lost as soon as the script finishes executing j edit uses a value of code false code when running startup scripts and a value of code true code when running all other macros exception exception instances are thrown when various bean shell errors occur since j edit 4 0pre7 public static void runscript view view string path reader in boolean own namespace throws exception runscript view path in own namespace new name space global script namespace global _runscript beanshell scriptpath beanshell textarea editpane ownnamespace beanshell jedit beanshell jedit _runscript ownnamespace _runscript ownnamespace namespace runscript method runs a bean shell script errors are passed to the caller p if the code in code parameter is non null the script is read from that stream otherwise it is read from the file identified by code path code p the code script path code bean shell variable is set to the path name of the script param view the view within the script references to code buffer code code text area code and code edit pane code are determined with reference to this parameter param path the script file s vfs path param in the reader to read the script from or code null code param namespace the namespace to run the script in exception exception instances are thrown when various bean shell errors occur since j edit 4 2pre5 public static void runscript view view string path reader in name space namespace throws exception log log log message bean shell class running script path interpreter interp create interpreter namespace vfs vfs null object session null try if in null buffer buffer j edit get buffer path vfs vfs manager getvfs for path path session vfs createvfs session path view if session null user cancelled return if buffer null if buffer is loaded vfs manager wait for requests in new string reader buffer get text 0 buffer get length else in new buffered reader new input stream reader vfs createinputstream session path false view setup default variables namespace view interp set script path path running true interp eval in namespace path catch exception e unwrap exception e finally running false if session null try vfs endvfssession session view catch io exception io log log log error bean shell class io gui utilities error view read error new string path io to string try no need to do this for macros if namespace global reset default variables namespace interp unset script path catch eval error e do nothing _runscript beanshell scriptpath beanshell textarea editpane beanshell jedit _runscript namespace beanshell createinterpreter jedit getbuffer vfsmanager getvfsforpath createvfssession isloaded vfsmanager waitforrequests stringreader gettext getlength bufferedreader inputstreamreader _createinputstream setupdefaultvariables scriptpath unwrapexception _endvfssession ioexception beanshell guiutilities tostring resetdefaultvariables scriptpath evalerror eval method evaluates the specified bean shell expression errors are reported in a dialog box param view the view within the script references to code buffer code code text area code and code edit pane code are determined with reference to this parameter param namespace the namespace param command the expression since j edit 4 0pre8 public static object eval view view name space namespace string command try return eval view namespace command catch throwable e log log log error bean shell class e handle exception view null e return null beanshell textarea editpane jedit namespace _eval beanshell handleexception eval method evaluates the specified bean shell expression unlike code eval code this method passes any exceptions to the caller param view the view within the script references to code buffer code code text area code and code edit pane code are determined with reference to this parameter param namespace the namespace param command the expression exception exception instances are thrown when various bean shell errors occur since j edit 3 2pre7 public static object eval view view name space namespace string command throws exception interpreter interp create interpreter namespace try setup default variables namespace view if debug beanshell debug log log log debug bean shell class command return interp eval command catch exception e unwrap exception e never called return null finally try reset default variables namespace catch util eval error e do nothing _eval beanshell textarea editpane beanshell jedit _eval namespace createinterpreter setupdefaultvariables beanshell_debug beanshell unwrapexception resetdefaultvariables utilevalerror cache block method caches a block of code returning a handle that can be passed to run cached block param id an identifier if null a unique identifier is generated param code the code param namespace if true the namespace will be set exception exception instances are thrown when various bean shell errors occur since j edit 4 1pre1 public static bsh method cache block string id string code boolean namespace throws exception string name internal id evaluate a method declaration if namespace eval null global name ns nthis callstack set 0 ns n code n return global get method name new class name space class else eval null global name n code n return global get method name new class 0 cacheblock runcachedblock beanshell jedit bshmethod cacheblock __internal_ _eval getmethod namespace _eval getmethod run cached block method runs a cached block of code in the specified namespace faster than evaluating the block each time param method the method instance returned by cache block param view the view param namespace the namespace to run the code in exception exception instances are thrown when various bean shell errors occur since j edit 4 1pre1 public static object run cached block bsh method method view view name space namespace throws exception boolean use namespace if namespace null use namespace false namespace global else use namespace true try setup default variables namespace view object ret val method invoke use namespace new object namespace no args interp for methods new call stack if ret val instanceof primitive if ret val primitive void return null else return primitive ret val get value else return ret val catch exception e unwrap exception e never called return null finally reset default variables namespace runcachedblock cacheblock beanshell jedit runcachedblock bshmethod namespace usenamespace usenamespace usenamespace setupdefaultvariables retval usenamespace no_args interpformethods callstack retval retval retval getvalue retval unwrapexception resetdefaultvariables is script running method returns if a bean shell script or macro is currently running since j edit 2 7pre2 public static boolean is script running return running isscriptrunning beanshell jedit isscriptrunning get name space method returns the global namespace since j edit 3 2pre5 public static name space get name space return global getnamespace jedit namespace getnamespace run script method deprecated the code rethrow bsh errors code parameter is now obsolete call code runscript code or code run script code instead public static void run script view view string path boolean own namespace boolean rethrow bsh errors run script view path null own namespace runscript rethrowbsherrors _runscript runscript runscript ownnamespace rethrowbsherrors runscript ownnamespace run script method deprecated the code rethrow bsh errors code parameter is now obsolete call code runscript code or code run script code instead public static void run script view view string path reader in boolean own namespace boolean rethrow bsh errors run script view path in own namespace runscript rethrowbsherrors _runscript runscript runscript ownnamespace rethrowbsherrors runscript ownnamespace eval method deprecated the code rethrow bsh errors code parameter is now obsolete call code eval code or code eval code instead public static object eval view view string command boolean rethrow bsh errors return eval view global command rethrowbsherrors _eval rethrowbsherrors eval method deprecated the code rethrow bsh errors code parameter is now obsolete call code eval code or code eval code instead public static object eval view view name space namespace string command boolean rethrow bsh errors return eval view namespace command rethrowbsherrors _eval namespace rethrowbsherrors init method static void init try name space class get method add command path new class string class class class catch exception e log log log error bean shell class you have bean shell version interpreter version in your classpath log log log error bean shell class please remove it from the classpath since j edit can only run with the bundled bean shell version required version system exit 1 class manager new custom class manager class manager set class loader new jar class loader global new name space class manager j edit embedded bean shell interpreter global import package org gjt sp jedit global import package org gjt sp jedit browser global import package org gjt sp jedit buffer global import package org gjt sp jedit gui global import package org gjt sp jedit help global import package org gjt sp jedit io global import package org gjt sp jedit menu global import package org gjt sp jedit msg global import package org gjt sp jedit options global import package org gjt sp jedit pluginmgr global import package org gjt sp jedit print global import package org gjt sp jedit search global import package org gjt sp jedit syntax global import package org gjt sp jedit textarea global import package org gjt sp util interp for methods create interpreter global namespace getmethod addcommandpath beanshell beanshell beanshell jedit beanshell required_version classmanager customclassmanager classmanager setclassloader jarclassloader namespace classmanager jedit beanshell importpackage importpackage importpackage importpackage importpackage importpackage importpackage importpackage importpackage importpackage importpackage importpackage importpackage importpackage importpackage interpformethods createinterpreter reset class manager method causes bean shell internal structures to drop references to cached class instances static void reset class manager class manager reset resetclassmanager beanshell resetclassmanager classmanager setup default variables method private static void setup default variables name space namespace view view throws util eval error if view null edit pane edit pane view get edit pane namespace set variable view view namespace set variable edit pane edit pane namespace set variable buffer edit pane get buffer namespace set variable text area edit pane get text area namespace set variable wm view get dockable window manager setupdefaultvariables setupdefaultvariables namespace utilevalerror editpane editpane geteditpane setvariable setvariable editpane editpane setvariable editpane getbuffer setvariable textarea editpane gettextarea setvariable getdockablewindowmanager reset default variables method private static void reset default variables name space namespace throws util eval error namespace set variable view null namespace set variable edit pane null namespace set variable buffer null namespace set variable text area null namespace set variable wm null resetdefaultvariables resetdefaultvariables namespace utilevalerror setvariable setvariable editpane setvariable setvariable textarea setvariable unwrap exception method this extracts an exception from a wrapping exception as bean shell sometimes throws this gives the user a more accurate error traceback private static void unwrap exception exception e throws exception if e instanceof target error throwable t target error e get target if t instanceof exception throw exception t else if t instanceof error throw error t if e instanceof invocation target exception throwable t invocation target exception e get target exception if t instanceof exception throw exception t else if t instanceof error throw error t throw e unwrapexception beanshell unwrapexception targeterror targeterror gettarget invocationtargetexception invocationtargetexception gettargetexception handle exception method private static void handle exception view view string path throwable t if t instanceof io exception vfs manager error view path ioerror read error new string t to string else new bean shell error dialog view t handleexception handleexception ioexception vfsmanager tostring beanshellerrordialog create interpreter method private static interpreter create interpreter name space name space return new interpreter null system out system err false name space createinterpreter createinterpreter namespace namespace namespace copy and paste from bsh classpath class manager impl java public synchronized void add listener listener l listeners add new weak reference l ref queue clean up old listeners reference deadref while deadref ref queue poll null boolean ok listeners remove deadref if ok system err println cleaned up weak ref deadref else if interpreter debug interpreter debug tried to remove non existent weak ref deadref classmanagerimpl addlistener weakreference refqueue refqueue public void remove listener listener l throw new error unimplemented removelistener public void reset class loader changed classloaderchanged protected synchronized void class loader changed clear the static caches in bsh class manager clear caches for iterator iter listeners iterator iter has next weak reference wr weak reference iter next listener l listener wr get if l null garbage collected iter remove else l class loader changed classloaderchanged bshclassmanager clearcaches hasnext weakreference weakreference classloaderchanged constructor public show recent menu super j edit get property macos plugin menu recent label add menu listener this showrecentmenu jedit getproperty macosplugin addmenulistener construct method private void construct list recent buffer history get history j menu item item file file int max recent size int min max 20 if max 0 item new j menu item j edit get property macos plugin menu recent none item set enabled false add item return if min 0 min 0 for int i max 1 i min i file new file buffer history entry recent get i path item new show recent menu item file get name file get path item set icon file cell renderer file icon add item bufferhistory gethistory jmenuitem jmenuitem jedit getproperty macosplugin setenabled bufferhistory showrecentmenuitem getname getpath seticon filecellrenderer fileicon menu selected method public void menu selected menu event e construct menuselected menuselected menuevent menu deselected method public void menu deselected menu event e remove all menudeselected menudeselected menuevent removeall menu canceled method public void menu canceled menu event e menucanceled menucanceled menuevent public show recent menu item string name string path super name this path path add action listener new show file action showrecentmenuitem addactionlistener showfileaction class show file action implements action listener public void action performed action event e macos actions show in finder path showfileaction actionlistener actionperformed actionevent macosactions showinfinder handle message method public void handle message eb message msg if msg instanceof vfs update vfs update vmsg vfs update msg maybe reload vmsg get path handlemessage handlemessage ebmessage vfsupdate vfsupdate vfsupdate maybereload getpath maybe reload method private void maybe reload string path string j edit home j edit getj edit home string settings directory j edit get settings directory if misc utilities isurl path path misc utilities resolve symlinks path on windows and macos path names are case insensitive if vfs manager getvfs for path path get capabilities vfs case insensitive cap 0 path path to lower case j edit home j edit home to lower case settings directory settings directory to lower case xxx does this really belong here search file set fileset search and replace get search file set if fileset instanceof directory list set directory list set dirset directory list set fileset string dir misc utilities resolve symlinks dirset get directory if path starts with dir dirset invalidate cached list if j edit home null path starts with j edit home path path substring j edit home length else if settings directory null path starts with settings directory path path substring settings directory length else not in settings directory or j edit home directory no need to reload anything return if path starts with file separator path starts with path path substring 1 if path starts with macros macros load macros else if path starts with modes path ends with xml path ends with catalog j edit reload modes maybereload maybereload jedithome jedit getjedithome settingsdirectory jedit getsettingsdirectory miscutilities miscutilities resolvesymlinks vfsmanager getvfsforpath getcapabilities case_insensitive_cap tolowercase jedithome jedithome tolowercase settingsdirectory settingsdirectory tolowercase searchfileset searchandreplace getsearchfileset directorylistset directorylistset directorylistset miscutilities resolvesymlinks getdirectory startswith invalidatecachedlist jedithome startswith jedithome jedithome settingsdirectory startswith settingsdirectory settingsdirectory jedit startswith startswith startswith loadmacros startswith endswith endswith jedit reloadmodes constructs an uninitialized link item item object item constructs a copy of the given item param index index of the item to be constructed param i the item that must be copied into the item to be constructed item final short index final item i this index index type i type int val i int val long val i long val float val i float val double val i double val str val1 i str val1 str val2 i str val2 str val3 i str val3 hash code i hash code intval intval longval longval floatval floatval doubleval doubleval strval1 strval1 strval2 strval2 strval3 strval3 hashcode hashcode sets this item to an link class writer int int item param int val the value of this item void set final int int val this type class writer int this int val int val this hash code type int val classwriter intval intval classwriter intval intval hashcode intval sets this item to a link class writer long long item param long val the value of this item void set final long long val this type class writer long this long val long val this hash code type int long val classwriter longval longval classwriter longval longval hashcode longval sets this item to a link class writer float float item param float val the value of this item void set final float float val this type class writer float this float val float val this hash code type int float val classwriter floatval floatval classwriter floatval floatval hashcode floatval sets this item to a link class writer double double item param double val the value of this item void set final double double val this type class writer double this double val double val this hash code type int double val classwriter doubleval doubleval classwriter doubleval doubleval hashcode doubleval sets this item to an item that do not hold a primitive value param type the type of this item param str val1 first part of the value of this item param str val2 second part of the value of this item param str val3 third part of the value of this item void set final int type final string str val1 final string str val2 final string str val3 this type type this str val1 str val1 this str val2 str val2 this str val3 str val3 switch type case class writer utf8 case class writer str case class writer class hash code type str val1 hash code return case class writer name type hash code type str val1 hash code str val2 hash code return case class writer field case class writer meth case class writer imeth default hash code type str val1 hash code str val2 hash code str val3 hash code return strval1 strval2 strval3 strval1 strval2 strval3 strval1 strval1 strval2 strval2 strval3 strval3 classwriter classwriter classwriter hashcode strval1 hashcode classwriter name_type hashcode strval1 hashcode strval2 hashcode classwriter classwriter classwriter hashcode strval1 hashcode strval2 hashcode strval3 hashcode indicates if the given item is equal to this one param i the item to be compared to this one return tt true tt if the given item if equal to this one tt false tt otherwise boolean is equal to final item i if i type type switch type case class writer int return i int val int val case class writer long return i long val long val case class writer float return i float val float val case class writer double return i double val double val case class writer utf8 case class writer str case class writer class return i str val1 equals str val1 case class writer name type return i str val1 equals str val1 i str val2 equals str val2 case class writer field case class writer meth case class writer imeth default return i str val1 equals str val1 i str val2 equals str val2 i str val3 equals str val3 return false isequalto classwriter intval intval classwriter longval longval classwriter floatval floatval classwriter doubleval doubleval classwriter classwriter classwriter strval1 strval1 classwriter name_type strval1 strval1 strval2 strval2 classwriter classwriter classwriter strval1 strval1 strval2 strval2 strval3 strval3 browser option pane constructor public browser option pane super browser general browseroptionpane browseroptionpane init method public void init default directory string dirs j edit get property options browser general default path favorites j edit get property options browser general default path home j edit get property options browser general default path last j edit get property options browser general default path buffer j edit get property options browser general default path working default directory new j combo box dirs string default dir j edit get property vfs browser default path if favorites equals default dir default directory set selected index 0 else if home equals default dir default directory set selected index 1 else if last equals default dir default directory set selected index 2 else if buffer equals default dir default directory set selected index 3 else if working equals default dir default directory set selected index 4 add component j edit get property options browser general default path default directory show tool bar show toolbar new j check box j edit get property options browser general show toolbar show toolbar set selected j edit get boolean property vfs browser show toolbar add component show toolbar show menu bar show menubar new j check box j edit get property options browser general show menubar show menubar set selected j edit get boolean property vfs browser show menubar add component show menubar show icons show icons new j check box j edit get property options browser general show icons show icons set selected j edit get boolean property vfs browser show icons add component show icons show hidden files show hidden files new j check box j edit get property options browser general show hidden files show hidden files set selected j edit get boolean property vfs browser show hidden files add component show hidden files ignore case when sorting sort ignore case new j check box j edit get property options browser general sort ignore case sort ignore case set selected j edit get boolean property vfs browser sort ignore case add component sort ignore case mix files and directories sort mix files and dirs new j check box j edit get property options browser general sort mix files and dirs sort mix files and dirs set selected j edit get boolean property vfs browser sort mix files and dirs add component sort mix files and dirs double click close double click close new j check box j edit get property options browser general double click close double click close set selected j edit get boolean property vfs browser double click close add component double click close split vfs file dialog horizontally current buffer filter new j check box j edit get property options browser general current buffer filter current buffer filter set selected j edit get boolean property vfs browser current buffer filter add component current buffer filter _init _init jedit getproperty defaultpath jedit getproperty defaultpath jedit getproperty defaultpath jedit getproperty defaultpath jedit getproperty defaultpath defaultdirectory jcombobox defaultdir jedit getproperty defaultpath defaultdir defaultdirectory setselectedindex defaultdir defaultdirectory setselectedindex defaultdir defaultdirectory setselectedindex defaultdir defaultdirectory setselectedindex defaultdir defaultdirectory setselectedindex addcomponent jedit getproperty defaultpath defaultdirectory showtoolbar jcheckbox jedit getproperty showtoolbar showtoolbar setselected jedit getbooleanproperty showtoolbar addcomponent showtoolbar showmenubar jcheckbox jedit getproperty showmenubar showmenubar setselected jedit getbooleanproperty showmenubar addcomponent showmenubar showicons jcheckbox jedit getproperty showicons showicons setselected jedit getbooleanproperty showicons addcomponent showicons showhiddenfiles jcheckbox jedit getproperty showhiddenfiles showhiddenfiles setselected jedit getbooleanproperty showhiddenfiles addcomponent showhiddenfiles sortignorecase jcheckbox jedit getproperty sortignorecase sortignorecase setselected jedit getbooleanproperty sortignorecase addcomponent sortignorecase sortmixfilesanddirs jcheckbox jedit getproperty sortmixfilesanddirs sortmixfilesanddirs setselected jedit getbooleanproperty sortmixfilesanddirs addcomponent sortmixfilesanddirs doubleclickclose jcheckbox jedit getproperty doubleclickclose doubleclickclose setselected jedit getbooleanproperty doubleclickclose addcomponent doubleclickclose vfsfiledialog currentbufferfilter jcheckbox jedit getproperty currentbufferfilter currentbufferfilter setselected jedit getbooleanproperty currentbufferfilter addcomponent currentbufferfilter save method public void save string dirs favorites home last buffer working j edit set property vfs browser default path dirs default directory get selected index j edit set boolean property vfs browser show toolbar show toolbar is selected j edit set boolean property vfs browser show menubar show menubar is selected j edit set boolean property vfs browser show icons show icons is selected j edit set boolean property vfs browser show hidden files show hidden files is selected j edit set boolean property vfs browser sort ignore case sort ignore case is selected j edit set boolean property vfs browser sort mix files and dirs sort mix files and dirs is selected j edit set boolean property vfs browser double click close double click close is selected j edit set boolean property vfs browser current buffer filter current buffer filter is selected _save _save jedit setproperty defaultpath defaultdirectory getselectedindex jedit setbooleanproperty showtoolbar showtoolbar isselected jedit setbooleanproperty showmenubar showmenubar isselected jedit setbooleanproperty showicons showicons isselected jedit setbooleanproperty showhiddenfiles showhiddenfiles isselected jedit setbooleanproperty sortignorecase sortignorecase isselected jedit setbooleanproperty sortmixfilesanddirs sortmixfilesanddirs isselected jedit setbooleanproperty doubleclickclose doubleclickclose isselected jedit setbooleanproperty currentbufferfilter currentbufferfilter isselected buffer printable constructor buffer printable printer job job object format view view buffer buffer font font boolean header boolean footer boolean line numbers boolean color this job job this format format this view view this buffer buffer this font font this header header this footer footer this line numbers line numbers styles gui utilities load styles j edit get property print font j edit get integer property print fontsize 10 color styles token null new syntax style text color null font change any white text to black for int i 0 i styles length i syntax style s styles i if s get foreground color equals color white s get background color null styles i new syntax style color black styles i get background color styles i get font line list new array list token handler new display token handler bufferprintable bufferprintable printerjob linenumbers linenumbers linenumbers guiutilities loadstyles jedit getproperty jedit getintegerproperty syntaxstyle textcolor syntaxstyle getforegroundcolor getbackgroundcolor syntaxstyle getbackgroundcolor getfont linelist arraylist tokenhandler displaytokenhandler print method public void print try buffer read lock if format null job print else method method printer job class get method print new class class for name javax print attribute print request attribute set method invoke job new object format catch printer abort exception ae log log log debug this ae catch exception e log log log error this e final string args e to string swing utilities invoke later new runnable public void run gui utilities error view print error args finally buffer read unlock readlock printerjob getmethod forname printrequestattributeset printerabortexception tostring swingutilities invokelater guiutilities readunlock swing utilities invoke later new runnable public void run gui utilities error view print error args swingutilities invokelater guiutilities print method public int print graphics gfx page format page format int page index throws printer exception we keep the first non null frc we get since sometimes we get invalid ones on subsequent pages on windows if frc null frc graphics2d gfx get font render context log log log debug this font render context is frc log log log debug this asked to print page page index log log log debug this current page is current page if page index current page for int i current page i page index i log log log debug this current physical line is now current page start current physical line current page start print page gfx page format i true current page page index 1 log log log debug this current page is now current page if page index current page 1 if end log log log debug this the end return no such page current page start current physical line log log log debug this 2 current physical line is now current page start current page page index log log log debug this 2 current page is now current page else if page index current page current physical line current page start log log log debug this 3 current physical line is now current page start print page gfx page format page index true return page exists _gfx pageformat pageformat pageindex printerexception _gfx getfontrendercontext pageindex currentpage pageindex currentpage currentpage pageindex currentpagestart currentphysicalline currentpagestart printpage _gfx pageformat currentpage pageindex currentpage pageindex currentpage no_such_page currentpagestart currentphysicalline currentpagestart currentpage pageindex currentpage pageindex currentpage currentphysicalline currentpagestart currentpagestart printpage _gfx pageformat pageindex page_exists print page method private void print page graphics gfx page format page format int page index boolean actually paint log log log debug this print page page index actually paint graphics2d gfx graphics2d gfx gfx set font font double pagex page format get imageablex double pagey page format get imageabley double page width page format get imageable width double page height page format get imageable height log log log debug this 1 page dimensions page width x page height if header double header height paint header gfx pagex pagey page width actually paint pagey header height page height header height if footer double footer height paint footer gfx pagex pagey page width page height page index actually paint page height footer height boolean glyph vector j edit get boolean property print glyph vector double line number width determine line number width if line numbers the 1 s ensure that 99 gets 3 digits 103 gets 4 digits and so on int line number digits int math ceil math log buffer get line count 1 math log 10 1 now that we know how many chars there are get the width char chars new char line number digits for int i 0 i chars length i chars i line number width font get string bounds chars 0 line number digits frc get width else line number width 0 0 log log log debug this 2 page dimensions page width line number width x page height calculate tab size int tab size j edit get integer property print tab size 8 char chars new char tab size for int i 0 i chars length i chars i double tab width font get string bounds chars 0 tab size frc get width print tab expander e new print tab expander tab width double y 0 0 lm font get line metrics g gyyx frc log log log debug this line height is lm get height print loop for if current physical line buffer get line count log log log debug this finished buffer end true break print loop line list clear token handler init styles frc e line list float page width line number width buffer mark tokens current physical line token handler if line list size 0 line list add null if y lm get height line list size page height log log log debug this finished page before line current physical line break print loop if line numbers actually paint gfx set font font gfx set color line number color gfx draw string string value of current physical line 1 float pagex float pagey y lm get height for int i 0 i line list size i y lm get height chunk chunks chunk line list get i if chunks null actually paint chunk paint chunk backgrounds chunks gfx float pagex line number width float pagey y chunk paint chunk list chunks gfx float pagex line number width float pagey y glyph vector current physical line printpage printpage _gfx pageformat pageformat pageindex actuallypaint printpage pageindex actuallypaint _gfx setfont pageformat getimageablex pageformat getimageabley pagewidth pageformat getimageablewidth pageheight pageformat getimageableheight pagewidth pageheight headerheight paintheader pagewidth actuallypaint headerheight pageheight headerheight footerheight paintfooter pagewidth pageheight pageindex actuallypaint pageheight footerheight glyphvector jedit getbooleanproperty glyphvector linenumberwidth linenumbers linenumberdigits getlinecount linenumberdigits linenumberwidth getstringbounds linenumberdigits getwidth linenumberwidth pagewidth linenumberwidth pageheight tabsize jedit getintegerproperty tabsize tabsize tabwidth getstringbounds tabsize getwidth printtabexpander printtabexpander tabwidth getlinemetrics ggyyx getheight print_loop currentphysicalline getlinecount print_loop linelist tokenhandler linelist pagewidth linenumberwidth marktokens currentphysicalline tokenhandler linelist linelist getheight linelist pageheight currentphysicalline print_loop linenumbers actuallypaint setfont setcolor linenumbercolor drawstring valueof currentphysicalline getheight linelist getheight linelist actuallypaint paintchunkbackgrounds linenumberwidth paintchunklist linenumberwidth glyphvector currentphysicalline paint header method private double paint header graphics2d gfx double pagex double pagey double page width boolean actually paint string header text j edit get property print header text new string buffer get name font render context frc gfx get font render context lm font get line metrics header text frc rectangle2d bounds font get string bounds header text frc rectangle2d header bounds new rectangle2d double pagex pagey page width bounds get height if actually paint gfx set color header color gfx fill header bounds gfx set color header text color gfx draw string header text float pagex page width bounds get width 2 float pagey lm get ascent return header bounds get height paintheader paintheader pagewidth actuallypaint headertext jedit getproperty headertext getname fontrendercontext getfontrendercontext getlinemetrics headertext getstringbounds headertext headerbounds pagewidth getheight actuallypaint setcolor headercolor headerbounds setcolor headertextcolor drawstring headertext pagewidth getwidth getascent headerbounds getheight paint footer method private double paint footer graphics2d gfx double pagex double pagey double page width double page height int page index boolean actually paint string footer text j edit get property print footer text new object new date new integer page index 1 font render context frc gfx get font render context lm font get line metrics footer text frc rectangle2d bounds font get string bounds footer text frc rectangle2d footer bounds new rectangle2d double pagex pagey page height bounds get height page width bounds get height if actually paint gfx set color footer color gfx fill footer bounds gfx set color footer text color gfx draw string footer text float pagex page width bounds get width 2 float pagey page height bounds get height lm get ascent return footer bounds get height paintfooter paintfooter pagewidth pageheight pageindex actuallypaint footertext jedit getproperty footertext pageindex fontrendercontext getfontrendercontext getlinemetrics footertext getstringbounds footertext footerbounds pageheight getheight pagewidth getheight actuallypaint setcolor footercolor footerbounds setcolor footertextcolor drawstring footertext pagewidth getwidth pageheight getheight getascent footerbounds getheight print tab expander constructor public print tab expander double tab width this tab width tab width printtabexpander printtabexpander tabwidth tabwidth tabwidth next tab stop method public float next tab stop float x int tab offset int ntabs int x 1 tab width return float ntabs 1 tab width nexttabstop nexttabstop taboffset tabwidth tabwidth char indexed string string str int index s str len s length anchor index charindexedstring public char char at int index int pos anchor index return pos len pos 0 s char at pos out of bounds charat charat out_of_bounds public boolean is valid return anchor len isvalid public boolean move int index return anchor index len filevfs method public filevfs super file read cap write cap delete cap rename cap mkdir cap low latency cap operating system is macos operating system isdos derived case insensitive cap 0 new string ea type ea size ea status ea modified read_cap write_cap delete_cap rename_cap mkdir_cap low_latency_cap operatingsystem ismacos operatingsystem isdosderived case_insensitive_cap ea_type ea_size ea_status ea_modified get parent of path method public string get parent of path string path if operating system isdos derived if path length 2 path char at 1 return file rootsvfs protocol else if path length 3 path ends with return file rootsvfs protocol else if path starts with path index of 2 1 return path return super get parent of path path getparentofpath getparentofpath operatingsystem isdosderived charat filerootsvfs endswith filerootsvfs startswith indexof getparentofpath construct path method public string construct path string parent string path if parent ends with file separator parent ends with return parent path else return parent file separator path constructpath constructpath endswith endswith get file separator method public char get file separator return file separator char getfileseparator getfileseparator separatorchar save method public boolean save view view buffer buffer string path if operating system is unix int permissions get permissions buffer get path log log log debug this buffer get path has permissions 0 integer to string permissions 8 buffer set integer property permissions property permissions return super save view buffer path operatingsystem isunix getpermissions getpath getpath tostring setintegerproperty permissions_property insert method public boolean insert view view buffer buffer string path file file new file path check if file is valid if file exists return false if file is directory vfs manager error view file get path ioerror open directory null return false if file can read vfs manager error view file get path ioerror no read null return false return super insert view buffer path isdirectory vfsmanager getpath canread vfsmanager getpath canonpath method returns the canonical form if the specified path name for example code code might be expanded to the user s home directory param session the session param path the path param comp the component that will parent error dialog boxes exception io exception if an i o error occurred since j edit 4 0pre2 public string canonpath object session string path component comp throws io exception return misc utilities canon path path _canonpath ioexception jedit _canonpath ioexception miscutilities canonpath public local directory entry file file super file get name file get path file get path file is directory directory file file length file is hidden this modified file last modified this can read file can read this can write file can write this symlink path misc utilities resolve symlinks path localdirectoryentry getname getpath getpath isdirectory ishidden lastmodified canread canread canwrite canwrite symlinkpath miscutilities resolvesymlinks public string get extended attribute string name if name equals ea modified return date format format new date modified else return super get extended attribute name getextendedattribute ea_modified date_format getextendedattribute listdirectory method public vfs directory entry listdirectory object session string path component comp windows work around on windows paths of the form x list the last working directory on that drive to list the root of the drive you must use x however the vfs browser and friends strip off trailing path separators for various reasons so to work around that we add a to drive letter paths on windows if operating system is windows if path length 2 path char at 1 path path concat file separator file directory new file path file list directory list files if list null vfs manager error comp path ioerror directory error nomsg null return null vfs directory entry list2 new vfs directory entry list length for int i 0 i list length i list2 i new local directory entry list i return list2 _listdirectory directoryentry _listdirectory operatingsystem iswindows charat listfiles vfsmanager directoryentry directoryentry localdirectoryentry getdirectoryentry method public directory entry getdirectoryentry object session string path component comp if path equals operating system is unix return new vfs directory entry path path path vfs directory entry directory 0l false file file new file path if file exists return null return new local directory entry file _getdirectoryentry directoryentry _getdirectoryentry operatingsystem isunix directoryentry directoryentry localdirectoryentry delete method public boolean delete object session string path component comp file file new file path do some platforms throw exceptions if the file does not exist when we ask for the canonical path string canon path try canon path file get canonical path catch io exception io canon path path boolean ret val file delete if ret val vfs manager sendvfs update this canon path true return ret val _delete _delete canonpath canonpath getcanonicalpath ioexception canonpath retval retval vfsmanager sendvfsupdate canonpath retval rename method public boolean rename object session string from string to component comp file to new file to string to canon path try to canon path to get canonical path catch io exception io to canon path to this is needed because on os x renaming to a non existent directory causes problems file parent new file to get parent if parent exists if parent is directory return false else parent mkdirs if parent exists return false file from new file from string from canon path try from canon path from get canonical path catch io exception io from canon path from case insensitive fs workaround if from canon path equals ignore case to canon path to delete boolean ret val from rename to to vfs manager sendvfs update this from canon path true vfs manager sendvfs update this to canon path true return ret val _rename _rename _to tocanonpath tocanonpath _to getcanonicalpath ioexception tocanonpath _to getparent isdirectory _from fromcanonpath fromcanonpath _from getcanonicalpath ioexception fromcanonpath fromcanonpath equalsignorecase tocanonpath _to retval _from renameto _to vfsmanager sendvfsupdate fromcanonpath vfsmanager sendvfsupdate tocanonpath retval mkdir method public boolean mkdir object session string directory component comp string parent get parent of path directory if new file parent exists if mkdir session parent comp return false file file new file directory boolean ret val file mkdir string canon path try canon path file get canonical path catch io exception io canon path directory vfs manager sendvfs update this canon path true return ret val _mkdir _mkdir getparentofpath _mkdir retval canonpath canonpath getcanonicalpath ioexception canonpath vfsmanager sendvfsupdate canonpath retval backup method public void backup object session string path component comp throws io exception fetch properties int backups j edit get integer property backups 1 if backups 0 return string backup prefix j edit get property backup prefix string backup suffix j edit get property backup suffix string backup directory j edit get property backup directory int backup time distance j edit get integer property backup min time 0 file file new file path check for backup directory and create that directory if it doesn t exist if backup directory null backup directory length 0 backup directory file get parent else backup directory misc utilities construct path system get property user home backup directory perhaps here we would want to guard with a property for parallel backups or not backup directory misc utilities concat path backup directory file get parent file dir new file backup directory if dir exists dir mkdirs misc utilities save backup file backups backup prefix backup suffix backup directory backup time distance _backup _backup ioexception jedit getintegerproperty backupprefix jedit getproperty backupsuffix jedit getproperty backupdirectory jedit getproperty backuptimedistance jedit getintegerproperty mintime backupdirectory backupdirectory backupdirectory getparent backupdirectory miscutilities constructpath getproperty backupdirectory backupdirectory miscutilities concatpath backupdirectory getparent backupdirectory miscutilities savebackup backupprefix backupsuffix backupdirectory backuptimedistance createinputstream method public input stream createinputstream object session string path boolean ignore errors component comp throws io exception try return new file input stream path catch io exception io if ignore errors return null else throw io _createinputstream inputstream _createinputstream ignoreerrors ioexception fileinputstream ioexception ignoreerrors createoutputstream method public output stream createoutputstream object session string path component comp throws io exception return new file output stream path _createoutputstream outputstream _createoutputstream ioexception fileoutputstream savecomplete method public void savecomplete object session buffer buffer string path component comp int permissions buffer get integer property permissions property 0 set permissions path permissions _savecomplete _savecomplete getintegerproperty permissions_property setpermissions get permissions method returns numeric permissions of a file on non unix systems always returns zero since j edit 3 2pre9 public static int get permissions string path int permissions 0 if j edit get boolean property chmod disabled return permissions if operating system is unix string cmdarray ls ld path try process process runtime get runtime exec cmdarray buffered reader reader new buffered reader new input stream reader process get input stream string output reader read line if output null string s output substring 1 10 permissions misc utilities parse permissions s feb 4 2000 5 30 pm catch throwable here rather than exception kaffe s implementation of runtime exec throws java lang internal error catch throwable t return permissions getpermissions jedit getpermissions jedit getbooleanproperty chmoddisabled operatingsystem isunix getruntime bufferedreader bufferedreader inputstreamreader getinputstream readline miscutilities parsepermissions internalerror set permissions method sets numeric permissions of a file on non unix platforms does nothing since j edit 3 2pre9 public static void set permissions string path int permissions if j edit get boolean property chmod disabled return if permissions 0 if operating system is unix string cmdarray chmod integer to string permissions 8 path try process process runtime get runtime exec cmdarray process get input stream close process get output stream close process get error stream close jun 9 2004 12 40 pm wait for hangs on some java implementations int exit code process wait for if exit code 0 log log log notice filevfs class chmod exited with code exit code feb 4 2000 5 30 pm catch throwable here rather than exception kaffe s implementation of runtime exec throws java lang internal error catch throwable t setpermissions jedit setpermissions jedit getbooleanproperty chmoddisabled operatingsystem isunix tostring getruntime getinputstream getoutputstream geterrorstream waitfor exitcode waitfor exitcode exitcode internalerror re token char int sub index char c boolean ins super sub index ch new char 1 ch 0 insens ins character to lower case c c retokenchar subindex subindex tolowercase int get minimum length return ch length getminimumlength boolean match char indexed input re match mymatch int z ch length char c for int i 0 i z i c input char at mymatch index i if insens character to lower case c c ch i return false mymatch index z return next input mymatch charindexed rematch charat tolowercase overrides re token chain to optimize for strings boolean chain re token next if next instanceof re token char re token char cnext re token char next assume for now that next can only be one character int newsize ch length cnext ch length char ch temp new char newsize system arraycopy ch 0 ch temp 0 ch length system arraycopy cnext ch 0 ch temp ch length cnext ch length ch ch temp return false else return super chain next retoken retoken retokenchar retokenchar retokenchar chtemp chtemp chtemp chtemp void dump string buffer os os append ch stringbuffer add to bus method adds a component to the bus it will receive all messages sent on the bus param comp the component to add public static void add to bus eb component comp synchronized components components add comp copy components null addtobus addtobus ebcomponent copycomponents remove from bus method removes a component from the bus param comp the component to remove public static void remove from bus eb component comp synchronized components components remove comp copy components null removefrombus removefrombus ebcomponent copycomponents get components method returns an array of all components connected to the bus public static eb component get components synchronized components if copy components null copy components eb component components to array new eb component components size return copy components getcomponents ebcomponent getcomponents copycomponents copycomponents ebcomponent toarray ebcomponent copycomponents send method sends a message to all components on the bus in turn param message the message public static void send eb message message log log log debug edit bus class message to string to avoid any problems if components are added or removed while the message is being sent eb component comps get components for int i 0 i comps length i try eb component comp comps i if debug eb timer long start system current time millis comp handle message message long time system current time millis start if time 0 log log log debug edit bus class comp time ms else comps i handle message message catch throwable t log log log error edit bus class exception while sending message on edit bus log log log error edit bus class t ebmessage editbus tostring ebcomponent getcomponents ebcomponent eb_timer currenttimemillis handlemessage currenttimemillis editbus handlemessage editbus editbus editbus can t create new instances private edit bus editbus set interval method public static void set interval int interval if interval 0 if timer null timer stop timer null return interval 1000 if timer null timer new timer interval new autosave timer start else timer set delay interval setinterval setinterval setdelay stop method public static void stop if timer null timer stop action performed method public void action performed action event evt might come in handy useful some time runtime runtime runtime get runtime int free memory int runtime free memory 1024 int total memory int runtime total memory 1024 int used memory total memory free memory log log log debug this java heap used memory kb total memory kb used memory 100 total memory save list of open files if j edit get view count 0 perspective manager is perspective dirty perspective manager set perspective dirty false perspective manager save perspective true buffer buffer array j edit get buffers for int i 0 i buffer array length i buffer array i autosave flush log log flush stream actionperformed actionperformed actionevent getruntime freememory freememory totalmemory totalmemory usedmemory totalmemory freememory usedmemory totalmemory usedmemory totalmemory jedit getviewcount perspectivemanager isperspectivedirty perspectivemanager setperspectivedirty perspectivemanager saveperspective bufferarray jedit getbuffers bufferarray bufferarray flushstream private static timer timer private autosave directory provider constructor public directory provider string dir this dir dir directoryprovider directoryprovider update every time method public boolean update every time return true updateeverytime updateeverytime update method public void update j menu menu final view view gui utilities get view menu final string path if dir null path view get buffer get directory else path dir j menu item mi new j menu item path mi set action command path mi set icon file cell renderer open dir icon action listeners action listener file listener new action listener public void action performed action event evt j edit open file view evt get action command action listener dir listener new action listener public void action performed action event evt vfs browser browse directory view evt get action command mi add action listener dir listener menu add mi menu add separator if dir null view get buffer getvfs instanceof filevfs mi new j menu item j edit get property directory not local mi set enabled false menu add mi return file directory new file path j menu current menu for filtering out backups string backup prefix j edit get property backup prefix string backup suffix j edit get property backup suffix file list directory list files if list null list length 0 mi new j menu item j edit get property directory no files mi set enabled false menu add mi else int max items j edit get integer property menu spillover 20 misc utilities quicksort list new misc utilities stringi case compare for int i 0 i list length i file file list i string name file get name skip marker files if name ends with marks continue skip autosave files if name starts with name ends with continue skip backup files if backup prefix length 0 name starts with backup prefix backup suffix length 0 name ends with backup suffix continue skip directories if file is directory continue mi new j menu item name mi set action command file get path mi add action listener file is directory dir listener file listener mi set icon file is directory file cell renderer dir icon file cell renderer file icon if current get item count max items i list length 1 current add separator j menu new current new j menu j edit get property common more current add new current current new current current add mi jmenu guiutilities getview getbuffer getdirectory jmenuitem jmenuitem setactioncommand seticon filecellrenderer opendiricon actionlisteners actionlistener filelistener actionlistener actionperformed actionevent jedit openfile getactioncommand actionlistener dirlistener actionlistener actionperformed actionevent vfsbrowser browsedirectory getactioncommand addactionlistener dirlistener addseparator getbuffer jmenuitem jedit getproperty setenabled jmenu backupprefix jedit getproperty backupsuffix jedit getproperty listfiles jmenuitem jedit getproperty setenabled maxitems jedit getintegerproperty miscutilities miscutilities stringicasecompare getname endswith startswith endswith backupprefix startswith backupprefix backupsuffix endswith backupsuffix isdirectory jmenuitem setactioncommand getpath addactionlistener isdirectory dirlistener filelistener seticon isdirectory filecellrenderer diricon filecellrenderer fileicon getitemcount maxitems addseparator jmenu newcurrent jmenu jedit getproperty newcurrent newcurrent action listener file listener new action listener public void action performed action event evt j edit open file view evt get action command actionlistener filelistener actionlistener actionperformed actionevent jedit openfile getactioncommand public void action performed action event evt vfs browser browse directory view evt get action command actionperformed actionevent vfsbrowser browsedirectory getactioncommand text area dialog constructor public text area dialog frame frame string title string caption icon icon string text super frame title true init caption icon text textareadialog textareadialog text area dialog constructor public text area dialog frame frame string name throwable t this frame j edit get property name title j edit get property name message ui manager get icon option pane error icon misc utilities throwable to string t textareadialog textareadialog jedit getproperty jedit getproperty uimanager geticon optionpane erroricon miscutilities throwabletostring text area dialog constructor public text area dialog dialog frame string title string caption icon icon string text super frame title true init caption icon text textareadialog textareadialog text area dialog constructor public text area dialog dialog frame string name throwable t this frame j edit get property name title j edit get property name message ui manager get icon option pane error icon misc utilities throwable to string t textareadialog textareadialog jedit getproperty jedit getproperty uimanager geticon optionpane erroricon miscutilities throwabletostring init method private void init string caption icon icon string text j panel content new j panel new border layout 12 12 content set border new empty border 12 12 12 12 set content pane content box icon box new box box layout y axis icon box add new j label icon icon box add box create glue content add border layout west icon box j panel center panel new j panel new border layout 6 6 center panel add border layout north gui utilities create multiline label caption j text area text area new j text area 10 80 text area set text text text area set line wrap true text area set caret position 0 center panel add border layout center new j scroll pane text area content add border layout center center panel box buttons new box box layout x axis buttons add box create glue j button ok new j button j edit get property common ok ok add action listener new action handler buttons add ok buttons add box create glue content add border layout south buttons get root pane set default button ok pack set location relative to get parent set visible true jpanel jpanel borderlayout setborder emptyborder setcontentpane iconbox boxlayout y_axis iconbox jlabel iconbox createglue borderlayout iconbox jpanel centerpanel jpanel borderlayout centerpanel borderlayout guiutilities createmultilinelabel jtextarea textarea jtextarea textarea settext textarea setlinewrap textarea setcaretposition centerpanel borderlayout jscrollpane textarea borderlayout centerpanel boxlayout x_axis createglue jbutton jbutton jedit getproperty addactionlistener actionhandler createglue borderlayout getrootpane setdefaultbutton setlocationrelativeto getparent setvisible ok method public void ok dispose cancel method public void cancel dispose action performed method public void action performed action event evt dispose actionperformed actionperformed actionevent returns the image public string to string return image tostring returns a new token object by default however if you want you can create and return subclass objects based on the value of of kind simply add the cases to the switch for all those special cases for example if you have a subclass of token called id token that you want to create if of kind is id simlpy add something like case my parser constants id return new id token to the following switch statement then you can cast matched token variable to the appropriate type and use it in your lexical actions public static final token new token int of kind switch of kind default return new token ofkind idtoken ofkind myparserconstants idtoken matchedtoken newtoken ofkind ofkind constructor public macos option pane super macos plugin macosoptionpane macosplugin init method public void init dimension d new dimension 7 7 dimension d 2 new dimension 20 20 menu box new j check box j edit get property options macos plugin menubar label add component menu box add component new j label requires restart for changes to take effect add component new box filler d d d preserve box new j check box j edit get property options macos plugin preserve label add component preserve box add component new box filler d d d selection box new j check box j edit get property options macos plugin use selection label add component selection box get settings _init _init d_2 menubox jcheckbox jedit getproperty macosplugin addcomponent menubox addcomponent jlabel addcomponent preservebox jcheckbox jedit getproperty macosplugin addcomponent preservebox addcomponent selectionbox jcheckbox jedit getproperty macosplugin useselection addcomponent selectionbox getsettings save method public void save j edit set boolean property macos plugin use screen menu bar menu box is selected j edit set boolean property macos plugin preserve codes preserve box is selected j edit set boolean property macos plugin use selection selection box is selected _save _save jedit setbooleanproperty macosplugin usescreenmenubar menubox isselected jedit setbooleanproperty macosplugin preservecodes preservebox isselected jedit setbooleanproperty macosplugin useselection selectionbox isselected get settings method public void get settings menu box set selected j edit get boolean property macos plugin use screen menu bar j edit get boolean property macos plugin default use screen menu bar preserve box set selected j edit get boolean property macos plugin preserve codes j edit get boolean property macos plugin default preserve codes selection box set selected j edit get boolean property macos plugin use selection j edit get boolean property macos plugin default use selection getsettings getsettings menubox setselected jedit getbooleanproperty macosplugin usescreenmenubar jedit getbooleanproperty macosplugin usescreenmenubar preservebox setselected jedit getbooleanproperty macosplugin preservecodes jedit getbooleanproperty macosplugin preservecodes selectionbox setselected jedit getbooleanproperty macosplugin useselection jedit getbooleanproperty macosplugin useselection private string newline matches after a newline re token start int sub index string newline super sub index this newline newline retokenstart subindex subindex boolean match char indexed input re match mymatch char at index n may be unknown on a reader input stream fixme match after a newline if in multiline mode if newline null int len newline length if mymatch offset len boolean found true char z int i 0 position in re token newline char ch input char at mymatch index len do z newline char at i if ch z found false break i ch input char at mymatch index len i while i len if found return next input mymatch don t match at all if reg notbol is set if mymatch eflags re reg notbol 0 return false if mymatch eflags re reg anchorindex 0 return mymatch anchor mymatch offset next input mymatch false else return mymatch index 0 mymatch offset 0 next input mymatch false charindexed rematch charat inputstream retoken charat charat charat reg_notbol reg_notbol reg_anchorindex void dump string buffer os os append stringbuffer constructor public show buffer menu super j edit get property macos plugin menu buffers label add menu listener this showbuffermenu jedit getproperty macosplugin addmenulistener construct method private void construct j menu item item remove all buffer buffs j edit get buffers for int i 0 i buffs length i if buffs i is untitled item add new show buffer menu item buffs i get name buffs i get path item set icon file cell renderer file icon add item if get item count 0 item new j menu item j edit get property macos plugin menu buffers none item set enabled false add item jmenuitem removeall jedit getbuffers isuntitled showbuffermenuitem getname getpath seticon filecellrenderer fileicon getitemcount jmenuitem jedit getproperty macosplugin setenabled menu selected method public void menu selected menu event e construct menuselected menuselected menuevent menu deselected method public void menu deselected menu event e menudeselected menudeselected menuevent menu canceled method public void menu canceled menu event e menucanceled menucanceled menuevent public show buffer menu item string name string path super name this path path add action listener new show file action showbuffermenuitem addactionlistener showfileaction class show file action implements action listener public void action performed action event e macos actions show in finder path showfileaction actionlistener actionperformed actionevent macosactions showinfinder public invalid header exception super invalidheaderexception public invalid header exception string msg super msg invalidheaderexception process key event method public static key event process key event key event evt int key code evt get key code char ch evt get key char switch evt getid key pressed case key event key pressed last key time evt get when get rid of keys we never need to handle switch key code case key event vk dead grave case key event vk dead acute case key event vk dead circumflex case key event vk dead tilde case key event vk dead macron case key event vk dead breve case key event vk dead abovedot case key event vk dead diaeresis case key event vk dead abovering case key event vk dead doubleacute case key event vk dead caron case key event vk dead cedilla case key event vk dead ogonek case key event vk dead iota case key event vk dead voiced sound case key event vk dead semivoiced sound case 0 return null case key event vk alt modifiers input event alt mask return null case key event vk alt graph modifiers input event alt graph mask return null case key event vk control modifiers input event ctrl mask return null case key event vk shift modifiers input event shift mask return null case key event vk meta modifiers input event meta mask return null default if evt is meta down if evt is control down evt is alt down last key time 0l else if evt is control down evt is alt down last key time 0l if key code key event vk 0 key code key event vk 9 return null if key code key event vk a key code key event vk z return null if debug alt key pressed disabled we don t handle key pressed a they re too troublesome if modifiers input event alt mask 0 return null switch key code case key event vk numpad0 case key event vk numpad1 case key event vk numpad2 case key event vk numpad3 case key event vk numpad4 case key event vk numpad5 case key event vk numpad6 case key event vk numpad7 case key event vk numpad8 case key event vk numpad9 case key event vk multiply case key event vk add case key event vk separator case key event vk subtract case key event vk decimal case key event vk divide last last numkeypad break default last last nothing break return evt key typed case key event key typed need to let b through so that backspace will work in history text fields if ch 0x20 ch 0x7f ch 0xff ch b ch t ch n return null if evt get when last key time 750 if debug alternative dispatcher if modifiers input event ctrl mask 0 modifiers input event alt mask 0 modifiers input event meta mask 0 return null if the last key was a numeric keypad key and num lock is off filter it out if last last numkeypad last last nothing if ch 0 ch 9 ch ch ch ch ch return null windows jdk workaround else if last last alt last last nothing switch ch case b case m case x case c case case case return null else if modifiers input event shift mask 0 switch ch case n case t return null modifiers 0 return evt key released case key event key released switch key code case key event vk alt modifiers input event alt mask last key time evt get when we consume this to work around the bug where a tab window switching activates the menu bar on windows evt consume return null case key event vk alt graph modifiers input event alt graph mask return null case key event vk control modifiers input event ctrl mask return null case key event vk shift modifiers input event shift mask return null case key event vk meta modifiers input event meta mask return null case key event vk left case key event vk right case key event vk up case key event vk down case key event vk page up case key event vk page down case key event vk end case key event vk home workaround for a keys producing garbage on windows if modifiers input event alt mask last last alt break return evt default return evt processkeyevent keyevent processkeyevent keyevent keycode getkeycode getkeychar key_pressed keyevent key_pressed lastkeytime getwhen keycode keyevent vk_dead_grave keyevent vk_dead_acute keyevent vk_dead_circumflex keyevent vk_dead_tilde keyevent vk_dead_macron keyevent vk_dead_breve keyevent vk_dead_abovedot keyevent vk_dead_diaeresis keyevent vk_dead_abovering keyevent vk_dead_doubleacute keyevent vk_dead_caron keyevent vk_dead_cedilla keyevent vk_dead_ogonek keyevent vk_dead_iota keyevent vk_dead_voiced_sound keyevent vk_dead_semivoiced_sound keyevent vk_alt inputevent alt_mask keyevent vk_alt_graph inputevent alt_graph_mask keyevent vk_control inputevent ctrl_mask keyevent vk_shift inputevent shift_mask keyevent vk_meta inputevent meta_mask ismetadown iscontroldown isaltdown lastkeytime iscontroldown isaltdown lastkeytime keycode keyevent vk_0 keycode keyevent vk_9 keycode keyevent vk_a keycode keyevent vk_z alt_key_pressed_disabled inputevent alt_mask keycode keyevent vk_numpad0 keyevent vk_numpad1 keyevent vk_numpad2 keyevent vk_numpad3 keyevent vk_numpad4 keyevent vk_numpad5 keyevent vk_numpad6 keyevent vk_numpad7 keyevent vk_numpad8 keyevent vk_numpad9 keyevent vk_multiply keyevent vk_add keyevent vk_separator keyevent vk_subtract keyevent vk_decimal keyevent vk_divide last_numkeypad last_nothing key_typed keyevent key_typed historytextfields getwhen lastkeytime alternative_dispatcher inputevent ctrl_mask inputevent alt_mask inputevent meta_mask numlock last_numkeypad last_nothing last_alt last_nothing inputevent shift_mask key_released keyevent key_released keycode keyevent vk_alt inputevent alt_mask lastkeytime getwhen keyevent vk_alt_graph inputevent alt_graph_mask keyevent vk_control inputevent ctrl_mask keyevent vk_shift inputevent shift_mask keyevent vk_meta inputevent meta_mask keyevent vk_left keyevent vk_right keyevent vk_up keyevent vk_down keyevent vk_page_up keyevent vk_page_down keyevent vk_end keyevent vk_home inputevent alt_mask last_alt numeric keypad key method a workaround for non working num lock status in some java versions since j edit 4 0pre8 public static void numeric keypad key last last nothing numerickeypadkey numlock jedit numerickeypadkey last_nothing service list handler constructor service list handler pluginjar plugin url uri this plugin plugin this uri uri state stack new stack cached services new linked list servicelisthandler servicelisthandler statestack cachedservices linkedlist resolve entity method public object resolve entity string public id string system id if services dtd equals system id this will result in a slight speed up since we don t need to read the dtd anyway as a elfred is non validating return new string reader try return new buffered reader new input stream reader get class get resource as stream org gjt sp jedit services dtd catch exception e log log log error this error while opening dockables dtd log log log error this e return null resolveentity resolveentity publicid systemid systemid aelfred stringreader bufferedreader inputstreamreader getclass getresourceasstream attribute method public void attribute string aname string value boolean is specified if aname equals name service name value else if aname equals class service class value isspecified servicename serviceclass doctype decl method public void doctype decl string name string public id string system id throws exception if services equals name return log log log error this uri doctype must be services doctypedecl doctypedecl publicid systemid char data method public void char data char c int off int len string tag peek element string text new string c off len if tag service code text chardata chardata peekelement start element method public void start element string tag tag push element tag startelement startelement pushelement end element method public void end element string name if name null return string tag peek element if name equals tag if tag service service manager descriptor d new service manager descriptor service class service name code plugin service manager register service d cached services add d pop element else can t happen throw new internal error endelement endelement peekelement servicemanager servicemanager serviceclass servicename servicemanager registerservice cachedservices popelement internalerror start document method public void start document try push element null catch exception e e print stack trace startdocument startdocument pushelement printstacktrace get cached services method public service manager descriptor get cached services return service manager descriptor cached services to array new service manager descriptor cached services size getcachedservices servicemanager getcachedservices servicemanager cachedservices toarray servicemanager cachedservices push element method private string push element string name name name null null name intern state stack push name return name pushelement pushelement statestack peek element method private string peek element return string state stack peek peekelement peekelement statestack pop element method private string pop element return string state stack pop popelement popelement statestack history text field constructor creates a new history text field since j edit 3 2pre5 public history text field this null historytextfield jedit historytextfield history text field constructor creates a new history text field param name the history model name public history text field string name this name false true historytextfield historytextfield history text field constructor creates a new history text field param name the history model name param instant popups if true selecting a value from the history popup will immediately fire an action event if false the user will have to press enter first since j edit 2 2pre5 public history text field string name boolean instant popups this name instant popups true historytextfield instantpopups actionevent jedit historytextfield instantpopups instantpopups history text field constructor creates a new history text field param name the history model name param instant popups if true selecting a value from the history popup will immediately fire an action event if false the user will have to press enter first param enter adds to history if true pressing the enter key will automatically add the currently entered text to the history since j edit 2 6pre5 public history text field string name boolean instant popups boolean enter adds to history set model name mouse handler mouse handler new mouse handler add mouse listener mouse handler add mouse motion listener mouse handler this instant popups instant popups this enter adds to history enter adds to history index 1 historytextfield instantpopups actionevent enteraddstohistory jedit historytextfield instantpopups enteraddstohistory setmodel mousehandler mousehandler mousehandler addmouselistener mousehandler addmousemotionlistener mousehandler instantpopups instantpopups enteraddstohistory enteraddstohistory set instant popups method sets if selecting a value from the popup should immediately fire an action event since j edit 4 0pre3 public void set instant popups boolean instant popups this instant popups instant popups setinstantpopups actionevent jedit setinstantpopups instantpopups instantpopups instantpopups get instant popups method returns if selecting a value from the popup should immediately fire an action event since j edit 4 0pre3 public boolean get instant popups return instant popups getinstantpopups actionevent jedit getinstantpopups instantpopups set enter adds to history method sets if pressing enter should automatically add the currently entered text to the history since j edit 4 0pre3 public void set enter adds to history boolean enter adds to history this enter adds to history enter adds to history setenteraddstohistory jedit setenteraddstohistory enteraddstohistory enteraddstohistory enteraddstohistory get enter adds to history method returns if pressing enter should automatically add the currently entered text to the history since j edit 4 0pre3 public boolean set enter adds to history return enter adds to history getenteraddstohistory jedit setenteraddstohistory enteraddstohistory set select all on focus method sets if all text should be selected when the field gets focus since j edit 4 0pre3 public void set select all on focus boolean select all on focus this select all on focus select all on focus setselectallonfocus jedit setselectallonfocus selectallonfocus selectallonfocus selectallonfocus get select all on focus method returns if all text should be selected when the field gets focus since j edit 4 0pre3 public boolean set select all on focus return select all on focus getselectallonfocus jedit setselectallonfocus selectallonfocus get model method returns the underlying history model public history model get model return history model getmodel historymodel getmodel historymodel set model method sets the history list model param name the model name since j edit 2 3pre3 public void set model string name border text field border ui manager get border text field border if name null history model null if text field border null set border text field border else history model history model get model name if text field border null set border new compound border text field border new history border index 1 repaint setmodel jedit setmodel textfieldborder uimanager getborder textfield historymodel textfieldborder setborder textfieldborder historymodel historymodel getmodel textfieldborder setborder compoundborder textfieldborder historyborder add current to history method adds the currently entered item to the history public void add current to history if history model null history model add item get text index 0 addcurrenttohistory addcurrenttohistory historymodel historymodel additem gettext set text method sets the displayed text public void set text string text super set text text index 1 settext settext settext fire action performed method fires an action event to all listeners this is public so that inner classes can access it public void fire action performed super fire action performed fireactionperformed fireactionperformed fireactionperformed process key event method protected void process key event key event evt if is enabled return evt key event workaround process key event evt if evt null return if evt getid key event key pressed switch evt get key code case key event vk enter if enter adds to history add current to history if evt get modifiers 0 fire action performed evt consume break case key event vk up if evt is shift down do backward search else history previous evt consume break case key event vk down if evt is shift down do forward search else if evt is alt down show popup menu evt is shift down else history next evt consume break case key event vk tab if evt is control down do backward search evt consume break if evt is consumed super process key event evt processkeyevent processkeyevent keyevent isenabled keyeventworkaround processkeyevent keyevent key_pressed getkeycode keyevent vk_enter enteraddstohistory addcurrenttohistory getmodifiers fireactionperformed keyevent vk_up isshiftdown dobackwardsearch historyprevious keyevent vk_down isshiftdown doforwardsearch isaltdown showpopupmenu isshiftdown historynext keyevent vk_tab iscontroldown dobackwardsearch isconsumed processkeyevent process mouse event method protected void process mouse event mouse event evt if is enabled return switch evt getid case mouse event mouse pressed border border get border insets insets border get border insets history text field this if evt getx get width insets right gui utilities is popup trigger evt show popup menu evt is shift down else super process mouse event evt break case mouse event mouse exited set cursor cursor get default cursor super process mouse event evt break default super process mouse event evt break processmouseevent processmouseevent mouseevent isenabled mouseevent mouse_pressed getborder getborderinsets historytextfield getwidth guiutilities ispopuptrigger showpopupmenu isshiftdown processmouseevent mouseevent mouse_exited setcursor getdefaultcursor processmouseevent processmouseevent do backward search method private void do backward search if history model null return if get selection end get document get length set caret position get document get length string text get text substring 0 get selection start if text null history previous return for int i index 1 i history model get size i string item history model get item i if item starts with text replace selection item substring text length select text length get document get length index i return get toolkit beep dobackwardsearch dobackwardsearch historymodel getselectionend getdocument getlength setcaretposition getdocument getlength gettext getselectionstart historyprevious historymodel getsize historymodel getitem startswith replaceselection getdocument getlength gettoolkit do forward search method private void do forward search if history model null return if get selection end get document get length set caret position get document get length string text get text substring 0 get selection start if text null history next return for int i index 1 i 0 i string item history model get item i if item starts with text replace selection item substring text length select text length get document get length index i return get toolkit beep doforwardsearch doforwardsearch historymodel getselectionend getdocument getlength setcaretposition getdocument getlength gettext getselectionstart historynext historymodel getitem startswith replaceselection getdocument getlength gettoolkit history previous method private void history previous if history model null return if index history model get size 1 get toolkit beep else if index 1 current get text set text history model get item 0 index 0 else have to do this because set text sets index to 1 int new index index 1 set text history model get item new index index new index historyprevious historyprevious historymodel historymodel getsize gettoolkit gettext settext historymodel getitem settext newindex settext historymodel getitem newindex newindex history next method private void history next if history model null return if index 1 get toolkit beep else if index 0 set text current else have to do this because set text sets index to 1 int new index index 1 set text history model get item new index index new index historynext historynext historymodel gettoolkit settext settext newindex settext historymodel getitem newindex newindex show popup menu method private void show popup menu string text int x int y if history model null return request focus if popup null popup is visible popup set visible false return action handler action listener new action handler popup new j popup menu j menu item caption new j menu item j edit get property history caption caption get model set enabled false popup add caption popup add separator for int i 0 i history model get size i string item history model get item i if item starts with text j menu item menu item new j menu item item menu item set action command string value of i menu item add action listener action listener popup add menu item gui utilities show popup menu popup this x y false showpopupmenu showpopupmenu historymodel requestfocus isvisible setvisible actionhandler actionlistener actionhandler jpopupmenu jmenuitem jmenuitem jedit getproperty getmodel setenabled addseparator historymodel getsize historymodel getitem startswith jmenuitem menuitem jmenuitem menuitem setactioncommand valueof menuitem addactionlistener actionlistener menuitem guiutilities showpopupmenu show popup menu method private void show popup menu boolean search if search show popup menu get text substring 0 get selection start 0 get height else show popup menu 0 get height showpopupmenu showpopupmenu showpopupmenu gettext getselectionstart getheight showpopupmenu getheight public void action performed action event evt int ind integer parse int evt get action command if ind 1 if index 1 set text current else set text history model get item ind index ind if instant popups add current to history fire action performed actionperformed actionevent parseint getactioncommand settext settext historymodel getitem instantpopups addcurrenttohistory fireactionperformed mouse pressed method public void mouse pressed mouse event evt select all has focus select all on focus mousepressed mousepressed mouseevent selectall hasfocus selectallonfocus mouse released method public void mouse released mouse event evt swing utilities invoke later new runnable public void run if select all select all mousereleased mousereleased mouseevent swingutilities invokelater selectall selectall public void run if select all select all selectall selectall mouse moved method public void mouse moved mouse event evt border border get border insets insets border get border insets history text field this if evt getx get width insets right set cursor cursor get default cursor else set cursor cursor get predefined cursor cursor text cursor mousemoved mousemoved mouseevent getborder getborderinsets historytextfield getwidth setcursor getdefaultcursor setcursor getpredefinedcursor text_cursor mouse dragged method public void mouse dragged mouse event evt select all false mousedragged mousedragged mouseevent selectall public void paint border component c graphics g int x int y int w int h g translate x w width y 1 if c is enabled vertical separation line g set color ui manager get color control dk shadow g draw line 0 0 0 h down arrow int w2 width 2 int h2 h 2 g set color ui manager get color c is enabled history text field c get model null text field foreground text field disabled foreground g draw line w2 5 h2 2 w2 4 h2 2 g draw line w2 4 h2 1 w2 3 h2 1 g draw line w2 3 h2 w2 2 h2 g draw line w2 2 h2 1 w2 1 h2 1 g draw line w2 1 h2 2 w2 h2 2 g translate x w width y 1 paintborder isenabled setcolor uimanager getcolor controldkshadow drawline setcolor uimanager getcolor isenabled historytextfield getmodel textfield textfield disabledforeground drawline drawline drawline drawline drawline public insets get border insets component c return new insets 0 0 0 width getborderinsets public static void main string args throws exception if args length 2 system out println usage remote url http bsh file file system exit 1 string url args 0 string text get file args 1 int ret eval url text null system exit ret getfile evaluate text in the interpreter at url capturing output into output and returning a possible integer return value public static int eval string url string text string buffer output throws io exception string return value null if url starts with http return value do http url text else if url starts with bsh return value do bsh url text else throw new io exception unrecognized url type scheme must be http or bsh try return integer parse int return value catch exception e this convention may change return 0 stringbuffer ioexception returnvalue startswith returnvalue dohttp startswith returnvalue dobsh ioexception parseint returnvalue static string do bsh string url string text output stream out input stream in string host string port string return value 1 string orgurl url need some format checking here try url url substring 6 remove the bsh get the index of the between the host and the port is located int index url index of host url substring 0 index port url substring index 1 url length catch exception ex system err println bad url orgurl ex return return value try system out println connecting to host host at port port socket s new socket host integer parse int port 1 out s get output stream in s get input stream send line text out buffered reader bin new buffered reader new input stream reader in string line while line bin read line null system out println line need to scrape a value from the last line return value 1 return return value catch exception ex system err println error communicating with server ex return return value dobsh outputstream inputstream returnvalue indexof returnvalue parseint getoutputstream getinputstream sendline bufferedreader bufferedreader inputstreamreader readline returnvalue returnvalue returnvalue private static void send line string line output stream out pipe throws io exception out pipe write line get bytes out pipe flush sendline outputstream outpipe ioexception outpipe getbytes outpipe static string do http string posturl string text string return value null string buffer sb new string buffer sb append bsh client remote sb append bsh script sb append url encoder encode text string form data sb to string try url url new url posturl httpurl connection urlcon httpurl connection url open connection urlcon set request method post urlcon set request property content type application x www form urlencoded urlcon set do output true urlcon set do input true print writer pout new print writer new output stream writer urlcon get output stream 8859 1 true pout print form data pout flush read results int rc urlcon get response code if rc httpurl connection http ok system out println error http response rc return value urlcon get header field bsh return buffered reader bin new buffered reader new input stream reader urlcon get input stream string line while line bin read line null system out println line system out println return value return value catch malformedurl exception e system out println e bad posturl catch io exception e2 system out println e2 i o error return return value dohttp returnvalue stringbuffer stringbuffer urlencoder formdata tostring httpurlconnection httpurlconnection openconnection setrequestmethod setrequestproperty setdooutput setdoinput printwriter printwriter outputstreamwriter getoutputstream 8859_1 formdata getresponsecode httpurlconnection http_ok returnvalue getheaderfield bufferedreader bufferedreader inputstreamreader getinputstream readline returnvalue malformedurlexception ioexception returnvalue static string get file string name throws file not found exception io exception string buffer sb new string buffer buffered reader bin new buffered reader new file reader name string line while line bin read line null sb append line append n return sb to string getfile filenotfoundexception ioexception stringbuffer stringbuffer bufferedreader bufferedreader filereader readline tostring invoke method on arbitrary object invocation may be static through the object instance or dynamic object may be a bsh scripted object this type public static object invoke object method object object string method name object args interpreter interpreter call stack callstack simple node caller info throws reflect error eval error invocation target exception bsh scripted object if object instanceof this this is exposed this method method name return this object invoke method method name args interpreter callstack caller info false delcared only else java object find the java method try bsh class manager bcm interpreter null null interpreter get class manager class clas object get class method method resolve expected java method bcm clas object method name args false return invoke on method method object args catch util eval error e throw e to eval error caller info callstack invokeobjectmethod methodname callstack simplenode callerinfo reflecterror evalerror invocationtargetexception isexposedthismethod methodname invokemethod methodname callerinfo delcaredonly bshclassmanager getclassmanager getclass resolveexpectedjavamethod methodname invokeonmethod utilevalerror toevalerror callerinfo invoke a method known to be static no object instance is needed and there is no possibility of the method being a bsh scripted method public static object invoke static method bsh class manager bcm class clas string method name object args throws reflect error util eval error invocation target exception interpreter debug invoke static method method method resolve expected java method bcm clas null method name args true return invoke on method method null args invokestaticmethod bshclassmanager methodname reflecterror utilevalerror invocationtargetexception resolveexpectedjavamethod methodname invokeonmethod invoke the java method on the specified object param args may be null static object invoke on method method method object object object args throws reflect error invocation target exception if args null args new object 0 if interpreter debug interpreter debug invoking method entry method with args for int i 0 i args length i interpreter debug args i args i type args i get class map types to assignable forms need to keep this fast object tmp args new object args length class types method get parameter types try for int i 0 i args length i tmp args i types get assignable form args i types i catch util eval error e throw new interpreter error illegal argument type in method invocation e unwrap any primitives tmp args primitive unwrap tmp args if interpreter debug interpreter debug invoking method after massaging values method with tmp args for int i 0 i tmp args length i interpreter debug tmp args i tmp args i type tmp args i get class try object return value method invoke object tmp args if return value null return value primitive null class return type method get return type return primitive wrap return value return type catch illegal access exception e throw new reflect error cannot access method string util method string method get name method get parameter types in method get declaring class e invokeonmethod reflecterror invocationtargetexception getclass tmpargs getparametertypes tmpargs getassignableform utilevalerror interpretererror tmpargs tmpargs tmpargs tmpargs tmpargs tmpargs tmpargs getclass returnvalue tmpargs returnvalue returnvalue returntype getreturntype returnvalue returntype illegalaccessexception reflecterror stringutil methodstring getname getparametertypes getdeclaringclass public static object get index object array int index throws reflect error util target error if interpreter debug interpreter debug get index array index index try object val array get array index return primitive wrap val array get class get component type catch array index out of bounds exception e1 throw new util target error e1 catch exception e throw new reflect error array access e getindex reflecterror utiltargeterror getindex getclass getcomponenttype arrayindexoutofboundsexception utiltargeterror reflecterror public static void set index object array int index object val throws reflect error util target error try val primitive unwrap val array set array index val catch array store exception e2 throw new util target error e2 catch illegal argument exception e1 throw new util target error new array store exception e1 to string catch exception e throw new reflect error array access e setindex reflecterror utiltargeterror arraystoreexception utiltargeterror illegalargumentexception utiltargeterror arraystoreexception tostring reflecterror public static object get static field class clas string field name throws util eval error reflect error return get field value clas null field name true onlystatic getstaticfield fieldname utilevalerror reflecterror getfieldvalue fieldname public static object get object field object object string field name throws util eval error reflect error if object instanceof this return this object namespace get variable field name else try return get field value object get class object field name false onlystatic catch reflect error e no field try property acces if has object property getter object get class field name return get object property object field name else throw e getobjectfield fieldname utilevalerror reflecterror getvariable fieldname getfieldvalue getclass fieldname reflecterror hasobjectpropertygetter getclass fieldname getobjectproperty fieldname static lhs getlhs static field class clas string field name throws util eval error reflect error field f resolve expected java field clas field name true onlystatic return new lhs f getlhsstaticfield fieldname utilevalerror reflecterror resolveexpectedjavafield fieldname get an lhs reference to an object field this method also deals with the field style property access in the field does not exist we check for a property setter static lhs getlhs object field object object string field name throws util eval error reflect error if object instanceof this i guess this is when we pass it as an argument setting locally boolean recurse false return new lhs this object namespace field name recurse try field f resolve expected java field object get class field name false only static return new lhs object f catch reflect error e not a field try property access if has object property setter object get class field name return new lhs object field name else throw e getlhsobjectfield fieldname utilevalerror reflecterror fieldname resolveexpectedjavafield getclass fieldname onlystatic reflecterror hasobjectpropertysetter getclass fieldname fieldname private static object get field value class clas object object string field name boolean only static throws util eval error reflect error try field f resolve expected java field clas field name only static object value f get object class return type f get type return primitive wrap value return type catch null pointer exception e shouldn t happen throw new reflect error field name is not a static field catch illegal access exception e throw new reflect error can t access field field name getfieldvalue fieldname onlystatic utilevalerror reflecterror resolveexpectedjavafield fieldname onlystatic returntype gettype returntype nullpointerexception reflecterror fieldname illegalaccessexception reflecterror fieldname note this method and resolve expected java field should be rewritten to invert this logic so that no exceptions need to be caught unecessarily this is just a temporary impl return the field or null if not found protected static field resolve java field class clas string field name boolean only static throws util eval error try return resolve expected java field clas field name only static catch reflect error e return null resolveexpectedjavafield resolvejavafield fieldname onlystatic utilevalerror resolveexpectedjavafield fieldname onlystatic reflecterror throws reflect error if the field is not found note this should really just throw no such field exception need to change related signatures and code protected static field resolve expected java field class clas string field name boolean only static throws util eval error reflect error field f try if capabilities have accessibility f find accessible field clas field name else this one only finds public and in interfaces etc f clas get field field name catch no such field exception e try declared field throw new reflect error no such field field name if only static modifier is static f get modifiers throw new util eval error can t reach instance field field name from static context clas get name return f reflecterror nosuchfieldexception resolveexpectedjavafield fieldname onlystatic utilevalerror reflecterror haveaccessibility findaccessiblefield fieldname getfield fieldname nosuchfieldexception declaredfield reflecterror fieldname onlystatic isstatic getmodifiers utilevalerror fieldname getname used when accessibility capability is available to locate an occurrance of the field in the most derived class or superclass and set its accessibility flag note that this method is not needed in the simple non accessible case because we don t have to hunt for fields note that classes may declare overlapping private fields so the distinction about the most derived is important java doesn t normally allow this kind of access super won t show private variables so there is no real syntax for specifying which class scope to use return the field or throws no such field exception throws no such field exception if the field is not found this method should be rewritten to use get fields and avoid catching exceptions during the search private static field find accessible field class clas string field name throws util eval error no such field exception field field quick check catches public fields include those in interfaces try field clas get field field name reflect manager rm set accessible field return field catch no such field exception e now on with the hunt while clas null try field clas get declared field field name reflect manager rm set accessible field return field not found fall through to next class catch no such field exception e clas clas get superclass throw new no such field exception field name nosuchfieldexception nosuchfieldexception getfields findaccessiblefield fieldname utilevalerror nosuchfieldexception getfield fieldname reflectmanager rmsetaccessible nosuchfieldexception getdeclaredfield fieldname reflectmanager rmsetaccessible nosuchfieldexception getsuperclass nosuchfieldexception fieldname this method expects a non null method from resolve java method if the method is not found it throws a descriptive reflect error protected static method resolve expected java method bsh class manager bcm class clas object object string name object args boolean only static throws reflect error util eval error method method resolve java method bcm clas object name args only static if method null return method class types types get types args throw new reflect error only static static method method string util method string name types not found in class clas get name resolvejavamethod reflecterror resolveexpectedjavamethod bshclassmanager onlystatic reflecterror utilevalerror resolvejavamethod onlystatic gettypes reflecterror onlystatic stringutil methodstring getname the full blown resolver method all other method invocation methods delegate to this the method may be static or dynamic unless only static is set in which case object may be null if only static is set the only static methods will be located p this method performs java method caching internally param only static the method located must be static the object param may be null return the method or null if no matching method was found deprecated note object is only used here for precondition get rid of it protected static method resolve java method bsh class manager bcm class clas object object string name object args boolean only static throws util eval error why is object in the args if object primitive null throw new util target error new null pointer exception attempt to invoke method name on null value class types types get types args return resolve java method bcm clas name types only static onlystatic onlystatic onlystatic resolvejavamethod bshclassmanager onlystatic utilevalerror utiltargeterror nullpointerexception gettypes resolvejavamethod onlystatic protected static method resolve java method bsh class manager bcm class clas string name class types boolean only static throws util eval error if clas null throw new interpreter error null class method method null if bcm null interpreter debug resolve java method unoptimized lookup else method bcm get resolved method clas name types only static if method null return method if interpreter debug interpreter debug searching for method string util method string name types in clas get name first try for an accessible version of the exact match this first lookup seems redundant with below but is apparently needed this whole thing is messy try method find accessible method clas name types catch security exception e if not found and there are arguments to match look for an overloaded assignable match first find the method then find accessible version of it if method null types length 0 gather all of the methods of class and parents vector mv new vector class c clas while c null method m c get declared methods for int i 0 i m length i mv add m i c c get superclass method methods new method mv size mv copy into methods boolean public only capabilities have accessibility method find most specific method name types methods public only if method null modifier is public method get modifiers try reflect manager rm set accessible method catch util eval error e ignore if found a method make sure we have accessible version of it if method null try method find accessible method clas method get name method get parameter types catch security exception e leave null if interpreter debug method null interpreter debug had a method but it wasn t accessible if method null only static modifier is static method get modifiers throw new util eval error cannot reach instance method string util method string method get name method get parameter types from static context clas get name succeeded cache the resolved method if method null bcm null bcm cache resolved method clas types method return method resolvejavamethod bshclassmanager onlystatic utilevalerror interpretererror resolvejavamethod getresolvedmethod onlystatic stringutil methodstring getname findaccessiblemethod securityexception getdeclaredmethods getsuperclass copyinto publiconly haveaccessibility findmostspecificmethod publiconly ispublic getmodifiers reflectmanager rmsetaccessible utilevalerror findaccessiblemethod getname getparametertypes securityexception onlystatic isstatic getmodifiers utilevalerror stringutil methodstring getname getparametertypes getname cacheresolvedmethod locate a version of the method with the exact signature specified that is accessible via a public interface or through a public superclass or if accessibility is on through any interface or superclass in the normal non accessible case this still solves the problem that arises when a package private class or private inner class implements a public interface or derives from a public type param only static the method located must be static return null on not found notes see notes on find most specific method this method should be rolled into find most specific method static method find accessible method class clas string name class types throws util eval error method meth null method inaccessible version null vector classq new vector classq add element clas method found null while classq size 0 class c class classq first element classq remove element at 0 is this it is the class public or can we use accessibility if modifier is public c get modifiers capabilities have accessibility try meth c get declared method name types is the method public or are we in accessibility mode if modifier is public meth get modifiers modifier is public c get modifiers capabilities have accessibility reflect manager rm set accessible meth found meth yes it is break else found at least one matching method but couldn t use inaccessible version meth catch no such method exception e ignore and move on no it is not is this a class if c is interface class superclass c get superclass if superclass null classq add element object superclass search all of its interfaces breadth first class intfs c get interfaces for int i 0 i intfs length i classq add element object intfs i if found null return found if inaccessible version null throw new util eval error found non public method inaccessible version use set accessibility true to enable access to private and protected members of classes return null onlystatic findmostspecificmethod findmostspecificmethod findaccessiblemethod utilevalerror inaccessibleversion addelement firstelement removeelementat ispublic getmodifiers haveaccessibility getdeclaredmethod ispublic getmodifiers ispublic getmodifiers haveaccessibility reflectmanager rmsetaccessible inaccessibleversion nosuchmethodexception isinterface getsuperclass addelement getinterfaces addelement inaccessibleversion utilevalerror inaccessibleversion setaccessibility primary object constructor this method is simpler than those that must resolve general method invocation because constructors are not inherited static object construct object class clas object args throws reflect error invocation target exception if clas is interface throw new reflect error can t create instance of an interface clas object obj null class types types get types args constructor con null find an appropriate constructor use declared here to see package and private as well there are no inherited constructors to worry about constructor constructors clas get declared constructors if interpreter debug interpreter debug looking for most specific constructor clas con find most specific constructor types constructors if con null if types length 0 throw new reflect error can t find default constructor for clas else throw new reflect error can t find constructor string util method string clas get name types in class clas get name if modifier is public con get modifiers capabilities have accessibility try reflect manager rm set accessible con catch util eval error e ignore args primitive unwrap args try obj con new instance args catch instantiation exception e throw new reflect error the class is abstract catch illegal access exception e throw new reflect error we don t have permission to create an instance use set accessibility true to enable access catch illegal argument exception e throw new reflect error the number of arguments was wrong if obj null throw new reflect error couldn t construct the object return obj constructobject reflecterror invocationtargetexception isinterface reflecterror gettypes getdeclaredconstructors findmostspecificconstructor reflecterror reflecterror stringutil methodstring getname getname ispublic getmodifiers haveaccessibility reflectmanager rmsetaccessible utilevalerror newinstance instantiationexception reflecterror illegalaccessexception reflecterror setaccessibility illegalargumentexception reflecterror reflecterror implement jls 15 11 2 for method resolution return null on no match notes this is broken it finds public but less specific methods over non public but more specific ones this method needs to be rewritten to eliminate find accessible method we should implement the find most specific method that uses the public only flag find most specific method should also operate in two passes to give standard java assignable matches priority over extended bsh type matches static method find most specific method string name class ideal match method methods boolean public only pull out the method signatures with matching names vector sigs new vector vector meths new vector for int i 0 i methods length i if public only modifier is public methods i get modifiers continue method matches name if methods i get name equals name meths add element methods i sigs add element methods i get parameter types class candidates new class sigs size sigs copy into candidates if interpreter debug interpreter debug looking for most specific method name int match find most specific signature ideal match candidates if match 1 return null else return method meths element at match findaccessiblemethod findmostspecificmethod publiconly findmostspecificmethod findmostspecificmethod idealmatch publiconly publiconly ispublic getmodifiers getname addelement addelement getparametertypes copyinto findmostspecificsignature idealmatch elementat static constructor find most specific constructor class ideal match constructor constructors int match find most specific constructor index ideal match constructors if match 1 return null else return constructors match findmostspecificconstructor idealmatch findmostspecificconstructorindex idealmatch static int find most specific constructor index class ideal match constructor constructors class candidates new class constructors length for int i 0 i candidates length i candidates i constructors i get parameter types return find most specific signature ideal match candidates findmostspecificconstructorindex idealmatch getparametertypes findmostspecificsignature idealmatch implement jls 15 11 2 return the index of the most specific arguments match or 1 if no match is found static int find most specific signature class ideal match class candidates class best match null int best match index 1 for int i 0 i candidates length i class target match candidates i if ideal match fits target match and this is the first match or target match is more specific than the best match make it the new best match if types is signature assignable ideal match target match best match null types is signature assignable target match best match best match target match best match index i if best match null return best match index else return 1 findmostspecificsignature idealmatch bestmatch bestmatchindex targetmatch idealmatch targetmatch targetmatch issignatureassignable idealmatch targetmatch bestmatch issignatureassignable targetmatch bestmatch bestmatch targetmatch bestmatchindex bestmatch bestmatchindex private static string accessor name string getorset string prop name return getorset string value of character to upper case prop name char at 0 prop name substring 1 accessorname propname valueof touppercase propname charat propname public static boolean has object property getter class clas string prop name string getter name accessor name get prop name try clas get method getter name new class 0 return true catch no such method exception e fall through getter name accessor name is prop name try method m clas get method getter name new class 0 return m get return type boolean type catch no such method exception e return false hasobjectpropertygetter propname gettername accessorname propname getmethod gettername nosuchmethodexception gettername accessorname propname getmethod gettername getreturntype nosuchmethodexception public static boolean has object property setter class clas string prop name string setter name accessor name set prop name class sig new class clas method methods clas get methods we don t know the right hand side of the assignment yet has at least one setter of the right name for int i 0 i methods length i if methods i get name equals setter name return true return false hasobjectpropertysetter propname settername accessorname propname getmethods getname settername public static object get object property object obj string prop name throws util eval error reflect error object args new object interpreter debug property access method method null exception e1 null e2 null try string accessor name accessor name get prop name method resolve expected java method null bcm obj get class obj accessor name args false catch exception e e1 e if method null try string accessor name accessor name is prop name method resolve expected java method null bcm obj get class obj accessor name args false if method get return type boolean type method null catch exception e e2 e if method null throw new reflect error error in property getter e1 e2 null e2 try return invoke on method method obj args catch invocation target exception e throw new util eval error property accessor threw exception e get target exception getobjectproperty propname utilevalerror reflecterror accessorname accessorname propname resolveexpectedjavamethod getclass accessorname accessorname accessorname propname resolveexpectedjavamethod getclass accessorname getreturntype reflecterror invokeonmethod invocationtargetexception utilevalerror gettargetexception public static void set object property object obj string prop name object value throws reflect error util eval error string accessor name accessor name set prop name object args new object value interpreter debug property access try method method resolve expected java method null bcm obj get class obj accessor name args false invoke on method method obj args catch invocation target exception e throw new util eval error property accessor threw exception e get target exception setobjectproperty propname reflecterror utilevalerror accessorname accessorname propname resolveexpectedjavamethod getclass accessorname invokeonmethod invocationtargetexception utilevalerror gettargetexception return a more human readable version of the type name specifically array types are returned with postfix dimensions e g return int for integer array instead of class i as would be returned by class get name in that case public static string normalize class name class type if type is array return type get name string buffer class name new string buffer try class name append get array base type type get name for int i 0 i get array dimensions type i class name append catch reflect error e shouldn t happen return class name to string getname normalizeclassname isarray getname stringbuffer classname stringbuffer classname getarraybasetype getname getarraydimensions classname reflecterror classname tostring returns the dimensionality of the class returns 0 if the class is not an array class public static int get array dimensions class array class if array class is array return 0 return array class get name last index of 1 why so cute getarraydimensions arrayclass arrayclass isarray arrayclass getname lastindexof returns the base type of an array class throws reflect error if the class is not an array class public static class get array base type class array class throws reflect error if array class is array throw new reflect error the class is not an array return array class get component type reflecterror getarraybasetype arrayclass reflecterror arrayclass isarray reflecterror arrayclass getcomponenttype a command may be implemented as a compiled java class containing one or more static invoke methods of the correct signature the invoke methods must accept two additional leading arguments of the interpreter and callstack respectively e g invoke interpreter callstack this method adds the arguments and invokes the static method returning the result public static object invoke compiled command class command class object args interpreter interpreter call stack callstack throws util eval error add interpereter and namespace to args list object invoke args new object args length 2 invoke args 0 interpreter invoke args 1 callstack system arraycopy args 0 invoke args 2 args length bsh class manager bcm interpreter get class manager try return reflect invoke static method bcm command class invoke invoke args catch invocation target exception e throw new util eval error error in compiled command e get target exception catch reflect error e throw new util eval error error invoking compiled command e invokecompiledcommand commandclass callstack utilevalerror invokeargs invokeargs invokeargs invokeargs bshclassmanager getclassmanager invokestaticmethod commandclass invokeargs invocationtargetexception utilevalerror gettargetexception reflecterror utilevalerror public block name space name space parent throws eval error super parent parent get name block name space blocknamespace namespace evalerror getname blocknamespace override the standard namespace behavior to make assignments happen in our parent enclosing namespace unless the variable has already been assigned here via a typed declaration or through the special set block variable used for untyped args in try catch p i e only allow typed var declaration to happen in this namespace typed vars are handled in the ordinary way local scope all untyped assignments are delegated to the enclosing context note it may see like with the new 1 3 scoping this test could be removed but it cannot when recurse is false we still need to set the variable in our parent not here public void set variable string name object value boolean strict java boolean recurse throws util eval error if we have var name set the var here in the block namespace super set variable name value strict java false else set the var in the enclosing parent namespace get parent set variable name value strict java recurse setblockvariable setvariable strictjava utilevalerror wehavevar setvariable strictjava getparent setvariable strictjava set an untyped variable in the block namespace the block name space would normally delegate this set to the parent typed variables are naturally set locally this is used in try catch block argument public void set block variable string name object value throws util eval error super set variable name value false strict false blocknamespace setblockvariable utilevalerror setvariable we have the variable either it was declared here with a type giving it block local scope or an untyped var was explicitly set here via set block variable private boolean we have var string name super variables contains key name not any faster i checked try return super get variable impl name false null catch util eval error e return false setblockvariable wehavevar containskey getvariableimpl utilevalerror do we need this private name space get non block parent name space parent super get parent if parent instanceof block name space return block name space parent get non block parent else return parent namespace getnonblockparent namespace getparent blocknamespace blocknamespace getnonblockparent get a this reference is our parent s this for the object closure e g normally a this reference to a block name space e g if resolves to the parent namespace e g the namespace containing the if statement see get block this interpreter this get this interpreter declaring interpreter return get non block parent get this declaring interpreter blocknamespace getblockthis getthis declaringinterpreter getnonblockparent getthis declaringinterpreter super is our parent s super public this get super interpreter declaring interpreter return get non block parent get super declaring interpreter getsuper declaringinterpreter getnonblockparent getsuper declaringinterpreter delegate import to our parent public void import class string name get parent import class name importclass getparent importclass delegate import to our parent public void import package string name get parent import package name importpackage getparent importpackage public void set method string name bsh method method throws util eval error get parent set method name method setmethod bshmethod utilevalerror getparent setmethod hyper search request constructor public hyper search request view view search matcher matcher hyper search results results selection selection this view view this matcher matcher this results results this search string search and replace get search string this root search node new default mutable tree node search string this selection selection hypersearchrequest hypersearchrequest searchmatcher hypersearchresults searchstring searchandreplace getsearchstring rootsearchnode defaultmutabletreenode searchstring run method public void run set status j edit get property hypersearch status search file set fileset search and replace get search file set string files fileset get files view if files null files length 0 swing utilities invoke later new runnable public void run gui utilities error view empty fileset null results search done root search node return set progress maximum fileset get file count view to minimise synchronization and stuff like that we only show a status message at most twice a second initially zero so that we always show the first message long last status time 0 try if selection null buffer buffer view get buffer search in selection buffer else int current 0 loop for int i 0 i files length i string file files i current long current time system current time millis if current time last status time 250 set progress value current last status time current time buffer buffer j edit open temporary null null file false if buffer null continue loop do hyper search buffer catch final exception e log log log error this e swing utilities invoke later new runnable public void run search and replace handle error view e catch work thread abort a finally vfs manager run inawt thread new runnable public void run results search done root search node setstatus jedit getproperty searchfileset searchandreplace getsearchfileset getfiles swingutilities invokelater guiutilities searchdone rootsearchnode setprogressmaximum getfilecount laststatustime getbuffer searchinselection currenttime currenttimemillis currenttime laststatustime setprogressvalue laststatustime currenttime jedit opentemporary dohypersearch swingutilities invokelater searchandreplace handleerror workthread vfsmanager runinawtthread searchdone rootsearchnode public void run gui utilities error view empty fileset null results search done root search node guiutilities searchdone rootsearchnode swing utilities invoke later new runnable public void run search and replace handle error view e swingutilities invokelater searchandreplace handleerror vfs manager run inawt thread new runnable public void run results search done root search node vfsmanager runinawtthread searchdone rootsearchnode search in selection method private int search in selection buffer buffer throws exception set abortable false int result count 0 try buffer read lock for int i 0 i selection length i selection s selection i if s instanceof selection rect for int j s get start line j s get end line j result count do hyper search buffer s get start buffer j s get end buffer j else result count do hyper search buffer s get start s get end finally buffer read unlock set abortable true return result count searchinselection searchinselection setabortable resultcount readlock getstartline getendline resultcount dohypersearch getstart getend resultcount dohypersearch getstart getend readunlock setabortable resultcount do hyper search method private int do hyper search buffer buffer throws exception return do hyper search buffer 0 buffer get length dohypersearch dohypersearch dohypersearch getlength do hyper search method private int do hyper search buffer buffer int start int end throws exception set abortable false final default mutable tree node buffer node new default mutable tree node buffer get path int result count do hyper search buffer start end buffer node if result count 0 root search node insert buffer node root search node get child count set abortable true return result count dohypersearch dohypersearch setabortable defaultmutabletreenode buffernode defaultmutabletreenode getpath resultcount dohypersearch buffernode resultcount rootsearchnode buffernode rootsearchnode getchildcount setabortable resultcount do hyper search method private int do hyper search buffer buffer int start int end default mutable tree node buffer node int result count 0 try buffer read lock boolean end of line buffer get line end offset buffer get line of offset end 1 end segment text new segment int offset start hyper search result last result null loop for int counter 0 counter boolean start of line buffer get line start offset buffer get line of offset offset offset buffer get text offset end offset text search matcher match match matcher next match new char indexed segment text false start of line end of line counter 0 false if match null break loop int new line buffer get line of offset offset match start if last result null last result line new line last result new hyper search result buffer new line buffer node add new default mutable tree node last result false last result add occur offset match start offset match end offset match end result count finally buffer read unlock return result count dohypersearch dohypersearch defaultmutabletreenode buffernode resultcount readlock endofline getlineendoffset getlineofoffset hypersearchresult lastresult startofline getlinestartoffset getlineofoffset gettext searchmatcher nextmatch charindexedsegment startofline endofline newline getlineofoffset lastresult lastresult newline lastresult hypersearchresult newline buffernode defaultmutabletreenode lastresult lastresult addoccur resultcount readunlock resultcount creates a new editor exiting message param source the message source public editor exiting eb component source super source editorexiting ebcomponent class bsh ternary expression extends simple node bsh ternary expression int id super id bshternaryexpression simplenode bshternaryexpression public object eval call stack callstack interpreter interpreter throws eval error simple node cond simple node jjt get child 0 eval true simple node jjt get child 1 eval false simple node jjt get child 2 if bsh if statement evaluate condition cond callstack interpreter return eval true eval callstack interpreter else return eval false eval callstack interpreter callstack evalerror simplenode simplenode jjtgetchild evaltrue simplenode jjtgetchild evalfalse simplenode jjtgetchild bshifstatement evaluatecondition evaltrue evalfalse public int defined dimensions bsh array dimensions int id super id defineddimensions bsharraydimensions bsh array dimensions int id super id public void add defined dimension num defined dims bsharraydimensions adddefineddimension numdefineddims public void add defined dimension num defined dims public void add undefined dimension num undefined dims adddefineddimension numdefineddims addundefineddimension numundefineddims public object eval class type call stack callstack interpreter interpreter throws eval error if interpreter debug interpreter debug array base type type base type type return eval callstack interpreter callstack evalerror basetype evaluate the structure of the array in one of two ways a an initializer exists evaluate it and return the fully constructed array object also record the dimensions of that array b evaluate and record the lengths in each dimension and return void the structure of the array dims is maintained in dimensions public object eval call stack callstack interpreter interpreter throws eval error simple node child simple node jjt get child 0 child is array initializer evaluate it and fill in the dimensions it returns initialized arrays are always fully defined no undefined dimensions to worry about the syntax uses the undefined dimension count e g int 1 2 if child instanceof bsh array initializer if base type null throw new eval error internal array eval err unknown base type this callstack object init value bsh array initializer child eval base type num undefined dims callstack interpreter class array class init value get class int actual dimensions reflect get array dimensions array class defined dimensions new int actual dimensions compare with number of dimensions actually created with the number specified syntax uses the undefined ones here if defined dimensions length num undefined dims throw new eval error incompatible initializer allocation calls for a num undefined dims dimensional array but initializer is a actual dimensions dimensional array this callstack fill in defined dimensions lengths object array slice init value for int i 0 i defined dimensions length i defined dimensions i array get length array slice if defined dimensions i 0 array slice array get array slice 0 return init value else evaluate the defined dimensions of the array defined dimensions new int num defined dims for int i 0 i num defined dims i try object length simple node jjt get child i eval callstack interpreter defined dimensions i primitive length int value catch exception e throw new eval error array index i does not evaluate to an integer this callstack return primitive void callstack evalerror simplenode simplenode jjtgetchild undefineddimension bsharrayinitializer basetype evalerror initvalue bsharrayinitializer basetype numundefineddims arrayclass initvalue getclass actualdimensions getarraydimensions arrayclass defineddimensions actualdimensions defineddimensions numundefineddims evalerror numundefineddims actualdimensions defineddimensions arrayslice initvalue defineddimensions defineddimensions getlength arrayslice defineddimensions arrayslice arrayslice initvalue defineddimensions numdefineddims numdefineddims simplenode jjtgetchild defineddimensions intvalue evalerror public string field bsh primary suffix int id super id bshprimarysuffix public object do suffix object obj boolean tolhs call stack callstack interpreter interpreter throws eval error handle class suffix operation prefix must be a bsh type if operation class if obj instanceof bsh type if tolhs throw new eval error can t assign class this callstack name space namespace callstack top return bsh type obj get type callstack interpreter else throw new eval error attempt to use class suffix on non class this callstack evaluate our prefix if it needs evaluating first if this is the first evaluation our prefix mayb be a node directly from the primary prefix eval it to an object if it s an lhs resolve to a value note the ambiguous name construct is now necessary where the node may be an ambiguous name if this becomes common we might want to make a static method node to object or something the point is that we can t just eval we need to direct the evaluation to the context sensitive type of result namely object class etc if obj instanceof simple node if obj instanceof bsh ambiguous name obj bsh ambiguous name obj to object callstack interpreter else obj simple node obj eval callstack interpreter else if obj instanceof lhs try obj lhs obj get value catch util eval error e throw e to eval error this callstack try switch operation case index return do index obj tolhs callstack interpreter case name return do name obj tolhs callstack interpreter case property return do property tolhs obj callstack interpreter default throw new interpreter error unknown suffix type catch reflect error e throw new eval error reflection error e this callstack catch invocation target exception e throw new target error target exception e get target exception this callstack true dosuffix callstack evalerror bshtype bshtype evalerror namespace bshtype gettype evalerror primaryprefix nodetoobject simplenode bshambiguousname bshambiguousname toobject simplenode getvalue utilevalerror toevalerror doindex doname doproperty interpretererror reflecterror evalerror invocationtargetexception targeterror gettargetexception private object do name object obj boolean tolhs call stack callstack interpreter interpreter throws eval error reflect error invocation target exception try length on array if field equals length obj get class is array if tolhs throw new eval error can t assign array length this callstack else return new primitive array get length obj field access if jjt get num children 0 if tolhs return reflect getlhs object field obj field else return reflect get object field obj field method invocation lhs or non lhs evaluation can both encounter method calls object oa bsh arguments jjt get child 0 get arguments callstack interpreter return reflect invoke object method obj field oa interpreter callstack this catch util eval error e throw e to eval error this callstack doname callstack evalerror reflecterror invocationtargetexception getclass isarray evalerror getlength jjtgetnumchildren getlhsobjectfield getobjectfield bsharguments jjtgetchild getarguments invokeobjectmethod utilevalerror toevalerror static int get index aux object obj call stack callstack interpreter interpreter simple node caller info throws eval error if obj get class is array throw new eval error not an array caller info callstack int index try object index val simple node caller info jjt get child 0 eval callstack interpreter if index val instanceof primitive index val types get assignable form index val integer type index primitive index val int value catch util eval error e interpreter debug do index e throw e to eval error arrays may only be indexed by integer types caller info callstack return index getindexaux callstack simplenode callerinfo evalerror getclass isarray evalerror callerinfo indexval simplenode callerinfo jjtgetchild indexval indexval getassignableform indexval indexval intvalue utilevalerror doindex toevalerror callerinfo array index must handle tolhs case private object do index object obj boolean tolhs call stack callstack interpreter interpreter throws eval error reflect error int index get index aux obj callstack interpreter this if tolhs return new lhs obj index else try return reflect get index obj index catch util eval error e throw e to eval error this callstack doindex callstack evalerror reflecterror getindexaux getindex utilevalerror toevalerror property access must handle tolhs case private object do property boolean tolhs object obj call stack callstack interpreter interpreter throws eval error if obj primitive void throw new eval error attempt to access property on undefined variable or class name this callstack if obj instanceof primitive throw new eval error attempt to access property on a primitive this callstack object value simple node jjt get child 0 eval callstack interpreter if value instanceof string throw new eval error property expression must be a string or identifier this callstack if tolhs return new lhs obj string value property style access to hashtable or map collection manager cm collection manager get collection manager if cm is map obj object val cm get from map obj value key return val null val primitive null val try return reflect get object property obj string value catch util eval error e throw e to eval error property value this callstack catch reflect error e throw new eval error no such property value this callstack doproperty callstack evalerror evalerror evalerror simplenode jjtgetchild evalerror collectionmanager collectionmanager getcollectionmanager ismap getfrommap getobjectproperty utilevalerror toevalerror reflecterror evalerror char indexed segment constructor creates a new code char indexed segment code since j edit 4 1pre3 public char indexed segment segment seg int index this seg seg m index index charindexedsegment charindexedsegment jedit charindexedsegment m_index char indexed segment constructor creates a new code char indexed segment code since j edit 4 1pre1 public char indexed segment segment seg boolean reverse this seg seg m index reverse seg count 1 0 this reverse reverse charindexedsegment charindexedsegment jedit charindexedsegment m_index char at method public char char at int index if reverse index index return m index index seg count m index index 0 seg array seg offset m index index char indexed out of bounds charat charat m_index m_index m_index charindexed out_of_bounds is valid method public boolean is valid return m index 0 m index seg count isvalid isvalid m_index m_index reset method public void reset m index reverse seg count 1 0 m_index move method public boolean move int index if reverse index index return m index index seg count m_index hyper search results constructor public hyper search results view view super new border layout this view view caption new j label box tool bar new box box layout x axis tool bar add caption tool bar add box create glue action handler ah new action handler clear new rollover button gui utilities load icon clear png clear set tool tip text j edit get property hypersearch results clear label clear add action listener ah tool bar add clear multi new rollover button multi set tool tip text j edit get property hypersearch results multi label multi add action listener ah tool bar add multi add border layout north tool bar result tree root new default mutable tree node result tree model new default tree model result tree root result tree new j tree result tree model result tree set cell renderer new result cell renderer result tree set visible row count 16 result tree set root visible false result tree set shows root handles true looks bad with the os x l f apparently if operating system is macoslf result tree put client property j tree line style angled result tree set editable false result tree add key listener new key handler result tree add mouse listener new mouse handler j scroll pane scroll pane new j scroll pane result tree dimension dim scroll pane get preferred size dim width 400 scroll pane set preferred size dim add border layout center scroll pane hypersearchresults hypersearchresults borderlayout jlabel toolbar boxlayout x_axis toolbar toolbar createglue actionhandler actionhandler rolloverbutton guiutilities loadicon settooltiptext jedit getproperty addactionlistener toolbar rolloverbutton settooltiptext jedit getproperty addactionlistener toolbar borderlayout toolbar resulttreeroot defaultmutabletreenode resulttreemodel defaulttreemodel resulttreeroot resulttree jtree resulttreemodel resulttree setcellrenderer resultcellrenderer resulttree setvisiblerowcount resulttree setrootvisible resulttree setshowsroothandles operatingsystem ismacoslf resulttree putclientproperty jtree linestyle resulttree seteditable resulttree addkeylistener keyhandler resulttree addmouselistener mousehandler jscrollpane scrollpane jscrollpane resulttree scrollpane getpreferredsize scrollpane setpreferredsize borderlayout scrollpane focus on default component method public void focus on default component result tree request focus focusondefaultcomponent focusondefaultcomponent resulttree requestfocus add notify method public void add notify super add notify edit bus add to bus this multi status j edit get boolean property hypersearch results multi update multi status addnotify addnotify addnotify editbus addtobus multistatus jedit getbooleanproperty updatemultistatus remove notify method public void remove notify super remove notify edit bus remove from bus this j edit set boolean property hypersearch results multi multi status removenotify removenotify removenotify editbus removefrombus jedit setbooleanproperty multistatus visit buffers method private void visit buffers result visitor visitor buffer buffer impl note since multiple searches now allowed extra level in hierarchy for int i result tree root get child count 1 i 0 i default mutable tree node search node default mutable tree node result tree root get child at i for int j search node get child count 1 j 0 j default mutable tree node buffer node default mutable tree node search node get child at j for int k buffer node get child count 1 k 0 k object user object default mutable tree node buffer node get child at k get user object hyper search result result hyper search result user object if result path equals buffer get symlink path visitor visit buffer result visitbuffers visitbuffers resultvisitor resulttreeroot getchildcount defaultmutabletreenode searchnode defaultmutabletreenode resulttreeroot getchildat searchnode getchildcount defaultmutabletreenode buffernode defaultmutabletreenode searchnode getchildat buffernode getchildcount userobject defaultmutabletreenode buffernode getchildat getuserobject hypersearchresult hypersearchresult userobject pathequals getsymlinkpath handle message method public void handle message eb message msg if msg instanceof buffer update buffer update bmsg buffer update msg buffer buffer bmsg get buffer object what bmsg get what if what buffer update loaded what buffer update closed result visitor visitor null if what buffer update loaded visitor new buffer loaded visitor else buffer update closed visitor new buffer closed visitor visit buffers visitor buffer handlemessage handlemessage ebmessage bufferupdate bufferupdate bufferupdate getbuffer getwhat bufferupdate bufferupdate resultvisitor bufferupdate bufferloadedvisitor bufferupdate bufferclosedvisitor visitbuffers get tree model method public default tree model get tree model return result tree model gettreemodel defaulttreemodel gettreemodel resulttreemodel get tree method returns the result tree since j edit 4 1pre9 public j tree get tree return result tree gettree jedit jtree gettree resulttree search started method public void search started caption set text j edit get property hypersearch results searching searchstarted searchstarted settext jedit getproperty search failed method public void search failed caption set text j edit get property hypersearch results no results collapse all nodes as suggested on user mailing list for int i 0 i result tree root get child count i default mutable tree node node default mutable tree node result tree root get child at i result tree collapse path new tree path new object result tree root node searchfailed searchfailed settext jedit getproperty resulttreeroot getchildcount defaultmutabletreenode defaultmutabletreenode resulttreeroot getchildat resulttree collapsepath treepath resulttreeroot search done method public void search done final default mutable tree node search node final int node count search node get child count if node count 1 search failed return caption set text j edit get property hypersearch results done swing utilities invoke later new runnable public void run if multi status for int i 0 i result tree root get child count i result tree root remove 0 result tree root add search node result tree model reload result tree root tree path last node null for int i 0 i node count i last node new tree path default mutable tree node search node get child at i get path result tree expand path last node result tree scroll path to visible new tree path new object result tree root search node searchdone searchdone defaultmutabletreenode searchnode nodecount searchnode getchildcount nodecount searchfailed settext jedit getproperty swingutilities invokelater multistatus resulttreeroot getchildcount resulttreeroot resulttreeroot searchnode resulttreemodel resulttreeroot treepath lastnode nodecount lastnode treepath defaultmutabletreenode searchnode getchildat getpath resulttree expandpath lastnode resulttree scrollpathtovisible treepath resulttreeroot searchnode public void run if multi status for int i 0 i result tree root get child count i result tree root remove 0 result tree root add search node result tree model reload result tree root tree path last node null for int i 0 i node count i last node new tree path default mutable tree node search node get child at i get path result tree expand path last node result tree scroll path to visible new tree path new object result tree root search node multistatus resulttreeroot getchildcount resulttreeroot resulttreeroot searchnode resulttreemodel resulttreeroot treepath lastnode nodecount lastnode treepath defaultmutabletreenode searchnode getchildat getpath resulttree expandpath lastnode resulttree scrollpathtovisible treepath resulttreeroot searchnode update multi status method private void update multi status if multi status multi set icon gui utilities load icon multiple results png else multi set icon gui utilities load icon single result png updatemultistatus updatemultistatus multistatus seticon guiutilities loadicon multipleresults seticon guiutilities loadicon singleresult go to selected node method private void go to selected node tree path path result tree get selection path if path null return default mutable tree node node default mutable tree node path get last path component object value node get user object if node get parent result tree root do nothing if clicked foo showing n occurrences in m files else if value instanceof string buffer buffer j edit open file view string value if buffer null return view go to buffer buffer fuck me dead swing utilities invoke later new runnable public void run result tree request focus else if value instanceof hyper search result hyper search result value go to view gotoselectednode gotoselectednode treepath resulttree getselectionpath defaultmutabletreenode defaultmutabletreenode getlastpathcomponent getuserobject getparent resulttreeroot jedit openfile gotobuffer swingutilities invokelater resulttree requestfocus hypersearchresult hypersearchresult goto swing utilities invoke later new runnable public void run result tree request focus swingutilities invokelater resulttree requestfocus public void action performed action event evt object source evt get source if source clear result tree root remove all children result tree model reload result tree root else if source multi multi status multi status update multi status if multi status for int i result tree root get child count 2 i 0 i result tree model remove node from parent mutable tree node result tree root get child at i actionperformed actionevent getsource resulttreeroot removeallchildren resulttreemodel resulttreeroot multistatus multistatus updatemultistatus multistatus resulttreeroot getchildcount resulttreemodel removenodefromparent mutabletreenode resulttreeroot getchildat public void key pressed key event evt if evt get key code key event vk enter go to selected node fuck me dead swing utilities invoke later new runnable public void run result tree request focus evt consume keypressed keyevent getkeycode keyevent vk_enter gotoselectednode swingutilities invokelater resulttree requestfocus swing utilities invoke later new runnable public void run result tree request focus swingutilities invokelater resulttree requestfocus mouse pressed method public void mouse pressed mouse event evt if evt is consumed return tree path path1 result tree get path for location evt getx evt gety if path1 null return result tree set selection path path1 if gui utilities is popup trigger evt show popup menu evt else go to selected node view to front view request focus view get text area request focus mousepressed mousepressed mouseevent isconsumed treepath resulttree getpathforlocation resulttree setselectionpath guiutilities ispopuptrigger showpopupmenu gotoselectednode tofront requestfocus gettextarea requestfocus show popup menu method private void show popup menu mouse event evt if popup menu null popup menu new j popup menu popup menu add new remove tree node action gui utilities show popup menu popup menu evt get component evt getx evt gety evt consume showpopupmenu showpopupmenu mouseevent popupmenu popupmenu jpopupmenu popupmenu removetreenodeaction guiutilities showpopupmenu popupmenu getcomponent class remove tree node action extends abstract action public remove tree node action super j edit get property hypersearch results remove node removetreenodeaction abstractaction removetreenodeaction jedit getproperty public void action performed action event evt tree path path result tree get selection path if path null return mutable tree node value mutable tree node path get last path component result tree model remove node from parent value actionperformed actionevent treepath resulttree getselectionpath mutabletreenode mutabletreenode getlastpathcomponent resulttreemodel removenodefromparent class remove all tree nodes action extends abstract action public remove all tree nodes action super j edit get property hypersearch results remove all nodes removealltreenodesaction abstractaction removealltreenodesaction jedit getproperty public void action performed action event evt result tree root new default mutable tree node result tree model new default tree model result tree root result tree set model result tree model actionperformed actionevent resulttreeroot defaultmutabletreenode resulttreemodel defaulttreemodel resulttreeroot resulttree setmodel resulttreemodel result cell renderer constructor result cell renderer plain font ui manager get font tree font if plain font null plain font j edit get font property metal secondary font bold font new font plain font get name font bold plain font get size resultcellrenderer resultcellrenderer plainfont uimanager getfont plainfont plainfont jedit getfontproperty boldfont plainfont getname plainfont getsize get tree cell renderer component method public component get tree cell renderer component j tree tree object value boolean sel boolean expanded boolean leaf int row boolean has focus super get tree cell renderer component tree value sel expanded leaf row has focus set icon null default mutable tree node node default mutable tree node value if node get parent result tree root result cell renderer this set font bold font int buffer count node get child count int result count 0 for int i 0 i buffer count i result count node get child at i get child count string property hypersearch results result caption if buffer count 1 property result count 1 1 2 object pp node to string new integer result count new integer buffer count set text j edit get property property pp else if node get user object instanceof string file name result cell renderer this set font bold font int count node get child count if count 1 set text j edit get property hypersearch results file caption1 new object node get user object else set text j edit get property hypersearch results file caption new object node get user object new integer count else result cell renderer this set font plain font return this gettreecellrenderercomponent gettreecellrenderercomponent jtree hasfocus gettreecellrenderercomponent hasfocus seticon defaultmutabletreenode defaultmutabletreenode getparent resulttreeroot resultcellrenderer setfont boldfont buffercount getchildcount resultcount buffercount resultcount getchildat getchildcount buffercount resultcount tostring resultcount buffercount settext jedit getproperty getuserobject resultcellrenderer setfont boldfont getchildcount settext jedit getproperty getuserobject settext jedit getproperty getuserobject resultcellrenderer setfont plainfont interface result visitor public void visit buffer buffer hyper search result result resultvisitor hypersearchresult class buffer loaded visitor implements result visitor public void visit buffer buffer hyper search result result result buffer opened buffer bufferloadedvisitor resultvisitor hypersearchresult bufferopened class buffer closed visitor implements result visitor public void visit buffer buffer hyper search result result result buffer closed bufferclosedvisitor resultvisitor hypersearchresult bufferclosed get length method public final int get length return length getlength getlength get text method public string get text int start int len if start gap start return new string text start gap end gap start len else if start len gap start return new string text start len else return new string text start gap start start concat new string text gap end start len gap start gettext gettext gapstart gapend gapstart gapstart gapstart gapend gapstart get text method public void get text int start int len segment seg if start gap start seg array text seg offset start gap end gap start seg count len else if start len gap start seg array text seg offset start seg count len else seg array new char len copy text before gap system arraycopy text start seg array 0 gap start start copy text after gap system arraycopy text gap end seg array gap start start len start gap start seg offset 0 seg count len gettext gettext gapstart gapend gapstart gapstart gapstart gapend gapstart gapstart insert method public void insert int start string str int len str length move gap start start if gap end gap start len ensure capacity length len 1024 move gap end start len 1024 str get chars 0 len text start gap start len length len movegapstart gapend gapstart ensurecapacity movegapend getchars gapstart insert method public void insert int start segment seg move gap start start if gap end gap start seg count ensure capacity length seg count 1024 move gap end start seg count 1024 system arraycopy seg array seg offset text start seg count gap start seg count length seg count movegapstart gapend gapstart ensurecapacity movegapend gapstart setcontent method public void setcontent char text int length this text text this gap start this gap end 0 this length length _setcontent _setcontent gapstart gapend remove method public void remove int start int len move gap start start gap end len length len movegapstart gapend move gap start method private void move gap start int new start int new end gap end new start gap start if new start gap start nothing to do else if new start gap start system arraycopy text gap end text gap start new start gap start else if new start gap start system arraycopy text new start text new end gap start new start gap start new start gap end new end movegapstart movegapstart newstart newend gapend newstart gapstart newstart gapstart newstart gapstart gapend gapstart newstart gapstart newstart gapstart newstart newend gapstart newstart gapstart newstart gapend newend move gap end method private void move gap end int new end system arraycopy text gap end text new end length gap start gap end new end movegapend movegapend newend gapend newend gapstart gapend newend ensure capacity method private void ensure capacity int capacity if capacity text length char textn new char capacity 2 system arraycopy text 0 textn 0 length gap end gap start text textn ensurecapacity ensurecapacity gapend gapstart public synchronized static collection manager get collection manager if manager null capabilities class exists java util collection class clas try clas class for name bsh collection collection manager impl manager collection manager clas new instance catch exception e interpreter debug unable to load collection manager impl e if manager null manager new collection manager default impl return manager collectionmanager getcollectionmanager classexists forname collectionmanagerimpl collectionmanager newinstance collectionmanagerimpl collectionmanager public boolean is bsh iterable object obj this could be smarter try get bsh iterator obj return true catch illegal argument exception e return false isbshiterable getbshiterator illegalargumentexception public bsh iterator get bsh iterator object obj throws illegal argument exception return new basic bsh iterator obj bshiterator getbshiterator illegalargumentexception basicbshiterator public boolean is map object obj return obj instanceof hashtable ismap public object get from map object map object key return hashtable map get key getfrommap public object put in map object map object key object value return hashtable map put key value putinmap construct a basic basic bsh iterator param the object over which we are iterating throws java lang illegal argument exception if the argument is not a supported i e iterable type throws java lang null pointer exception if the argument is null public basic bsh iterator object iterate over me enumeration create enumeration iterate over me basicbshiterator illegalargumentexception nullpointerexception basicbshiterator iterateoverme createenumeration iterateoverme create an enumeration over the given object param iterate over me object of type enumeration vector string string buffer or an array return an enumeration throws java lang illegal argument exception if the argument is not a supported i e iterable type throws java lang null pointer exception if the argument is null protected enumeration create enumeration object iterate over me if iterate over me null throw new null pointer exception object arguments passed to the basic bsh iterator constructor cannot be null if iterate over me instanceof enumeration return enumeration iterate over me if iterate over me instanceof vector return vector iterate over me elements if iterate over me get class is array final object array iterate over me return new enumeration int index 0 length array get length array public object next element return array get array index public boolean has more elements return index length if iterate over me instanceof string return create enumeration string iterate over me to char array if iterate over me instanceof string buffer return create enumeration iterate over me to string to char array throw new illegal argument exception cannot enumerate object of type iterate over me get class iterateoverme stringbuffer illegalargumentexception nullpointerexception createenumeration iterateoverme iterateoverme nullpointerexception basicbshiterator iterateoverme iterateoverme iterateoverme iterateoverme iterateoverme getclass isarray iterateoverme getlength nextelement hasmoreelements iterateoverme createenumeration iterateoverme tochararray iterateoverme stringbuffer createenumeration iterateoverme tostring tochararray illegalargumentexception iterateoverme getclass return new enumeration int index 0 length array get length array public object next element return array get array index getlength nextelement return array get array index public boolean has more elements return index length hasmoreelements fetch the next object in the iteration return the next object public object next return enumeration next element nextelement returns true if and only if there are more objects available via the code next code method return the next object public boolean has next return enumeration has more elements hasnext hasmoreelements creates a new editor started message param source the message source public editor started eb component source super source editorstarted ebcomponent get screen bounds method returns the bounds of the default screen public static final rectangle get screen bounds int screenx int toolkit get default toolkit get screen size get width int screeny int toolkit get default toolkit get screen size get height int x y w h if is macos x 0 y 22 w screenx h screeny y 4 shadow size else if is windows x 4 y 4 w screenx 2 x h screeny 2 y else x 0 y 0 w screenx h screeny return new rectangle x y w h getscreenbounds getscreenbounds getdefaulttoolkit getscreensize getwidth getdefaulttoolkit getscreensize getheight ismacos iswindows get screen bounds method returns the bounds of the virtual screen that the window should be in param window the bounds of the window to get the screen for public static final rectangle get screen bounds rectangle window graphics device gd graphics environment get local graphics environment get screen devices vector intersects new vector get available screens o n 3 this is nasty but since we aren t dealling with many items it should be fine for int i 0 i gd length i graphics configuration gc gd i get default configuration don t add duplicates if window intersects gc get bounds for enumeration e intersects elements e has more elements graphics configuration gcc graphics configuration e next element if gcc get bounds equals gc get bounds break intersects add gc graphics configuration choice null if intersects size 0 pick screen with largest intersection for enumeration e intersects elements e has more elements graphics configuration gcc graphics configuration e next element if choice null choice gcc else rectangle int1 choice get bounds intersection window rectangle int2 gcc get bounds intersection window int area1 int1 width int1 height int area2 int2 width int2 height if area2 area1 choice gcc else choice graphics environment get local graphics environment get default screen device get default configuration make adjustments for some os s int screenx int choice get bounds x int screeny int choice get bounds y int screenw int choice get bounds width int screenh int choice get bounds height int x y w h if is macos x screenx y screeny 22 w screenw h screenh y 4 shadow size else if is windows x screenx 4 y screeny 4 w screenw 2 x h screenh 2 y else x screenx y screeny w screenw h screenh yay we re finally there return new rectangle x y w h getscreenbounds getscreenbounds graphicsdevice graphicsenvironment getlocalgraphicsenvironment getscreendevices graphicsconfiguration getdefaultconfiguration getbounds hasmoreelements graphicsconfiguration graphicsconfiguration nextelement getbounds getbounds graphicsconfiguration hasmoreelements graphicsconfiguration graphicsconfiguration nextelement getbounds getbounds graphicsenvironment getlocalgraphicsenvironment getdefaultscreendevice getdefaultconfiguration getbounds getbounds getbounds getbounds ismacos iswindows isdos derived method returns if we re running windows 95 98 me nt 2000 xp or os 2 public static final boolean isdos derived return is windows isos2 isdosderived isdosderived iswindows is windows method returns if we re running windows 95 98 me nt 2000 xp public static final boolean is windows return os windows 9x os windows nt iswindows iswindows windows_9x windows_nt is windows9x method returns if we re running windows 95 98 me public static final boolean is windows9x return os windows 9x iswindows9x iswindows9x windows_9x is windowsnt method returns if we re running windows nt 2000 xp public static final boolean is windowsnt return os windows nt iswindowsnt iswindowsnt windows_nt isos2 method returns if we re running os 2 public static final boolean isos2 return os os2 is unix method returns if we re running unix this includes macos x public static final boolean is unix return os unix os mac os x isunix isunix mac_os_x is macos method returns if we re running macos x public static final boolean is macos return os mac os x ismacos ismacos mac_os_x isx11 method returns if this os is likely to be using x11 as the graphics system since j edit 4 2pre3 public static boolean isx11 return os unix jedit isvms method returns if we re running vms public static final boolean isvms return os vms is macoslf method returns if we re running macos x and using the native look and feel public static final boolean is macoslf return is macos ui manager get look and feel is native look and feel ismacoslf ismacoslf ismacos uimanager getlookandfeel isnativelookandfeel has screen menu bar returns whether the screen menu bar on mac os x is in use since j edit 4 2pre1 public static final boolean has screen menu bar if is macos return false else if has screen menu bar 1 string result system get property apple laf use screen menu bar if result null result system get property com apple macos use screen menu bar has screen menu bar true equals result 1 0 return has screen menu bar 1 hasscreenmenubar jedit hasscreenmenubar ismacos hasscreenmenubar getproperty usescreenmenubar getproperty usescreenmenubar hasscreenmenubar hasscreenmenubar is java14 method returns if java 2 version 1 4 or java 2 version 1 5 is in use public static final boolean has java14 return java14 isjava14 hasjava14 is java15 method returns if java 2 version 1 5 is in use public static final boolean has java15 return java15 isjava15 hasjava15 token marker constructor public token marker rule sets new hashtable 64 tokenmarker tokenmarker rulesets add rule set method public void add rule set parser rule set rules rule sets put rules get set name rules if rules get set name equals main main rule set rules addruleset addruleset parserruleset rulesets getsetname getsetname mainruleset get main rule set method public parser rule set get main rule set return main rule set getmainruleset parserruleset getmainruleset mainruleset get rule set method public parser rule set get rule set string set name return parser rule set rule sets get set name getruleset parserruleset getruleset setname parserruleset rulesets setname get rule sets method since j edit 4 2pre3 public parser rule set get rule sets return parser rule set rule sets values to array new parser rule set rule sets size getrulesets jedit parserruleset getrulesets parserruleset rulesets toarray parserruleset rulesets mark tokens method do not call this method directly call buffer mark tokens instead public line context mark tokens line context prev context token handler token handler segment line set up some instance variables this is to avoid having to pass around lots and lots of parameters this token handler token handler this line line last offset line offset line length line count line offset context new line context if prev context null context rules get main rule set else context parent prev context parent context in rule prev context in rule context rules prev context rules context span end subst prev context span end subst keywords context rules get keywords escaped false seen whitespace end false whitespace end line offset main parser loop parser rule rule int terminate char context rules get terminate char boolean terminated false main loop for pos line offset pos line length pos check if we have to stop parsing if terminate char 0 pos line offset terminate char terminated terminated true context new line context parser rule set get standard rule set context rules get default context keywords context rules get keywords check for end of delegate if context parent null rule context parent in rule if rule null if check delegate end rule seen whitespace end true continue main loop check every rule char ch line array pos rule context rules get rules ch while rule null stop checking rules if there was a match if handle rule rule false seen whitespace end true continue main loop rule rule next check if current character is a word separator if character is whitespace ch if seen whitespace end whitespace end pos 1 if context in rule null handle rule context in rule true handle no word break mark keyword false if last offset pos token handler handle token line context rules get default last offset line offset pos last offset context token handler handle token line context rules get default pos line offset 1 context last offset pos 1 escaped false else if keywords null context rules get rule count 0 string no word sep context rules get no word sep if character is letter or digit ch no word sep index of ch 1 if context in rule null handle rule context in rule true handle no word break mark keyword true token handler handle token line context rules get default last offset line offset 1 context last offset pos 1 seen whitespace end true escaped false mark all remaining characters pos line length if context in rule null handle rule context in rule true handle no word break mark keyword true unwind any no line break parent delegates unwind while context parent null rule context parent in rule if rule null rule action parser rule no line break parser rule no line break terminated context context parent keywords context rules get keywords context in rule null else break unwind token handler handle token line token end pos line offset 0 context context context intern token handler set line context context return context marktokens marktokens linecontext marktokens linecontext prevcontext tokenhandler tokenhandler tokenhandler tokenhandler lastoffset linelength linecontext prevcontext getmainruleset prevcontext inrule prevcontext inrule prevcontext spanendsubst prevcontext spanendsubst getkeywords seenwhitespaceend whitespaceend parserrule terminatechar getterminatechar main_loop linelength terminatechar terminatechar linecontext parserruleset getstandardruleset getdefault getkeywords inrule checkdelegateend seenwhitespaceend main_loop getrules handlerule seenwhitespaceend main_loop iswhitespace seenwhitespaceend whitespaceend inrule handlerule inrule handlenowordbreak markkeyword lastoffset tokenhandler handletoken getdefault lastoffset lastoffset tokenhandler handletoken getdefault lastoffset getrulecount nowordsep getnowordsep isletterordigit nowordsep indexof inrule handlerule inrule handlenowordbreak markkeyword tokenhandler handletoken getdefault lastoffset lastoffset seenwhitespaceend linelength inrule handlerule inrule handlenowordbreak markkeyword no_line_break inrule parserrule no_line_break parserrule no_line_break getkeywords inrule tokenhandler handletoken tokenhandler setlinecontext check delegate end method private boolean check delegate end parser rule rule if rule end null return false line context temp context context context context parent keywords context rules get keywords boolean temp escaped escaped boolean b handle rule rule true context temp context keywords context rules get keywords if b temp escaped if context in rule null handle rule context in rule true mark keyword true context line context context parent clone token handler handle token line context in rule action parser rule exclude match parser rule exclude match context rules get default context in rule token pos line offset pattern count context keywords context rules get keywords context in rule null last offset pos pattern count move pos to last character of match sequence pos pattern count 1 return true check escape rule of parent if rule action parser rule no escape 0 parser rule escape context parent rules get escape rule if escape null handle rule escape false return true return false checkdelegateend checkdelegateend parserrule linecontext tempcontext getkeywords tempescaped handlerule tempcontext getkeywords tempescaped inrule handlerule inrule markkeyword linecontext tokenhandler handletoken inrule parserrule exclude_match parserrule exclude_match getdefault inrule getkeywords inrule lastoffset parserrule no_escape parserrule getescaperule handlerule handle rule method checks if the rule matches the line at the current position and handles the rule if it does match private boolean handle rule parser rule check rule boolean end some rules can only match in certain locations if end if character to upper case check rule hash char character to upper case line array pos return false int offset check rule action parser rule mark previous 0 last offset pos int pos match end check rule end pos match check rule start pos match if pos match parser rule at line start parser rule at line start if offset line offset return false else if pos match parser rule at whitespace end parser rule at whitespace end if offset whitespace end return false else if pos match parser rule at word start parser rule at word start if offset last offset return false int matched chars 1 char indexed segment char indexed null re match match null see if the rule s start or end sequence matches here if end check rule action parser rule mark following 0 the end cannot be a regular expression if check rule action parser rule regexp 0 end if end if context span end subst null pattern array context span end subst else pattern array check rule end else pattern array check rule start pattern offset 0 pattern count pattern array length matched chars pattern count if syntax utilities region matches context rules get ignore case line pos pattern array return false else note that all regexps start with a so they only match the start of the string int match start pos line offset char indexed new char indexed segment line match start match check rule start regexp get match char indexed 0 re reg anchorindex if match null return false else if match get start index 0 throw new internal error can t happen else matched chars match get end index workaround for hang if match was zero width not sure if there is a better way to handle this if matched chars 0 matched chars 1 check for an escape sequence if check rule action parser rule is escape parser rule is escape if context in rule null handle rule context in rule true escaped escaped pos pattern count 1 else if escaped escaped false pos pattern count 1 handle start of rule else if end if context in rule null handle rule context in rule true mark keyword check rule action parser rule mark previous parser rule mark previous switch check rule action parser rule major actions seq case parser rule seq context span end subst null if check rule action parser rule regexp 0 handle token with spaces token handler check rule token pos line offset matched chars context else token handler handle token line check rule token pos line offset matched chars context a delegate attribute on a seq changes the ruleset from the end of the seq onwards if check rule delegate null context new line context check rule delegate context parent keywords context rules get keywords break span eol span case parser rule span case parser rule eol span context in rule check rule byte token type check rule action parser rule exclude match parser rule exclude match context rules get default check rule token if check rule action parser rule regexp 0 handle token with spaces token handler token type pos line offset matched chars context else token handler handle token line token type pos line offset matched chars context char span end subst null substitute result of matching the rule start into the end string eg in shell script mode s w is matched into 1 to construct rules for highlighting read ins like this eof eof if char indexed null check rule end null span end subst substitute match check rule end context span end subst span end subst context new line context check rule delegate context keywords context rules get keywords break mark following case parser rule mark following token handler handle token line check rule action parser rule exclude match parser rule exclude match context rules get default check rule token pos line offset pattern count context context span end subst null context in rule check rule break mark previous case parser rule mark previous context span end subst null if check rule action parser rule exclude match parser rule exclude match if pos last offset token handler handle token line check rule token last offset line offset pos last offset context token handler handle token line context rules get default pos line offset pattern count context else token handler handle token line check rule token last offset line offset pos last offset pattern count context break default throw new internal error unhandled major action move pos to last character of match sequence pos matched chars 1 last offset pos 1 break out of inner for loop to check next char handle end of mark following else if context in rule action parser rule mark following 0 if pos last offset token handler handle token line context in rule token last offset line offset pos last offset context last offset pos context in rule null return true handlerule handlerule parserrule checkrule touppercase checkrule hashchar touppercase checkrule parserrule mark_previous lastoffset posmatch checkrule endposmatch checkrule startposmatch posmatch parserrule at_line_start parserrule at_line_start posmatch parserrule at_whitespace_end parserrule at_whitespace_end whitespaceend posmatch parserrule at_word_start parserrule at_word_start lastoffset matchedchars charindexedsegment charindexed rematch checkrule parserrule mark_following checkrule parserrule spanendsubst spanendsubst checkrule checkrule matchedchars syntaxutilities regionmatches getignorecase matchstart charindexed charindexedsegment matchstart checkrule startregexp getmatch charindexed reg_anchorindex getstartindex internalerror matchedchars getendindex matchedchars matchedchars checkrule parserrule is_escape parserrule is_escape inrule handlerule inrule inrule handlerule inrule markkeyword checkrule parserrule mark_previous parserrule mark_previous checkrule parserrule major_actions parserrule spanendsubst checkrule parserrule handletokenwithspaces tokenhandler checkrule matchedchars tokenhandler handletoken checkrule matchedchars checkrule linecontext checkrule getkeywords eol_span parserrule parserrule eol_span inrule checkrule tokentype checkrule parserrule exclude_match parserrule exclude_match getdefault checkrule checkrule parserrule handletokenwithspaces tokenhandler tokentype matchedchars tokenhandler handletoken tokentype matchedchars spanendsubst charindexed checkrule spanendsubst checkrule spanendsubst spanendsubst linecontext checkrule getkeywords mark_following parserrule mark_following tokenhandler handletoken checkrule parserrule exclude_match parserrule exclude_match getdefault checkrule spanendsubst inrule checkrule mark_previous parserrule mark_previous spanendsubst checkrule parserrule exclude_match parserrule exclude_match lastoffset tokenhandler handletoken checkrule lastoffset lastoffset tokenhandler handletoken getdefault tokenhandler handletoken checkrule lastoffset lastoffset internalerror matchedchars lastoffset mark_following inrule parserrule mark_following lastoffset tokenhandler handletoken inrule lastoffset lastoffset lastoffset inrule handle no word break method private void handle no word break if context parent null parser rule rule context parent in rule if rule null context parent in rule action parser rule no word break 0 if pos last offset token handler handle token line rule token last offset line offset pos last offset context last offset pos context context parent keywords context rules get keywords context in rule null handlenowordbreak handlenowordbreak parserrule inrule inrule parserrule no_word_break lastoffset tokenhandler handletoken lastoffset lastoffset lastoffset getkeywords inrule handle token with spaces method private void handle token with spaces token handler token handler byte token type int start int len line context context int last start int end start len for int i start i end i if character is whitespace line array i line offset if last i token handler handle token line token type last i last context token handler handle token line token type i 1 context last i 1 if last end token handler handle token line token type last end last context handletokenwithspaces handletokenwithspaces tokenhandler tokenhandler tokentype linecontext iswhitespace tokenhandler handletoken tokentype tokenhandler handletoken tokentype tokenhandler handletoken tokentype mark keyword method private void mark keyword boolean add remaining int len pos last offset if len 0 return do digits if context rules get highlight digits boolean digit false boolean mixed false for int i last offset i pos i char ch line array i if character is digit ch digit true else mixed true if mixed re digitre context rules get digit regexp only match against regexp if its not all digits if all digits no point matching if digit if digitre null mixed digit alpha keyword and no regexp don t highlight as digit digit false else char indexed segment seg new char indexed segment line false int old count line count int old offset line offset line offset last offset line count len if digitre is match seg digit false line offset old offset line count old count if digit token handler handle token line token digit last offset line offset len context last offset pos return do keywords if keywords null byte id keywords lookup line last offset len if id token null token handler handle token line id last offset line offset len context last offset pos return handle any remaining crud if add remaining token handler handle token line context rules get default last offset line offset len context last offset pos markkeyword markkeyword addremaining lastoffset gethighlightdigits lastoffset isdigit getdigitregexp charindexedsegment charindexedsegment oldcount oldoffset lastoffset ismatch oldoffset oldcount tokenhandler handletoken lastoffset lastoffset lastoffset tokenhandler handletoken lastoffset lastoffset addremaining tokenhandler handletoken getdefault lastoffset lastoffset substitute method private char substitute re match match char end string buffer buf new string buffer for int i 0 i end length i char ch end i if ch if i end length 1 buf append ch else char digit end i 1 if character is digit digit buf append ch else buf append match to string digit 0 i else buf append ch char return value new char buf length buf get chars 0 buf length return value 0 return return value rematch stringbuffer stringbuffer isdigit tostring returnvalue getchars returnvalue returnvalue line context constructor public line context parser rule set rs line context lc rules rs parent lc null null line context lc clone linecontext linecontext parserruleset linecontext linecontext line context constructor public line context linecontext linecontext intern method public line context intern object obj intern get this if obj null intern put this this return this else return line context obj linecontext linecontext hash code method public int hash code if in rule null return in rule hash code else if rules null return rules hash code else return 0 hashcode hashcode inrule inrule hashcode hashcode equals method public boolean equals object obj if obj instanceof line context line context lc line context obj return lc in rule in rule lc rules rules misc utilities objects equal parent lc parent char arrays equal span end subst lc span end subst else return false linecontext linecontext linecontext inrule inrule miscutilities objectsequal chararraysequal spanendsubst spanendsubst clone method public object clone line context lc new line context lc in rule in rule lc rules rules lc parent parent null null line context parent clone lc span end subst span end subst return lc linecontext linecontext inrule inrule linecontext spanendsubst spanendsubst char arrays equal method private boolean char arrays equal char c1 char c2 if c1 null return c2 null else if c2 null return c1 null if c1 length c2 length return false for int i 0 i c1 length i if c1 i c2 i return false return true chararraysequal chararraysequal invoke action method invokes the given action in response to a user generated event param evt the event param action the action since j edit 4 2pre1 invokeaction jedit add action set method adds a new action set to the context since j edit 4 2pre1 public void add action set action set action set action names null action sets add element action set action set context this string actions action set get action names for int i 0 i actions length i action hash put actions i action set addactionset jedit addactionset actionset actionset actionnames actionsets addelement actionset actionset actionset getactionnames actionhash actionset remove action set method removes an action set from the context since j edit 4 2pre1 public void remove action set action set action set action names null action sets remove element action set action set context null string actions action set get action names for int i 0 i actions length i action hash remove actions i removeactionset jedit removeactionset actionset actionset actionnames actionsets removeelement actionset actionset actionset getactionnames actionhash get action sets method returns all registered action sets since j edit 4 2pre1 public action set get action sets action set ret val new action set action sets size action sets copy into ret val return ret val getactionsets jedit actionset getactionsets actionset retval actionset actionsets actionsets copyinto retval retval get action method returns the specified action param name the action name since j edit 4 2pre1 public edit action get action string name action set set action set action hash get name if set null return null else return set get action name getaction jedit editaction getaction actionset actionset actionhash getaction get action set for action method returns the action set that contains the specified action param action the action since j edit 4 2pre1 public action set get action set for action string action return action set action hash get action getactionsetforaction jedit actionset getactionsetforaction actionset actionhash get action names method returns all registered action names public string get action names if action names null list vec new linked list for int i 0 i action sets size i action set action sets element at i get action names vec action names string vec to array new string vec size arrays sort action names new misc utilities stringi case compare return action names getactionnames getactionnames actionnames linkedlist actionsets actionset actionsets elementat getactionnames actionnames toarray actionnames miscutilities stringicasecompare actionnames dummy fold handler constructor public dummy fold handler super none dummyfoldhandler dummyfoldhandler get fold level method returns the fold level of the specified line param buffer the buffer in question param line index the line index param seg a segment the fold handler can use to obtain any text from the buffer if necessary return the fold level of the specified line since j edit 4 0pre1 public int get fold level buffer buffer int line index segment seg return 0 getfoldlevel lineindex jedit getfoldlevel lineindex mode constructor creates a new edit mode param name the name used in mode listings and to query mode properties see get property string public mode string name this name name props new hashtable getproperty init method initializes the edit mode should be called after all properties are loaded and set public void init try string filename glob string get property filename glob if filename glob null filename glob length 0 filenamere new re misc utilities glob tore filename glob re reg icase string firstline glob string get property firstline glob if firstline glob null firstline glob length 0 firstlinere new re misc utilities glob tore firstline glob re reg icase catch re exception re log log log error this invalid filename firstline globs in mode name log log log error this re fix for this bug put a mode into the user dir with the same name as one on the system dir reload edit modes old mode from system dir still used for highlighting until j edit restart marker null filenameglob getproperty filenameglob filenameglob filenameglob miscutilities globtore filenameglob reg_icase firstlineglob getproperty firstlineglob firstlineglob firstlineglob miscutilities globtore firstlineglob reg_icase reexception jedit get token marker method returns the token marker for this mode public token marker get token marker load if necessary return marker gettokenmarker tokenmarker gettokenmarker loadifnecessary set token marker method sets the token marker for this mode param marker the new token marker public void set token marker token marker marker this marker marker settokenmarker settokenmarker tokenmarker load if necessary method loads the mode from disk if it hasn t been loaded already since j edit 2 5pre3 public void load if necessary if marker null j edit load mode this loadifnecessary jedit loadifnecessary jedit loadmode get property method returns a mode property param key the property name since j edit 2 2pre1 public object get property string key string prefix mode name if j edit get boolean property prefix custom settings string property j edit get property prefix key if property null object value try value new integer property catch number format exception nf value property return value object value props get key if value null return value string global j edit get property buffer key if global null try return new integer global catch number format exception nf return global else return null getproperty jedit getproperty jedit getbooleanproperty customsettings jedit getproperty numberformatexception jedit getproperty numberformatexception get boolean property method returns the value of a boolean property param key the property name since j edit 2 5pre3 public boolean get boolean property string key object value get property key if true equals value on equals value yes equals value return true else return false getbooleanproperty jedit getbooleanproperty getproperty set property method sets a mode property param key the property name param value the property value public void set property string key object value props put key value setproperty setproperty unset property method unsets a mode property param key the property name since j edit 3 2pre3 public void unset property string key props remove key unsetproperty jedit unsetproperty set properties method should only be called by code x mode handler code since j edit 4 0pre3 public void set properties hashtable props if props null props new hashtable need to carry over file name and first line globs because they are not given to us by the x mode handler but instead are filled in by the catalog loader string filename glob string this props get filename glob string firstline glob string this props get firstline glob string filename string this props get file this props props if filename glob null props put filename glob filename glob if firstline glob null props put firstline glob firstline glob if filename null props put file filename setproperties xmodehandler jedit setproperties xmode filenameglob filenameglob firstlineglob firstlineglob filenameglob filenameglob filenameglob firstlineglob firstlineglob firstlineglob accept method returns if the edit mode is suitable for editing the specified file the buffer name and first line is checked against the file name and first line globs respectively param file name the buffer s name param first line the first line of the buffer since j edit 3 2pre3 public boolean accept string file name string first line if filenamere null filenamere is match file name return true if firstlinere null firstlinere is match first line return true return false filename firstline jedit filename firstline ismatch filename ismatch firstline get name method returns the internal name of this edit mode public string get name return name getname getname to string method returns a string representation of this edit mode public string to string return name tostring tostring public quick notepad text area super set line wrap true set wrap style word true set tab size 4 quicknotepadtextarea setlinewrap setwrapstyleword settabsize class bsh allocation expression extends simple node bsh allocation expression int id super id bshallocationexpression simplenode bshallocationexpression public object eval call stack callstack interpreter interpreter throws eval error type is either a class name or a primitive type simple node type simple node jjt get child 0 args is either constructor arguments or array dimensions simple node args simple node jjt get child 1 if type instanceof bsh ambiguous name bsh ambiguous name name bsh ambiguous name type if args instanceof bsh arguments return object allocation name bsh arguments args callstack interpreter else return object array allocation name bsh array dimensions args callstack interpreter else return primitive array allocation bsh primitive type type bsh array dimensions args callstack interpreter callstack evalerror simplenode simplenode jjtgetchild simplenode simplenode jjtgetchild bshambiguousname bshambiguousname bshambiguousname bsharguments objectallocation bsharguments objectarrayallocation bsharraydimensions primitivearrayallocation bshprimitivetype bsharraydimensions private object object allocation bsh ambiguous name name node bsh arguments arguments node call stack callstack interpreter interpreter throws eval error name space namespace callstack top object args arguments node get arguments callstack interpreter if args null throw new eval error null args in new this callstack look for scripted class object object obj name node to object callstack interpreter false force class try regular class obj name node to object callstack interpreter true force class class type null if obj instanceof class identifier type class identifier obj get target class else throw new eval error unknown class name node text this callstack is an inner class style object allocation boolean has body jjt get num children 2 if has body bsh block body bsh block jjt get child 2 if type is interface return construct with interface body type args body callstack interpreter else return construct with class body type args body callstack interpreter else return construct object type args callstack objectallocation bshambiguousname namenode bsharguments argumentsnode callstack evalerror namespace argumentsnode getarguments evalerror namenode toobject namenode toobject classidentifier classidentifier gettargetclass evalerror namenode hasbody jjtgetnumchildren hasbody bshblock bshblock jjtgetchild isinterface constructwithinterfacebody constructwithclassbody constructobject private object construct object class type object args call stack callstack throws eval error object obj try obj reflect construct object type args catch reflect error e throw new eval error constructor error e get message this callstack catch invocation target exception e no need to wrap this debug interpreter debug the constructor threw an exception n t e get target exception throw new target error object constructor e get target exception this callstack true string class name type get name is it an inner class if class name index of 1 return obj temporary hack to support inner classes if the obj is a non static inner class then import the context this is not a sufficient emulation of inner classes replace this later work through to class this this ths callstack top get this null name space instance name space name get class name space ths get name space change the parent which was the class static to the class instance we really need to check if we re a static inner class here first but for some reason java won t show the static modifier on our fake inner classes could generate a flag field if instance name space null class name starts with instance name space get name try class generator get class generator set instance name space parent obj class name instance name space catch util eval error e throw e to eval error this callstack return obj constructobject callstack evalerror constructobject reflecterror evalerror getmessage invocationtargetexception gettargetexception targeterror gettargetexception classname getname classname indexof getthis namespace instancenamespace getclassnamespace getnamespace instancenamespace classname startswith instancenamespace getname classgenerator getclassgenerator setinstancenamespaceparent classname instancenamespace utilevalerror toevalerror private object construct with class body class type object args bsh block block call stack callstack interpreter interpreter throws eval error string name callstack top get name inner class count modifiers modifiers new modifiers modifiers add modifier modifiers class public class clas try clas class generator get class generator generate class name modifiers null interfaces type super class block false is interface callstack interpreter catch util eval error e throw e to eval error this callstack try return reflect construct object clas args catch exception e if e instanceof invocation target exception e exception invocation target exception e get target exception throw new eval error error constructing inner class instance e this callstack constructwithclassbody bshblock callstack evalerror getname innerclasscount addmodifier classgenerator getclassgenerator generateclass superclass isinterface utilevalerror toevalerror constructobject invocationtargetexception invocationtargetexception gettargetexception evalerror private object construct with interface body class type object args bsh block body call stack callstack interpreter interpreter throws eval error name space namespace callstack top name space local new name space namespace anonymous block callstack push local body eval callstack interpreter true override namespace callstack pop statical import fields from the interface so that code inside can refer to the fields directly e g height local import static type try return local get this interpreter get interface type catch util eval error e throw e to eval error this callstack constructwithinterfacebody bshblock callstack evalerror namespace namespace namespace anonymousblock overridenamespace importstatic getthis getinterface utilevalerror toevalerror private object object array allocation bsh ambiguous name name node bsh array dimensions dimensions node call stack callstack interpreter interpreter throws eval error name space namespace callstack top class type name node to class callstack interpreter if type null throw new eval error class name node get name namespace not found this callstack return array allocation dimensions node type callstack interpreter objectarrayallocation bshambiguousname namenode bsharraydimensions dimensionsnode callstack evalerror namespace namenode toclass evalerror namenode getname arrayallocation dimensionsnode private object primitive array allocation bsh primitive type type node bsh array dimensions dimensions node call stack callstack interpreter interpreter throws eval error class type type node get type return array allocation dimensions node type callstack interpreter primitivearrayallocation bshprimitivetype typenode bsharraydimensions dimensionsnode callstack evalerror typenode gettype arrayallocation dimensionsnode private object array allocation bsh array dimensions dimensions node class type call stack callstack interpreter interpreter throws eval error dimensions node can return either a fully intialized array or void when void the prescribed array dimensions defined and undefined are contained in the node object result dimensions node eval type callstack interpreter if result primitive void return result else return array new instance type dimensions node callstack arrayallocation bsharraydimensions dimensionsnode callstack evalerror dimensionsnode dimensionsnode arraynewinstance dimensionsnode create an array of the dimensions specified in dimensions node dimensions node may contain a number of undefined as well as defined dimensions p background in java arrays are implemented in arrays of arrays style where for example a two dimensional array is a an array of arrays of some base type each dimension type has a java class type associated with it so if foo new int 5 5 then the type of foo is int and the type of foo 0 is int etc arrays may also be specified with undefined trailing dimensions meaning that the lower order arrays are not allocated as objects e g if foo new int 5 then foo 0 null true and can later be assigned with the appropriate type e g foo 0 new int 5 see learning java o reilly associates more background p to create an array with undefined trailing dimensions using the reflection api we must use an array type to represent the lower order undefined dimensions as the base type for the array creation java will then create the correct type by adding the dimensions of the base type to specified allocated dimensions yielding an array of dimensionality base specified with the base dimensons unallocated to create the base array type we simply create a prototype zero length in each dimension array and use it to get its class actually i think there is a way we could do it with class for name but i don t trust this the code is simpler than the explanation see below private object array new instance class type bsh array dimensions dimensions node call stack callstack throws eval error if dimensions node num undefined dims 0 object proto array new instance type new int dimensions node num undefined dims zeros type proto get class try return array new instance type dimensions node defined dimensions catch negative array size exception e1 throw new target error e1 this callstack catch exception e throw new eval error can t construct primitive array e get message this callstack dimensionsnode dimensionsnode forname arraynewinstance bsharraydimensions dimensionsnode callstack evalerror dimensionsnode numundefineddims newinstance dimensionsnode numundefineddims getclass newinstance dimensionsnode defineddimensions negativearraysizeexception targeterror evalerror getmessage get first file method public synchronized string get first file view view if files null files getfiles view if files null files length 0 return null else return files 0 getfirstfile getfirstfile _getfiles get next file method public synchronized string get next file view view string file if files null files getfiles view if files null files length 0 return null if file null file view get buffer get symlink path vfs vfs vfs manager getvfs for path file boolean ignore case vfs get capabilities vfs case insensitive cap 0 for int i 0 i files length i if misc utilities compare strings files i file ignore case 0 return file return get first file view else 1 so that the last isn t checked vfs vfs vfs manager getvfs for path file boolean ignore case vfs get capabilities vfs case insensitive cap 0 for int i 0 i files length 1 i if misc utilities compare strings files i file ignore case 0 return files i 1 return null getnextfile getnextfile _getfiles getbuffer getsymlinkpath vfsmanager getvfsforpath ignorecase getcapabilities case_insensitive_cap miscutilities comparestrings ignorecase getfirstfile vfsmanager getvfsforpath ignorecase getcapabilities case_insensitive_cap miscutilities comparestrings ignorecase get files method public synchronized string get files view view if files null files getfiles view if files null files length 0 return null else return files getfiles getfiles _getfiles get file count method public synchronized int get file count view view if files null files getfiles view if files null return 0 else return files length getfilecount getfilecount _getfiles get code method public string get code not supported for arbitriary filesets return null getcode getcode invalidate cached list method public synchronized void invalidate cached list files null invalidatecachedlist invalidatecachedlist note that the paths in the returned list must be fully canonicalized static primitive invalid cast new primitive 1 get the java types of the arguments public static class get types object args if args null return new class 0 class types new class args length for int i 0 i args length i if args i null types i null else if args i instanceof primitive types i primitive args i get type else types i args i get class return types invalid_cast gettypes gettype getclass arguments are assignable as defined by types get assignable form which takes into account special bsh conversions such as x this and primitive wrapper promotion deprecated fix this need to stop catching exception static boolean args assignable class parameters object args class arg types get types args return is signature assignable arg types parameters getassignableform xthis argsassignable argtypes gettypes issignatureassignable argtypes is the from signature argument types assignable to the to signature candidate method types using is java assignable this method handles the special case of null values in to types indicating a loose type and matching anything should check for strict java here and use is java assignable instead static boolean is signature assignable class from class to if from length to length return false for int i 0 i from length i if is bsh assignable to i from i return false return true isjavaassignable isjavaassignable issignatureassignable isbshassignable is a standard java assignment legal from the rhs type to the lhs type in a normal assignment i e without any cast p for java primitive type classes this method takes primitive promotion into account the ordinary class is assignable from does not take primitive promotion conversions into account note that java allows additional assignments without a cast in combination with variable declarations those are handled elsewhere maybe should be here with a flag p this class accepts a null rhs type indicating that the rhs was the value primitive null and allows it to be assigned to any object lhs type non primitive p note that the get assignable form method is the primary bsh method for checking assignability it adds additional bsh conversions etc see is bsh assignable class class param lhs assigning from rhs to lhs param rhs assigning from rhs to lhs static boolean is java assignable class lhs class rhs null from type corresponds to type of primitive null assign to any object type if rhs null return lhs is primitive if lhs is primitive rhs is primitive if lhs rhs return true handle primitive widening conversions jls 5 1 2 if rhs byte type lhs short type lhs integer type lhs long type lhs float type lhs double type return true if rhs short type lhs integer type lhs long type lhs float type lhs double type return true if rhs character type lhs integer type lhs long type lhs float type lhs double type return true if rhs integer type lhs long type lhs float type lhs double type return true if rhs long type lhs float type lhs double type return true if rhs float type lhs double type return true else if lhs is assignable from rhs return true return false isassignablefrom getassignableform isbshassignable isjavaassignable isprimitive isprimitive isprimitive isassignablefrom param rhs may be primitive param lhs type is java type or type deprecated getting rid of this use is bsh assignable and cast object public static object get assignable form object rhs class lhs type throws util eval error return cast object rhs lhs type assignment lhstype isbshassignable castobject getassignableform lhstype utilevalerror castobject lhstype attempt to cast an object instance to a new type this method can handle from value primitive types representing primitive casts as well as from value object casts requiring interface generation etc param to type the class type of the cast result which may include primitive types e g byte type param from value an object or bsh primitive primitive value including primitive null or primitive void see is bsh assignable class class public static object cast object object from value class to type int operation throws util eval error if from value null throw new interpreter error null from value class from type from value instanceof primitive primitive from value get type from value get class return cast object to type from type from value operation false checkonly fromvalue fromvalue totype fromvalue isbshassignable castobject fromvalue totype utilevalerror fromvalue interpretererror fromvalue fromtype fromvalue fromvalue gettype fromvalue getclass castobject totype fromtype fromvalue static boolean is bsh assignable class to type class from type try return cast object to type from type null from value assignment true check only valid cast catch util eval error e this should not happen with check only true throw new interpreter error err in cast check e isbshassignable totype fromtype castobject totype fromtype fromvalue checkonly valid_cast utilevalerror checkonly interpretererror static object cast object class to type class from type object from value int operation boolean check only throws util eval error lots of preconditions checked here once things are running smoothly we might comment these out that s what assertions are for if check only from value null throw new interpreter error bad cast params 1 if check only from value null throw new interpreter error bad cast params 2 if from type primitive class throw new interpreter error bad from type need to unwrap if from value primitive null from type null throw new interpreter error inconsistent args 1 if from value primitive void from type void type throw new interpreter error inconsistent args 2 if to type void type throw new interpreter error loose to type should be null assignment to loose type void type or exactly same type if to type null to type from type return check only valid cast from value if to type is primitive if from type void type from type null from type is primitive both primitives do primitive cast return primitive cast primitive to type from type primitive from value check only operation else if primitive is wrapper type from type wrapper to primitive convert value to primitive and check cast it object r check only valid cast class unboxed from type primitive unbox type from type primitive prim from value if check only prim from value null must be null in check only else prim from value primitive primitive wrap from value unboxed from type return primitive cast primitive to type unboxed from type prim from value check only operation else cannot cast from arbitrary object to primitive if check only return invalid cast else throw cast error to type from type operation casting to reference type if from type void type from type null from type is primitive if primitive is wrapper type to type from type void type from type null primitive to wrapper type return check only valid cast primitive cast wrapper primitive unbox type to type primitive from value get value primitive not null or void to object class type if to type object class from type void type from type null box it return check only valid cast primitive from value get value primitive to arbitrary object type allow primitive cast to type to handle it as well as cases of primitive null and primitive void return primitive cast primitive to type from type primitive from value check only operation if type already assignable no cast necessary we do this last to allow various errors above to be caught e g cast primitive void to object would pass this if to type is assignable from from type return check only valid cast from value can we use the proxy mechanism to cast a bsh this to the correct interface if to type is interface bsh this class is assignable from from type capabilities can generate interfaces return check only valid cast bsh this from value get interface to type both numeric wrapper types try numeric style promotion wrapper cast if primitive is wrapper type to type primitive is wrapper type from type return check only valid cast primitive cast wrapper to type from value if check only return invalid cast else throw cast error to type from type operation castobject totype fromtype fromvalue checkonly utilevalerror checkonly fromvalue interpretererror checkonly fromvalue interpretererror fromtype interpretererror fromvalue fromtype interpretererror fromvalue fromtype interpretererror totype interpretererror totype totype totype fromtype checkonly valid_cast fromvalue totype isprimitive fromtype fromtype fromtype isprimitive castprimitive totype fromtype fromvalue checkonly iswrappertype fromtype checkonly valid_cast unboxedfromtype unboxtype fromtype primfromvalue checkonly primfromvalue checkonly primfromvalue fromvalue unboxedfromtype castprimitive totype unboxedfromtype primfromvalue checkonly checkonly invalid_cast casterror totype fromtype fromtype fromtype fromtype isprimitive iswrappertype totype fromtype fromtype checkonly valid_cast castwrapper unboxtype totype fromvalue getvalue totype fromtype fromtype checkonly valid_cast fromvalue getvalue casttotype castprimitive totype fromtype fromvalue checkonly totype isassignablefrom fromtype checkonly valid_cast fromvalue totype isinterface isassignablefrom fromtype cangenerateinterfaces checkonly valid_cast fromvalue getinterface totype iswrappertype totype iswrappertype fromtype checkonly valid_cast castwrapper totype fromvalue checkonly invalid_cast casterror totype fromtype return a util eval error or util target error wrapping a class cast exception describing an illegal assignment or illegal cast respectively static util eval error cast error class lhs type class rhs type int operation return cast error reflect normalize class name lhs type reflect normalize class name rhs type operation utilevalerror utiltargeterror classcastexception utilevalerror casterror lhstype rhstype casterror normalizeclassname lhstype normalizeclassname rhstype static util eval error cast error string lhs string rhs int operation if operation assignment return new util eval error can t assign rhs to lhs exception cce new class cast exception cannot cast rhs to lhs return new util target error cce utilevalerror casterror utilevalerror classcastexception utiltargeterror public cb zip2 output stream final output stream output throws io exception this output 9 cbzip2outputstream outputstream ioexception public cb zip2 output stream final output stream output final int block size throws io exception bs set stream output m workfactor 50 int out block size block size if out block size 9 out block size 9 if out block size 1 out block size 1 m blocksize100k out block size allocate compress structures initialize init block cbzip2outputstream outputstream blocksize ioexception bssetstream m_workfactor outblocksize blocksize outblocksize outblocksize outblocksize outblocksize m_blocksize100k outblocksize allocatecompressstructures initblock private static void hb make code lengths char len int freq int alpha size int max len nodes and heap entries run from 1 entry 0 for both the heap and nodes is a sentinel int n nodes nodes and heap entries run from 1 entry 0 for both the heap and nodes is a sentinel int n heap nodes and heap entries run from 1 entry 0 for both the heap and nodes is a sentinel int n1 nodes and heap entries run from 1 entry 0 for both the heap and nodes is a sentinel int n2 nodes and heap entries run from 1 entry 0 for both the heap and nodes is a sentinel int i nodes and heap entries run from 1 entry 0 for both the heap and nodes is a sentinel int j nodes and heap entries run from 1 entry 0 for both the heap and nodes is a sentinel int k boolean too long int heap new int max alpha size 2 int weights new int max alpha size 2 int parent new int max alpha size 2 for i 0 i alpha size i weights i 1 freq i 0 1 freq i 8 while true n nodes alpha size n heap 0 heap 0 0 weights 0 0 parent 0 2 for i 1 i alpha size i parent i 1 n heap heap n heap i int zz int tmp zz n heap tmp heap zz while weights tmp weights heap zz 1 heap zz heap zz 1 zz 1 heap zz tmp if n heap max alpha size 2 panic while n heap 1 n1 heap 1 heap 1 heap n heap n heap int zz 0 int yy 0 int tmp 0 zz 1 tmp heap zz while true yy zz 1 if yy n heap break if yy n heap weights heap yy 1 weights heap yy yy if weights tmp weights heap yy break heap zz heap yy zz yy heap zz tmp n2 heap 1 heap 1 heap n heap n heap int zz 0 int yy 0 int tmp 0 zz 1 tmp heap zz while true yy zz 1 if yy n heap break if yy n heap weights heap yy 1 weights heap yy yy if weights tmp weights heap yy break heap zz heap yy zz yy heap zz tmp n nodes parent n1 n nodes parent n2 n nodes final int v1 weights n1 final int v2 weights n2 final int weight calculate weight v1 v2 weights n nodes weight parent n nodes 1 n heap heap n heap n nodes int zz 0 int tmp 0 zz n heap tmp heap zz while weights tmp weights heap zz 1 heap zz heap zz 1 zz 1 heap zz tmp if n nodes max alpha size 2 panic too long false for i 1 i alpha size i j 0 k i while parent k 0 k parent k j len i 1 char j if j max len too long true if too long break for i 1 i alpha size i j weights i 8 j 1 j 2 weights i j 8 hbmakecodelengths alphasize maxlen nnodes nheap toolong max_alpha_size max_alpha_size max_alpha_size alphasize nnodes alphasize nheap alphasize nheap nheap nheap nheap max_alpha_size nheap nheap nheap nheap nheap nheap nheap nheap nheap nnodes nnodes nnodes calculateweight nnodes nnodes nheap nheap nnodes nheap nnodes max_alpha_size toolong alphasize maxlen toolong toolong alphasize private static int calculate weight final int v1 final int v2 final int upper v1 upper byte mask v2 upper byte mask final int v1 lower v1 lower byte mask final int v2 lower v2 lower byte mask final int nnnn v1 lower v2 lower v1 lower v2 lower return upper 1 nnnn calculateweight upper_byte_mask upper_byte_mask v1lower lower_byte_mask v2lower lower_byte_mask v1lower v2lower v1lower v2lower private static void panic system out println panic throw new c error cerror public void close throws io exception if m closed return if m runlength 0 write run m currentchar 1 end block end compression m closed true super close m bsstream close ioexception m_closed m_runlength writerun m_currentchar endblock endcompression m_closed m_bsstream public void finalize throws throwable close public void flush throws io exception super flush m bsstream flush ioexception m_bsstream modified by oliver merkel 010128 param bv description of parameter exception java io io exception description of exception public void write int bv throws io exception int b 256 bv 256 if m currentchar 1 if m currentchar b m runlength if m runlength 254 write run m currentchar 1 m runlength 0 else write run m runlength 1 m currentchar b else m currentchar b m runlength ioexception ioexception m_currentchar m_currentchar m_runlength m_runlength writerun m_currentchar m_runlength writerun m_runlength m_currentchar m_currentchar m_runlength private void allocate compress structures int n base block size m blocksize100k m block new char n 1 num overshoot bytes m quadrant new int n num overshoot bytes m zptr new int n m ftab new int 65537 if m block null m quadrant null m zptr null m ftab null int total draw n 1 num overshoot bytes n num overshoot bytes n 65537 compress out of memory total draw n the back end needs a place to store the mtf values whilst it calculates the coding tables we could put them in the zptr array however these values will fit in a short so we overlay szptr at the start of zptr in the hope of reducing the number of cache misses induced by the multiple traversals of the mtf values when calculating coding tables seems to improve compression speed by about 1 szptr zptr m szptr new short 2 n allocatecompressstructures base_block_size m_blocksize100k m_block num_overshoot_bytes m_quadrant num_overshoot_bytes m_zptr m_ftab m_block m_quadrant m_zptr m_ftab totaldraw num_overshoot_bytes num_overshoot_bytes compressoutofmemory totaldraw m_szptr private void bs finished with stream throws io exception while m bslive 0 int ch m bsbuff 24 try m bsstream write ch write 8 bit catch io exception e throw e m bsbuff 8 m bslive 8 bsfinishedwithstream ioexception m_bslive m_bsbuff m_bsstream ioexception m_bsbuff m_bslive private void bs put intvs int num bits int c throws io exception bsw num bits c bsputintvs numbits ioexception numbits private void bs putu char int c throws io exception bsw 8 c bsputuchar ioexception private void bs putint int u throws io exception bsw 8 u 24 0xff bsw 8 u 16 0xff bsw 8 u 8 0xff bsw 8 u 0xff bsputint ioexception private void bs set stream output stream f m bsstream f m bslive 0 m bsbuff 0 bssetstream outputstream m_bsstream m_bslive m_bsbuff private void bsw int n int v throws io exception while m bslive 8 int ch m bsbuff 24 try m bsstream write ch write 8 bit catch io exception e throw e m bsbuff 8 m bslive 8 m bsbuff v 32 m bslive n m bslive n ioexception m_bslive m_bsbuff m_bsstream ioexception m_bsbuff m_bslive m_bsbuff m_bslive m_bslive private void do reversible transformation int i m worklimit m workfactor m last m workdone 0 m blockrandomised false m firstattempt true main sort if m workdone m worklimit m firstattempt randomise block m worklimit 0 m workdone 0 m blockrandomised true m firstattempt false main sort m origptr 1 for i 0 i m last i if m zptr i 0 m origptr i break if m origptr 1 panic doreversibletransformation m_worklimit m_workfactor m_last m_workdone m_blockrandomised m_firstattempt mainsort m_workdone m_worklimit m_firstattempt randomiseblock m_worklimit m_workdone m_blockrandomised m_firstattempt mainsort m_origptr m_last m_zptr m_origptr m_origptr private void end block throws io exception m blockcrc m crc get finalcrc m combinedcrc m combinedcrc 1 m combinedcrc 31 m combinedcrc m blockcrc sort the block and establish posn of original string do reversible transformation a 6 byte block header the value chosen arbitrarily as 0x314159265359 a 32 bit value does not really give a strong enough guarantee that the value will not appear by chance in the compressed datastream worst case probability of this event for a 900k block is about 2 0e 3 for 32 bits 1 0e 5 for 40 bits and 4 0e 8 for 48 bits for a compressed file of size 100 gb about 100000 blocks only a 48 bit marker will do nb normal compression decompression do not rely on these statistical properties they are only important when trying to recover blocks from damaged files bs putu char 0x31 bs putu char 0x41 bs putu char 0x59 bs putu char 0x26 bs putu char 0x53 bs putu char 0x59 now the block s crc so it is in a known place bs putint m blockcrc now a single bit indicating randomisation if m blockrandomised bsw 1 1 else bsw 1 0 finally block s contents proper move to front code and send endblock ioexception m_blockcrc m_crc getfinalcrc m_combinedcrc m_combinedcrc m_combinedcrc m_combinedcrc m_blockcrc doreversibletransformation 100gb bsputuchar bsputuchar bsputuchar bsputuchar bsputuchar bsputuchar bsputint m_blockcrc m_blockrandomised movetofrontcodeandsend private void end compression throws io exception now another magic 48 bit number 0x177245385090 to indicate the end of the last block sqrt pi if you want to know i did want to use e but it contains too much repetition 27 18 28 18 28 46 for me to feel statistically comfortable call me paranoid bs putu char 0x17 bs putu char 0x72 bs putu char 0x45 bs putu char 0x38 bs putu char 0x50 bs putu char 0x90 bs putint m combinedcrc bs finished with stream endcompression ioexception bsputuchar bsputuchar bsputuchar bsputuchar bsputuchar bsputuchar bsputint m_combinedcrc bsfinishedwithstream private boolean full gtu int i1 int i2 int k char c1 char c2 int s1 int s2 c1 m block i1 1 c2 m block i2 1 if c1 c2 return c1 c2 i1 i2 c1 m block i1 1 c2 m block i2 1 if c1 c2 return c1 c2 i1 i2 c1 m block i1 1 c2 m block i2 1 if c1 c2 return c1 c2 i1 i2 c1 m block i1 1 c2 m block i2 1 if c1 c2 return c1 c2 i1 i2 c1 m block i1 1 c2 m block i2 1 if c1 c2 return c1 c2 i1 i2 c1 m block i1 1 c2 m block i2 1 if c1 c2 return c1 c2 i1 i2 k m last 1 do c1 m block i1 1 c2 m block i2 1 if c1 c2 return c1 c2 s1 m quadrant i1 s2 m quadrant i2 if s1 s2 return s1 s2 i1 i2 c1 m block i1 1 c2 m block i2 1 if c1 c2 return c1 c2 s1 m quadrant i1 s2 m quadrant i2 if s1 s2 return s1 s2 i1 i2 c1 m block i1 1 c2 m block i2 1 if c1 c2 return c1 c2 s1 m quadrant i1 s2 m quadrant i2 if s1 s2 return s1 s2 i1 i2 c1 m block i1 1 c2 m block i2 1 if c1 c2 return c1 c2 s1 m quadrant i1 s2 m quadrant i2 if s1 s2 return s1 s2 i1 i2 if i1 m last i1 m last i1 if i2 m last i2 m last i2 k 4 m workdone while k 0 return false fullgtu m_block m_block m_block m_block m_block m_block m_block m_block m_block m_block m_block m_block m_last m_block m_block m_quadrant m_quadrant m_block m_block m_quadrant m_quadrant m_block m_block m_quadrant m_quadrant m_block m_block m_quadrant m_quadrant m_last m_last m_last m_last m_workdone private void generatemtf values char yy new char 256 int i int j char tmp char tmp2 int z pend int wr int eob make maps eob m ninuse 1 for i 0 i eob i m mtffreq i 0 wr 0 z pend 0 for i 0 i m ninuse i yy i char i for i 0 i m last i char ll i ll i m unseqtoseq m block m zptr i j 0 tmp yy j while ll i tmp j tmp2 tmp tmp yy j yy j tmp2 yy 0 tmp if j 0 z pend else if z pend 0 z pend while true switch z pend 2 case 0 m szptr wr short runa wr m mtffreq runa break case 1 m szptr wr short runb wr m mtffreq runb break if z pend 2 break z pend z pend 2 2 z pend 0 m szptr wr short j 1 wr m mtffreq j 1 if z pend 0 z pend while true switch z pend 2 case 0 m szptr wr short runa wr m mtffreq runa break case 1 m szptr wr short runb wr m mtffreq runb break if z pend 2 break z pend z pend 2 2 m szptr wr short eob wr m mtffreq eob m nmtf wr generatemtfvalues zpend makemaps m_ninuse m_mtffreq zpend m_ninuse m_last ll_i ll_i m_unseqtoseq m_block m_zptr ll_i zpend zpend zpend zpend m_szptr m_mtffreq m_szptr m_mtffreq zpend zpend zpend zpend m_szptr m_mtffreq zpend zpend zpend m_szptr m_mtffreq m_szptr m_mtffreq zpend zpend zpend m_szptr m_mtffreq m_nmtf private void hb assign codes int code char length int min len int max len int alpha size int n int vec int i vec 0 for n min len n max len n for i 0 i alpha size i if length i n code i vec vec vec 1 hbassigncodes minlen maxlen alphasize minlen maxlen alphasize private void init block block no m crc initialisecrc m last 1 ch 0 for int i 0 i 256 i m inuse i false 20 is just a paranoia constant m allowableblocksize base block size m blocksize100k 20 initblock blockno m_crc m_last m_inuse m_allowableblocksize base_block_size m_blocksize100k private void initialize throws io exception write magic bytes h indicating file format huffmanised followed by a digit indicating block size100k bs putu char h bs putu char 0 m blocksize100k m combinedcrc 0 ioexception blocksize100k bsputuchar bsputuchar m_blocksize100k m_combinedcrc private void main sort int i int j int ss int sb int running order new int 256 int copy new int 256 boolean big done new boolean 256 int c1 int c2 in the various block sized structures live data runs from 0 to last num overshoot bytes inclusive first set up the overshoot area for block if verbosity 4 fprintf stderr sort initialise n for i 0 i num overshoot bytes i m block m last i 2 m block i m last 1 1 for i 0 i m last num overshoot bytes i m quadrant i 0 m block 0 m block m last 1 if m last 4000 use simple sort since the full sorting mechanism has quite a large constant overhead for i 0 i m last i m zptr i i m firstattempt false m workdone 0 m worklimit 0 simple sort 0 m last 0 else for i 0 i 255 i big done i false for i 0 i 65536 i m ftab i 0 c1 m block 0 for i 0 i m last i c2 m block i 1 m ftab c1 8 c2 c1 c2 for i 1 i 65536 i m ftab i m ftab i 1 c1 m block 1 for i 0 i m last i c2 m block i 2 j c1 8 c2 c1 c2 m ftab j m zptr m ftab j i j m block m last 1 8 m block 1 m ftab j m zptr m ftab j m last now ftab contains the first loc of every small bucket calculate the running order from smallest to largest big bucket for i 0 i 255 i running order i i int vv int h 1 do h 3 h 1 while h 256 do h h 3 for i h i 255 i vv running order i j i while m ftab running order j h 1 8 m ftab running order j h 8 m ftab vv 1 8 m ftab vv 8 running order j running order j h j j h if j h 1 break running order j vv while h 1 the main sorting loop for i 0 i 255 i process big buckets starting with the least full ss running order i complete the big bucket ss by quicksorting any unsorted small buckets ss j hopefully previous pointer scanning phases have already completed many of the small buckets ss j so we don t have to sort them at all for j 0 j 255 j sb ss 8 j if m ftab sb setmask setmask int lo m ftab sb clearmask int hi m ftab sb 1 clearmask 1 if hi lo q sort3 lo hi 2 if m workdone m worklimit m firstattempt return m ftab sb setmask the ss big bucket is now done record this fact and update the quadrant descriptors remember to update quadrants in the overshoot area too if necessary the if i 255 test merely skips this updating for the last bucket processed since updating for the last bucket is pointless big done ss true if i 255 int bb start m ftab ss 8 clearmask int bb size m ftab ss 1 8 clearmask bb start int shifts 0 while bb size shifts 65534 shifts for j 0 j bb size j int a2update m zptr bb start j int q val j shifts m quadrant a2update q val if a2update num overshoot bytes m quadrant a2update m last 1 q val if bb size 1 shifts 65535 panic now scan this big bucket so as to synthesise the sorted order for small buckets t ss for all t ss for j 0 j 255 j copy j m ftab j 8 ss clearmask for j m ftab ss 8 clearmask j m ftab ss 1 8 clearmask j c1 m block m zptr j if big done c1 m zptr copy c1 m zptr j 0 m last m zptr j 1 copy c1 for j 0 j 255 j m ftab j 8 ss setmask mainsort runningorder bigdone num_overshoot_bytes num_overshoot_bytes m_block m_last m_block m_last m_last num_overshoot_bytes m_quadrant m_block m_block m_last m_last simplesort m_last m_zptr m_firstattempt m_workdone m_worklimit simplesort m_last bigdone m_ftab m_block m_last m_block m_ftab m_ftab m_ftab m_block m_last m_block m_ftab m_zptr m_ftab m_block m_last m_block m_ftab m_zptr m_ftab m_last runningorder runningorder m_ftab runningorder m_ftab runningorder m_ftab m_ftab runningorder runningorder runningorder runningorder m_ftab m_ftab m_ftab qsort3 m_workdone m_worklimit m_firstattempt m_ftab bigdone bbstart m_ftab bbsize m_ftab bbstart bbsize bbsize m_zptr bbstart qval m_quadrant qval num_overshoot_bytes m_quadrant m_last qval bbsize m_ftab m_ftab m_ftab m_block m_zptr bigdone m_zptr m_zptr m_last m_zptr m_ftab private void make maps int i m ninuse 0 for i 0 i 256 i if m inuse i m seqtounseq m ninuse char i m unseqtoseq i char m ninuse m ninuse makemaps m_ninuse m_inuse m_seqtounseq m_ninuse m_unseqtoseq m_ninuse m_ninuse private char med3 char a char b char c char t if a b t a a b b t if b c t b b c c t if a b b a return b private void move to front code and send throws io exception bs put intvs 24 m origptr generatemtf values sendmtf values movetofrontcodeandsend ioexception bsputintvs m_origptr generatemtfvalues sendmtfvalues private void q sort3 int lo st int hi st int d st int un lo int un hi int lt lo int gt hi int med int n int m int sp int lo int hi int d stack elem stack new stack elem qsort stack size for int count 0 count qsort stack size count stack count new stack elem sp 0 stack sp m ll lo st stack sp m hh hi st stack sp m dd d st sp while sp 0 if sp qsort stack size panic sp lo stack sp m ll hi stack sp m hh d stack sp m dd if hi lo small thresh d depth thresh simple sort lo hi d if m workdone m worklimit m firstattempt return continue med med3 m block m zptr lo d 1 m block m zptr hi d 1 m block m zptr lo hi 1 d 1 un lo lo lt lo lo un hi hi gt hi hi while true while true if un lo un hi break n m block m zptr un lo d 1 med if n 0 int temp 0 temp m zptr un lo m zptr un lo m zptr lt lo m zptr lt lo temp lt lo un lo continue if n 0 break un lo while true if un lo un hi break n m block m zptr un hi d 1 med if n 0 int temp 0 temp m zptr un hi m zptr un hi m zptr gt hi m zptr gt hi temp gt hi un hi continue if n 0 break un hi if un lo un hi break int temp 0 temp m zptr un lo m zptr un lo m zptr un hi m zptr un hi temp un lo un hi if gt hi lt lo stack sp m ll lo stack sp m hh hi stack sp m dd d 1 sp continue n lt lo lo un lo lt lo lt lo lo un lo lt lo vswap lo un lo n n m hi gt hi gt hi un hi hi gt hi gt hi un hi vswap un lo hi m 1 m n lo un lo lt lo 1 m hi gt hi un hi 1 stack sp m ll lo stack sp m hh n stack sp m dd d sp stack sp m ll n 1 stack sp m hh m 1 stack sp m dd d 1 sp stack sp m ll m stack sp m hh hi stack sp m dd d sp qsort3 lost hist dst unlo unhi ltlo gthi stackelem stackelem qsort_stack_size qsort_stack_size stackelem m_ll lost m_hh hist m_dd dst qsort_stack_size m_ll m_hh m_dd small_thresh depth_thresh simplesort m_workdone m_worklimit m_firstattempt m_block m_zptr m_block m_zptr m_block m_zptr unlo ltlo unhi gthi unlo unhi m_block m_zptr unlo m_zptr unlo m_zptr unlo m_zptr ltlo m_zptr ltlo ltlo unlo unlo unlo unhi m_block m_zptr unhi m_zptr unhi m_zptr unhi m_zptr gthi m_zptr gthi gthi unhi unhi unlo unhi m_zptr unlo m_zptr unlo m_zptr unhi m_zptr unhi unlo unhi gthi ltlo m_ll m_hh m_dd ltlo unlo ltlo ltlo unlo ltlo unlo gthi gthi unhi gthi gthi unhi unlo unlo ltlo gthi unhi m_ll m_hh m_dd m_ll m_hh m_dd m_ll m_hh m_dd private void randomise block int i int rn to go 0 int rt pos 0 for i 0 i 256 i m inuse i false for i 0 i m last i if rn to go 0 rn to go char rand nums rt pos rt pos if rt pos 512 rt pos 0 rn to go m block i 1 rn to go 1 1 0 handle 16 bit signed numbers m block i 1 0xff m inuse m block i 1 true randomiseblock rntogo rtpos m_inuse m_last rntogo rntogo rand_nums rtpos rtpos rtpos rtpos rntogo m_block rntogo m_block m_inuse m_block private void sendmtf values throws io exception char len new char n groups max alpha size int v int t int i int j int gs int ge int bt int bc int iter int n selectors 0 int alpha size int min len int max len int sel ctr int n groups alpha size m ninuse 2 for t 0 t n groups t for v 0 v alpha size v len t v char greater icost decide how many coding tables to use if m nmtf 0 panic if m nmtf 200 n groups 2 else if m nmtf 600 n groups 3 else if m nmtf 1200 n groups 4 else if m nmtf 2400 n groups 5 else n groups 6 generate an initial set of coding tables int n part int remf int t freq int a freq n part n groups remf m nmtf gs 0 while n part 0 t freq remf n part ge gs 1 a freq 0 while a freq t freq ge alpha size 1 ge a freq m mtffreq ge if ge gs n part n groups n part 1 n groups n part 2 1 a freq m mtffreq ge ge for v 0 v alpha size v if v gs v ge len n part 1 v char lesser icost else len n part 1 v char greater icost n part gs ge 1 remf a freq int rfreq new int n groups max alpha size int fave new int n groups short cost new short n groups iterate up to n iters times to improve the tables for iter 0 iter n iters iter for t 0 t n groups t fave t 0 for t 0 t n groups t for v 0 v alpha size v rfreq t v 0 n selectors 0 gs 0 while true set group start end marks if gs m nmtf break ge gs g size 1 if ge m nmtf ge m nmtf 1 calculate the cost of this group as coded by each of the coding tables for t 0 t n groups t cost t 0 if n groups 6 short cost0 0 short cost1 0 short cost2 0 short cost3 0 short cost4 0 short cost5 0 for i gs i ge i short icv m szptr i cost0 len 0 icv cost1 len 1 icv cost2 len 2 icv cost3 len 3 icv cost4 len 4 icv cost5 len 5 icv cost 0 cost0 cost 1 cost1 cost 2 cost2 cost 3 cost3 cost 4 cost4 cost 5 cost5 else for i gs i ge i short icv m szptr i for t 0 t n groups t cost t len t icv find the coding table which is best for this group and record its identity in the selector table bc 999999999 bt 1 for t 0 t n groups t if cost t bc bc cost t bt t fave bt m selector n selectors char bt n selectors increment the symbol frequencies for the selected table for i gs i ge i rfreq bt m szptr i gs ge 1 recompute the tables based on the accumulated frequencies for t 0 t n groups t hb make code lengths len t rfreq t alpha size 20 rfreq null fave null cost null if n groups 8 panic if n selectors 32768 n selectors 2 900000 g size panic compute mtf values for the selectors char pos new char n groups char ll i char tmp2 char tmp for i 0 i n groups i pos i char i for i 0 i n selectors i ll i m selector i j 0 tmp pos j while ll i tmp j tmp2 tmp tmp pos j pos j tmp2 pos 0 tmp m selectormtf i char j int code new int n groups max alpha size assign actual codes for the tables for t 0 t n groups t min len 32 max len 0 for i 0 i alpha size i if len t i max len max len len t i if len t i min len min len len t i if max len 20 panic if min len 1 panic hb assign codes code t len t min len max len alpha size transmit the mapping table boolean in use16 new boolean 16 for i 0 i 16 i in use16 i false for j 0 j 16 j if m inuse i 16 j in use16 i true for i 0 i 16 i if in use16 i bsw 1 1 else bsw 1 0 for i 0 i 16 i if in use16 i for j 0 j 16 j if m inuse i 16 j bsw 1 1 else bsw 1 0 now the selectors bsw 3 n groups bsw 15 n selectors for i 0 i n selectors i for j 0 j m selectormtf i j bsw 1 1 bsw 1 0 for t 0 t n groups t int curr len t 0 bsw 5 curr for i 0 i alpha size i while curr len t i bsw 2 2 curr 10 while cur sendmtfvalues ioexception n_groups max_alpha_size nselectors alphasize minlen maxlen selctr ngroups alphasize m_ninuse n_groups alphasize greater_icost m_nmtf m_nmtf ngroups m_nmtf ngroups m_nmtf ngroups m_nmtf ngroups ngroups npart tfreq afreq npart ngroups m_nmtf npart tfreq npart afreq afreq tfreq alphasize afreq m_mtffreq npart ngroups npart ngroups npart afreq m_mtffreq alphasize npart lesser_icost npart greater_icost npart afreq n_groups max_alpha_size n_groups n_groups n_iters n_iters ngroups ngroups alphasize nselectors m_nmtf g_size m_nmtf m_nmtf ngroups ngroups m_szptr m_szptr ngroups ngroups m_selector nselectors nselectors m_szptr ngroups hbmakecodelengths alphasize ngroups nselectors nselectors g_size n_groups ll_i ngroups nselectors ll_i m_selector ll_i m_selectormtf n_groups max_alpha_size ngroups minlen maxlen alphasize maxlen maxlen minlen minlen maxlen minlen hbassigncodes minlen maxlen alphasize inuse16 inuse16 m_inuse inuse16 inuse16 inuse16 m_inuse ngroups nselectors nselectors m_selectormtf ngroups alphasize private void simple sort int lo int hi int d int i int j int h int bign int hp int v bign hi lo 1 if bign 2 return hp 0 while m incs hp bign hp hp for hp 0 hp h m incs hp i lo h while true copy 1 if i hi break v m zptr i j i while full gtu m zptr j h d v d m zptr j m zptr j h j j h if j lo h 1 break m zptr j v i copy 2 if i hi break v m zptr i j i while full gtu m zptr j h d v d m zptr j m zptr j h j j h if j lo h 1 break m zptr j v i copy 3 if i hi break v m zptr i j i while full gtu m zptr j h d v d m zptr j m zptr j h j j h if j lo h 1 break m zptr j v i if m workdone m worklimit m firstattempt return simplesort m_incs m_incs m_zptr fullgtu m_zptr m_zptr m_zptr m_zptr m_zptr fullgtu m_zptr m_zptr m_zptr m_zptr m_zptr fullgtu m_zptr m_zptr m_zptr m_zptr m_workdone m_worklimit m_firstattempt private void vswap int p1 int p2 int n int temp 0 while n 0 temp m zptr p1 m zptr p1 m zptr p2 m zptr p2 temp p1 p2 n m_zptr m_zptr m_zptr m_zptr private void write run throws io exception if m last m allowableblocksize m inuse m currentchar true for int i 0 i m runlength i m crc updatecrc char m currentchar switch m runlength case 1 m last m block m last 1 char m currentchar break case 2 m last m block m last 1 char m currentchar m last m block m last 1 char m currentchar break case 3 m last m block m last 1 char m currentchar m last m block m last 1 char m currentchar m last m block m last 1 char m currentchar break default m inuse m runlength 4 true m last m block m last 1 char m currentchar m last m block m last 1 char m currentchar m last m block m last 1 char m currentchar m last m block m last 1 char m currentchar m last m block m last 1 char m runlength 4 break else end block init block write run writerun ioexception m_last m_allowableblocksize m_inuse m_currentchar m_runlength m_crc m_currentchar m_runlength m_last m_block m_last m_currentchar m_last m_block m_last m_currentchar m_last m_block m_last m_currentchar m_last m_block m_last m_currentchar m_last m_block m_last m_currentchar m_last m_block m_last m_currentchar m_inuse m_runlength m_last m_block m_last m_currentchar m_last m_block m_last m_currentchar m_last m_block m_last m_currentchar m_last m_block m_last m_currentchar m_last m_block m_last m_runlength endblock initblock writerun get first file method public string get first file view view return view get buffer get path getfirstfile getfirstfile getbuffer getpath get next file method public string get next file view view string file if file null return view get buffer get path else return null getnextfile getnextfile getbuffer getpath get files method public string get files view view return new string view get buffer get path getfiles getfiles getbuffer getpath get file count method public int get file count view view return 1 getfilecount getfilecount get code method public string get code return new current buffer set getcode getcode currentbufferset add extension method void add extension int layer text area extension ext entry entry new entry layer ext int i 0 iterator iter extensions iterator while iter has next int layer entry iter next layer if layer layer extensions add i entry return i extensions add entry addextension addextension textareaextension hasnext _layer _layer remove extension method void remove extension text area extension ext iterator iter extensions iterator while iter has next if entry iter next ext ext iter remove return removeextension removeextension textareaextension hasnext get extensions method text area extension get extensions text area extension ret val new text area extension extensions size iterator iter extensions iterator int i 0 while iter has next ret val i entry iter next ext return ret val getextensions textareaextension getextensions textareaextension retval textareaextension hasnext retval retval paint screen line range method void paint screen line range j edit text area text area graphics2d gfx int first line int last line int y int line height try int physical lines new int last line first line 1 int start new int physical lines length int end new int physical lines length for int i 0 i physical lines length i int screen line i first line chunk cache line info line info text area chunk cache get line info screen line if line info physical line 1 physical lines i 1 else physical lines i line info physical line start i text area get screen line start offset screen line end i text area get screen line end offset screen line paint screen line range gfx first line last line physical lines start end y line height catch exception e log log log error this error repainting line range first line last line log log log error this e paintscreenlinerange paintscreenlinerange jedittextarea textarea firstline lastline lineheight physicallines lastline firstline physicallines physicallines physicallines screenline firstline chunkcache lineinfo lineinfo textarea chunkcache getlineinfo screenline lineinfo physicalline physicallines physicallines lineinfo physicalline textarea getscreenlinestartoffset screenline textarea getscreenlineendoffset screenline paintscreenlinerange firstline lastline physicallines lineheight firstline lastline get tool tip text method string get tool tip text int x int y for int i 0 i extensions size i text area extension ext entry extensions get i ext string tool tip ext get tool tip text x y if tool tip null return tool tip return null gettooltiptext gettooltiptext textareaextension tooltip gettooltiptext tooltip tooltip paint screen line range method private void paint screen line range graphics2d gfx int first line int last line int physical lines int start int end int y int line height iterator iter extensions iterator while iter has next text area extension ext entry iter next ext try ext paint screen line range gfx first line last line physical lines start end y line height catch throwable t log log log error this t remove it so editor can continue functioning iter remove paintscreenlinerange paintscreenlinerange firstline lastline physicallines lineheight hasnext textareaextension paintscreenlinerange firstline lastline physicallines lineheight entry int layer text area extension ext this layer layer this ext ext textareaextension public throwable t public util target error string message throwable t super message this t t utiltargeterror public util target error throwable t this null t utiltargeterror override to eval error to throw target error type public eval error to eval error string msg simple node node call stack callstack if msg null msg get message else msg msg get message return new target error msg t node callstack false toevalerror targeterror evalerror toevalerror simplenode callstack getmessage getmessage targeterror vfs constructor deprecated use the form where the constructor takes a capability list public vfs string name this name 0 vfs constructor creates a new virtual filesystem param name the name param caps the capabilities public vfs string name int caps this name name this caps caps reasonable defaults this ext attrs new string ea size ea type extattrs ea_size ea_type vfs constructor creates a new virtual filesystem param name the name param caps the capabilities param ext attrs the extended attributes since j edit 4 2pre1 public vfs string name int caps string ext attrs this name name this caps caps this ext attrs ext attrs extattrs jedit extattrs extattrs extattrs get name method returns this vfs s name the name is used to obtain the label stored in the code vfs i name i label code property public string get name return name getname getname get capabilities method returns the capabilities of this vfs since j edit 2 6pre2 public int get capabilities return caps getcapabilities jedit getcapabilities get extended attributes method returns the extended attributes supported by this vfs since j edit 4 2pre1 public string get extended attributes return ext attrs getextendedattributes jedit getextendedattributes extattrs show browse dialog method displays a dialog box that should set up a session and return the initial url to browse param session where the vfs session will be stored param comp the component that will parent error dialog boxes return the url since j edit 2 7pre1 public string show browse dialog object session component comp return null showbrowsedialog jedit showbrowsedialog get file name method returns the file name component of the specified path param path the path since j edit 3 1pre4 public string get file name string path if path equals return path if path ends with path ends with file separator path path substring 0 path length 1 int index math max path last index of path last index of file separator char if index 1 index path index of don t want get file name roots to return if index 1 index path length 1 return path return path substring index 1 getfilename jedit getfilename endswith endswith lastindexof lastindexof separatorchar indexof getfilename get parent of path method returns the parent of the specified path this must be overridden to return a non null value for browsing of this filesystem to work param path the path since j edit 2 6pre5 public string get parent of path string path ignore last character of path to properly handle paths like foo bar int count math max 0 path length 2 int index path last index of file separator char count if index 1 index path last index of count if index 1 this ensures that get file parent protocol for example is protocol and not index path last index of return path substring 0 index 1 getparentofpath jedit getparentofpath lastindexof separatorchar lastindexof getfileparent lastindexof construct path method constructs a path from the specified directory and file name component this must be overridden to return a non null value otherwise browsing this filesystem will not work p unless you are writing a vfs this method should not be called directly to ensure correct behavior you b must b call link org gjt sp jedit misc utilities construct path string string instead param parent the parent directory param path the path since j edit 2 6pre2 public string construct path string parent string path return parent path constructpath miscutilities constructpath jedit constructpath get file separator method returns the file separator used by this vfs since j edit 2 6pre9 public char get file separator return getfileseparator jedit getfileseparator get two stage save name method returns a temporary file name based on the given path by default j edit first saves a file to code i name i save code and then renames it to the original file however some virtual file systems might not support the code code character in filenames so this method permits the vfs to override this behavior param path the path name since j edit 4 1pre7 public string get two stage save name string path return misc utilities construct path get parent of path path get file name path save gettwostagesavename jedit jedit gettwostagesavename miscutilities constructpath getparentofpath getfilename reload directory method called before a directory is reloaded by the file system browser can be used to flush a cache etc since j edit 4 0pre3 reloaddirectory jedit createvfs session method creates a vfs session this method is called from the awt thread so it should not do any i o it could however prompt for a login name and password for example param path the path in question param comp the component that will parent any dialog boxes shown return the session since j edit 2 6pre3 public object createvfs session string path component comp return new object createvfssession jedit createvfssession load method loads the specified buffer the default implementation posts an i o request to the i o thread param view the view param buffer the buffer param path the path public boolean load view view buffer buffer string path if get capabilities read cap 0 vfs manager error view path vfs not supported load new string name return false object session createvfs session path view if session null return false if get capabilities write cap 0 buffer set read only true bufferio request request new bufferio request bufferio request load view buffer session this path if buffer is temporary this makes hyper search much faster request run else vfs manager run in work thread request return true getcapabilities read_cap vfsmanager createvfssession getcapabilities write_cap setreadonly bufferiorequest bufferiorequest bufferiorequest istemporary hypersearch vfsmanager runinworkthread save method saves the specifies buffer the default implementation posts an i o request to the i o thread param view the view param buffer the buffer param path the path public boolean save view view buffer buffer string path if get capabilities write cap 0 vfs manager error view path vfs not supported save new string name return false object session createvfs session path view if session null return false when doing a save as the path to save to path will not be the same as the buffer s previous path buffer get path in that case we want to create a backup of the new path even if the old path was backed up as well backed up property set if path equals buffer get path buffer unset property buffer backed up vfs manager run in work thread new bufferio request bufferio request save view buffer session this path return true getcapabilities write_cap vfsmanager createvfssession getpath backed_up getpath unsetproperty backed_up vfsmanager runinworkthread bufferiorequest bufferiorequest insert method inserts a file into the specified buffer the default implementation posts an i o request to the i o thread param view the view param buffer the buffer param path the path public boolean insert view view buffer buffer string path if get capabilities read cap 0 vfs manager error view path vfs not supported load new string name return false object session createvfs session path view if session null return false vfs manager run in work thread new bufferio request bufferio request insert view buffer session this path return true getcapabilities read_cap vfsmanager createvfssession vfsmanager runinworkthread bufferiorequest bufferiorequest canonpath method returns the canonical form of the specified path name for example code code might be expanded to the user s home directory param session the session param path the path param comp the component that will parent error dialog boxes exception io exception if an i o error occurred since j edit 4 0pre2 public string canonpath object session string path component comp throws io exception return path _canonpath ioexception jedit _canonpath ioexception listdirectory method a convinience method that matches file names against globs and can optionally list the directory recursively param session the session param directory the directory note that this must be a full url including the host name path name and so on the username and password if needed by the vfs is obtained from the session instance param glob only file names matching this glob will be returned param recursive if true subdirectories will also be listed param comp the component that will parent error dialog boxes exception io exception if an i o error occurred since j edit 4 1pre1 public string listdirectory object session string directory string glob boolean recursive component comp throws io exception log log log debug this listing directory array list files new array list 100 re filter try filter new re misc utilities glob tore glob re reg icase catch re exception e log log log error this e return null listdirectory session new array list files directory filter recursive comp string ret val string files to array new string files size arrays sort ret val new misc utilities stringi case compare return ret val _listdirectory ioexception jedit _listdirectory ioexception arraylist arraylist miscutilities globtore reg_icase reexception _listdirectory arraylist retval toarray retval miscutilities stringicasecompare retval listdirectory method lists the specified directory param session the session param directory the directory note that this must be a full url including the host name path name and so on the username and password if needed by the vfs is obtained from the session instance param comp the component that will parent error dialog boxes exception io exception if an i o error occurred since j edit 2 7pre1 public directory entry listdirectory object session string directory component comp throws io exception vfs manager error comp directory vfs not supported list new string name return null _listdirectory ioexception jedit directoryentry _listdirectory ioexception vfsmanager getdirectoryentry method returns the specified directory entry param session the session param path the path param comp the component that will parent error dialog boxes exception io exception if an i o error occurred return the specified directory entry or null if it doesn t exist since j edit 2 7pre1 public directory entry getdirectoryentry object session string path component comp throws io exception return null _getdirectoryentry ioexception jedit directoryentry _getdirectoryentry ioexception directory entry constructor since j edit 4 2pre2 public directory entry directoryentry jedit directoryentry directory entry constructor public directory entry string name string path string delete path int type long length boolean hidden this name name this path path this delete path delete path this symlink path path this type type this length length this hidden hidden if path null maintain backwards compatibility vfs vfs vfs manager getvfs for path path can read vfs get capabilities read cap 0 can write vfs get capabilities write cap 0 directoryentry directoryentry deletepath deletepath deletepath symlinkpath vfsmanager getvfsforpath canread getcapabilities read_cap canwrite getcapabilities write_cap get extended attribute method returns the value of an extended attribute note that this returns formatted strings eg 10 mb for a file size of 1048576 bytes if you need access to the raw data access fields and methods of this class param name the extended attribute name since j edit 4 2pre1 public string get extended attribute string name if name equals ea type switch type case file return j edit get property vfs browser type file case directory return j edit get property vfs browser type directory case filesystem return j edit get property vfs browser type filesystem default throw new illegal argument exception else if name equals ea status if can read if can write return j edit get property vfs browser status rw else return j edit get property vfs browser status ro else if can write return j edit get property vfs browser status append else return j edit get property vfs browser status no else if name equals ea size if type file return null else return misc utilities format file size length else return null getextendedattribute jedit getextendedattribute ea_type jedit getproperty jedit getproperty jedit getproperty illegalargumentexception ea_status canread canwrite jedit getproperty jedit getproperty canwrite jedit getproperty jedit getproperty ea_size miscutilities formatfilesize get color method public color get color if color calculated color calculated true color get default color for name return color getcolor getcolor colorcalculated colorcalculated getdefaultcolorfor to string method public string to string return name tostring tostring delete method deletes the specified url param session the vfs session param path the path param comp the component that will parent error dialog boxes exception io exception if an i o error occurs since j edit 2 7pre1 public boolean delete object session string path component comp throws io exception return false _delete ioexception jedit _delete ioexception rename method renames the specified url some filesystems might support moving ur ls between directories however others may not do not rely on this behavior param session the vfs session param from the old path param to the new path param comp the component that will parent error dialog boxes exception io exception if an i o error occurs since j edit 2 7pre1 public boolean rename object session string from string to component comp throws io exception return false _rename urls ioexception jedit _rename ioexception mkdir method creates a new directory with the specified url param session the vfs session param directory the directory param comp the component that will parent error dialog boxes exception io exception if an i o error occurs since j edit 2 7pre1 public boolean mkdir object session string directory component comp throws io exception return false _mkdir ioexception jedit _mkdir ioexception backup method backs up the specified file this should only be overriden by the local filesystem vfs param session the vfs session param path the path param comp the component that will parent error dialog boxes exception io exception if an i o error occurs since j edit 3 2pre2 public void backup object session string path component comp throws io exception _backup ioexception jedit _backup ioexception createinputstream method creates an input stream this method is called from the i o thread param session the vfs session param path the path param ignore errors if true file not found errors should be ignored param comp the component that will parent error dialog boxes exception io exception if an i o error occurs since j edit 2 7pre1 public input stream createinputstream object session string path boolean ignore errors component comp throws io exception vfs manager error comp path vfs not supported load new string name return null _createinputstream ignoreerrors ioexception jedit inputstream _createinputstream ignoreerrors ioexception vfsmanager createoutputstream method creates an output stream this method is called from the i o thread param session the vfs session param path the path param comp the component that will parent error dialog boxes exception io exception if an i o error occurs since j edit 2 7pre1 public output stream createoutputstream object session string path component comp throws io exception vfs manager error comp path vfs not supported save new string name return null _createoutputstream ioexception jedit outputstream _createoutputstream ioexception vfsmanager savecomplete method called after a file has been saved param session the vfs session param buffer the buffer param path the path the buffer was saved to can be different from link org gjt sp jedit buffer get path if the user invoked the b save a copy as b command for example param comp the component that will parent error dialog boxes exception io exception if an i o error occurs since j edit 4 1pre9 public void savecomplete object session buffer buffer string path _savecomplete getpath ioexception jedit _savecomplete endvfssession method finishes the specified vfs session this must be called after all i o with this vfs is complete to avoid leaving stale network connections and such param session the vfs session param comp the component that will parent error dialog boxes exception io exception if an i o error occurred since j edit 2 7pre1 public void endvfssession object session component comp throws io exception _endvfssession ioexception jedit _endvfssession ioexception get default color for method returns color of the specified file name by matching it against user specified regular expressions since j edit 4 0pre1 public static color get default color for string name synchronized lock if colors null load colors for int i 0 i colors size i color entry entry color entry colors element at i if entry re is match name return entry color return null getdefaultcolorfor jedit getdefaultcolorfor loadcolors colorentry colorentry elementat ismatch creates a new code directory entry compare code param sort mix files and dirs if false directories are put at the top of the listing param sort ignore case if false upper case comes before lower case public directory entry compare boolean sort mix files and dirs boolean sort ignore case this sort mix files and dirs sort mix files and dirs this sort ignore case sort ignore case directoryentrycompare sortmixfilesanddirs sortignorecase directoryentrycompare sortmixfilesanddirs sortignorecase sortmixfilesanddirs sortmixfilesanddirs sortignorecase sortignorecase public int compare object obj1 object obj2 vfs directory entry file1 vfs directory entry obj1 vfs directory entry file2 vfs directory entry obj2 if sort mix files and dirs if file1 type file2 type return file2 type file1 type return misc utilities compare strings file1 name file2 name sort ignore case directoryentry directoryentry directoryentry directoryentry sortmixfilesanddirs miscutilities comparestrings sortignorecase public void handle message eb message msg if msg instanceof properties changed synchronized lock colors null handlemessage ebmessage propertieschanged listdirectory method private void listdirectory object session array list stack array list files string directory re glob boolean recursive component comp throws io exception if stack contains directory log log log error this recursion in listdirectory directory return else stack add directory vfs directory entry files listdirectory session directory comp if files null files length 0 return for int i 0 i files length i vfs directory entry file files i if file type vfs directory entry directory file type vfs directory entry filesystem if recursive resolve symlinks to avoid loops string canon path canonpath session file path comp if misc utilities isurl canon path canon path misc utilities resolve symlinks canon path listdirectory session stack files canon path glob recursive comp else if glob is match file name continue log log log debug this file path files add file path _listdirectory _listdirectory arraylist arraylist ioexception _listdirectory directoryentry _files _listdirectory _files _files _files directoryentry _files directoryentry directoryentry canonpath _canonpath miscutilities canonpath canonpath miscutilities resolvesymlinks canonpath _listdirectory canonpath ismatch load colors method private static void load colors synchronized lock colors new vector if j edit get boolean property vfs browser colorize return string glob int i 0 while glob j edit get property vfs browser colors i glob null try colors add element new color entry new re misc utilities glob tore glob j edit get color property vfs browser colors i color color black catch re exception e log log log error vfs class invalid regular expression glob log log log error vfs class e i loadcolors loadcolors jedit getbooleanproperty jedit getproperty addelement colorentry miscutilities globtore jedit getcolorproperty reexception color entry re re color color this re re this color color colorentry j this name space namespace interpreter declaring interp super namespace declaring interp jthis namespace declaringinterp declaringinterp public string to string return this reference j this to bsh object namespace get name tostring jthis getname void event string name object event call stack callstack new call stack namespace bsh method method null handle event gets all events try method namespace get method handle event new class null catch util eval error e squeltch if method null try method invoke new object event declaring interpreter callstack null catch eval error e declaring interpreter error local event hander method invocation error e send to specific event handler try method namespace get method name new class null catch util eval error e squeltch if method null try method invoke new object event declaring interpreter callstack null catch eval error e declaring interpreter error local event hander method invocation error e callstack callstack bshmethod handleevent getmethod handleevent utilevalerror declaringinterpreter evalerror declaringinterpreter getmethod utilevalerror declaringinterpreter evalerror declaringinterpreter listener interfaces public void ancestor added ancestor event e event ancestor added e ancestoradded ancestorevent ancestoradded public void ancestor added ancestor event e event ancestor added e public void ancestor removed ancestor event e event ancestor removed e ancestoradded ancestorevent ancestoradded ancestorremoved ancestorevent ancestorremoved public void ancestor added ancestor event e event ancestor added e public void ancestor removed ancestor event e event ancestor removed e public void ancestor moved ancestor event e event ancestor moved e ancestoradded ancestorevent ancestoradded ancestorremoved ancestorevent ancestorremoved ancestormoved ancestorevent ancestormoved public void ancestor removed ancestor event e event ancestor removed e public void ancestor moved ancestor event e event ancestor moved e public void caret update caret event e event caret update e ancestorremoved ancestorevent ancestorremoved ancestormoved ancestorevent ancestormoved caretupdate caretevent caretupdate public void ancestor moved ancestor event e event ancestor moved e public void caret update caret event e event caret update e public void editing stopped change event e event editing stopped e ancestormoved ancestorevent ancestormoved caretupdate caretevent caretupdate editingstopped changeevent editingstopped public void caret update caret event e event caret update e public void editing stopped change event e event editing stopped e public void editing canceled change event e event editing canceled e caretupdate caretevent caretupdate editingstopped changeevent editingstopped editingcanceled changeevent editingcanceled public void editing stopped change event e event editing stopped e public void editing canceled change event e event editing canceled e public void state changed change event e event state changed e editingstopped changeevent editingstopped editingcanceled changeevent editingcanceled statechanged changeevent statechanged public void editing canceled change event e event editing canceled e public void state changed change event e event state changed e public void insert update document event e event insert update e editingcanceled changeevent editingcanceled statechanged changeevent statechanged insertupdate documentevent insertupdate public void state changed change event e event state changed e public void insert update document event e event insert update e public void remove update document event e event remove update e statechanged changeevent statechanged insertupdate documentevent insertupdate removeupdate documentevent removeupdate public void insert update document event e event insert update e public void remove update document event e event remove update e public void changed update document event e event changed update e insertupdate documentevent insertupdate removeupdate documentevent removeupdate changedupdate documentevent changedupdate public void remove update document event e event remove update e public void changed update document event e event changed update e public void hyperlink update hyperlink event e event internal frame opened e removeupdate documentevent removeupdate changedupdate documentevent changedupdate hyperlinkupdate hyperlinkevent internalframeopened public void changed update document event e event changed update e public void hyperlink update hyperlink event e event internal frame opened e public void internal frame opened internal frame event e event internal frame opened e changedupdate documentevent changedupdate hyperlinkupdate hyperlinkevent internalframeopened internalframeopened internalframeevent internalframeopened public void hyperlink update hyperlink event e event internal frame opened e public void internal frame opened internal frame event e event internal frame opened e public void internal frame closing internal frame event e event internal frame closing e hyperlinkupdate hyperlinkevent internalframeopened internalframeopened internalframeevent internalframeopened internalframeclosing internalframeevent internalframeclosing public void internal frame opened internal frame event e event internal frame opened e public void internal frame closing internal frame event e event internal frame closing e public void internal frame closed internal frame event e event internal frame closed e internalframeopened internalframeevent internalframeopened internalframeclosing internalframeevent internalframeclosing internalframeclosed internalframeevent internalframeclosed public void internal frame closing internal frame event e event internal frame closing e public void internal frame closed internal frame event e event internal frame closed e public void internal frame iconified internal frame event e event internal frame iconified e internalframeclosing internalframeevent internalframeclosing internalframeclosed internalframeevent internalframeclosed internalframeiconified internalframeevent internalframeiconified public void internal frame closed internal frame event e event internal frame closed e public void internal frame iconified internal frame event e event internal frame iconified e public void internal frame deiconified internal frame event e event internal frame deiconified e internalframeclosed internalframeevent internalframeclosed internalframeiconified internalframeevent internalframeiconified internalframedeiconified internalframeevent internalframedeiconified public void internal frame iconified internal frame event e event internal frame iconified e public void internal frame deiconified internal frame event e event internal frame deiconified e public void internal frame activated internal frame event e event internal frame activated e internalframeiconified internalframeevent internalframeiconified internalframedeiconified internalframeevent internalframedeiconified internalframeactivated internalframeevent internalframeactivated public void internal frame deiconified internal frame event e event internal frame deiconified e public void internal frame activated internal frame event e event internal frame activated e public void internal frame deactivated internal frame event e event internal frame deactivated e internalframedeiconified internalframeevent internalframedeiconified internalframeactivated internalframeevent internalframeactivated internalframedeactivated internalframeevent internalframedeactivated public void internal frame activated internal frame event e event internal frame activated e public void internal frame deactivated internal frame event e event internal frame deactivated e public void interval added list data event e event interval added e internalframeactivated internalframeevent internalframeactivated internalframedeactivated internalframeevent internalframedeactivated intervaladded listdataevent intervaladded public void internal frame deactivated internal frame event e event internal frame deactivated e public void interval added list data event e event interval added e public void interval removed list data event e event interval removed e internalframedeactivated internalframeevent internalframedeactivated intervaladded listdataevent intervaladded intervalremoved listdataevent intervalremoved public void interval added list data event e event interval added e public void interval removed list data event e event interval removed e public void contents changed list data event e event contents changed e intervaladded listdataevent intervaladded intervalremoved listdataevent intervalremoved contentschanged listdataevent contentschanged public void interval removed list data event e event interval removed e public void contents changed list data event e event contents changed e public void value changed list selection event e event value changed e intervalremoved listdataevent intervalremoved contentschanged listdataevent contentschanged valuechanged listselectionevent valuechanged public void contents changed list data event e event contents changed e public void value changed list selection event e event value changed e public void menu drag mouse entered menu drag mouse event e event menu drag mouse entered e contentschanged listdataevent contentschanged valuechanged listselectionevent valuechanged menudragmouseentered menudragmouseevent menudragmouseentered public void value changed list selection event e event value changed e public void menu drag mouse entered menu drag mouse event e event menu drag mouse entered e public void menu drag mouse exited menu drag mouse event e event menu drag mouse exited e valuechanged listselectionevent valuechanged menudragmouseentered menudragmouseevent menudragmouseentered menudragmouseexited menudragmouseevent menudragmouseexited public void menu drag mouse entered menu drag mouse event e event menu drag mouse entered e public void menu drag mouse exited menu drag mouse event e event menu drag mouse exited e public void menu drag mouse dragged menu drag mouse event e event menu drag mouse dragged e menudragmouseentered menudragmouseevent menudragmouseentered menudragmouseexited menudragmouseevent menudragmouseexited menudragmousedragged menudragmouseevent menudragmousedragged public void menu drag mouse exited menu drag mouse event e event menu drag mouse exited e public void menu drag mouse dragged menu drag mouse event e event menu drag mouse dragged e public void menu drag mouse released menu drag mouse event e event menu drag mouse released e menudragmouseexited menudragmouseevent menudragmouseexited menudragmousedragged menudragmouseevent menudragmousedragged menudragmousereleased menudragmouseevent menudragmousereleased public void menu drag mouse dragged menu drag mouse event e event menu drag mouse dragged e public void menu drag mouse released menu drag mouse event e event menu drag mouse released e public void menu key typed menu key event e event menu key typed e menudragmousedragged menudragmouseevent menudragmousedragged menudragmousereleased menudragmouseevent menudragmousereleased menukeytyped menukeyevent menukeytyped public void menu drag mouse released menu drag mouse event e event menu drag mouse released e public void menu key typed menu key event e event menu key typed e public void menu key pressed menu key event e event menu key pressed e menudragmousereleased menudragmouseevent menudragmousereleased menukeytyped menukeyevent menukeytyped menukeypressed menukeyevent menukeypressed public void menu key typed menu key event e event menu key typed e public void menu key pressed menu key event e event menu key pressed e public void menu key released menu key event e event menu key released e menukeytyped menukeyevent menukeytyped menukeypressed menukeyevent menukeypressed menukeyreleased menukeyevent menukeyreleased public void menu key pressed menu key event e event menu key pressed e public void menu key released menu key event e event menu key released e public void menu selected menu event e event menu selected e menukeypressed menukeyevent menukeypressed menukeyreleased menukeyevent menukeyreleased menuselected menuevent menuselected public void menu key released menu key event e event menu key released e public void menu selected menu event e event menu selected e public void menu deselected menu event e event menu deselected e menukeyreleased menukeyevent menukeyreleased menuselected menuevent menuselected menudeselected menuevent menudeselected public void menu selected menu event e event menu selected e public void menu deselected menu event e event menu deselected e public void menu canceled menu event e event menu canceled e menuselected menuevent menuselected menudeselected menuevent menudeselected menucanceled menuevent menucanceled public void menu deselected menu event e event menu deselected e public void menu canceled menu event e event menu canceled e public void popup menu will become visible popup menu event e event popup menu will become visible e menudeselected menuevent menudeselected menucanceled menuevent menucanceled popupmenuwillbecomevisible popupmenuevent popupmenuwillbecomevisible public void menu canceled menu event e event menu canceled e public void popup menu will become visible popup menu event e event popup menu will become visible e public void popup menu will become invisible popup menu event e event popup menu will become invisible e menucanceled menuevent menucanceled popupmenuwillbecomevisible popupmenuevent popupmenuwillbecomevisible popupmenuwillbecomeinvisible popupmenuevent popupmenuwillbecomeinvisible public void popup menu will become visible popup menu event e event popup menu will become visible e public void popup menu will become invisible popup menu event e event popup menu will become invisible e public void popup menu canceled popup menu event e event popup menu canceled e popupmenuwillbecomevisible popupmenuevent popupmenuwillbecomevisible popupmenuwillbecomeinvisible popupmenuevent popupmenuwillbecomeinvisible popupmenucanceled popupmenuevent popupmenucanceled public void popup menu will become invisible popup menu event e event popup menu will become invisible e public void popup menu canceled popup menu event e event popup menu canceled e public void column added table column model event e event column added e popupmenuwillbecomeinvisible popupmenuevent popupmenuwillbecomeinvisible popupmenucanceled popupmenuevent popupmenucanceled columnadded tablecolumnmodelevent columnadded public void popup menu canceled popup menu event e event popup menu canceled e public void column added table column model event e event column added e public void column removed table column model event e event column removed e popupmenucanceled popupmenuevent popupmenucanceled columnadded tablecolumnmodelevent columnadded columnremoved tablecolumnmodelevent columnremoved public void column added table column model event e event column added e public void column removed table column model event e event column removed e public void column moved table column model event e event column moved e columnadded tablecolumnmodelevent columnadded columnremoved tablecolumnmodelevent columnremoved columnmoved tablecolumnmodelevent columnmoved public void column removed table column model event e event column removed e public void column moved table column model event e event column moved e public void column margin changed change event e event column margin changed e columnremoved tablecolumnmodelevent columnremoved columnmoved tablecolumnmodelevent columnmoved columnmarginchanged changeevent columnmarginchanged public void column moved table column model event e event column moved e public void column margin changed change event e event column margin changed e public void column selection changed list selection event e event column selection changed e columnmoved tablecolumnmodelevent columnmoved columnmarginchanged changeevent columnmarginchanged columnselectionchanged listselectionevent columnselectionchanged public void column margin changed change event e event column margin changed e public void column selection changed list selection event e event column selection changed e public void table changed table model event e event table changed e columnmarginchanged changeevent columnmarginchanged columnselectionchanged listselectionevent columnselectionchanged tablechanged tablemodelevent tablechanged public void column selection changed list selection event e event column selection changed e public void table changed table model event e event table changed e public void tree expanded tree expansion event e event tree expanded e columnselectionchanged listselectionevent columnselectionchanged tablechanged tablemodelevent tablechanged treeexpanded treeexpansionevent treeexpanded public void table changed table model event e event table changed e public void tree expanded tree expansion event e event tree expanded e public void tree collapsed tree expansion event e event tree collapsed e tablechanged tablemodelevent tablechanged treeexpanded treeexpansionevent treeexpanded treecollapsed treeexpansionevent treecollapsed public void tree expanded tree expansion event e event tree expanded e public void tree collapsed tree expansion event e event tree collapsed e public void tree nodes changed tree model event e event tree nodes changed e treeexpanded treeexpansionevent treeexpanded treecollapsed treeexpansionevent treecollapsed treenodeschanged treemodelevent treenodeschanged public void tree collapsed tree expansion event e event tree collapsed e public void tree nodes changed tree model event e event tree nodes changed e public void tree nodes inserted tree model event e event tree nodes inserted e treecollapsed treeexpansionevent treecollapsed treenodeschanged treemodelevent treenodeschanged treenodesinserted treemodelevent treenodesinserted public void tree nodes changed tree model event e event tree nodes changed e public void tree nodes inserted tree model event e event tree nodes inserted e public void tree nodes removed tree model event e event tree nodes removed e treenodeschanged treemodelevent treenodeschanged treenodesinserted treemodelevent treenodesinserted treenodesremoved treemodelevent treenodesremoved public void tree nodes inserted tree model event e event tree nodes inserted e public void tree nodes removed tree model event e event tree nodes removed e public void tree structure changed tree model event e event tree structure changed e treenodesinserted treemodelevent treenodesinserted treenodesremoved treemodelevent treenodesremoved treestructurechanged treemodelevent treestructurechanged public void tree nodes removed tree model event e event tree nodes removed e public void tree structure changed tree model event e event tree structure changed e public void value changed tree selection event e event value changed e treenodesremoved treemodelevent treenodesremoved treestructurechanged treemodelevent treestructurechanged valuechanged treeselectionevent valuechanged public void tree structure changed tree model event e event tree structure changed e public void value changed tree selection event e event value changed e public void tree will expand tree expansion event e event tree will expand e treestructurechanged treemodelevent treestructurechanged valuechanged treeselectionevent valuechanged treewillexpand treeexpansionevent treewillexpand public void value changed tree selection event e event value changed e public void tree will expand tree expansion event e event tree will expand e public void tree will collapse tree expansion event e event tree will collapse e valuechanged treeselectionevent valuechanged treewillexpand treeexpansionevent treewillexpand treewillcollapse treeexpansionevent treewillcollapse public void tree will expand tree expansion event e event tree will expand e public void tree will collapse tree expansion event e event tree will collapse e public void undoable edit happened undoable edit event e event undoable edit happened e treewillexpand treeexpansionevent treewillexpand treewillcollapse treeexpansionevent treewillcollapse undoableedithappened undoableeditevent undoableedithappened listener interfaces public void action performed action event e event action performed e actionperformed actionevent actionperformed listener interfaces public void action performed action event e event action performed e public void adjustment value changed adjustment event e event adjustment value changed e actionperformed actionevent actionperformed adjustmentvaluechanged adjustmentevent adjustmentvaluechanged public void action performed action event e event action performed e public void adjustment value changed adjustment event e event adjustment value changed e public void component resized component event e event component resized e actionperformed actionevent actionperformed adjustmentvaluechanged adjustmentevent adjustmentvaluechanged componentresized componentevent componentresized public void adjustment value changed adjustment event e event adjustment value changed e public void component resized component event e event component resized e public void component moved component event e event component moved e adjustmentvaluechanged adjustmentevent adjustmentvaluechanged componentresized componentevent componentresized componentmoved componentevent componentmoved public void component resized component event e event component resized e public void component moved component event e event component moved e public void component shown component event e event component shown e componentresized componentevent componentresized componentmoved componentevent componentmoved componentshown componentevent componentshown public void component moved component event e event component moved e public void component shown component event e event component shown e public void component hidden component event e event component hidden e componentmoved componentevent componentmoved componentshown componentevent componentshown componenthidden componentevent componenthidden public void component shown component event e event component shown e public void component hidden component event e event component hidden e public void component added container event e event component added e componentshown componentevent componentshown componenthidden componentevent componenthidden componentadded containerevent componentadded public void component hidden component event e event component hidden e public void component added container event e event component added e public void component removed container event e event component removed e componenthidden componentevent componenthidden componentadded containerevent componentadded componentremoved containerevent componentremoved public void component added container event e event component added e public void component removed container event e event component removed e public void focus gained focus event e event focus gained e componentadded containerevent componentadded componentremoved containerevent componentremoved focusgained focusevent focusgained public void component removed container event e event component removed e public void focus gained focus event e event focus gained e public void focus lost focus event e event focus lost e componentremoved containerevent componentremoved focusgained focusevent focusgained focuslost focusevent focuslost public void focus gained focus event e event focus gained e public void focus lost focus event e event focus lost e public void item state changed item event e event item state changed e focusgained focusevent focusgained focuslost focusevent focuslost itemstatechanged itemevent itemstatechanged public void focus lost focus event e event focus lost e public void item state changed item event e event item state changed e public void key typed key event e event key typed e focuslost focusevent focuslost itemstatechanged itemevent itemstatechanged keytyped keyevent keytyped public void item state changed item event e event item state changed e public void key typed key event e event key typed e public void key pressed key event e event key pressed e itemstatechanged itemevent itemstatechanged keytyped keyevent keytyped keypressed keyevent keypressed public void key typed key event e event key typed e public void key pressed key event e event key pressed e public void key released key event e event key released e keytyped keyevent keytyped keypressed keyevent keypressed keyreleased keyevent keyreleased public void key pressed key event e event key pressed e public void key released key event e event key released e public void mouse clicked mouse event e event mouse clicked e keypressed keyevent keypressed keyreleased keyevent keyreleased mouseclicked mouseevent mouseclicked public void key released key event e event key released e public void mouse clicked mouse event e event mouse clicked e public void mouse pressed mouse event e event mouse pressed e keyreleased keyevent keyreleased mouseclicked mouseevent mouseclicked mousepressed mouseevent mousepressed public void mouse clicked mouse event e event mouse clicked e public void mouse pressed mouse event e event mouse pressed e public void mouse released mouse event e event mouse released e mouseclicked mouseevent mouseclicked mousepressed mouseevent mousepressed mousereleased mouseevent mousereleased public void mouse pressed mouse event e event mouse pressed e public void mouse released mouse event e event mouse released e public void mouse entered mouse event e event mouse entered e mousepressed mouseevent mousepressed mousereleased mouseevent mousereleased mouseentered mouseevent mouseentered public void mouse released mouse event e event mouse released e public void mouse entered mouse event e event mouse entered e public void mouse exited mouse event e event mouse exited e mousereleased mouseevent mousereleased mouseentered mouseevent mouseentered mouseexited mouseevent mouseexited public void mouse entered mouse event e event mouse entered e public void mouse exited mouse event e event mouse exited e public void mouse dragged mouse event e event mouse dragged e mouseentered mouseevent mouseentered mouseexited mouseevent mouseexited mousedragged mouseevent mousedragged public void mouse exited mouse event e event mouse exited e public void mouse dragged mouse event e event mouse dragged e public void mouse moved mouse event e event mouse moved e mouseexited mouseevent mouseexited mousedragged mouseevent mousedragged mousemoved mouseevent mousemoved public void mouse dragged mouse event e event mouse dragged e public void mouse moved mouse event e event mouse moved e public void text value changed text event e event text value changed e mousedragged mouseevent mousedragged mousemoved mouseevent mousemoved textvaluechanged textevent textvaluechanged public void mouse moved mouse event e event mouse moved e public void text value changed text event e event text value changed e public void window opened window event e event window opened e mousemoved mouseevent mousemoved textvaluechanged textevent textvaluechanged windowopened windowevent windowopened public void text value changed text event e event text value changed e public void window opened window event e event window opened e public void window closing window event e event window closing e textvaluechanged textevent textvaluechanged windowopened windowevent windowopened windowclosing windowevent windowclosing public void window opened window event e event window opened e public void window closing window event e event window closing e public void window closed window event e event window closed e windowopened windowevent windowopened windowclosing windowevent windowclosing windowclosed windowevent windowclosed public void window closing window event e event window closing e public void window closed window event e event window closed e public void window iconified window event e event window iconified e windowclosing windowevent windowclosing windowclosed windowevent windowclosed windowiconified windowevent windowiconified public void window closed window event e event window closed e public void window iconified window event e event window iconified e public void window deiconified window event e event window deiconified e windowclosed windowevent windowclosed windowiconified windowevent windowiconified windowdeiconified windowevent windowdeiconified public void window iconified window event e event window iconified e public void window deiconified window event e event window deiconified e public void window activated window event e event window activated e windowiconified windowevent windowiconified windowdeiconified windowevent windowdeiconified windowactivated windowevent windowactivated public void window deiconified window event e event window deiconified e public void window activated window event e event window activated e public void window deactivated window event e event window deactivated e windowdeiconified windowevent windowdeiconified windowactivated windowevent windowactivated windowdeactivated windowevent windowdeactivated public void window deactivated window event e event window deactivated e public void property change property change event e event property change e windowdeactivated windowevent windowdeactivated propertychange propertychangeevent propertychange public void property change property change event e event property change e public void vetoable change property change event e event vetoable change e propertychange propertychangeevent propertychange vetoablechange propertychangeevent vetoablechange public boolean image update java awt image img int infoflags int x int y int width int height bsh method method null try method namespace get method image update new class null null null null null null catch util eval error e squeltch if method null try call stack callstack new call stack namespace method invoke new object img new primitive infoflags new primitive x new primitive y new primitive width new primitive height declaring interpreter callstack null catch eval error e declaring interpreter error local event handler image update method invocation error e return true imageupdate bshmethod getmethod imageupdate utilevalerror callstack callstack declaringinterpreter evalerror declaringinterpreter imageupdate param context is method or field public void add modifier int context string name if modifiers null modifiers new hashtable object got modifiers put name void type arbitrary flag if got null throw new illegal state exception duplicate modifier name int count 0 if has modifier private count if has modifier protected count if has modifier public count if count 1 throw new illegal state exception public private protected cannot be used in combination switch context case class validate for class break case method validate for method break case field validate for field break addmodifier illegalstateexception hasmodifier hasmodifier hasmodifier illegalstateexception validateforclass validateformethod validateforfield public boolean has modifier string name if modifiers null modifiers new hashtable return modifiers get name null hasmodifier could refactor these a bit private void validate for method insure no volatile method insure no transient method validateformethod insureno insureno private void validate for field insure no synchronized variable insure no native variable insure no abstract variable validateforfield insureno insureno insureno private void validate for class validate for method volatile transient insure no native class insure no synchronized class validateforclass validateformethod insureno insureno private void insure no string modifier string context if has modifier modifier throw new illegal state exception context cannot be declared modifier insureno hasmodifier illegalstateexception public string to string return modifiers modifiers tostring option group constructor creates an option group param name the internal name of the option group used to key a property code options i name i label code which is the label displayed in the options dialog see j edit get property string public option group string name this name name label j edit get property options name label members new vector optiongroup jedit getproperty optiongroup jedit getproperty option group constructor creates an option group param label the label param options a whitespace separated list of option pane names since j edit 4 2pre2 public option group string name string label string options this name name this label label members new vector string tokenizer st new string tokenizer options while st has more tokens string pane st next token add option pane pane optiongroup jedit optiongroup stringtokenizer stringtokenizer hasmoretokens nexttoken addoptionpane get name method public string get name return name getname getname get label method returns the option group s human readable label since j edit 4 2pre1 public string get label return label getlabel jedit getlabel add option group method public void add option group option group group insertion sort group get label group addoptiongroup addoptiongroup optiongroup insertionsort getlabel add option pane method public void add option pane option pane pane string label j edit get property options pane get name label no label property pane get name insertion sort label pane addoptionpane addoptionpane optionpane jedit getproperty getname getname insertionsort add option pane method public void add option pane string pane string label j edit get property options pane label no label property pane insertion sort label pane addoptionpane addoptionpane jedit getproperty insertionsort get members method public enumeration get members return members elements getmembers getmembers get member method public object get member int index return index 0 index members size members element at index null getmember getmember elementat get member index method public int get member index object member return members index of member getmemberindex getmemberindex indexof get member count method public int get member count return members size getmembercount getmembercount set sort method sets if the members of this group should be sorted since j edit 4 2pre3 public void set sort boolean sort this sort sort setsort jedit setsort insertion sort method private void insertion sort string new label object new obj if sort for int i 0 i members size i object obj members element at i string label if obj instanceof option pane string name option pane obj get name label j edit get property options name label no label property name else if obj instanceof string label j edit get property options obj label no label property obj else if obj instanceof option group label option group obj get label else throw new internal error if new label compare to label 0 members insert element at new obj i return members add element new obj insertionsort insertionsort newlabel newobj elementat optionpane optionpane getname jedit getproperty jedit getproperty optiongroup optiongroup getlabel internalerror newlabel compareto insertelementat newobj addelement newobj public swing install installer new install os tasks operating system get operating system getos tasks installer app name installer get property app name app version installer get property app version set title app name app version installer j panel content new j panel new wizard layout set content pane content caption new j label caption set font new font sans serif font bold 18 action handler action handler new action handler cancel button new j button cancel cancel button set request focus enabled false cancel button add action listener action handler prev button new j button previous prev button set request focus enabled false prev button add action listener action handler next button new j button next button set request focus enabled false next button add action listener action handler content add caption content add cancel button content add prev button content add next button string clazz operating system get operating system get class get name string completed info done clazz substring clazz index of 1 html pages new component new text panel installer get property app readme new text panel installer get property app license choose directory new choose directory select components new select components progress new swing progress new text panel completed info for int i 0 i pages length i content add pages i page changed set default close operation do nothing on close add window listener new window handler dimension screen get toolkit get screen size pack set location screen width get size width 2 screen height get size height 2 set visible true swinginstall ostasks operatingsystem getoperatingsystem getostasks appname getproperty appversion getproperty settitle appname appversion jpanel jpanel wizardlayout setcontentpane jlabel setfont sansserif actionhandler actionhandler actionhandler cancelbutton jbutton cancelbutton setrequestfocusenabled cancelbutton addactionlistener actionhandler prevbutton jbutton prevbutton setrequestfocusenabled prevbutton addactionlistener actionhandler nextbutton jbutton nextbutton setrequestfocusenabled nextbutton addactionlistener actionhandler cancelbutton prevbutton nextbutton operatingsystem getoperatingsystem getclass getname completedinfo indexof textpanel getproperty textpanel getproperty choosedirectory choosedirectory selectcomponents selectcomponents swingprogress textpanel completedinfo pagechanged setdefaultcloseoperation do_nothing_on_close addwindowlistener windowhandler gettoolkit getscreensize setlocation getsize getsize setvisible void install vector components new vector int size 0 j panel comp select components comp vector ids select components filesets for int i 0 i comp get component count i if j check box comp get component i get model is selected size installer get integer property comp ids element at i real size components add element installer get property comp ids element at i fileset string install dir choose directory install dir get text map os task dirs choose directory os task dirs iterator keys os task dirs key set iterator while keys has next operating system os task os task operating system os task keys next string dir j text field os task dirs get os task get text if dir null dir length 0 os task set enabled true os task set directory dir else os task set enabled false install thread thread new install thread installer progress install dir os tasks size components progress set thread thread thread start jpanel selectcomponents selectcomponents getcomponentcount jcheckbox getcomponent getmodel isselected getintegerproperty elementat addelement getproperty elementat installdir choosedirectory installdir gettext ostaskdirs choosedirectory ostaskdirs ostaskdirs keyset hasnext operatingsystem ostask ostask operatingsystem ostask jtextfield ostaskdirs ostask gettext ostask setenabled ostask setdirectory ostask setenabled installthread installthread installdir ostasks setthread private void page changed switch current page case 0 caption set text installing app name next button set text next prev button set enabled false break case 1 caption set text installer get property app license title next button set text next prev button set enabled true break case 2 caption set text specify where app name is to be installed next button set text next prev button set enabled true break case 3 caption set text choose components to install next button set text install prev button set enabled true break case 4 caption set text installing app name next button set text finish prev button set enabled false next button set enabled false install break case 5 caption set text installation complete next button set text finish prev button set enabled false next button set enabled true break get root pane invalidate get root pane validate pagechanged currentpage settext appname nextbutton settext prevbutton setenabled settext getproperty nextbutton settext prevbutton setenabled settext appname nextbutton settext prevbutton setenabled settext nextbutton settext prevbutton setenabled settext appname nextbutton settext prevbutton setenabled nextbutton setenabled settext nextbutton settext prevbutton setenabled nextbutton setenabled getrootpane getrootpane public void action performed action event evt object source evt get source if source cancel button system exit 0 else if source prev button current page page changed else if source next button if current page pages length 1 system exit 0 else current page page changed actionperformed actionevent getsource cancelbutton prevbutton currentpage pagechanged nextbutton currentpage currentpage pagechanged class window handler extends window adapter public void window closing window event evt system exit 0 windowhandler windowadapter windowclosing windowevent class wizard layout implements layout manager public void add layout component string name component comp wizardlayout layoutmanager addlayoutcomponent public void remove layout component component comp removelayoutcomponent public dimension preferred layout size container parent dimension dim new dimension dimension caption size caption get preferred size dim width caption size width for int i 0 i pages length i dimension dim pages i get preferred size dim width math max dim width dim width dim height math max dim height dim height dim width padding 2 dim height padding 2 dim height next button get preferred size height dim height caption size height return dim preferredlayoutsize captionsize getpreferredsize captionsize _dim getpreferredsize _dim _dim nextbutton getpreferredsize captionsize public dimension minimum layout size container parent return preferred layout size parent minimumlayoutsize preferredlayoutsize public void layout container container parent dimension size parent get size dimension caption size caption get preferred size caption set bounds padding padding caption size width caption size height make all buttons the same size dimension button size cancel button get preferred size button size width math max button size width prev button get preferred size width button size width math max button size width next button get preferred size width cancel button goes on far left cancel button set bounds padding size height button size height padding button size width button size height prev and next buttons are on the right prev button set bounds size width button size width 2 6 padding size height button size height padding button size width button size height next button set bounds size width button size width padding size height button size height padding button size width button size height calculate size for current page rectangle current page bounds new rectangle current page bounds x padding current page bounds y padding 2 caption size height current page bounds width size width current page bounds x padding current page bounds height size height button size height current page bounds y padding 2 for int i 0 i pages length i component page pages i page set bounds current page bounds page set visible i current page layoutcontainer getsize captionsize getpreferredsize setbounds captionsize captionsize buttonsize cancelbutton getpreferredsize buttonsize buttonsize prevbutton getpreferredsize buttonsize buttonsize nextbutton getpreferredsize cancelbutton setbounds buttonsize buttonsize buttonsize prevbutton setbounds buttonsize buttonsize buttonsize buttonsize nextbutton setbounds buttonsize buttonsize buttonsize buttonsize currentpagebounds currentpagebounds currentpagebounds captionsize currentpagebounds currentpagebounds currentpagebounds buttonsize currentpagebounds setbounds currentpagebounds setvisible currentpage text panel string file super new border layout j editor pane text new j editor pane try text set page text panel this get class get resource file catch exception e text set text error loading file e print stack trace text set editable false j scroll pane scroll pane new j scroll pane text dimension dim new dimension dim width 450 dim height 200 scroll pane set preferred size dim text panel this add border layout center scroll pane textpanel borderlayout jeditorpane jeditorpane setpage textpanel getclass getresource settext printstacktrace seteditable jscrollpane scrollpane jscrollpane scrollpane setpreferredsize textpanel borderlayout scrollpane choose directory super new border layout os task dirs new hash map j panel directory panel new j panel new variable grid layout variable grid layout fixed num columns 3 12 12 install dir add field directory panel install program in operating system get operating system get install directory app name app version for int i 0 i os tasks length i operating system os task os task os tasks i string label os task get label if label null j text field field add field directory panel label os task get directory os task dirs put os task field choose directory this add border layout north directory panel choosedirectory borderlayout ostaskdirs hashmap jpanel directorypanel jpanel variablegridlayout variablegridlayout fixed_num_columns installdir addfield directorypanel operatingsystem getoperatingsystem getinstalldirectory appname appversion ostasks operatingsystem ostask ostask ostasks ostask getlabel jtextfield addfield directorypanel ostask getdirectory ostaskdirs ostask choosedirectory borderlayout directorypanel private j text field add field j panel directory panel string label string default text j text field field new j text field default text directory panel add new j label label swing constants right box field box new box box layout y axis field box add box create glue dimension dim field get preferred size dim width integer max value field set maximum size dim field box add field field box add box create glue directory panel add field box j button choose new j button choose choose set request focus enabled false choose add action listener new action handler field directory panel add choose return field jtextfield addfield jpanel directorypanel defaulttext jtextfield jtextfield defaulttext directorypanel jlabel swingconstants fieldbox boxlayout y_axis fieldbox createglue getpreferredsize max_value setmaximumsize fieldbox fieldbox createglue directorypanel fieldbox jbutton jbutton setrequestfocusenabled addactionlistener actionhandler directorypanel j text field field action handler j text field field this field field jtextfield actionhandler jtextfield public void action performed action event evt file directory new file field get text j file chooser chooser new j file chooser directory get parent chooser set file selection mode j file chooser directories only chooser set selected file directory if chooser show open dialog swing install this j file chooser approve option field set text chooser get selected file get path actionperformed actionevent gettext jfilechooser jfilechooser getparent setfileselectionmode jfilechooser directories_only setselectedfile showopendialog swinginstall jfilechooser approve_option settext getselectedfile getpath select components super new border layout comp create comp panel select components this add border layout north comp size label new j label swing constants left select components this add border layout south size label update size selectcomponents borderlayout createcomppanel selectcomponents borderlayout sizelabel jlabel swingconstants selectcomponents borderlayout sizelabel updatesize public void action performed action event evt update size actionperformed actionevent updatesize private j panel create comp panel filesets new vector int count installer get integer property comp count j panel panel new j panel new grid layout count 1 string os class operating system get operating system get class get name os class os class substring os class index of 1 for int i 0 i count i string os installer get property comp i os if os null os class equals os continue j check box check box new j check box installer get property comp i name installer get property comp i disk size kb check box get model set selected true check box add action listener this check box set request focus enabled false filesets add element new integer i panel add check box dimension dim panel get preferred size dim width integer max value panel set maximum size dim return panel jpanel createcomppanel getintegerproperty jpanel jpanel gridlayout osclass operatingsystem getoperatingsystem getclass getname osclass osclass osclass indexof getproperty osclass jcheckbox checkbox jcheckbox getproperty getproperty checkbox getmodel setselected checkbox addactionlistener checkbox setrequestfocusenabled addelement checkbox getpreferredsize max_value setmaximumsize private void update size int size 0 for int i 0 i filesets size i if j check box comp get component i get model is selected size installer get integer property comp filesets element at i disk size size label set text estimated disk usage of selected components size kb updatesize jcheckbox getcomponent getmodel isselected getintegerproperty elementat sizelabel settext swing progress super new border layout progress new j progress bar progress set string painted true swing progress this add border layout north progress swingprogress borderlayout jprogressbar setstringpainted swingprogress borderlayout public void set maximum final int max swing utilities invoke later new runnable public void run progress set maximum max setmaximum swingutilities invokelater setmaximum swing utilities invoke later new runnable public void run progress set maximum max swingutilities invokelater setmaximum public void advance final int value try swing utilities invoke and wait new runnable public void run progress set value progress get value value thread yield catch exception e swingutilities invokeandwait setvalue getvalue public void run progress set value progress get value value setvalue getvalue public void done swing utilities invoke later new runnable public void run current page page changed swingutilities invokelater currentpage pagechanged public void run current page page changed currentpage pagechanged public void error final string message swing utilities invoke later new runnable public void run dispose j option pane show message dialog null message installation aborted j option pane error message system exit 1 swingutilities invokelater joptionpane showmessagedialog joptionpane error_message public void run dispose j option pane show message dialog null message installation aborted j option pane error message system exit 1 joptionpane showmessagedialog joptionpane error_message public void set thread install thread thread this thread thread setthread installthread history model constructor creates a new history list calling this is normally not necessary public history model string name this name name data new vector max historymodel historymodel add item method adds an item to the end of this history list trimming the list to the maximum number of items if necessary param text the item public void add item string text if text null text length 0 return modified true int index data index of text if index 1 data remove element at index data insert element at text 0 while get size max data remove element at data size 1 additem additem indexof removeelementat insertelementat getsize removeelementat get item method returns an item from the history list param index the index public string get item int index return string data element at index getitem getitem elementat get element at method returns an item from the history list this method returns the same thing as link get item int and only exists so that code history model code instances can be used as list models param index the index since j edit 4 2pre2 public object get element at int index return get item index getelementat getitem historymodel jedit getelementat getitem clear method removes all entries from this history model since j edit 4 2pre2 public void clear modified true data remove all elements jedit removeallelements get size method returns the number of elements in this history list public int get size return data size getsize getsize get name method returns the name of this history list this can be passed to the history text field constructor public string get name return name getname historytextfield getname get model method returns a named model if the specified model does not already exist it will be created param name the model name public static history model get model string name if models null models new hashtable history model model history model models get name if model null model new history model name models put name model return model getmodel historymodel getmodel historymodel historymodel historymodel load history method public static void load history string settings directory j edit get settings directory if settings directory null return history new file misc utilities construct path settings directory history if history exists return history mod time history last modified log log log message history model class loading history if models null models new hashtable buffered reader in null try in new buffered reader new file reader history history model current model null string line while line in read line null if line starts with line ends with if current model null models put current model get name current model string model name misc utilities escapes to chars line substring 1 line length 1 current model new history model model name else if current model null throw new io exception history data starts before model name else current model data add element misc utilities escapes to chars line if current model null models put current model get name current model catch file not found exception fnf log log log debug history model class fnf catch io exception io log log log error history model class io finally try if in null in close catch io exception io loadhistory loadhistory settingsdirectory jedit getsettingsdirectory settingsdirectory miscutilities constructpath settingsdirectory historymodtime lastmodified historymodel bufferedreader bufferedreader filereader historymodel currentmodel readline startswith endswith currentmodel currentmodel getname currentmodel modelname miscutilities escapestochars currentmodel historymodel modelname currentmodel ioexception currentmodel addelement miscutilities escapestochars currentmodel currentmodel getname currentmodel filenotfoundexception historymodel ioexception historymodel ioexception save history method public static void save history if modified return log log log message history model class saving history file file1 new file misc utilities construct path j edit get settings directory history save file file2 new file misc utilities construct path j edit get settings directory history if file2 exists file2 last modified history mod time log log log warning history model class file2 changed on disk will not save history return j edit backup settings file file2 string line sep system get property line separator buffered writer out null try out new buffered writer new file writer file1 if models null enumeration model enum models elements while model enum has more elements history model model history model model enum next element if model get size 0 continue out write out write misc utilities chars to escapes model get name to escape out write out write line sep for int i 0 i model get size i out write misc utilities chars to escapes model get item i to escape out write line sep out close to avoid data loss only do this if the above completed successfully file2 delete file1 rename to file2 modified false catch io exception io log log log error history model class io finally try if out null out close catch io exception e history mod time file2 last modified savehistory savehistory historymodel miscutilities constructpath jedit getsettingsdirectory miscutilities constructpath jedit getsettingsdirectory lastmodified historymodtime historymodel jedit backupsettingsfile linesep getproperty bufferedwriter bufferedwriter filewriter modelenum modelenum hasmoreelements historymodel historymodel modelenum nextelement getsize miscutilities charstoescapes getname to_escape linesep getsize miscutilities charstoescapes getitem to_escape linesep renameto ioexception historymodel ioexception historymodtime lastmodified properties changed method public static void properties changed max j edit get integer property history 25 propertieschanged propertieschanged jedit getintegerproperty re token back ref int sub index int num boolean insens super sub index this num num this insens insens retokenbackref subindex subindex boolean match char indexed input re match mymatch int b e b mymatch start num e mymatch end num if b 1 e 1 return false this shouldn t happen but for int i b i e i if input char at mymatch index i b input char at i return false mymatch index e b return next input mymatch charindexed rematch charat charat void dump string buffer os os append append num stringbuffer public string text public bsh formal comment int id super id bshformalcomment get instance method returns the currently visible plugin manager window or null since j edit 4 2pre2 public static plugin manager get instance return instance getinstance jedit pluginmanager getinstance dispose method public void dispose gui utilities save geometry this plugin manager instance null edit bus remove from bus this super dispose guiutilities savegeometry editbus removefrombus handle message method public void handle message eb message message force the install tab to refresh for possible change of mirror if message instanceof properties changed plugin list null update plugin list if tab pane get selected index 0 installer update model updater update model else if message instanceof plugin update if queued update swing utilities invoke later new runnable public void run queued update false manager update queued update true handlemessage handlemessage ebmessage propertieschanged pluginlist updatepluginlist tabpane getselectedindex updatemodel updatemodel pluginupdate queuedupdate swingutilities invokelater queuedupdate queuedupdate public void run queued update false manager update queuedupdate show plugin manager method public static void show plugin manager frame frame if instance null instance new plugin manager else instance to front return showpluginmanager showpluginmanager pluginmanager tofront ok method public void ok dispose cancel method public void cancel dispose get plugin list method public plugin list get plugin list return plugin list getpluginlist pluginlist getpluginlist pluginlist plugin manager constructor private plugin manager super j edit get property plugin manager title edit bus add to bus this setup panes j panel content new j panel new border layout 12 12 content set border new empty border 12 12 12 12 set content pane content tab pane new j tabbed pane tab pane add tab j edit get property manage plugins title manager new manage panel this tab pane add tab j edit get property update plugins title updater new install panel this true tab pane add tab j edit get property install plugins title installer new install panel this false content add border layout center tab pane tab pane add change listener new list updater create the buttons box buttons new box box layout x axis action listener al new action handler mgr options new j button j edit get property plugin manager mgr options mgr options add action listener al plugin options new j button j edit get property plugin manager plugin options plugin options add action listener al done new j button j edit get property plugin manager done done add action listener al buttons add box create glue buttons add mgr options buttons add box create horizontal strut 6 buttons add plugin options buttons add box create horizontal strut 6 buttons add done buttons add box create glue get root pane set default button done content add border layout south buttons set default close operation dispose on close set icon image gui utilities get plugin icon pack gui utilities load geometry this plugin manager set visible true pluginmanager pluginmanager jedit getproperty editbus addtobus jpanel jpanel borderlayout setborder emptyborder setcontentpane tabpane jtabbedpane tabpane addtab jedit getproperty managepanel tabpane addtab jedit getproperty installpanel tabpane addtab jedit getproperty installpanel borderlayout tabpane tabpane addchangelistener listupdater boxlayout x_axis actionlistener actionhandler mgroptions jbutton jedit getproperty mgroptions addactionlistener pluginoptions jbutton jedit getproperty pluginoptions addactionlistener jbutton jedit getproperty addactionlistener createglue mgroptions createhorizontalstrut pluginoptions createhorizontalstrut createglue getrootpane setdefaultbutton borderlayout setdefaultcloseoperation dispose_on_close seticonimage guiutilities getpluginicon guiutilities loadgeometry setvisible update plugin list method private void update plugin list if j edit get settings directory null j edit getj edit home null gui utilities error this no settings null return else if plugin list null downloading plugin list return final exception exception new exception 1 vfs manager run in work thread new work request public void run try downloading plugin list true set status j edit get property plugin manager list download plugin list new plugin list catch exception e exception 0 e finally downloading plugin list false vfs manager run inawt thread new runnable public void run if exception 0 instanceof xml exception xml exception xe xml exception exception 0 int line xe get line string path j edit get property plugin manager export url string message xe get message log log log error this path line message string pp path string value of line message gui utilities error plugin manager this plugin list xmlerror pp else if exception 0 null exception e exception 0 log log log error this e string pp e to string string ok j edit get property common ok string proxy button j edit get property plugin list ioerror proxy servers int ret val j option pane show option dialog plugin manager this j edit get property plugin list ioerror message pp j edit get property plugin list ioerror title j option pane yes no option j option pane error message null new object proxy button ok ok if ret val 0 new global options plugin manager this firewall updatepluginlist updatepluginlist jedit getsettingsdirectory jedit getjedithome guiutilities pluginlist downloadingpluginlist vfsmanager runinworkthread workrequest downloadingpluginlist setstatus jedit getproperty pluginlist pluginlist downloadingpluginlist vfsmanager runinawtthread xmlexception xmlexception xmlexception getline jedit getproperty getmessage valueof guiutilities pluginmanager tostring jedit getproperty proxybutton jedit getproperty retval joptionpane showoptiondialog pluginmanager jedit getproperty jedit getproperty joptionpane yes_no_option joptionpane error_message proxybutton retval globaloptions pluginmanager public void run try downloading plugin list true set status j edit get property plugin manager list download plugin list new plugin list catch exception e exception 0 e finally downloading plugin list false downloadingpluginlist setstatus jedit getproperty pluginlist pluginlist downloadingpluginlist public void run if exception 0 instanceof xml exception xml exception xe xml exception exception 0 int line xe get line string path j edit get property plugin manager export url string message xe get message log log log error this path line message string pp path string value of line message gui utilities error plugin manager this plugin list xmlerror pp else if exception 0 null exception e exception 0 log log log error this e string pp e to string string ok j edit get property common ok string proxy button j edit get property plugin list ioerror proxy servers int ret val j option pane show option dialog plugin manager this j edit get property plugin list ioerror message pp j edit get property plugin list ioerror title j option pane yes no option j option pane error message null new object proxy button ok ok if ret val 0 new global options plugin manager this firewall xmlexception xmlexception xmlexception getline jedit getproperty getmessage valueof guiutilities pluginmanager tostring jedit getproperty proxybutton jedit getproperty retval joptionpane showoptiondialog pluginmanager jedit getproperty jedit getproperty joptionpane yes_no_option joptionpane error_message proxybutton retval globaloptions pluginmanager public void action performed action event evt object source evt get source if source done ok else if source mgr options new global options plugin manager this plugin manager else if source plugin options new plugin options plugin manager this actionperformed actionevent getsource mgroptions globaloptions pluginmanager pluginoptions pluginoptions pluginmanager public void state changed change event e final component selected tab pane get selected component if selected installer selected updater update plugin list installer update model updater update model else if selected manager manager update statechanged changeevent tabpane getselectedcomponent updatepluginlist updatemodel updatemodel constructor public show recent dir menu super j edit get property macos plugin menu recent dir label add menu listener this showrecentdirmenu jedit getproperty macosplugin recentdir addmenulistener construct method private void construct history model model history model get model vfs browser path j menu item item file file int max model get size if max 0 item new j menu item j edit get property macos plugin menu recent dir none item set enabled false add item return for int i 0 i max i file new file model get item i item new show recent dir menu item file get name file get path item set icon file cell renderer dir icon add item historymodel historymodel getmodel jmenuitem getsize jmenuitem jedit getproperty macosplugin recentdir setenabled getitem showrecentdirmenuitem getname getpath seticon filecellrenderer diricon menu selected method public void menu selected menu event e construct menuselected menuselected menuevent menu deselected method public void menu deselected menu event e remove all menudeselected menudeselected menuevent removeall menu canceled method public void menu canceled menu event e menucanceled menucanceled menuevent public show recent dir menu item string name string path super name this path path add action listener new show file action showrecentdirmenuitem addactionlistener showfileaction class show file action implements action listener public void action performed action event e macos actions show in finder path showfileaction actionlistener actionperformed actionevent macosactions showinfinder start method j edit calls this method when the plugin is being activated either during startup or at any other time a plugin can get activated for a number of reasons ul li the plugin is written for j edit 4 1 or older in which case it will always be loaded at startup li li the plugin has its code activate code property set to code startup code in which case it will always be loaded at startup li li one of the properties listed in the plugin s code activate code property is set to code true code in which case it will always be loaded at startup li li one of the plugin s classes is being accessed by another plugin a macro or a bean shell snippet in a plugin api xml file li ul note that this method is always called from the event dispatch thread even if the activation resulted from a class being loaded from another thread a side effect of this is that some of your plugin s code might get executed before this method finishes running p when this method is being called for plugins written for j edit 4 1 and below no views or buffers are open however this is not the case for plugins using the new api for example if your plugin adds tool bars to views make sure you correctly handle the case where views are already open when the plugin is loaded p if your plugin must be loaded on startup take care to have this method return as quickly as possible p the default implementation of this method does nothing since j edit 2 1pre1 jedit jedit beanshell jedit jedit stop method j edit calls this method when the plugin is being unloaded this can be when the program is exiting or at any other time p if a plugin uses state information or other persistent data that should be stored in a special format this would be a good place to write the data to storage if the plugin uses j edit s properties api to hold settings no special processing is needed for them on exit since they will be saved automatically p with plugins written for j edit 4 1 and below this method is only called when the program is exiting however this is not the case for plugins using the new api for example if your plugin adds tool bars to views make sure you correctly handle the case where views are still open when the plugin is unloaded p to avoid memory leaks this method should ensure that no references to any objects created by this plugin remain in the heap in the case of actions dockable windows and services j edit ensures this automatically for other objects your plugin must clean up maually p the default implementation of this method does nothing since j edit 2 1pre1 jedit jedit jedit jedit jedit get class name method returns the plugin s class name this might not be the same as the class of the actual code edit plugin code instance for example if the plugin is not loaded yet since j edit 2 5pre3 public string get class name return get class get name getclassname editplugin jedit getclassname getclass getname get pluginjar method returns the jar file containing this plugin since j edit 4 2pre1 public pluginjar get pluginjar return jar getpluginjar jedit getpluginjar create menu items method called by the view when constructing its b plugins b menu see the description of this class for details about how the menu items are constructed from plugin properties since j edit 4 2pre1 public final j menu item create menu items if this instanceof broken return null string menu item name j edit get property plugin get class name menu item if menu item name null return gui utilities load menu item menu item name string menu property plugin get class name menu string code property plugin get class name menu code if j edit get property menu property null j edit get property code property null string plugin name j edit get property plugin get class name name return new enhanced menu menu property plugin name return null createmenuitems jedit jmenuitem createmenuitems menuitemname jedit getproperty getclassname menuitemname guiutilities loadmenuitem menuitemname menuproperty getclassname codeproperty getclassname jedit getproperty menuproperty jedit getproperty codeproperty pluginname jedit getproperty getclassname enhancedmenu menuproperty pluginname create browser menu items method called by the filesystem browser when constructing its b plugins b menu see the description of this class for details about how the menu items are constructed from plugin properties since j edit 4 2pre1 public final j menu item create browser menu items if this instanceof broken return null string menu item name j edit get property plugin get class name browser menu item if menu item name null return gui utilities load menu item vfs browser get action context menu item name false string menu property plugin get class name browser menu if j edit get property menu property null string plugin name j edit get property plugin get class name name return new enhanced menu menu property plugin name vfs browser get action context return null createbrowsermenuitems jedit jmenuitem createbrowsermenuitems menuitemname jedit getproperty getclassname menuitemname guiutilities loadmenuitem vfsbrowser getactioncontext menuitemname menuproperty getclassname jedit getproperty menuproperty pluginname jedit getproperty getclassname enhancedmenu menuproperty pluginname vfsbrowser getactioncontext create menu items method deprecated instead of overriding this method define properties as specified in the description of this class createmenuitems create option panes method deprecated instead of overriding this method define properties as specified in the description of this class createoptionpanes getjar method deprecated call code get pluginjar code instead public edit plugin jar getjar return jar getpluginjar editplugin public static class broken extends edit plugin public string get class name return clazz editplugin getclassname package private members broken string clazz this clazz clazz public static class deferred extends edit plugin public string get class name return clazz editplugin getclassname package private members deferred string clazz this clazz clazz edit plugin load plugin class return null editplugin loadpluginclass public string to string return deferred clazz tostring public static class jar extends pluginjar jar java io file file super file browse directory in new window method opens the specified directory in a new floating file system browser param view the view param path the directory s path since j edit 4 1pre2 public static void browse directory in new window view view string path dockable window manager wm view get dockable window manager if path null this is such a bad way of doing it but oh well j edit set temporary property vfs browser path tmp path wm float dockable window vfs browser j edit unset property vfs browser path tmp browsedirectoryinnewwindow jedit browsedirectoryinnewwindow dockablewindowmanager getdockablewindowmanager jedit settemporaryproperty floatdockablewindow jedit unsetproperty browse directory method opens the specified directory in a file system browser param view the view param path the directory s path since j edit 4 0pre3 public static void browse directory view view string path dockable window manager wm view get dockable window manager vfs browser browser vfs browser wm get dockable name if browser null wm show dockable window name browser set directory path else if path null this is such a bad way of doing it but oh well j edit set temporary property vfs browser path tmp path wm add dockable window vfs browser j edit unset property vfs browser path tmp browsedirectory jedit browsedirectory dockablewindowmanager getdockablewindowmanager vfsbrowser vfsbrowser getdockable showdockablewindow setdirectory jedit settemporaryproperty adddockablewindow jedit unsetproperty get action context method returns the browser action context since j edit 4 2pre1 public static action context get action context return action context getactioncontext jedit actioncontext getactioncontext actioncontext vfs browser constructor creates a new vfs browser param view the view to open buffers in by default public vfs browser view view string position this view null browser true position vfsbrowser vfsbrowser vfs browser constructor creates a new vfs browser param view the view to open buffers in by default param path the path to display param mode the browser mode param multiple selection true if multiple selection should be allowed param position where the browser is located since j edit 4 2pre1 public vfs browser view view string path int mode boolean multiple selection string position super new border layout listener list new event listener list this mode mode this multiple selection multiple selection this view view current encoding j edit get property buffer encoding system get property file encoding auto detect encoding j edit get boolean property buffer encoding autodetect action handler action handler new action handler box top box new box box layout y axis horizontal layout mode browser dockable window manager top equals position dockable window manager bottom equals position toolbar box new box horizontal layout box layout x axis box layout y axis top box add toolbar box grid bag layout layout new grid bag layout j panel path and filter panel new j panel layout grid bag constraints cons new grid bag constraints cons gridwidth cons gridheight 1 cons gridx cons gridy 0 cons fill grid bag constraints both cons anchor grid bag constraints east j label label new j label j edit get property vfs browser path swing constants right label set border new empty border 0 0 0 12 layout set constraints label cons path and filter panel add label path field new history text field vfs browser path path field set instant popups true path field set enter adds to history false path field set select all on focus true because its preferred size can be quite wide we don t want it to make the browser way too big so set the preferred width to 0 dimension pref size path field get preferred size pref size width 0 path field set preferred size pref size path field add action listener action handler cons gridx 1 cons weightx 1 0f layout set constraints path field cons path and filter panel add path field filter checkbox new j check box j edit get property vfs browser filter filter checkbox set margin new insets 0 0 0 0 filter checkbox set request focus enabled false filter checkbox set border new empty border 0 0 0 12 filter checkbox set selected j edit get boolean property vfs browser filter enabled filter checkbox add action listener action handler if mode choose directory dialog cons gridx 0 cons weightx 0 0f cons gridy 1 layout set constraints filter checkbox cons path and filter panel add filter checkbox filter field new history text field vfs browser filter filter field set instant popups true filter field set select all on focus true filter field add action listener action handler if mode choose directory dialog cons gridx 1 cons weightx 1 0f layout set constraints filter field cons path and filter panel add filter field top box add path and filter panel add border layout north top box add border layout center browser view new browser view this properties changed string filter if mode browser j edit get boolean property vfs browser current buffer filter filter j edit get property vfs browser last filter if filter null filter j edit get property vfs browser default filter else string ext misc utilities get file extension view get buffer get name if ext length 0 filter j edit get property vfs browser default filter else filter ext filter field set text filter filter field add current to history update filter enabled see vfs browser browse directory if path null path j edit get property vfs browser path tmp if path null path length 0 string user home system get property user home string default path j edit get property vfs browser default path if default path equals home path user home else if default path equals working path system get property user dir else if default path equals buffer if view null buffer buffer view get buffer path buffer get directory else path user home else if default path equals last history model path model history model get model vfs browser path if path model get size 0 path else path path model get item 0 else if default path equals favorites path favorites else unknown value path user home final string path path swing utilities invoke later new runnable public void run set directory path vfsbrowser multipleselection jedit vfsbrowser multipleselection borderlayout listenerlist eventlistenerlist multipleselection multipleselection currentencoding jedit getproperty getproperty autodetectencoding jedit getbooleanproperty encodingautodetect actionhandler actionhandler actionhandler topbox boxlayout y_axis horizontallayout dockablewindowmanager dockablewindowmanager toolbarbox horizontallayout boxlayout x_axis boxlayout y_axis topbox toolbarbox gridbaglayout gridbaglayout jpanel pathandfilterpanel jpanel gridbagconstraints gridbagconstraints gridbagconstraints gridbagconstraints jlabel jlabel jedit getproperty swingconstants setborder emptyborder setconstraints pathandfilterpanel pathfield historytextfield pathfield setinstantpopups pathfield setenteraddstohistory pathfield setselectallonfocus prefsize pathfield getpreferredsize prefsize pathfield setpreferredsize prefsize pathfield addactionlistener actionhandler setconstraints pathfield pathandfilterpanel pathfield filtercheckbox jcheckbox jedit getproperty filtercheckbox setmargin filtercheckbox setrequestfocusenabled filtercheckbox setborder emptyborder filtercheckbox setselected jedit getbooleanproperty filtercheckbox addactionlistener actionhandler choose_directory_dialog setconstraints filtercheckbox pathandfilterpanel filtercheckbox filterfield historytextfield filterfield setinstantpopups filterfield setselectallonfocus filterfield addactionlistener actionhandler choose_directory_dialog setconstraints filterfield pathandfilterpanel filterfield topbox pathandfilterpanel borderlayout topbox borderlayout browserview browserview propertieschanged jedit getbooleanproperty currentbufferfilter jedit getproperty jedit getproperty miscutilities getfileextension getbuffer getname jedit getproperty filterfield settext filterfield addcurrenttohistory updatefilterenabled vfsbrowser browsedirectory jedit getproperty userhome getproperty defaultpath jedit getproperty defaultpath defaultpath userhome defaultpath getproperty defaultpath getbuffer getdirectory userhome defaultpath historymodel pathmodel historymodel getmodel pathmodel getsize pathmodel getitem defaultpath userhome _path swingutilities invokelater setdirectory _path swing utilities invoke later new runnable public void run set directory path swingutilities invokelater setdirectory _path focus on default component method public void focus on default component browser view focus on file view focusondefaultcomponent focusondefaultcomponent browserview focusonfileview add notify method public void add notify super add notify edit bus add to bus this addnotify addnotify addnotify editbus addtobus remove notify method public void remove notify super remove notify j edit set boolean property vfs browser filter enabled filter checkbox is selected if mode browser j edit get boolean property vfs browser current buffer filter j edit set property vfs browser last filter filter field get text edit bus remove from bus this removenotify removenotify removenotify jedit setbooleanproperty filtercheckbox isselected jedit getbooleanproperty currentbufferfilter jedit setproperty filterfield gettext editbus removefrombus handle message method public void handle message eb message msg if msg instanceof properties changed properties changed else if msg instanceof buffer update buffer update bmsg buffer update msg if bmsg get what buffer update created bmsg get what buffer update closed browser view update file view hacked bufferio request to send vfs updates in case two stage save is off now else if bmsg get what buffer update saved maybe reload directory misc utilities get parent of path bmsg get buffer get path else if msg instanceof plugin update plugin update pmsg plugin update msg if pmsg get what plugin update loaded pmsg get what plugin update unloaded plugins update popup menu else if msg instanceof vfs update maybe reload directory vfs update msg get path handlemessage handlemessage ebmessage propertieschanged propertieschanged bufferupdate bufferupdate bufferupdate getwhat bufferupdate getwhat bufferupdate browserview updatefileview bufferiorequest vfsupdates getwhat bufferupdate maybereloaddirectory miscutilities getparentofpath getbuffer getpath pluginupdate pluginupdate pluginupdate getwhat pluginupdate getwhat pluginupdate updatepopupmenu vfsupdate maybereloaddirectory vfsupdate getpath get view method public view get view return view getview getview get mode method public int get mode return mode getmode getmode is multiple selection enabled method public boolean is multiple selection enabled return multiple selection ismultipleselectionenabled ismultipleselectionenabled multipleselection is horizontal layout method public boolean is horizontal layout return horizontal layout ishorizontallayout ishorizontallayout horizontallayout get show hidden files method public boolean get show hidden files return show hidden files getshowhiddenfiles getshowhiddenfiles showhiddenfiles set show hidden files method public void set show hidden files boolean show hidden files this show hidden files show hidden files setshowhiddenfiles setshowhiddenfiles showhiddenfiles showhiddenfiles showhiddenfiles get filename filter method returns the file name filter glob since j edit 3 2pre2 public string get filename filter if filter checkbox is selected string filter filter field get text if filter length 0 return else return filter else return getfilenamefilter jedit getfilenamefilter filtercheckbox isselected filterfield gettext set filename filter method public void set filename filter string filter if filter null filter length 0 filter equals filter checkbox set selected false else filter checkbox set selected true filter field set text filter setfilenamefilter setfilenamefilter filtercheckbox setselected filtercheckbox setselected filterfield settext get directory field method public history text field get directory field return path field getdirectoryfield historytextfield getdirectoryfield pathfield get directory method public string get directory return path getdirectory getdirectory set directory method public void set directory string path if path starts with file path path substring 5 path field set text path if start request return update filename filter browser view save expansion state browser view load directory null path this path path vfs manager run inawt thread new runnable public void run end request setdirectory setdirectory startswith pathfield settext startrequest updatefilenamefilter browserview saveexpansionstate browserview loaddirectory vfsmanager runinawtthread endrequest vfs manager run inawt thread new runnable public void run end request vfsmanager runinawtthread endrequest root directory method goes to the local drives directory since j edit 4 0pre4 public void root directory if operating system is macos operating system isdos derived set directory file rootsvfs protocol else set directory rootdirectory jedit rootdirectory operatingsystem ismacos operatingsystem isdosderived setdirectory filerootsvfs setdirectory reload directory method public void reload directory used by ftp plugin to clear directory cache vfs manager getvfs for path path reload directory path update filename filter browser view save expansion state browser view load directory null path reloaddirectory reloaddirectory vfsmanager getvfsforpath reloaddirectory updatefilenamefilter browserview saveexpansionstate browserview loaddirectory delete method note that all files must be on the same vfs public void delete vfs directory entry files string dialog type if misc utilities isurl files 0 delete path favoritesvfs protocol equals misc utilities get protocol ofurl files 0 delete path dialog type vfs browser delete favorites else dialog type vfs browser delete confirm string buffer buf new string buffer for int i 0 i files length i buf append files i path buf append n object args buf to string int result gui utilities confirm this dialog type args j option pane yes no option j option pane warning message if result j option pane yes option return vfs vfs vfs manager getvfs for path files 0 delete path if start request return for int i 0 i files length i object session vfs createvfs session files i delete path this if session null continue vfs manager run in work thread new browserio request browserio request delete this session vfs files i delete path null null vfs manager run inawt thread new runnable public void run end request directoryentry dialogtype miscutilities deletepath miscutilities getprotocolofurl deletepath dialogtype dialogtype stringbuffer stringbuffer tostring guiutilities dialogtype joptionpane yes_no_option joptionpane warning_message joptionpane yes_option vfsmanager getvfsforpath deletepath startrequest createvfssession deletepath vfsmanager runinworkthread browseriorequest browseriorequest deletepath vfsmanager runinawtthread endrequest vfs manager run inawt thread new runnable public void run end request vfsmanager runinawtthread endrequest rename method public void rename string from vfs vfs vfs manager getvfs for path from string filename vfs get file name from string args filename string to gui utilities input this vfs browser rename args filename if to null return to misc utilities construct path vfs get parent of path from to object session vfs createvfs session from this if session null return if start request return vfs manager run in work thread new browserio request browserio request rename this session vfs from to null vfs manager run inawt thread new runnable public void run end request vfsmanager getvfsforpath getfilename guiutilities miscutilities constructpath getparentofpath createvfssession startrequest vfsmanager runinworkthread browseriorequest browseriorequest vfsmanager runinawtthread endrequest vfs manager run inawt thread new runnable public void run end request vfsmanager runinawtthread endrequest mkdir method public void mkdir string new directory gui utilities input this vfs browser mkdir null if new directory null return if a directory is selected create new dir in there if a file is selected create new dir inside its parent vfs directory entry selected get selected files string parent if selected length 0 parent path else if selected 0 type vfs directory entry file parent selected 0 path parent vfs manager getvfs for path parent get parent of path parent else parent selected 0 path vfs vfs vfs manager getvfs for path parent path is the currently viewed directory in the browser new directory misc utilities construct path parent new directory object session vfs createvfs session new directory this if session null return if start request return vfs manager run in work thread new browserio request browserio request mkdir this session vfs new directory null null vfs manager run inawt thread new runnable public void run end request newdirectory guiutilities newdirectory directoryentry getselectedfiles directoryentry vfsmanager getvfsforpath getparentofpath vfsmanager getvfsforpath newdirectory miscutilities constructpath newdirectory createvfssession newdirectory startrequest vfsmanager runinworkthread browseriorequest browseriorequest newdirectory vfsmanager runinawtthread endrequest vfs manager run inawt thread new runnable public void run end request vfsmanager runinawtthread endrequest new file method creates a new file in the current directory since j edit 4 0pre2 public void new file vfs directory entry selected get selected files if selected length 1 vfs directory entry file selected 0 if file type vfs directory entry directory j edit new file view file path else vfs vfs vfs manager getvfs for path file path j edit new file view vfs get parent of path file path else j edit new file view path newfile jedit newfile directoryentry getselectedfiles directoryentry directoryentry jedit newfile vfsmanager getvfsforpath jedit newfile getparentofpath jedit newfile search in directory method opens a directory search in the current directory since j edit 4 0pre2 public void search in directory vfs directory entry selected get selected files if selected length 1 vfs directory entry file selected 0 search in directory file path file type vfs directory entry file else search in directory this path true searchindirectory jedit searchindirectory directoryentry getselectedfiles directoryentry searchindirectory directoryentry searchindirectory search in directory method opens a directory search in the specified directory param path the path name param directory true if the path is a directory false if it is a file since j edit 4 2pre1 public void search in directory string path boolean directory string filter if directory filter get filename filter else string name misc utilities get file name path string ext misc utilities get file extension name filter ext null ext length 0 get filename filter ext path misc utilities get parent of path path search and replace set search file set new directory list set path filter true search dialog show search dialog view null search dialog directory searchindirectory jedit searchindirectory getfilenamefilter miscutilities getfilename miscutilities getfileextension getfilenamefilter miscutilities getparentofpath searchandreplace setsearchfileset directorylistset searchdialog showsearchdialog searchdialog get browser view method public browser view get browser view return browser view getbrowserview browserview getbrowserview browserview get selected files method public vfs directory entry get selected files return browser view get selected files getselectedfiles directoryentry getselectedfiles browserview getselectedfiles locate file method goes to the given file s directory and selects the file in the list param path the file since j edit 4 2pre2 public void locate file final string path if filename filter is match misc utilities get file name path set filename filter null set directory misc utilities get parent of path path vfs manager run inawt thread new runnable public void run browser view get table select file path locatefile jedit locatefile filenamefilter ismatch miscutilities getfilename setfilenamefilter setdirectory miscutilities getparentofpath vfsmanager runinawtthread browserview gettable selectfile vfs manager run inawt thread new runnable public void run browser view get table select file path vfsmanager runinawtthread browserview gettable selectfile add browser listener method public void add browser listener browser listener l listener list add browser listener class l addbrowserlistener addbrowserlistener browserlistener listenerlist browserlistener remove browser listener method public void remove browser listener browser listener l listener list remove browser listener class l removebrowserlistener removebrowserlistener browserlistener listenerlist browserlistener this method does the double click handling it is public so that code browser actions xml code can bind to it since j edit 4 2pre2 public void files activated int mode boolean can double click close vfs directory entry selected files browser view get selected files buffer buffer null check selected for int i 0 i selected files length i vfs directory entry file selected files i if file type vfs directory entry directory file type vfs directory entry filesystem if mode m open new view this mode browser browse directory in new window view file path else set directory file path else if this mode browser this mode browser dialog if mode m insert view get buffer insert file view file path continue check selected buffer buffer j edit get buffer file path if buffer null hashtable props new hashtable props put buffer encoding current encoding props put buffer encoding autodetect new boolean auto detect encoding buffer j edit open file null null file path false props else if double click close can double click close this mode browser dialog selected files length 1 close if this buffer is currently visible in the view edit pane edit panes view get edit panes for int j 0 j edit panes length j if edit panes j get buffer buffer j edit close buffer view buffer return if buffer null buffer buffer else if a file is selected in open dialog or save dialog mode just let the listener s handle it if buffer null switch mode case m open view set buffer buffer break case m open new view j edit new view view buffer false break case m open new plain view j edit new view view buffer true break case m open new split view split horizontally set buffer buffer break object listeners listener list get listener list for int i 0 i listeners length i if listeners i browser listener class browser listener l browser listener listeners i 1 l files activated this selected files jedit filesactivated candoubleclickclose directoryentry selectedfiles browserview getselectedfiles check_selected selectedfiles directoryentry selectedfiles directoryentry directoryentry m_open_new_view browsedirectoryinnewwindow setdirectory browser_dialog m_insert getbuffer insertfile check_selected _buffer jedit getbuffer _buffer currentencoding encoding_autodetect autodetectencoding _buffer jedit openfile doubleclickclose candoubleclickclose browser_dialog selectedfiles editpane editpanes geteditpanes editpanes editpanes getbuffer _buffer jedit closebuffer _buffer _buffer _buffer open_dialog save_dialog m_open setbuffer m_open_new_view jedit newview m_open_new_plain_view jedit newview m_open_new_split splithorizontally setbuffer listenerlist getlistenerlist browserlistener browserlistener browserlistener filesactivated selectedfiles paths equal method this will be made public at some stage in the io package but not yet static boolean paths equal string p1 string p2 if p1 ends with p1 ends with file separator p1 p1 substring 0 p1 length 1 if p2 ends with p2 ends with file separator p2 p2 substring 0 p2 length 1 return p1 equals p2 pathsequal pathsequal endswith endswith endswith endswith update filename filter method void update filename filter try string filter filter field get text if filter length 0 filter filename filter new re misc utilities glob tore filter re reg icase catch exception e log log log error vfs browser this e string args filter field get text e get message gui utilities error this vfs browser bad filter args updatefilenamefilter updatefilenamefilter filterfield gettext filenamefilter miscutilities globtore reg_icase vfsbrowser filterfield gettext getmessage guiutilities directory loaded method void directory loaded object node object load info vfs manager run inawt thread new directory loadedawt request node load info directoryloaded directoryloaded loadinfo vfsmanager runinawtthread directoryloadedawtrequest loadinfo files selected method void files selected vfs directory entry selected files browser view get selected files if mode browser for int i 0 i selected files length i vfs directory entry file selected files i buffer buffer j edit get buffer file path if buffer null view null view set buffer buffer object listeners listener list get listener list for int i 0 i listeners length i if listeners i browser listener class browser listener l browser listener listeners i 1 l files selected this selected files filesselected filesselected directoryentry selectedfiles browserview getselectedfiles selectedfiles directoryentry selectedfiles jedit getbuffer setbuffer listenerlist getlistenerlist browserlistener browserlistener browserlistener filesselected selectedfiles end request method void end request request running false endrequest endrequest requestrunning create menu bar method private j panel create menu bar j panel menu bar new j panel menu bar set layout new box layout menu bar box layout x axis menu bar set border new empty border 0 1 0 3 menu bar add new commands menu button menu bar add box create horizontal strut 3 menu bar add plugins new plugins menu button menu bar add box create horizontal strut 3 menu bar add favorites new favorites menu button return menu bar createmenubar jpanel createmenubar jpanel menubar jpanel menubar setlayout boxlayout menubar boxlayout x_axis menubar setborder emptyborder menubar commandsmenubutton menubar createhorizontalstrut menubar pluginsmenubutton menubar createhorizontalstrut menubar favoritesmenubutton menubar create tool bar method private box create tool bar if mode browser return gui utilities load tool bar action context vfs browser toolbar browser else return gui utilities load tool bar action context vfs browser toolbar dialog createtoolbar createtoolbar guiutilities loadtoolbar actioncontext guiutilities loadtoolbar actioncontext properties changed method private void properties changed show hidden files j edit get boolean property vfs browser show hidden files sort mix files and dirs j edit get boolean property vfs browser sort mix files and dirs sort ignore case j edit get boolean property vfs browser sort ignore case double click close j edit get boolean property vfs browser double click close browser view properties changed toolbar box remove all if j edit get boolean property vfs browser show toolbar box toolbar create tool bar if horizontal layout toolbar box add toolbar else toolbar add box create glue toolbar box add toolbar if j edit get boolean property vfs browser show menubar j panel menubar create menu bar if horizontal layout toolbar box add box create horizontal strut 6 toolbar box add menubar 0 else menubar add box create glue toolbar box add menubar else favorites null toolbar box add box create glue revalidate if path null reload directory propertieschanged propertieschanged showhiddenfiles jedit getbooleanproperty showhiddenfiles sortmixfilesanddirs jedit getbooleanproperty sortmixfilesanddirs sortignorecase jedit getbooleanproperty sortignorecase doubleclickclose jedit getbooleanproperty doubleclickclose browserview propertieschanged toolbarbox removeall jedit getbooleanproperty showtoolbar createtoolbar horizontallayout toolbarbox createglue toolbarbox jedit getbooleanproperty showmenubar jpanel createmenubar horizontallayout toolbarbox createhorizontalstrut toolbarbox createglue toolbarbox toolbarbox createglue reloaddirectory start request method private boolean start request if request running dump stack trace for debugging purposes log log log debug this new throwable for debugging purposes gui utilities error this browser multiple io null return false else request running true return true startrequest startrequest requestrunning guiutilities requestrunning update filter enabled method private void update filter enabled filter field set enabled filter checkbox is selected updatefilterenabled updatefilterenabled filterfield setenabled filtercheckbox isselected maybe reload directory method private void maybe reload directory string dir if misc utilities isurl dir misc utilities get protocol ofurl dir equals favoritesvfs protocol if favorites null favorites popup null this is a dirty hack and it relies on the fact that updates for parents are sent before updates for the changed nodes themselves if this was not the case the browser wouldn t be updated properly on delete etc to avoid causing 1 request errors don t reload directory if request already active if maybe reload request running log log log warning this vfs update request already in progress return save a file sends vfs update if a vfs file dialog box is shown from the same event frame as the save the vfs update will be delivered before the directory is loaded and before the path is set if path null try maybe reload request running true browser view maybe reload directory dir finally vfs manager run inawt thread new runnable public void run maybe reload request running false maybereloaddirectory maybereloaddirectory miscutilities miscutilities getprotocolofurl maybereloadrequestrunning vfsupdate maybereloadrequestrunning browserview maybereloaddirectory vfsmanager runinawtthread maybereloadrequestrunning vfs manager run inawt thread new runnable public void run maybe reload request running false vfsmanager runinawtthread maybereloadrequestrunning public void action performed action event evt object source evt get source if source path field source filter field source filter checkbox update filter enabled string path path field get text if path null set directory path browser view focus on file view actionperformed actionevent getsource pathfield filterfield filtercheckbox updatefilterenabled pathfield gettext setdirectory browserview focusonfileview commands menu button constructor commands menu button set text j edit get property vfs browser commands label set icon gui utilities load icon toolbar menu gif set horizontal text position swing constants leading popup new browser commands menu vfs browser this null commands menu button this set request focus enabled false set margin new insets 1 1 1 1 commands menu button this add mouse listener new mouse handler if operating system is macoslf commands menu button this put client property j button button type toolbar commandsmenubutton commandsmenubutton settext jedit getproperty seticon guiutilities loadicon toolbarmenu sethorizontaltextposition swingconstants browsercommandsmenu vfsbrowser commandsmenubutton setrequestfocusenabled setmargin commandsmenubutton addmouselistener mousehandler operatingsystem ismacoslf commandsmenubutton putclientproperty jbutton buttontype public void mouse pressed mouse event evt if popup is visible popup update gui utilities show popup menu popup commands menu button this 0 commands menu button this get height false else popup set visible false mousepressed mouseevent isvisible guiutilities showpopupmenu commandsmenubutton commandsmenubutton getheight setvisible plugins menu button constructor plugins menu button set text j edit get property vfs browser plugins label set icon gui utilities load icon toolbar menu gif set horizontal text position swing constants leading plugins menu button this set request focus enabled false set margin new insets 1 1 1 1 plugins menu button this add mouse listener new mouse handler if operating system is macoslf plugins menu button this put client property j button button type toolbar pluginsmenubutton pluginsmenubutton settext jedit getproperty seticon guiutilities loadicon toolbarmenu sethorizontaltextposition swingconstants pluginsmenubutton setrequestfocusenabled setmargin pluginsmenubutton addmouselistener mousehandler operatingsystem ismacoslf pluginsmenubutton putclientproperty jbutton buttontype update popup menu method void update popup menu popup null updatepopupmenu updatepopupmenu create popup menu method private void create popup menu if popup null return popup new j popup menu action handler action handler new action handler if get mode browser popup add gui utilities load menu item plugin manager false popup add gui utilities load menu item plugin options false popup add separator else we re in a modal dialog array list vec new array list old api enumeration e vfs manager get filesystems while e has more elements vfs vfs vfs e next element if vfs get capabilities vfs browse cap 0 continue j menu item menu item new j menu item j edit get property vfs vfs get name label menu item set action command vfs get name menu item add action listener action handler vec add menu item new api edit plugin plugins j edit get plugins for int i 0 i plugins length i j menu item menu item plugins i create browser menu items if menu item null vec add menu item if vec size 0 misc utilities quicksort vec new misc utilities menu item compare for int i 0 i vec size i popup add j menu item vec get i else j menu item mi new j menu item j edit get property vfs browser plugins no plugins label mi set enabled false popup add mi createpopupmenu createpopupmenu jpopupmenu actionhandler actionhandler actionhandler getmode guiutilities loadmenuitem guiutilities loadmenuitem addseparator arraylist arraylist vfsmanager getfilesystems hasmoreelements nextelement getcapabilities browse_cap jmenuitem menuitem jmenuitem jedit getproperty getname menuitem setactioncommand getname menuitem addactionlistener actionhandler menuitem editplugin jedit getplugins jmenuitem menuitem createbrowsermenuitems menuitem menuitem miscutilities miscutilities menuitemcompare jmenuitem jmenuitem jmenuitem jedit getproperty setenabled public void action performed action event evt vfs vfs vfs manager getvfs by name evt get action command string directory vfs show browse dialog null vfs browser this if directory null set directory directory actionperformed actionevent vfsmanager getvfsbyname getactioncommand showbrowsedialog vfsbrowser setdirectory public void mouse pressed mouse event evt create popup menu if popup is visible gui utilities show popup menu popup plugins menu button this 0 plugins menu button this get height false else popup set visible false mousepressed mouseevent createpopupmenu isvisible guiutilities showpopupmenu pluginsmenubutton pluginsmenubutton getheight setvisible favorites menu button constructor favorites menu button set text j edit get property vfs browser favorites label set icon gui utilities load icon toolbar menu gif set horizontal text position swing constants leading favorites menu button this set request focus enabled false set margin new insets 1 1 1 1 favorites menu button this add mouse listener new mouse handler if operating system is macoslf favorites menu button this put client property j button button type toolbar favoritesmenubutton favoritesmenubutton settext jedit getproperty seticon guiutilities loadicon toolbarmenu sethorizontaltextposition swingconstants favoritesmenubutton setrequestfocusenabled setmargin favoritesmenubutton addmouselistener mousehandler operatingsystem ismacoslf favoritesmenubutton putclientproperty jbutton buttontype create popup menu method void create popup menu popup new j popup menu action handler action handler new action handler j menu item mi new j menu item j edit get property vfs browser favorites add to favorites label mi set action command add to favorites mi add action listener action handler popup add mi mi new j menu item j edit get property vfs browser favorites edit favorites label mi set action command dir favorites mi add action listener action handler popup add mi popup add separator vfs directory entry favorites favoritesvfs get favorites if favorites length 0 mi new j menu item j edit get property vfs browser favorites no favorites label mi set enabled false popup add mi else misc utilities quicksort favorites new vfs directory entry compare sort mix files and dirs sort ignore case for int i 0 i favorites length i vfs directory entry favorite favorites i mi new j menu item favorite path mi set icon file cell renderer get icon for file favorite false string cmd favorite type vfs directory entry file file dir favorite path mi set action command cmd mi add action listener action handler popup add mi createpopupmenu createpopupmenu jpopupmenu actionhandler actionhandler actionhandler jmenuitem jmenuitem jedit getproperty setactioncommand addactionlistener actionhandler jmenuitem jedit getproperty setactioncommand addactionlistener actionhandler addseparator directoryentry getfavorites jmenuitem jedit getproperty setenabled miscutilities directoryentrycompare sortmixfilesanddirs sortignorecase directoryentry jmenuitem seticon filecellrenderer geticonforfile directoryentry setactioncommand addactionlistener actionhandler public void action performed action event evt string action command evt get action command if action command equals add to favorites if any directories are selected add them otherwise add current directory vfs directory entry selected get selected files if selected null selected length 0 if path equals favoritesvfs protocol gui utilities error vfs browser this vfs browser recurse favorites null else favoritesvfs add to favorites path vfs directory entry directory else for int i 0 i selected length i vfs directory entry file selected i favoritesvfs add to favorites file path file type else if action command starts with dir set directory action command substring 4 else if action command starts with file switch get mode case browser j edit open file view action command substring 5 break default locate file action command substring 5 break actionperformed actionevent actioncommand getactioncommand actioncommand directoryentry getselectedfiles guiutilities vfsbrowser addtofavorites directoryentry directoryentry addtofavorites actioncommand startswith setdirectory actioncommand actioncommand startswith getmode jedit openfile actioncommand locatefile actioncommand public void mouse pressed mouse event evt if popup null popup is visible popup set visible false return if popup null create popup menu gui utilities show popup menu popup favorites menu button this 0 favorites menu button this get height false mousepressed mouseevent isvisible setvisible createpopupmenu guiutilities showpopupmenu favoritesmenubutton favoritesmenubutton getheight directory loadedawt request object node object load info this node node this load info load info directoryloadedawtrequest loadinfo loadinfo loadinfo public void run string path string load info 0 if path null there was an error return vfs directory entry list vfs directory entry load info 1 if node null this is the new canonical path vfs browser this path path if path field get text equals path path field set text path if path ends with path ends with file separator ensure consistent history eg we don t want both foo and foo path path substring 0 path length 1 history model get model vfs browser path add item path boolean filter enabled filter checkbox is selected array list directory vector new array list int directories 0 int files 0 int invisible 0 if list null for int i 0 i list length i vfs directory entry file list i if file hidden show hidden files invisible continue if file type vfs directory entry file filter enabled filename filter null filename filter is match file name invisible continue if file type vfs directory entry file files else directories directory vector add file misc utilities quicksort directory vector new vfs directory entry compare sort mix files and dirs sort ignore case browser view directory loaded node path directory vector to notify listeners that any existing selection has been deactivated turns out under some circumstances this method can switch the current buffer in browser mode in any case this is only needed for the directory chooser why so we add a check otherwise poor rick will go insane if mode choose directory dialog files selected loadinfo directoryentry directoryentry loadinfo vfsbrowser pathfield gettext pathfield settext endswith endswith historymodel getmodel additem filterenabled filtercheckbox isselected arraylist directoryvector arraylist directoryentry showhiddenfiles directoryentry filterenabled filenamefilter filenamefilter ismatch directoryentry directoryvector miscutilities directoryvector directoryentrycompare sortmixfilesanddirs sortignorecase browserview directoryloaded directoryvector choose_directory_dialog filesselected public string to string return string load info 0 tostring loadinfo if event source hierarchy contains a vfs directory entry table this is the currently selected files there otherwise this is the currently selected item in the parent directory list private vfs directory entry get selected files event object evt vfs browser browser component source component evt get source if gui utilities get component parent source j list class null object selected browser get browser view get parent directory list get selected values vfs directory entry return value new vfs directory entry selected length system arraycopy selected 0 return value 0 selected length return return value else return browser get selected files vfsdirectoryentrytable directoryentry getselectedfiles eventobject vfsbrowser getsource guiutilities getcomponentparent jlist getbrowserview getparentdirectorylist getselectedvalues directoryentry returnvalue directoryentry returnvalue returnvalue getselectedfiles public void invoke action event object evt edit action action vfs browser browser vfs browser gui utilities get component parent component evt get source vfs browser class vfs directory entry files get selected files evt browser in the future we will want something better eg having an evt object passed to edit action invoke for now since all browser actions are written in beanshell we set the browser variable directly name space global bean shell get name space try global set variable browser browser global set variable files files view view browser get view i guess ideally all browsers should have views but since they don t we just use the active view in that case since some actions depend on a view being there and i don t want to add checks to them all if view null view j edit get active view action invoke view catch util eval error err log log log error this err finally try global set variable browser null global set variable files null catch util eval error err log log log error this err invokeaction eventobject editaction vfsbrowser vfsbrowser guiutilities getcomponentparent getsource vfsbrowser directoryentry getselectedfiles editaction namespace beanshell getnamespace setvariable setvariable getview jedit getactiveview utilevalerror setvariable setvariable utilevalerror editing option pane constructor public editing option pane super editing editingoptionpane editingoptionpane init method protected void init mode modes j edit get modes misc utilities quicksort modes new misc utilities stringi case compare global new mode properties mode props new mode properties modes length string mode names new string modes length 1 mode names 0 j edit get property options editing global for int i 0 i modes length i mode props i new mode properties modes i mode names i 1 modes i get name mode new j combo box mode names mode add action listener new action handler caption box new box box layout x axis add component caption box add component j edit get property options editing mode mode use defaults new j check box j edit get property options editing use defaults use defaults add action listener new action handler add component use defaults add component j edit get property options editing no word sep no word sep new j text field string fold modes fold handler get fold modes add component j edit get property options editing folding folding new j combo box fold modes add component j edit get property options editing collapse folds collapse folds new j text field string wrap modes none soft hard add component j edit get property options editing wrap wrap new j combo box wrap modes wrap add action listener new action handler string line lens 0 72 76 80 add component j edit get property options editing max line len max line len new j combo box line lens max line len set editable true max line len add action listener new action handler string tab sizes 2 4 8 add component j edit get property options editing tab size tab size new j combo box tab sizes tab size set editable true add component j edit get property options editing indent size indent size new j combo box tab sizes indent size set editable true add component no tabs new j check box j edit get property options editing no tabs add component deep indent new j check box j edit get property options editing deep indent add component j edit get property options editing filename glob filename glob new j text field add component j edit get property options editing firstline glob firstline glob new j text field select mode add separator default mode new j combo box modes default mode set selected item j edit get mode j edit get property buffer default mode add component j edit get property options editing default mode default mode undo count new j text field j edit get property buffer undo count add component j edit get property options editing undo count undo count _init _init jedit getmodes miscutilities miscutilities stringicasecompare modeproperties modeprops modeproperties modenames modenames jedit getproperty modeprops modeproperties modenames getname jcombobox modenames addactionlistener actionhandler captionbox boxlayout x_axis addcomponent captionbox addcomponent jedit getproperty usedefaults jcheckbox jedit getproperty usedefaults usedefaults addactionlistener actionhandler addcomponent usedefaults addcomponent jedit getproperty nowordsep nowordsep jtextfield foldmodes foldhandler getfoldmodes addcomponent jedit getproperty jcombobox foldmodes addcomponent jedit getproperty collapsefolds collapsefolds jtextfield wrapmodes addcomponent jedit getproperty jcombobox wrapmodes addactionlistener actionhandler linelens addcomponent jedit getproperty maxlinelen maxlinelen jcombobox linelens maxlinelen seteditable maxlinelen addactionlistener actionhandler tabsizes addcomponent jedit getproperty tabsize tabsize jcombobox tabsizes tabsize seteditable addcomponent jedit getproperty indentsize indentsize jcombobox tabsizes indentsize seteditable addcomponent notabs jcheckbox jedit getproperty notabs addcomponent deepindent jcheckbox jedit getproperty deepindent addcomponent jedit getproperty filenameglob filenameglob jtextfield addcomponent jedit getproperty firstlineglob firstlineglob jtextfield selectmode addseparator defaultmode jcombobox defaultmode setselecteditem jedit getmode jedit getproperty defaultmode addcomponent jedit getproperty defaultmode defaultmode undocount jtextfield jedit getproperty undocount addcomponent jedit getproperty undocount undocount save method protected void save j edit set property buffer default mode mode default mode get selected item get name j edit set property buffer undo count undo count get text save mode global save for int i 0 i mode props length i mode props i save _save _save jedit setproperty defaultmode defaultmode getselecteditem getname jedit setproperty undocount undocount gettext savemode modeprops modeprops save mode method private void save mode current use defaults use defaults is selected current filename glob filename glob get text current firstline glob firstline glob get text current no word sep no word sep get text current folding string folding get selected item current collapse folds collapse folds get text current wrap string wrap get selected item current max line len string max line len get selected item current tab size string tab size get selected item current indent size string indent size get selected item current no tabs no tabs is selected current deep indent deep indent is selected savemode savemode usedefaults usedefaults isselected filenameglob filenameglob gettext firstlineglob firstlineglob gettext nowordsep nowordsep gettext getselecteditem collapsefolds collapsefolds gettext getselecteditem maxlinelen maxlinelen getselecteditem tabsize tabsize getselecteditem indentsize indentsize getselecteditem notabs notabs isselected deepindent deepindent isselected select mode method private void select mode int index mode get selected index current index 0 global mode props index 1 current edited true current load caption box remove all caption box add gui utilities create multiline label j edit get property options editing caption index 0 0 1 use defaults set selected current use defaults filename glob set text current filename glob firstline glob set text current firstline glob no word sep set text current no word sep folding set selected item current folding collapse folds set text current collapse folds wrap set selected item current wrap max line len set selected item current max line len tab size set selected item current tab size indent size set selected item current indent size no tabs set selected current no tabs deep indent set selected current deep indent update enabled revalidate selectmode selectmode getselectedindex modeprops captionbox removeall captionbox guiutilities createmultilinelabel jedit getproperty usedefaults setselected usedefaults filenameglob settext filenameglob firstlineglob settext firstlineglob nowordsep settext nowordsep setselecteditem collapsefolds settext collapsefolds setselecteditem maxlinelen setselecteditem maxlinelen tabsize setselecteditem tabsize indentsize setselecteditem indentsize notabs setselected notabs deepindent setselected deepindent updateenabled update enabled method private void update enabled boolean enabled if current global enabled true use defaults set enabled false filename glob set enabled false firstline glob set enabled false else enabled mode props mode get selected index 1 use defaults use defaults set enabled true filename glob set enabled enabled firstline glob set enabled enabled no word sep set enabled enabled folding set enabled enabled collapse folds set enabled enabled wrap set enabled enabled max line len set enabled enabled tab size set enabled enabled indent size set enabled enabled no tabs set enabled enabled deep indent set enabled enabled updateenabled updateenabled usedefaults setenabled filenameglob setenabled firstlineglob setenabled modeprops getselectedindex usedefaults usedefaults setenabled filenameglob setenabled firstlineglob setenabled nowordsep setenabled setenabled collapsefolds setenabled setenabled maxlinelen setenabled tabsize setenabled indentsize setenabled notabs setenabled deepindent setenabled public void action performed action event evt object source evt get source if source mode save mode select mode else if source use defaults mode props mode get selected index 1 use defaults use defaults is selected update enabled else if source wrap if wrap get selected item equals none if max line len get selected item equals 0 max line len set selected item 80 else if source max line len if wrap get selected item equals none if max line len get selected item equals 0 wrap set selected item none actionperformed actionevent getsource savemode selectmode usedefaults modeprops getselectedindex usedefaults usedefaults isselected updateenabled getselecteditem maxlinelen getselecteditem maxlinelen setselecteditem maxlinelen getselecteditem maxlinelen getselecteditem setselecteditem mode properties constructor mode properties modeproperties modeproperties mode properties constructor mode properties mode mode this mode mode modeproperties modeproperties load method void load if loaded return loaded true if mode null mode load if necessary use defaults j edit get boolean property mode mode get name custom settings filename glob string mode get property filename glob firstline glob string mode get property firstline glob no word sep string mode get property no word sep folding mode get property folding to string collapse folds mode get property collapse folds to string wrap mode get property wrap to string max line len mode get property max line len to string tab size mode get property tab size to string indent size mode get property indent size to string no tabs mode get boolean property no tabs deep indent mode get boolean property deep indent else no word sep j edit get property buffer no word sep folding j edit get property buffer folding collapse folds j edit get property buffer collapse folds wrap j edit get property buffer wrap max line len j edit get property buffer max line len tab size j edit get property buffer tab size indent size j edit get property buffer indent size no tabs j edit get boolean property buffer no tabs deep indent j edit get boolean property buffer deep indent loadifnecessary usedefaults jedit getbooleanproperty getname customsettings filenameglob getproperty filenameglob firstlineglob getproperty firstlineglob nowordsep getproperty nowordsep getproperty tostring collapsefolds getproperty collapsefolds tostring getproperty tostring maxlinelen getproperty maxlinelen tostring tabsize getproperty tabsize tostring indentsize getproperty indentsize tostring notabs getbooleanproperty notabs deepindent getbooleanproperty deepindent nowordsep jedit getproperty nowordsep jedit getproperty collapsefolds jedit getproperty collapsefolds jedit getproperty maxlinelen jedit getproperty maxlinelen tabsize jedit getproperty tabsize indentsize jedit getproperty indentsize notabs jedit getbooleanproperty notabs deepindent jedit getbooleanproperty deepindent save method void save don t do anything if the user didn t change any settings if edited return string prefix if mode null prefix mode mode get name j edit set boolean property prefix custom settings use defaults need to call mode init if the file name or first line globs change string old filename glob string mode get property filename glob string old firstline glob string mode get property firstline glob if use defaults j edit reset property prefix filename glob j edit reset property prefix firstline glob j edit reset property prefix no word sep j edit reset property prefix folding j edit reset property prefix collapse folds j edit reset property prefix wrap j edit reset property prefix max line len j edit reset property prefix tab size j edit reset property prefix indent size j edit reset property prefix no tabs j edit reset property prefix deep indent if misc utilities objects equal old filename glob string mode get property filename glob misc utilities objects equal old firstline glob string mode get property firstline glob mode init return else j edit set property prefix filename glob filename glob j edit set property prefix firstline glob firstline glob if misc utilities objects equal old filename glob filename glob misc utilities objects equal old firstline glob firstline glob mode init else prefix buffer j edit set property prefix no word sep no word sep j edit set property prefix folding folding j edit set property prefix collapse folds collapse folds j edit set property prefix wrap wrap j edit set property prefix max line len max line len j edit set property prefix tab size tab size j edit set property prefix indent size indent size j edit set boolean property prefix no tabs no tabs j edit set boolean property prefix deep indent deep indent getname jedit setbooleanproperty customsettings usedefaults oldfilenameglob getproperty filenameglob oldfirstlineglob getproperty firstlineglob usedefaults jedit resetproperty filenameglob jedit resetproperty firstlineglob jedit resetproperty nowordsep jedit resetproperty jedit resetproperty collapsefolds jedit resetproperty jedit resetproperty maxlinelen jedit resetproperty tabsize jedit resetproperty indentsize jedit resetproperty notabs jedit resetproperty deepindent miscutilities objectsequal oldfilenameglob getproperty filenameglob miscutilities objectsequal oldfirstlineglob getproperty firstlineglob jedit setproperty filenameglob filenameglob jedit setproperty firstlineglob firstlineglob miscutilities objectsequal oldfilenameglob filenameglob miscutilities objectsequal oldfirstlineglob firstlineglob jedit setproperty nowordsep nowordsep jedit setproperty jedit setproperty collapsefolds collapsefolds jedit setproperty jedit setproperty maxlinelen maxlinelen jedit setproperty tabsize tabsize jedit setproperty indentsize indentsize jedit setbooleanproperty notabs notabs jedit setbooleanproperty deepindent deepindent get this is a factory for bsh this type references the capabilities of this references in bsh are version dependent up until jdk1 3 the version dependence was to support different default interface implementations i e different sets of listener interfaces which scripted objects were capable of implementing in jdk1 3 the reflection proxy mechanism was introduced which allowed us to implement arbitrary interfaces this is fantastic a this object is a thin layer over a namespace comprising a bsh object context we create it here only if needed for the namespace note this method could be considered slow because of the way it dynamically factories objects however i ve also done tests where i hard code the factory to return j this and see no change in the rough test suite time this references are also cached in name space static this get this name space namespace interpreter declaring interpreter try class c if capabilities can generate interfaces c class for name bsh x this else if capabilities have swing c class for name bsh j this else return new this namespace declaring interpreter return this reflect construct object c new object namespace declaring interpreter catch exception e throw new interpreter error internal error 1 in this e getthis jthis namespace getthis namespace declaringinterpreter cangenerateinterfaces forname xthis haveswing forname jthis declaringinterpreter constructobject declaringinterpreter interpretererror get a version of this scripted object implementing the specified interface if this type of this implements it directly return this else try complain that we don t have the proxy mechanism public object get interface class clas throws util eval error if clas is instance this return this else throw new util eval error dynamic proxy mechanism not available cannot construct interface type clas getinterface utilevalerror isinstance utilevalerror get a version of this scripted object implementing the specified interfaces public object get interface class ca throws util eval error for int i 0 i ca length i if ca i is instance this throw new util eval error dynamic proxy mechanism not available cannot construct interface type ca i return this getinterface utilevalerror isinstance utilevalerror protected this name space namespace interpreter declaring interpreter this namespace namespace this declaring interpreter declaring interpreter init call stack namespace namespace declaringinterpreter declaringinterpreter declaringinterpreter initcallstack public name space get name space return namespace namespace getnamespace public string to string return this reference to bsh object namespace tostring public void run try invoke method run new object 0 catch eval error e declaring interpreter error exception in runnable e invokemethod evalerror declaringinterpreter invoke specified method as from outside java code using the declaring interpreter and current namespace the call stack will indicate that the method is being invoked from outside of bsh in native java code note you must still wrap unwrap args return values using primitive primitive unwrap for use outside of bean shell see bsh primitive public object invoke method string name object args throws eval error null callstack one will be created for us return invoke method name args null declaring interpreter null null false declared only beanshell invokemethod evalerror invokemethod declaringinterpreter declaredonly invoke a method in this namespace with the specified args interpreter reference callstack and caller info p note if you use this method outside of the bsh package and wish to use variables with primitive values you will have to wrap them using bsh primitive consider using this get interface to make a true java interface for invoking your scripted methods p this method also implements the default object protocol of to string hash code and equals and the invoke meta method handling as a last resort p note the invoke meta method will not catch the object protocol methods to string hash code if you want to override them you have to script them directly p see bsh this invoke method string method name object args interpreter interpreter call stack callstack simple node caller info param if call stack is null a new call stack will be created and initialized with this namespace param declared only if true then only methods declared directly in the namespace will be visible no inherited or imported methods will be visible see bsh primitive invoke method here is generally used by outside code to callback into the bsh interpreter e g when we are acting as an interface for a scripted listener etc in this case there is no real call stack so we make a default one starting with the special javacode namespace and our namespace as the next public object invoke method string method name object args interpreter interpreter call stack callstack simple node caller info boolean declared only throws eval error wrap nulls this is a bit of a cludge to address a deficiency in the class generator whereby it does not wrap nulls on method delegate see class generator java if we fix that then we can remove this just have to generate the code there if args null object oa new object args length for int i 0 i args length i oa i args i null primitive null args i args oa if interpreter null interpreter declaring interpreter if callstack null callstack new call stack namespace if caller info null caller info simple node javacode find the bsh method class types types get types args bsh method bsh method null try bsh method namespace get method method name types declared only catch util eval error e leave null if bsh method null return bsh method invoke args interpreter callstack caller info no scripted method of that name implement the required part of the object protocol public int hash code public boolean equals java lang object public java lang string to string if these were not handled by scripted methods we must provide a default impl a default to string that shows the interfaces we implement if method name equals to string return to string a default hash code if method name equals hash code return new integer this hash code a default equals testing for equality with the this reference if method name equals equals object obj args 0 return new boolean this obj look for a default invoke handler method in the namespace note this code duplicates that in name space get command is that ok try bsh method namespace get method invoke new class null null catch util eval error e leave null call script invoke string method name object args if bsh method null return bsh method invoke new object method name args interpreter callstack caller info throw new eval error method string util method string method name types not found in bsh scripted object namespace get name caller info callstack getinterface tostring hashcode tostring hashcode invokemethod methodname callstack simplenode callerinfo callstack callstack declaredonly invokemethod invokemethod methodname callstack simplenode callerinfo declaredonly evalerror declaringinterpreter callstack callerinfo callerinfo simplenode gettypes bshmethod bshmethod bshmethod getmethod methodname declaredonly utilevalerror bshmethod bshmethod callerinfo hashcode tostring tostring methodname tostring tostring hashcode methodname hashcode hashcode methodname namespace getcommand bshmethod getmethod utilevalerror methodname bshmethod bshmethod methodname callerinfo evalerror stringutil methodstring methodname getname callerinfo bind a this reference to a parent s namespace with the specified declaring interpreter also re init the callstack it s necessary to bind a this reference before it can be used after deserialization this is used by the bsh load command p this is a static utility method because it s used by a bsh command bind and the interpreter doesn t currently allow access to direct methods of this objects small hack public static void bind this ths name space namespace interpreter declaring interpreter ths namespace set parent namespace ths declaring interpreter declaring interpreter namespace declaringinterpreter setparent declaringinterpreter declaringinterpreter allow invocations of these method names on this type objects don t give bsh this a chance to override their behavior p if the method is passed here the invocation will actually happen on the bsh this object via the regular reflective method invocation mechanism if not then the method is evaluated by bsh this itself as a scripted method call static boolean is exposed this method string name return name equals get class name equals invoke method name equals get interface these are necessary to let us test synchronization from scripts name equals wait name equals notify name equals notify all isexposedthismethod getclass invokemethod getinterface notifyall enhanced menu item constructor creates a new menu item most plugins should call gui utilities load menu item instead param label the menu item label param action the edit action param context an action context since j edit 4 2pre1 public enhanced menu item string label string action action context context this action action this shortcut get shortcut if operating system has screen menu bar shortcut null set text label shortcut shortcut null else set text label if action null set enabled true add action listener new edit action wrapper context action add mouse listener new mouse handler else set enabled false enhancedmenuitem guiutilities loadmenuitem jedit enhancedmenuitem actioncontext getshortcut operatingsystem hasscreenmenubar settext settext setenabled addactionlistener editaction addmouselistener mousehandler setenabled get preferred size method public dimension get preferred size dimension d super get preferred size if shortcut null d width get font metrics accelerator font string width shortcut 15 return d getpreferredsize getpreferredsize getpreferredsize getfontmetrics acceleratorfont stringwidth paint method public void paint graphics g super paint g if shortcut null g set font accelerator font g set color get model is armed accelerator selection foreground accelerator foreground font metrics fm g get font metrics insets insets get insets g draw string shortcut get width fm string width shortcut insets right insets left 5 get font get size insets top operating system is macoslf 0 1 xxx magic number setfont acceleratorfont setcolor getmodel isarmed acceleratorselectionforeground acceleratorforeground fontmetrics getfontmetrics getinsets drawstring getwidth stringwidth getfont getsize operatingsystem ismacoslf get shortcut method private string get shortcut if action null return null else string shortcut1 j edit get property action shortcut string shortcut2 j edit get property action shortcut2 if shortcut1 null shortcut1 length 0 if shortcut2 null shortcut2 length 0 return null else return shortcut2 else if shortcut2 null shortcut2 length 0 return shortcut1 else return shortcut1 or shortcut2 getshortcut getshortcut jedit getproperty jedit getproperty public void mouse released mouse event evt if msg set gui utilities get view component evt get source get status set message null msg set false mousereleased mouseevent msgset guiutilities getview getsource getstatus setmessage msgset public void mouse entered mouse event evt string msg j edit get property action mouse over if msg null gui utilities get view component evt get source get status set message msg msg set true mouseentered mouseevent jedit getproperty guiutilities getview getsource getstatus setmessage msgset public void mouse exited mouse event evt if msg set gui utilities get view component evt get source get status set message null msg set false mouseexited mouseevent msgset guiutilities getview getsource getstatus setmessage msgset bsh method bsh method declaration method name space declaring name space modifiers modifiers this method name method return type method params node get param names method params node param types method block node declaring name space modifiers bshmethod bshmethoddeclaration namespace declaringnamespace returntype paramsnode getparamnames paramsnode paramtypes blocknode declaringnamespace bsh method string name class return type string param names class param types bsh block method body name space declaring name space modifiers modifiers this name name this creturn type return type this param names param names if param names null this num args param names length this cparam types param types this method body method body this declaring name space declaring name space this modifiers modifiers bshmethod returntype paramnames paramtypes bshblock methodbody namespace declaringnamespace creturntype returntype paramnames paramnames paramnames numargs paramnames cparamtypes paramtypes methodbody methodbody declaringnamespace declaringnamespace bsh method method method object object this method get name method get return type null param names method get parameter types null method block null declaring name space null modifiers this java method method this java object object bshmethod getname getreturntype paramnames getparametertypes declaringnamespace javamethod javaobject get the argument types of this method loosely typed untyped arguments will be represented by null argument types note bshmethod needs to re evaluate arg types here this is broken public class get parameter types return cparam types public string get parameter names return param names getparametertypes cparamtypes getparameternames paramnames get the return type of the method return returns null for a loosely typed return value void type for a void return type or the class of the type note bshmethod needs to re evaluate the method return type here this is broken public class get return type return creturn type public modifiers get modifiers return modifiers getreturntype creturntype getmodifiers public modifiers get modifiers return modifiers public string get name return name getmodifiers getname invoke the declared method with the specified arguments and interpreter reference this is the simplest form of invoke for bsh method intended to be used in reflective style access to bsh scripts public object invoke object arg values interpreter interpreter throws eval error return invoke arg values interpreter null null false bshmethod argvalues evalerror argvalues invoke the declared method with the specified arguments interpreter reference and callstack p note this form of invoke uses a null node for the caller and a null node for the call stack this method is for scripts performing relective style access to scripted methods public object invoke object arg values interpreter interpreter call stack callstack throws eval error return invoke arg values interpreter callstack null false callstack argvalues callstack evalerror argvalues public object invoke object arg values interpreter interpreter call stack callstack simple node caller info throws eval error return invoke arg values interpreter callstack caller info false argvalues callstack simplenode callerinfo evalerror argvalues callerinfo invoke the bsh method with the specified args interpreter ref and callstack caller info is the node representing the method invocation it is used primarily for debugging in order to provide access to the text of the construct that invoked the method through the namespace param caller info is the bean shell ast node representing the method invocation it is used to print the line number and text of errors in eval error exceptions if the node is null here error messages may not be able to point to the precise location and text of the error param callstack is the callstack if callstack is null a new one will be created with the declaring namespace of the method on top of the stack i e it will look for purposes of the method invocation like the method call occurred in the declaring enclosing namespace in which the method is defined param override name space when true the method is executed in the namespace on the top of the stack instead of creating its own local namespace this allows it to be used in constructors object invoke object arg values interpreter interpreter call stack callstack simple node caller info boolean override name space throws eval error if java method null try return reflect invoke on method java method java object arg values catch reflect error e throw new eval error error invoking java method e caller info callstack catch invocation target exception e2 throw new target error exception invoking imported object method e2 caller info callstack true is native is this a syncrhonized method if modifiers null modifiers has modifier synchronized the lock is our declaring namespace s this reference the method s super or in the case of a class it s the class instance object lock if declaring name space is class try lock declaring name space get class instance catch util eval error e throw new interpreter error can t get class instance for synchronized method else lock declaring name space get this interpreter synchronized lock return invoke impl arg values interpreter callstack caller info override name space else return invoke impl arg values interpreter callstack caller info override name space callerinfo callerinfo beanshell evalerror overridenamespace argvalues callstack simplenode callerinfo overridenamespace evalerror javamethod invokeonmethod javamethod javaobject argvalues reflecterror evalerror callerinfo invocationtargetexception targeterror callerinfo isnative hasmodifier declaringnamespace isclass declaringnamespace getclassinstance utilevalerror interpretererror declaringnamespace getthis invokeimpl argvalues callerinfo overridenamespace invokeimpl argvalues callerinfo overridenamespace private object invoke impl object arg values interpreter interpreter call stack callstack simple node caller info boolean override name space throws eval error class return type get return type class param types get parameter types if null callstack if callstack null callstack new call stack declaring name space if arg values null arg values new object cardinality number of args mismatch if arg values length num args look for help string try should check for null namespace here string help string declaring name space get bsh help name interpreter interpreter println help return primitive void catch exception e throw eval error throw new eval error wrong number of arguments for local method name caller info callstack make the local namespace for the method invocation name space local name space if override name space local name space callstack top else local name space new name space declaring name space name local name space is method true should we do this for both cases above local name space set node caller info set the method parameters in the local namespace for int i 0 i num args i set typed variable if param types i null try arg values i types get assignable form arg values i param types i catch util eval error e throw new eval error invalid argument param names i for method name e get message caller info callstack try local name space set typed variable param names i param types i arg values i null modifiers catch util eval error e2 throw e2 to eval error typed method parameter assignment caller info callstack set untyped variable else untyped param get assignable would catch this for typed param if arg values i primitive void throw new eval error undefined variable or class name parameter param names i to method name caller info callstack else try local name space set local variable param names i arg values i interpreter get strict java catch util eval error e3 throw e3 to eval error caller info callstack push the new namespace on the call stack if override name space callstack push local name space invoke the block overriding namespace with local name space object ret method body eval callstack interpreter true override save the callstack including the called method just for error mess call stack return stack callstack copy get back to caller namespace if override name space callstack pop return control ret control null if ret instanceof return control ret control return control ret method body can only use return statment type return control if ret control kind ret control return ret return control ret value else ret control return point is the node of the return statement throw new eval error continue or break in method body ret control return point return stack check for explicit return of value from void method type ret control return point is the node of the return statement if return type void type ret primitive void throw new eval error cannot return value from void method ret control return point return stack if return type null if return type void return void as the value if return type void type return primitive void return type is a class try ret types get assignable form ret class return type catch util eval error e point to return statement point if we had one else it was implicit return what s the case here simple node node caller info if ret control null node ret control return point throw e to eval error incorrect type returned from method name e get message node callstack return ret invokeimpl argvalues callstack simplenode callerinfo overridenamespace evalerror returntype getreturntype paramtypes getparametertypes callstack declaringnamespace argvalues argvalues argvalues numargs declaringnamespace evalerror callerinfo namespace localnamespace overridenamespace localnamespace localnamespace namespace declaringnamespace localnamespace ismethod localnamespace setnode callerinfo numargs paramtypes argvalues getassignableform argvalues paramtypes utilevalerror evalerror paramnames getmessage callerinfo localnamespace settypedvariable paramnames paramtypes argvalues utilevalerror toevalerror callerinfo getassignable argvalues evalerror paramnames callerinfo localnamespace setlocalvariable paramnames argvalues getstrictjava utilevalerror toevalerror callerinfo overridenamespace localnamespace localnamespace methodbody callstack returnstack overridenamespace returncontrol retcontrol returncontrol retcontrol returncontrol retcontrol retcontrol returncontrol retcontrol returnpoint evalerror retcontrol returnpoint returnstack retcontrol returnpoint returntype evalerror retcontrol returnpoint returnstack returntype returntype getassignableform returntype utilevalerror simplenode callerinfo retcontrol retcontrol returnpoint toevalerror getmessage public boolean has modifier string name return modifiers null modifiers has modifier name hasmodifier hasmodifier public string to string return scripted method string util method string name get parameter types tostring stringutil methodstring getparametertypes class bsh try statement extends simple node bsh try statement int id super id bshtrystatement simplenode bshtrystatement public object eval call stack callstack interpreter interpreter throws eval error bsh block try block bsh block jjt get child 0 vector catch params new vector vector catch blocks new vector int nchild jjt get num children node node null int i 1 while i nchild node jjt get child i instanceof bsh formal parameter catch params add element node catch blocks add element jjt get child i node null finaly block bsh block finally block null if node null finally block bsh block node why both of these target error target null throwable thrown null object ret null evaluate the contents of the try block and catch any resulting target errors generated by the script we save the callstack depth and if an exception is thrown we pop back to that depth before contiuing the exception short circuited any intervening method context pops note we the stack info what do we do with it append to exception message int callstack depth callstack depth try ret try block eval callstack interpreter catch target error e target e string stack info bsh stack while callstack depth callstack depth stack info t callstack pop n unwrap the target error if target null thrown target get target if we have an exception find a catch if thrown null int n catch params size for i 0 i n i get catch block bsh formal parameter fp bsh formal parameter catch params element at i should cache this subject to classloader change message evaluation of the formal parameter simply resolves its type via the specified namespace it doesn t modify the namespace fp eval callstack interpreter if fp type null interpreter get strict java throw new eval error strict java untyped catch block this callstack if the param is typed check assignability if fp type null try thrown throwable types get assignable form thrown fp type catch util eval error e catch the mismatch and continue to try the next note this is innefficient should have an is assignable from that doesn t throw continue found match execute catch block bsh block cb bsh block catch blocks element at i prepare to execute the block we must create a new block name space to hold the catch parameter and swap it on the stack after initializing it name space enclosing name space callstack top block name space cb name space new block name space enclosing name space try if fp type bsh formal parameter untyped set an untyped variable directly in the block cb name space set block variable fp name thrown else set a typed variable directly in the block cb name space set typed variable fp name fp type thrown false catch util eval error e throw new interpreter error unable to set var in catch block namespace put cb name space on the top of the stack callstack swap cb name space try ret cb eval callstack interpreter finally put it back callstack swap enclosing name space target null handled target break evaluate finally block if finally block null ret finally block eval callstack interpreter exception fell through throw it upward if target null throw target if ret instanceof return control return ret else return primitive void callstack evalerror bshblock tryblock bshblock jjtgetchild catchparams catchblocks jjtgetnumchildren jjtgetchild bshformalparameter catchparams addelement catchblocks addelement jjtgetchild bshblock finallyblock finallyblock bshblock targeterror targeterrors callstackdepth tryblock targeterror stackinfo callstackdepth stackinfo gettarget catchparams bshformalparameter bshformalparameter catchparams elementat getstrictjava evalerror getassignableform utilevalerror isassignablefrom bshblock bshblock catchblocks elementat blocknamespace namespace enclosingnamespace blocknamespace cbnamespace blocknamespace enclosingnamespace bshformalparameter cbnamespace setblockvariable cbnamespace settypedvariable utilevalerror interpretererror cbnamespace cbnamespace enclosingnamespace finallyblock finallyblock returncontrol constructs a new link byte vector byte vector with a default initial size public byte vector data new byte 64 bytevector bytevector bytevector constructs a new link byte vector byte vector with the given initial size param initial size the initial size of the byte vector to be constructed public byte vector final int initial size data new byte initial size bytevector bytevector initialsize bytevector initialsize initialsize puts a byte into this byte vector the byte vector is automatically enlarged if necessary param b a byte return this byte vector public byte vector put1 final int b int length this length if length 1 data length enlarge 1 data length byte b this length length return this bytevector puts two bytes into this byte vector the byte vector is automatically enlarged if necessary param b1 a byte param b2 another byte return this byte vector public byte vector put11 final int b1 final int b2 int length this length if length 2 data length enlarge 2 byte data this data data length byte b1 data length byte b2 this length length return this bytevector puts a short into this byte vector the byte vector is automatically enlarged if necessary param s a short return this byte vector public byte vector put2 final int s int length this length if length 2 data length enlarge 2 byte data this data data length byte s 8 data length byte s this length length return this bytevector puts a byte and a short into this byte vector the byte vector is automatically enlarged if necessary param b a byte param s a short return this byte vector public byte vector put12 final int b final int s int length this length if length 3 data length enlarge 3 byte data this data data length byte b data length byte s 8 data length byte s this length length return this bytevector puts an int into this byte vector the byte vector is automatically enlarged if necessary param i an int return this byte vector public byte vector put4 final int i int length this length if length 4 data length enlarge 4 byte data this data data length byte i 24 data length byte i 16 data length byte i 8 data length byte i this length length return this bytevector puts a long into this byte vector the byte vector is automatically enlarged if necessary param l a long return this byte vector public byte vector put8 final long l int length this length if length 8 data length enlarge 8 byte data this data int i int l 32 data length byte i 24 data length byte i 16 data length byte i 8 data length byte i i int l data length byte i 24 data length byte i 16 data length byte i 8 data length byte i this length length return this bytevector puts a string in utf format into this byte vector the byte vector is automatically enlarged if necessary param s a string return this byte vector public byte vector pututf final string s int char length s length int byte length 0 for int i 0 i char length i char c s char at i if c 001 c 177 byte length else if c u07ff byte length 3 else byte length 2 if byte length 65535 throw new illegal argument exception int length this length if length 2 byte length data length enlarge 2 byte length byte data this data data length byte byte length 8 data length byte byte length for int i 0 i char length i char c s char at i if c 001 c 177 data length byte c else if c u07ff data length byte 0xe0 c 12 0xf data length byte 0x80 c 6 0x3f data length byte 0x80 c 0x3f else data length byte 0xc0 c 6 0x1f data length byte 0x80 c 0x3f this length length return this bytevector charlength bytelength charlength charat bytelength bytelength bytelength bytelength illegalargumentexception bytelength bytelength bytelength bytelength charlength charat puts an array of bytes into this byte vector the byte vector is automatically enlarged if necessary param b an array of bytes may be tt null tt to put tt len tt null bytes into this byte vector param off index of the fist byte of b that must be copied param len number of bytes of b that must be copied return this byte vector public byte vector put byte array final byte b final int off final int len if length len data length enlarge len if b null system arraycopy b off data length len length len return this bytevector putbytearray enlarge this byte vector so that it can receive n more bytes param size number of additional bytes that this byte vector should be able to receive private void enlarge final int size byte new data new byte math max 2 data length length size system arraycopy data 0 new data 0 length data new data newdata newdata newdata gutter option pane constructor public gutter option pane super gutter gutteroptionpane gutteroptionpane init method public void init line numbering line numbers enabled new j check box j edit get property options gutter line numbers line numbers enabled set selected j edit get boolean property view gutter line numbers add component line numbers enabled text font gutter font new font selector j edit get font property view gutter font new font monospaced font plain 10 add component j edit get property options gutter font gutter font text color add component j edit get property options gutter foreground gutter foreground new color well button j edit get color property view gutter fg color grid bag constraints vertical background color add component j edit get property options gutter background gutter background new color well button j edit get color property view gutter bg color grid bag constraints vertical border width gutter border width new j text field j edit get property view gutter border width add component j edit get property options gutter border width gutter border width number alignment string alignments new string left center right gutter number alignment new j combo box alignments string alignment j edit get property view gutter number alignment if right equals alignment gutter number alignment set selected index 2 else if center equals alignment gutter number alignment set selected index 1 else gutter number alignment set selected index 0 add component j edit get property options gutter number alignment gutter number alignment current line highlight gutter current line highlight enabled new j check box j edit get property options gutter current line highlight gutter current line highlight enabled set selected j edit get boolean property view gutter highlight current line add component gutter current line highlight enabled gutter current line highlight new color well button j edit get color property view gutter current line color grid bag constraints vertical highlight interval and color gutter highlight interval new j text field j edit get property view gutter highlight interval 3 box gutter highlight box new box box layout x axis gutter highlight box add new j label j edit get property options gutter interval 1 gutter highlight box add box create horizontal strut 3 gutter highlight box add gutter highlight interval gutter highlight box add box create horizontal strut 3 gutter highlight box add new j label j edit get property options gutter interval 2 gutter highlight box add box create horizontal strut 12 add component gutter highlight box gutter highlight color new color well button j edit get color property view gutter highlight color grid bag constraints vertical structure highlight gutter structure highlight enabled new j check box j edit get property options gutter structure highlight gutter structure highlight enabled set selected j edit get boolean property view gutter structure highlight add component gutter structure highlight enabled gutter structure highlight new color well button j edit get color property view gutter structure highlight color grid bag constraints vertical marker highlight gutter marker highlight enabled new j check box j edit get property options gutter marker highlight gutter marker highlight enabled set selected j edit get boolean property view gutter marker highlight add component gutter marker highlight enabled gutter marker highlight new color well button j edit get color property view gutter marker color grid bag constraints vertical fold marker color add component j edit get property options gutter fold color gutter fold markers new color well button j edit get color property view gutter fold color grid bag constraints vertical focused border color add component j edit get property options gutter focus border color gutter focus border new color well button j edit get color property view gutter focus border color grid bag constraints vertical unfocused border color add component j edit get property options gutter no focus border color gutter no focus border new color well button j edit get color property view gutter no focus border color grid bag constraints vertical _init _init linenumbersenabled jcheckbox jedit getproperty linenumbers linenumbersenabled setselected jedit getbooleanproperty linenumbers addcomponent linenumbersenabled gutterfont fontselector jedit getfontproperty addcomponent jedit getproperty gutterfont addcomponent jedit getproperty gutterforeground colorwellbutton jedit getcolorproperty fgcolor gridbagconstraints addcomponent jedit getproperty gutterbackground colorwellbutton jedit getcolorproperty bgcolor gridbagconstraints gutterborderwidth jtextfield jedit getproperty borderwidth addcomponent jedit getproperty borderwidth gutterborderwidth gutternumberalignment jcombobox jedit getproperty numberalignment gutternumberalignment setselectedindex gutternumberalignment setselectedindex gutternumberalignment setselectedindex addcomponent jedit getproperty numberalignment gutternumberalignment guttercurrentlinehighlightenabled jcheckbox jedit getproperty currentlinehighlight guttercurrentlinehighlightenabled setselected jedit getbooleanproperty highlightcurrentline addcomponent guttercurrentlinehighlightenabled guttercurrentlinehighlight colorwellbutton jedit getcolorproperty currentlinecolor gridbagconstraints gutterhighlightinterval jtextfield jedit getproperty highlightinterval gutterhighlightbox boxlayout x_axis gutterhighlightbox jlabel jedit getproperty gutterhighlightbox createhorizontalstrut gutterhighlightbox gutterhighlightinterval gutterhighlightbox createhorizontalstrut gutterhighlightbox jlabel jedit getproperty gutterhighlightbox createhorizontalstrut addcomponent gutterhighlightbox gutterhighlightcolor colorwellbutton jedit getcolorproperty highlightcolor gridbagconstraints gutterstructurehighlightenabled jcheckbox jedit getproperty structurehighlight gutterstructurehighlightenabled setselected jedit getbooleanproperty structurehighlight addcomponent gutterstructurehighlightenabled gutterstructurehighlight colorwellbutton jedit getcolorproperty structurehighlightcolor gridbagconstraints guttermarkerhighlightenabled jcheckbox jedit getproperty markerhighlight guttermarkerhighlightenabled setselected jedit getbooleanproperty markerhighlight addcomponent guttermarkerhighlightenabled guttermarkerhighlight colorwellbutton jedit getcolorproperty markercolor gridbagconstraints addcomponent jedit getproperty foldcolor gutterfoldmarkers colorwellbutton jedit getcolorproperty foldcolor gridbagconstraints addcomponent jedit getproperty focusbordercolor gutterfocusborder colorwellbutton jedit getcolorproperty focusbordercolor gridbagconstraints addcomponent jedit getproperty nofocusbordercolor gutternofocusborder colorwellbutton jedit getcolorproperty nofocusbordercolor gridbagconstraints save method public void save j edit set boolean property view gutter line numbers line numbers enabled is selected j edit set font property view gutter font gutter font get font j edit set color property view gutter fg color gutter foreground get selected color j edit set color property view gutter bg color gutter background get selected color j edit set property view gutter border width gutter border width get text string alignment null switch gutter number alignment get selected index case 2 alignment right break case 1 alignment center break case 0 default alignment left j edit set property view gutter number alignment alignment j edit set boolean property view gutter highlight current line gutter current line highlight enabled is selected j edit set color property view gutter current line color gutter current line highlight get selected color j edit set property view gutter highlight interval gutter highlight interval get text j edit set color property view gutter highlight color gutter highlight color get selected color j edit set boolean property view gutter structure highlight gutter structure highlight enabled is selected j edit set color property view gutter structure highlight color gutter structure highlight get selected color j edit set boolean property view gutter marker highlight gutter marker highlight enabled is selected j edit set color property view gutter marker color gutter marker highlight get selected color j edit set color property view gutter fold color gutter fold markers get selected color j edit set color property view gutter focus border color gutter focus border get selected color j edit set color property view gutter no focus border color gutter no focus border get selected color _save _save jedit setbooleanproperty linenumbers linenumbersenabled isselected jedit setfontproperty gutterfont getfont jedit setcolorproperty fgcolor gutterforeground getselectedcolor jedit setcolorproperty bgcolor gutterbackground getselectedcolor jedit setproperty borderwidth gutterborderwidth gettext gutternumberalignment getselectedindex jedit setproperty numberalignment jedit setbooleanproperty highlightcurrentline guttercurrentlinehighlightenabled isselected jedit setcolorproperty currentlinecolor guttercurrentlinehighlight getselectedcolor jedit setproperty highlightinterval gutterhighlightinterval gettext jedit setcolorproperty highlightcolor gutterhighlightcolor getselectedcolor jedit setbooleanproperty structurehighlight gutterstructurehighlightenabled isselected jedit setcolorproperty structurehighlightcolor gutterstructurehighlight getselectedcolor jedit setbooleanproperty markerhighlight guttermarkerhighlightenabled isselected jedit setcolorproperty markercolor guttermarkerhighlight getselectedcolor jedit setcolorproperty foldcolor gutterfoldmarkers getselectedcolor jedit setcolorproperty focusbordercolor gutterfocusborder getselectedcolor jedit setcolorproperty nofocusbordercolor gutternofocusborder getselectedcolor get standard rule set method returns a parser rule set that highlights everything with the specified token type param id the token type public static parser rule set get standard rule set byte id return standard id getstandardruleset parserruleset getstandardruleset parser rule set constructor public parser rule set string mode name string set name this mode name mode name this set name set name rule map first new parser rule rule bucket count rule map last new parser rule rule bucket count imports new linked list parserruleset parserruleset modename setname modename modename setname setname rulemapfirst parserrule rule_bucket_count rulemaplast parserrule rule_bucket_count linkedlist get mode name method public string get mode name return mode name getmodename getmodename modename get set name method public string get set name return set name getsetname getsetname setname get name method public string get name return mode name set name getname getname modename setname get properties method public hashtable get properties return props getproperties getproperties set properties method public void set properties hashtable props this props props nowordsep null setproperties setproperties _nowordsep resolve imports method resolves all rulesets added with link add rule set parser rule set since j edit 4 2pre3 public void resolve imports iterator iter imports iterator while iter has next parser rule set ruleset parser rule set iter next for int i 0 i ruleset rule map first length i parser rule rule ruleset rule map first i while rule null add rule rule rule rule next if ruleset keywords null if keywords null keywords new keyword map ignore case keywords add ruleset keywords imports clear resolveimports addruleset parserruleset jedit resolveimports hasnext parserruleset parserruleset rulemapfirst parserrule rulemapfirst addrule keywordmap ignorecase add rule set method adds all rules contained in the given ruleset param ruleset the ruleset since j edit 4 2pre3 public void add rule set parser rule set ruleset imports add ruleset addruleset jedit addruleset parserruleset add rule method public void add rule parser rule r rule count int key character to upper case r hash char rule bucket count parser rule last rule map last key if last null rule map first key rule map last key r else last next r rule map last key r addrule addrule parserrule rulecount touppercase hashchar rule_bucket_count parserrule rulemaplast rulemapfirst rulemaplast rulemaplast get rules method public parser rule get rules char ch int key character to upper case ch rule bucket count return rule map first key getrules parserrule getrules touppercase rule_bucket_count rulemapfirst get rule count method public int get rule count return rule count getrulecount getrulecount rulecount get terminate char method public int get terminate char return terminate char getterminatechar getterminatechar terminatechar set terminate char method public void set terminate char int at char terminate char at char 0 at char 1 setterminatechar setterminatechar atchar terminatechar atchar atchar get ignore case method public boolean get ignore case return ignore case getignorecase getignorecase ignorecase set ignore case method public void set ignore case boolean b ignore case b setignorecase setignorecase ignorecase get keywords method public keyword map get keywords return keywords getkeywords keywordmap getkeywords set keywords method public void set keywords keyword map km keywords km nowordsep null setkeywords setkeywords keywordmap _nowordsep get highlight digits method public boolean get highlight digits return highlight digits gethighlightdigits gethighlightdigits highlightdigits set highlight digits method public void set highlight digits boolean highlight digits this highlight digits highlight digits sethighlightdigits sethighlightdigits highlightdigits highlightdigits highlightdigits get digit regexp method public re get digit regexp return digitre getdigitregexp getdigitregexp set digit regexp method public void set digit regexp re digitre this digitre digitre setdigitregexp setdigitregexp get escape rule method public parser rule get escape rule return escape rule getescaperule parserrule getescaperule escaperule set escape rule method public void set escape rule parser rule escape rule add rule escape rule this escape rule escape rule setescaperule setescaperule parserrule escaperule addrule escaperule escaperule escaperule get default method public byte get default return default token getdefault getdefault defaulttoken set default method public void set default byte def default token def setdefault setdefault defaulttoken get no word sep method public string get no word sep if nowordsep null nowordsep no word sep if no word sep null no word sep if keywords null no word sep keywords get non alpha numeric chars return no word sep getnowordsep getnowordsep _nowordsep _nowordsep nowordsep nowordsep nowordsep nowordsep getnonalphanumericchars nowordsep set no word sep method public void set no word sep string no word sep this no word sep no word sep nowordsep null setnowordsep setnowordsep nowordsep nowordsep nowordsep _nowordsep is built in method returns if this is a built in ruleset since j edit 4 2pre1 public boolean is built in return built in isbuiltin jedit isbuiltin builtin to string method public string to string return get class get name mode name set name tostring tostring getclass getname modename setname public target error string msg throwable t simple node node call stack callstack boolean in native code super msg node callstack target t this in native code in native code targeterror simplenode callstack innativecode innativecode innativecode public target error throwable t simple node node call stack callstack this target error t node callstack false targeterror simplenode callstack targeterror public throwable get target check for easy mistake if target instanceof invocation target exception return invocation target exception target get target exception else return target gettarget invocationtargetexception invocationtargetexception gettargetexception public string to string return super to string n target exception print target error target tostring tostring ntarget printtargeterror public void print stack trace print stack trace false system err printstacktrace printstacktrace public void print stack trace print stream out print stack trace false out printstacktrace printstream printstacktrace public void print stack trace boolean debug print stream out if debug super print stack trace out out println target stack trace target print stack trace out printstacktrace printstream printstacktrace printstacktrace generate a printable string showing the wrapped target exception if the proxy mechanism is available allow the extended print to check for undeclared throwable exception and print that embedded error public string print target error throwable t string s target to string if capabilities can generate interfaces s n x print target error t return s undeclaredthrowableexception printtargeterror tostring cangenerateinterfaces xprinttargeterror extended form of print target error this indirection is used to print undeclared throwable exceptions which are possible when the proxy mechanism is available we are shielded from compile problems by using a bsh script this is acceptable here because we re not in a critical path otherwise we d need yet another dynamically loaded module just for this public string x print target error throwable t string get target import java lang reflect undeclared throwable exception string result while target instanceof undeclared throwable exception target target get undeclared throwable result nested target to string return result interpreter i new interpreter try i set target t return string i eval get target catch eval error e throw new interpreter error xprintarget e to string undeclaredthrowableexceptions xprinttargeterror gettarget undeclaredthrowableexception undeclaredthrowableexception getundeclaredthrowable tostring gettarget evalerror interpretererror tostring return true if the target error was generated from native code e g if the script called into a compiled java class which threw the excpetion we distinguish so that we can print the stack trace for the native code case the stack trace would not be useful if the exception was generated by the script e g if the script explicitly threw an exception the stack trace would simply point to the bsh internals which generated the exception public boolean in native code return in native code targeterror innativecode innativecode help index constructor public help index words new hash map files new array list ignore word a ignore word an ignore word and ignore word are ignore word as ignore word be ignore word by ignore word can ignore word do ignore word for ignore word from ignore word how ignore word i ignore word if ignore word in ignore word is ignore word it ignore word not ignore word of ignore word on ignore word or ignore word s ignore word that ignore word the ignore word this ignore word to ignore word will ignore word with ignore word you helpindex helpindex hashmap arraylist ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword ignoreword index editor help method indexes all available help including the j edit user s guide faq and plugin documentation public void index editor help try string j edit home j edit getj edit home if j edit home null index directory misc utilities construct path j edit home doc users guide index directory misc utilities construct path j edit home doc faq index directory misc utilities construct path j edit home doc news42 catch throwable e log log log error this error indexing editor help log log log error this e pluginjar jars j edit get pluginja rs for int i 0 i jars length i try indexjar jars i get zip file catch throwable e log log log error this error indexing jar jars i get path log log log error this e log log log debug this indexed words size words indexeditorhelp jedit indexeditorhelp jedithome jedit getjedithome jedithome indexdirectory miscutilities constructpath jedithome indexdirectory miscutilities constructpath jedithome indexdirectory miscutilities constructpath jedithome jedit getpluginjars getzipfile getpath index directory method indexes all html and text files in the specified directory param dir the directory public void index directory string dir throws exception string files vfs manager get filevfs listdirectory null dir html txt true null for int i 0 i files length i indexurl files i indexdirectory indexdirectory vfsmanager getfilevfs _listdirectory indexjar method indexes all html and text files in the specified jar file param jar the jar file public void indexjar zip file jar throws exception enumeration e jar entries while e has more elements zip entry entry zip entry e next element string name entry get name string lname name to lower case if lname ends with html lname ends with txt only works for j edit plugins string url jeditresource misc utilities get file name jar get name name log log log debug this url index stream jar get input stream entry url zipfile hasmoreelements zipentry zipentry nextelement getname tolowercase endswith endswith jedit miscutilities getfilename getname indexstream getinputstream indexurl method reads the specified html file and adds all words defined therein to the index param url the html file s url public void indexurl string url throws exception input stream in if misc utilities isurl url in new url url open stream else in new file input stream url hack since help viewer needs a url url file url index stream in url inputstream _in miscutilities _in openstream _in fileinputstream helpviewer indexstream _in lookup word method public word lookup word string word object o words get word if o ignore return null else return word o lookupword lookupword get file method public help file get file int index return help file files get index getfile helpfile getfile helpfile ignore word method private void ignore word string word words put word ignore ignoreword ignoreword index stream method reads the specified html file and adds all words defined therein to the index param in the input stream param file the file private void index stream input stream in string file name throws exception help file file new help file file name files add file int index files size 1 string buffer title text new string buffer buffered reader in new buffered reader new input stream reader in try string buffer word new string buffer boolean inside tag false boolean inside entity false boolean title false int c while c in read 1 char ch char c if inside tag if ch if word to string equals title title true inside tag false word set length 0 else word append ch else if inside entity if ch inside entity false else if ch if title title false if word length 0 add word word to string index title word set length 0 inside tag true else if ch inside entity true else if title title text append ch else if character is letter or digit ch if word length 0 add word word to string index title word set length 0 else word append ch finally in close if title text length 0 file title file name else file title title text to string indexstream _in indexstream inputstream _in filename helpfile helpfile filename stringbuffer titletext stringbuffer bufferedreader bufferedreader inputstreamreader _in stringbuffer stringbuffer insidetag insideentity insidetag tostring insidetag setlength insideentity insideentity addword tostring setlength insidetag insideentity titletext isletterordigit addword tostring setlength titletext filename titletext tostring add word method private void add word string word int file boolean title word word to lower case object o words get word if o ignore return if o null words put word new word word file title else word o add occurrence file title addword addword tolowercase addoccurrence word string word int file boolean title this word word occurrences new occurrence 5 add occurrence file title addoccurrence void add occurrence int file boolean title for int i 0 i occur count i if occurrences i file file occurrences i count title title occur 1 return if occur count occurrences length occurrence new occur new occurrence occurrences length 2 system arraycopy occurrences 0 new occur 0 occur count occurrences new occur occurrences occur count new occurrence file title addoccurrence occurcount title_occur occurcount newoccur newoccur occurcount newoccur occurcount occurrence int file boolean title this file file this count title title occur 1 title_occur string title help file string file this file file helpfile public string to string return title tostring public boolean equals object o if o instanceof help file return help file o file equals file else return false helpfile helpfile text area option pane constructor public text area option pane super textarea textareaoptionpane textareaoptionpane init method public void init font font new font selector j edit get font property view font add component j edit get property options textarea font font text color add component j edit get property options textarea foreground foreground color new color well button j edit get color property view fg color grid bag constraints vertical background color add component j edit get property options textarea background background color new color well button j edit get color property view bg color grid bag constraints vertical caret color caret blink block caret blink caret new j check box j edit get property options textarea blink caret blink caret set selected j edit get boolean property view caret blink block caret new j check box j edit get property options textarea block caret block caret set selected j edit get boolean property view block caret box caret settings new box box layout x axis caret settings add new j label j edit get property options textarea caret caret settings add box create horizontal strut 6 caret settings add blink caret caret settings add block caret add component caret settings caret color new color well button j edit get color property view caret color grid bag constraints vertical selection color add component j edit get property options textarea selection selection color new color well button j edit get color property view selection color grid bag constraints vertical multiple selection color add component j edit get property options textarea multiple selection multiple selection color new color well button j edit get color property view multiple selection color grid bag constraints vertical line highlight line highlight new j check box j edit get property options textarea line highlight line highlight set selected j edit get boolean property view line highlight add component line highlight line highlight color new color well button j edit get color property view line highlight color grid bag constraints vertical structure highlight structure highlight new j check box j edit get property options textarea structure highlight structure highlight set selected j edit get boolean property view structure highlight add component structure highlight structure highlight color new color well button j edit get color property view structure highlight color grid bag constraints vertical eol markers eol markers new j check box j edit get property options textarea eol markers eol markers set selected j edit get boolean property view eol markers add component eol markers eol marker color new color well button j edit get color property view eol marker color grid bag constraints vertical wrap guide wrap guide new j check box j edit get property options textarea wrap guide wrap guide set selected j edit get boolean property view wrap guide add component wrap guide wrap guide color new color well button j edit get color property view wrap guide color grid bag constraints vertical electric borders electric borders new j check box j edit get property options textarea electric borders electric borders set selected 0 equals j edit get property view electric borders add component electric borders anti aliasing anti alias new j check box j edit get property options textarea anti alias boolean anti alias enabled j edit get boolean property view anti alias font set anti alias enabled anti alias enabled anti alias add action listener new action listener public void action performed action event evt font set anti alias enabled anti alias is selected font repaint anti alias set selected anti alias enabled add component anti alias fractional font metrics frac font metrics new j check box j edit get property options textarea frac font metrics frac font metrics set selected j edit get boolean property view frac font metrics add component frac font metrics _init _init fontselector jedit getfontproperty addcomponent jedit getproperty addcomponent jedit getproperty foregroundcolor colorwellbutton jedit getcolorproperty fgcolor gridbagconstraints addcomponent jedit getproperty backgroundcolor colorwellbutton jedit getcolorproperty bgcolor gridbagconstraints blinkcaret jcheckbox jedit getproperty blinkcaret blinkcaret setselected jedit getbooleanproperty caretblink blockcaret jcheckbox jedit getproperty blockcaret blockcaret setselected jedit getbooleanproperty blockcaret caretsettings boxlayout x_axis caretsettings jlabel jedit getproperty caretsettings createhorizontalstrut caretsettings blinkcaret caretsettings blockcaret addcomponent caretsettings caretcolor colorwellbutton jedit getcolorproperty caretcolor gridbagconstraints addcomponent jedit getproperty selectioncolor colorwellbutton jedit getcolorproperty selectioncolor gridbagconstraints addcomponent jedit getproperty multipleselection multipleselectioncolor colorwellbutton jedit getcolorproperty multipleselectioncolor gridbagconstraints linehighlight jcheckbox jedit getproperty linehighlight linehighlight setselected jedit getbooleanproperty linehighlight addcomponent linehighlight linehighlightcolor colorwellbutton jedit getcolorproperty linehighlightcolor gridbagconstraints structurehighlight jcheckbox jedit getproperty structurehighlight structurehighlight setselected jedit getbooleanproperty structurehighlight addcomponent structurehighlight structurehighlightcolor colorwellbutton jedit getcolorproperty structurehighlightcolor gridbagconstraints eolmarkers jcheckbox jedit getproperty eolmarkers eolmarkers setselected jedit getbooleanproperty eolmarkers addcomponent eolmarkers eolmarkercolor colorwellbutton jedit getcolorproperty eolmarkercolor gridbagconstraints wrapguide jcheckbox jedit getproperty wrapguide wrapguide setselected jedit getbooleanproperty wrapguide addcomponent wrapguide wrapguidecolor colorwellbutton jedit getcolorproperty wrapguidecolor gridbagconstraints electricborders jcheckbox jedit getproperty electricborders electricborders setselected jedit getproperty electricborders addcomponent electricborders antialias jcheckbox jedit getproperty antialias antialiasenabled jedit getbooleanproperty antialias setantialiasenabled antialiasenabled antialias addactionlistener actionlistener actionperformed actionevent setantialiasenabled antialias isselected antialias setselected antialiasenabled addcomponent antialias fracfontmetrics jcheckbox jedit getproperty fracfontmetrics fracfontmetrics setselected jedit getbooleanproperty fracfontmetrics addcomponent fracfontmetrics public void action performed action event evt font set anti alias enabled anti alias is selected font repaint actionperformed actionevent setantialiasenabled antialias isselected save method public void save j edit set font property view font font get font j edit set color property view fg color foreground color get selected color j edit set color property view bg color background color get selected color j edit set boolean property view caret blink blink caret is selected j edit set boolean property view block caret block caret is selected j edit set color property view caret color caret color get selected color j edit set color property view selection color selection color get selected color j edit set color property view multiple selection color multiple selection color get selected color j edit set boolean property view line highlight line highlight is selected j edit set color property view line highlight color line highlight color get selected color j edit set boolean property view structure highlight structure highlight is selected j edit set color property view structure highlight color structure highlight color get selected color j edit set boolean property view eol markers eol markers is selected j edit set color property view eol marker color eol marker color get selected color j edit set boolean property view wrap guide wrap guide is selected j edit set color property view wrap guide color wrap guide color get selected color j edit set integer property view electric borders electric borders is selected 3 0 j edit set boolean property view anti alias anti alias is selected j edit set boolean property view frac font metrics frac font metrics is selected _save _save jedit setfontproperty getfont jedit setcolorproperty fgcolor foregroundcolor getselectedcolor jedit setcolorproperty bgcolor backgroundcolor getselectedcolor jedit setbooleanproperty caretblink blinkcaret isselected jedit setbooleanproperty blockcaret blockcaret isselected jedit setcolorproperty caretcolor caretcolor getselectedcolor jedit setcolorproperty selectioncolor selectioncolor getselectedcolor jedit setcolorproperty multipleselectioncolor multipleselectioncolor getselectedcolor jedit setbooleanproperty linehighlight linehighlight isselected jedit setcolorproperty linehighlightcolor linehighlightcolor getselectedcolor jedit setbooleanproperty structurehighlight structurehighlight isselected jedit setcolorproperty structurehighlightcolor structurehighlightcolor getselectedcolor jedit setbooleanproperty eolmarkers eolmarkers isselected jedit setcolorproperty eolmarkercolor eolmarkercolor getselectedcolor jedit setbooleanproperty wrapguide wrapguide isselected jedit setcolorproperty wrapguidecolor wrapguidecolor getselectedcolor jedit setintegerproperty electricborders electricborders isselected jedit setbooleanproperty antialias antialias isselected jedit setbooleanproperty fracfontmetrics fracfontmetrics isselected is perspective dirty method we only autosave the perspective if it has changed to avoid spinning up the disk on laptops since j edit 4 2pre13 public static boolean is perspective dirty return dirty isperspectivedirty jedit isperspectivedirty set perspective dirty method we only autosave the perspective if it has changed to avoid spinning up the disk on laptops since j edit 4 2pre13 public static void set perspective dirty boolean dirty perspective manager dirty dirty setperspectivedirty jedit setperspectivedirty perspectivemanager load perspective method public static view load perspective boolean restore files string settings directory j edit get settings directory if settings directory null return null file perspective new file misc utilities construct path settings directory perspective xml if perspective exists return null log log log message perspective manager class loading perspective perspective handler handler new perspective handler restore files xml parser parser new xml parser parser set handler handler reader in null try in new buffered reader new file reader perspective parser parse null null in catch xml exception xe int line xe get line string message xe get message log log log error perspective manager class perspective line message catch file not found exception fnf catch exception e log log log error perspective manager class e finally try if in null in close catch io exception io log log log error perspective manager class io return handler view loadperspective loadperspective restorefiles settingsdirectory jedit getsettingsdirectory settingsdirectory miscutilities constructpath settingsdirectory perspectivemanager perspectivehandler perspectivehandler restorefiles xmlparser xmlparser sethandler bufferedreader filereader xmlexception getline getmessage perspectivemanager filenotfoundexception perspectivemanager ioexception perspectivemanager save perspective method public static void save perspective boolean autosave string settings directory j edit get settings directory if settings directory null return backgrounded if j edit get buffer count 0 return if autosave log log log message perspective manager class saving perspective xml file file1 new file misc utilities construct path settings directory perspective xml save file file2 new file misc utilities construct path settings directory perspective xml string line sep system get property line separator buffered writer out null try out new buffered writer new file writer file1 out write xml version 1 0 out write line sep out write doctype perspective system perspective dtd out write line sep out write perspective out write line sep buffer buffers j edit get buffers for int i 0 i buffers length i buffer buffer buffers i if buffer is new file continue out write buffer out write misc utilities chars to entities buffer get path out write buffer out write line sep view views j edit get views for int i 0 i views length i view view views i ensures that active view is saved last ie created last on next load ie in front on next load if view j edit get active view i views length 1 view last views views length 1 views i last views views length 1 view view last view view config config views i get view config out write view plain out write config plain view true false out write out write panes out write line sep out write misc utilities chars to entities config split config out write line sep out write panes out write line sep out write geometry x out write string value of config x out write y out write string value of config y out write width out write string value of config width out write height out write string value of config height out write ext state out write string value of config ext state out write out write line sep out write docking left out write config left null config left out write top out write config top null config top out write right out write config right null config right out write bottom out write config bottom null config bottom out write left pos out write string value of config left pos out write top pos out write string value of config top pos out write right pos out write string value of config right pos out write bottom pos out write string value of config bottom pos out write out write line sep out write view out write line sep out write perspective out write line sep catch io exception io log log log error perspective manager class error saving file1 log log log error perspective manager class io finally try if out null out close catch io exception e file2 delete file1 rename to file2 saveperspective saveperspective settingsdirectory jedit getsettingsdirectory settingsdirectory jedit getbuffercount perspectivemanager miscutilities constructpath settingsdirectory miscutilities constructpath settingsdirectory linesep getproperty bufferedwriter bufferedwriter filewriter linesep linesep linesep jedit getbuffers isnewfile miscutilities charstoentities getpath linesep jedit getviews jedit getactiveview viewconfig getviewconfig plainview linesep miscutilities charstoentities splitconfig linesep linesep valueof valueof valueof valueof ext_state valueof extstate linesep left_pos valueof leftpos top_pos valueof toppos right_pos valueof rightpos bottom_pos valueof bottompos linesep linesep linesep ioexception perspectivemanager perspectivemanager ioexception renameto perspective handler boolean restore files this restore files restore files config new view view config perspectivehandler restorefiles restorefiles restorefiles viewconfig public object resolve entity string public id string system id if perspective dtd equals system id this will result in a slight speed up since we don t need to read the dtd anyway as a elfred is non validating return new string reader try return new buffered reader new input stream reader get class get resource as stream recent dtd catch exception e log log log error this error while opening recent dtd log log log error this e return null resolveentity publicid systemid systemid aelfred stringreader bufferedreader inputstreamreader getclass getresourceasstream public void doctype decl string name string public id string system id throws exception if perspective equals name return log log log error this perspective xml doctype must be perspective doctypedecl publicid systemid public void attribute string aname string value boolean specified if specified return if aname equals x config x integer parse int value else if aname equals y config y integer parse int value else if aname equals width config width integer parse int value else if aname equals height config height integer parse int value else if aname equals ext state config ext state integer parse int value else if aname equals plain config plain view true equals value else if aname equals top config top value else if aname equals left config left value else if aname equals bottom config bottom value else if aname equals right config right value else if aname equals top pos config top pos integer parse int value else if aname equals left pos config left pos integer parse int value else if aname equals bottom pos config bottom pos integer parse int value else if aname equals right pos config right pos integer parse int value parseint parseint parseint parseint ext_state extstate parseint plainview top_pos toppos parseint left_pos leftpos parseint bottom_pos bottompos parseint right_pos rightpos parseint public void end element string name if name equals buffer if restore files j edit open file null char data else if name equals panes config split config char data else if name equals view view j edit new view view null config config new view view config endelement restorefiles jedit openfile chardata splitconfig chardata jedit newview viewconfig public void char data char ch int start int length char data new string ch start length chardata chardata help search panel constructor public help search panel help viewer help viewer super new border layout 6 6 this help viewer help viewer box box new box box layout x axis box add new j label j edit get property helpviewer search caption box add box create horizontal strut 6 box add search field new history text field helpviewer search search field add action listener new action handler add border layout north box results new j list results add mouse listener new mouse handler results set selection mode list selection model single selection results set cell renderer new result renderer add border layout center new j scroll pane results helpsearchpanel helpsearchpanel helpviewer helpviewer borderlayout helpviewer helpviewer boxlayout x_axis jlabel jedit getproperty createhorizontalstrut searchfield historytextfield searchfield addactionlistener actionhandler borderlayout jlist addmouselistener mousehandler setselectionmode listselectionmodel single_selection setcellrenderer resultrenderer borderlayout jscrollpane private help index get help index if index null index new help index try index index editor help catch exception e index null log log log error this e gui utilities error help viewer helpviewer search error new string e to string return index helpindex gethelpindex helpindex indexeditorhelp guiutilities helpviewer tostring private int rank result icon int rank this rank rank resulticon public int get icon width return 40 geticonwidth public int get icon height return 9 geticonheight public void paint icon component c graphics g int x int y graphics2d g2d graphics2d g create g2d set rendering hints rendering hints for int i 0 i 4 i if rank i g2d set color ui manager get color label foreground else g2d set color ui manager get color label disabled foreground g2d fill oval x i 10 y 9 9 painticon setrenderinghints renderinghints setcolor uimanager getcolor setcolor uimanager getcolor disabledforeground filloval public component get list cell renderer component j list list object value int index boolean is selected boolean cell has focus super get list cell renderer component list null index is selected cell has focus if value instanceof string set icon null set text string value else result result result value set icon new result icon result rank set text result title return this getlistcellrenderercomponent jlist isselected cellhasfocus getlistcellrenderercomponent isselected cellhasfocus seticon settext seticon resulticon settext result help index help file file int count this file file file this title file title rank count helpindex helpfile public int compare object o1 object o2 result r1 result o1 result r2 result o2 if r1 rank r2 rank return r1 title compare to r2 title else return r2 rank r1 rank compareto public void action performed action event evt final help index index get help index if index null return results set list data new string j edit get property helpviewer searching final string text search field get text final vector result model new vector vfs manager run in work thread new runnable public void run string tokenizer st new string tokenizer text we later use this to compute a relative ranking int max rank 0 while st has more tokens string word st next token to lower case help index word lookup index lookup word word if lookup null continue for int i 0 i lookup occur count i help index word occurrence occur lookup occurrences i boolean ok false help index help file file index get file occur file for int j 0 j result model size j result result result result model element at j if result file equals file file result rank occur count result rank 20 multiple files w word bonus max rank math max result rank max rank ok true break if ok max rank math max occur count max rank result model add element new result file occur count if max rank 0 turn the rankings into relative rankings from 1 to 4 for int i 0 i result model size i result result result result model element at i result rank int math ceil double result rank 4 max rank collections sort result model new result compare vfs manager run inawt thread new runnable public void run if result model size 0 results set list data new string j edit get property helpviewer no results get toolkit beep else results set list data result model actionperformed actionevent helpindex gethelpindex setlistdata jedit getproperty searchfield gettext resultmodel vfsmanager runinworkthread stringtokenizer stringtokenizer maxrank hasmoretokens nexttoken tolowercase helpindex lookupword occurcount helpindex helpindex helpfile getfile resultmodel resultmodel elementat maxrank maxrank maxrank maxrank resultmodel addelement maxrank resultmodel resultmodel elementat maxrank resultmodel resultcompare vfsmanager runinawtthread resultmodel setlistdata jedit getproperty gettoolkit setlistdata resultmodel public void run string tokenizer st new string tokenizer text we later use this to compute a relative ranking int max rank 0 while st has more tokens string word st next token to lower case help index word lookup index lookup word word if lookup null continue for int i 0 i lookup occur count i help index word occurrence occur lookup occurrences i boolean ok false help index help file file index get file occur file for int j 0 j result model size j result result result result model element at j if result file equals file file result rank occur count result rank 20 multiple files w word bonus max rank math max result rank max rank ok true break if ok max rank math max occur count max rank result model add element new result file occur count if max rank 0 turn the rankings into relative rankings from 1 to 4 for int i 0 i result model size i result result result result model element at i result rank int math ceil double result rank 4 max rank collections sort result model new result compare stringtokenizer stringtokenizer maxrank hasmoretokens nexttoken tolowercase helpindex lookupword occurcount helpindex helpindex helpfile getfile resultmodel resultmodel elementat maxrank maxrank maxrank maxrank resultmodel addelement maxrank resultmodel resultmodel elementat maxrank resultmodel resultcompare public void run if result model size 0 results set list data new string j edit get property helpviewer no results get toolkit beep else results set list data result model resultmodel setlistdata jedit getproperty gettoolkit setlistdata resultmodel public void mouse released mouse event evt int row results location to index evt get point if row 1 result result result results get model get element at row help viewer gotourl result file true mousereleased mouseevent locationtoindex getpoint getmodel getelementat helpviewer buffer update constructor creates a new buffer update message param buffer the buffer param what what happened public buffer update buffer buffer view view object what super buffer this view view if what null throw new null pointer exception what must be non null this what what bufferupdate bufferupdate nullpointerexception get what method returns what caused this buffer update public object get what return what getwhat getwhat get buffer method returns the buffer involved public buffer get buffer return buffer get source getbuffer getbuffer getsource get view method returns the view involved which may be null public view get view return view getview getview param string method public string param string return what what view view super param string paramstring paramstring paramstring global options constructor public global options frame frame super frame options j edit get property options last globaloptions globaloptions jedit getproperty global options constructor public global options frame frame string pane super frame options pane globaloptions globaloptions global options constructor public global options dialog dialog super dialog options j edit get property options last globaloptions globaloptions jedit getproperty global options constructor public global options dialog dialog string pane super dialog options pane globaloptions globaloptions create option tree model method protected option tree model create option tree model option tree model pane tree model new option tree model option group root group option group pane tree model get root initialize the j edit branch of the options tree j edit group new option group jedit j edit group add option pane abbrevs j edit group add option pane appearance j edit group add option pane auto back j edit group add option pane context j edit group add option pane docking j edit group add option pane editing j edit group add option pane general j edit group add option pane gutter j edit group add option pane mouse j edit group add option pane print j edit group add option pane plugin manager j edit group add option pane firewall j edit group add option pane shortcuts j edit group add option pane status j edit group add option pane syntax j edit group add option pane textarea j edit group add option pane toolbar j edit group add option pane view root group add option group j edit group browser group new option group browser browser group add option pane browser general browser group add option pane browser colors root group add option group browser group return pane tree model createoptiontreemodel optiontreemodel createoptiontreemodel optiontreemodel panetreemodel optiontreemodel optiongroup rootgroup optiongroup panetreemodel getroot jedit jeditgroup optiongroup jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane jeditgroup addoptionpane rootgroup addoptiongroup jeditgroup browsergroup optiongroup browsergroup addoptionpane browsergroup addoptionpane rootgroup addoptiongroup browsergroup panetreemodel get default group method protected option group get default group return null getdefaultgroup optiongroup getdefaultgroup urlvfs constructor public urlvfs super url read cap write cap read_cap write_cap construct path method public string construct path string parent string path if parent ends with return parent path else return parent path constructpath constructpath endswith createinputstream method public input stream createinputstream object session string path boolean ignore errors component comp throws io exception try return new url path open stream catch malformedurl exception mu log log log error this mu string args mu get message vfs manager error comp path ioerror badurl args return null _createinputstream inputstream _createinputstream ignoreerrors ioexception openstream malformedurlexception getmessage vfsmanager createoutputstream method public output stream createoutputstream object session string path component comp throws io exception try return new url path open connection get output stream catch malformedurl exception mu log log log error this mu string args mu get message vfs manager error comp path ioerror badurl args return null _createoutputstream outputstream _createoutputstream ioexception openconnection getoutputstream malformedurlexception getmessage vfsmanager load dockable windows method plugins shouldn t need to call this method since j edit 4 2pre1 public static void load dockable windows pluginjar plugin url uri pluginjar plugin cache entry cache reader in null try log log log debug dockable window manager class loading dockables from uri dockable list handler dh new dockable list handler plugin uri in new buffered reader new input stream reader uri open stream xml parser parser new xml parser parser set handler dh parser parse null null in if cache null cache cached dockable names dh get cached dockable names cache cached dockable action flags dh get cached dockable action flags catch xml exception xe int line xe get line string message xe get message log log log error dockable window manager class uri line message catch exception e log log log error dockable window manager class e finally try if in null in close catch io exception io log log log error dockable window manager class io loaddockablewindows jedit loaddockablewindows plugincacheentry dockablewindowmanager dockablelisthandler dockablelisthandler bufferedreader inputstreamreader openstream xmlparser xmlparser sethandler cacheddockablenames getcacheddockablenames cacheddockableactionflags getcacheddockableactionflags xmlexception getline getmessage dockablewindowmanager dockablewindowmanager ioexception dockablewindowmanager unload dockable windows method plugins shouldn t need to call this method since j edit 4 2pre1 public static void unload dockable windows pluginjar plugin iterator entries dockable window factories entry set iterator while entries has next map entry entry map entry entries next factory factory factory entry get value if factory plugin plugin entries remove unloaddockablewindows jedit unloaddockablewindows dockablewindowfactories entryset hasnext getvalue cache dockable windows method since j edit 4 2pre1 public static void cache dockable windows pluginjar plugin string name boolean actions for int i 0 i name length i factory factory new factory plugin name i null actions i dockable window factories put name i factory cachedockablewindows jedit cachedockablewindows dockablewindowfactories register dockable window method public static void register dockable window pluginjar plugin string name string code boolean actions factory factory factory dockable window factories get name if factory null factory code code factory loaded true else factory new factory plugin name code actions dockable window factories put name factory registerdockablewindow registerdockablewindow dockablewindowfactories dockablewindowfactories get registered dockable windows method public static string get registered dockable windows string ret val new string dockable window factories size iterator entries dockable window factories values iterator int i 0 while entries has next factory factory factory entries next ret val i factory name return ret val getregistereddockablewindows getregistereddockablewindows retval dockablewindowfactories dockablewindowfactories hasnext retval retval dockable list handler constructor dockable list handler pluginjar plugin url uri this plugin plugin this uri uri state stack new stack actions true cached dockable names new linked list cached dockable action flags new linked list dockablelisthandler dockablelisthandler statestack cacheddockablenames linkedlist cacheddockableactionflags linkedlist resolve entity method public object resolve entity string public id string system id if dockables dtd equals system id this will result in a slight speed up since we don t need to read the dtd anyway as a elfred is non validating return new string reader try return new buffered reader new input stream reader get class get resource as stream org gjt sp jedit dockables dtd catch exception e log log log error this error while opening dockables dtd log log log error this e return null resolveentity resolveentity publicid systemid systemid aelfred stringreader bufferedreader inputstreamreader getclass getresourceasstream attribute method public void attribute string aname string value boolean is specified aname aname null null aname intern value value null null value intern if aname name dockable name value else if aname no actions actions value false isspecified dockablename no_actions doctype decl method public void doctype decl string name string public id string system id throws exception if dockables equals name return log log log error this uri doctype must be dockables doctypedecl doctypedecl publicid systemid char data method public void char data char c int off int len string tag peek element string text new string c off len if tag dockable code text chardata chardata peekelement start element method public void start element string tag tag push element tag startelement startelement pushelement end element method public void end element string name if name null return string tag peek element if name equals tag if tag dockable register dockable window plugin dockable name code actions cached dockable names add dockable name cached dockable action flags add new boolean actions make default be true for the next action actions true pop element else can t happen throw new internal error endelement endelement peekelement registerdockablewindow dockablename cacheddockablenames dockablename cacheddockableactionflags popelement internalerror start document method public void start document try push element null catch exception e e print stack trace startdocument startdocument pushelement printstacktrace get cached dockable names method public string get cached dockable names return string cached dockable names to array new string cached dockable names size getcacheddockablenames getcacheddockablenames cacheddockablenames toarray cacheddockablenames get cached dockable action flags method public boolean get cached dockable action flags boolean return value new boolean cached dockable action flags size iterator iter cached dockable action flags iterator int i 0 while iter has next boolean flag boolean iter next boolean value return value i flag return return value getcacheddockableactionflags getcacheddockableactionflags returnvalue cacheddockableactionflags cacheddockableactionflags hasnext booleanvalue returnvalue returnvalue push element method private string push element string name name name null null name intern state stack push name return name pushelement pushelement statestack peek element method private string peek element return string state stack peek peekelement peekelement statestack pop element method private string pop element return string state stack pop popelement popelement statestack factory constructor factory pluginjar plugin string name string code boolean actions this plugin plugin this name name this code code if code null loaded true if actions action set action set plugin null j edit get built in action set plugin get action set action set add action new open action name action set add action new toggle action name action set add action new float action name string label j edit get property name label if label null label no label property name string args label j edit set temporary property name label label j edit set temporary property name toggle label j edit get property view docking toggle label args j edit set temporary property name toggle toggle true j edit set temporary property name float label j edit get property view docking float label args actionset actionset jedit getbuiltinactionset getactionset actionset addaction openaction actionset addaction toggleaction actionset addaction floataction jedit getproperty jedit settemporaryproperty jedit settemporaryproperty jedit getproperty jedit settemporaryproperty jedit settemporaryproperty jedit getproperty load method void load if loaded return load dockable windows plugin plugin get dockablesuri null loaddockablewindows getdockablesuri create dockable window method j component create dockable window view view string position load if loaded log log log warning this outdated cache return null name space name space new name space bean shell get name space dockable window manager factory create dockable window try name space set variable position position catch util eval error e log log log error this e j component win j component bean shell eval view name space code return win createdockablewindow jcomponent createdockablewindow namespace namespace namespace beanshell getnamespace dockablewindowmanager createdockablewindow namespace setvariable utilevalerror jcomponent jcomponent beanshell namespace open action constructor open action string name super name this dockable name openaction openaction invoke method public void invoke view view view get dockable window manager show dockable window dockable getdockablewindowmanager showdockablewindow get code method public string get code return view get dockable window manager show dockable window dockable getcode getcode getdockablewindowmanager showdockablewindow toggle action constructor toggle action string name super name toggle this dockable name toggleaction toggleaction invoke method public void invoke view view view get dockable window manager toggle dockable window dockable getdockablewindowmanager toggledockablewindow is selected method public boolean is selected view view return view get dockable window manager is dockable window visible dockable isselected isselected getdockablewindowmanager isdockablewindowvisible get code method public string get code return view get dockable window manager toggle dockable window dockable getcode getcode getdockablewindowmanager toggledockablewindow float action constructor float action string name super name float this dockable name floataction floataction invoke method public void invoke view view view get dockable window manager float dockable window dockable getdockablewindowmanager floatdockablewindow get code method public string get code return view get dockable window manager float dockable window dockable getcode getcode getdockablewindowmanager floatdockablewindow dockable window manager constructor creates a new dockable window manager param view the view since j edit 2 6pre3 public dockable window manager view view view view config config set layout new dockable layout this view view windows new hashtable clones new array list top new panel window container this top config top pos left new panel window container this left config left pos bottom new panel window container this bottom config bottom pos right new panel window container this right config right pos add dockable layout top buttons top button panel add dockable layout left buttons left button panel add dockable layout bottom buttons bottom button panel add dockable layout right buttons right button panel add top top dockable panel add left left dockable panel add bottom bottom dockable panel add right right dockable panel dockablewindowmanager jedit dockablewindowmanager viewconfig setlayout dockablelayout arraylist panelwindowcontainer toppos panelwindowcontainer leftpos panelwindowcontainer bottompos panelwindowcontainer rightpos dockablelayout top_buttons buttonpanel dockablelayout left_buttons buttonpanel dockablelayout bottom_buttons buttonpanel dockablelayout right_buttons buttonpanel dockablepanel dockablepanel dockablepanel dockablepanel init method initialises dockable window manager do not call this method directly public void init edit bus add to bus this iterator entries dockable window factories values iterator while entries has next add entry factory entries next properties changed editbus addtobus dockablewindowfactories hasnext addentry propertieschanged get view method returns this dockable window manager s view since j edit 4 0pre2 public view get view return view getview jedit getview float dockable window method opens a new instance of the specified dockable window in a floating container param name the dockable window name return the new dockable window instance since j edit 4 1pre2 public j component float dockable window string name entry entry entry windows get name if entry null log log log error this unknown dockable window name return null create a copy of this dockable window and float it entry new entry new entry entry factory floating new entry win new entry factory create dockable window view floating if new entry win null new entry container new floating window container this true new entry container register new entry new entry container show new entry clones add new entry return new entry win floatdockablewindow jedit jcomponent floatdockablewindow newentry newentry newentry createdockablewindow newentry newentry floatingwindowcontainer newentry newentry newentry newentry newentry newentry show dockable window method opens the specified dockable window param name the dockable window name since j edit 2 6pre3 public void show dockable window string name entry entry entry windows get name if entry null log log log error this unknown dockable window name return if entry win null entry win entry factory create dockable window view entry position if entry win null if entry position equals floating entry container null entry container new floating window container this view is plain view entry container register entry entry container show entry else an error occurred showdockablewindow jedit showdockablewindow createdockablewindow floatingwindowcontainer isplainview add dockable window method opens the specified dockable window as of j edit 4 0pre1 has the same effect as calling show dockable window param name the dockable window name since j edit 2 6pre3 public void add dockable window string name show dockable window name adddockablewindow jedit showdockablewindow jedit adddockablewindow showdockablewindow hide dockable window method hides the specified dockable window param name the dockable window name since j edit 2 6pre3 public void hide dockable window string name entry entry entry windows get name if entry null log log log error this unknown dockable window name return if entry win null return entry container show null hidedockablewindow jedit hidedockablewindow remove dockable window method hides the specified dockable window as of j edit 4 2pre1 has the same effect as calling hide dockable window param name the dockable window name since j edit 4 2pre1 public void remove dockable window string name hide dockable window name removedockablewindow jedit hidedockablewindow jedit removedockablewindow hidedockablewindow toggle dockable window method toggles the visibility of the specified dockable window param name the dockable window name public void toggle dockable window string name if is dockable window visible name remove dockable window name else add dockable window name toggledockablewindow toggledockablewindow isdockablewindowvisible removedockablewindow adddockablewindow get dockable window method returns the specified dockable window note that this method will return null if the dockable has not been added yet make sure you call link add dockable window string first param name the name of the dockable window since j edit 4 1pre2 public j component get dockable window string name return get dockable name getdockablewindow adddockablewindow jedit jcomponent getdockablewindow getdockable get dockable method returns the specified dockable window note that this method will return null if the dockable has not been added yet make sure you call link add dockable window string first for historical reasons this does the same thing as link get dockable window string param name the name of the dockable window since j edit 4 0pre1 public j component get dockable string name entry entry entry windows get name if entry null entry win null return null else return entry win getdockable adddockablewindow getdockablewindow jedit jcomponent getdockable get dockable title method returns the title of the specified dockable window param name the name of the dockable window since j edit 4 1pre5 public string get dockable title string name string title j edit get property name title if title null return no title property name else return title getdockabletitle jedit getdockabletitle jedit getproperty is dockable window visible method returns if the specified dockable window is visible param name the dockable window name public boolean is dockable window visible string name entry entry entry windows get name if entry null entry win null return false else return entry container is visible entry isdockablewindowvisible isdockablewindowvisible isvisible is dockable window docked method returns if the specified dockable window is docked into the view param name the dockable s name since j edit 4 0pre2 public boolean is dockable window docked string name entry entry entry windows get name if entry null return false else return entry position equals floating isdockablewindowdocked jedit isdockablewindowdocked close current area method closes the currently focused docking area since j edit 4 1pre3 public void close current area i don t know of any other way to fix this since invoking this command from a menu results in the focus owner being the menu until the menu goes away swing utilities invoke later new runnable public void run component comp view get focus owner while comp null system err println comp get class if comp instanceof panel window container dockable panel panel window container container panel window container dockable panel comp get window container container show null return comp comp get parent get toolkit beep closecurrentarea jedit closecurrentarea swingutilities invokelater getfocusowner getclass panelwindowcontainer dockablepanel panelwindowcontainer panelwindowcontainer dockablepanel getwindowcontainer getparent gettoolkit public void run component comp view get focus owner while comp null system err println comp get class if comp instanceof panel window container dockable panel panel window container container panel window container dockable panel comp get window container container show null return comp comp get parent get toolkit beep getfocusowner getclass panelwindowcontainer dockablepanel panelwindowcontainer panelwindowcontainer dockablepanel getwindowcontainer getparent gettoolkit close method called when the view is being closed since j edit 2 6pre3 public void close edit bus remove from bus this iterator iter windows values iterator while iter has next entry entry entry iter next if entry win null entry container unregister entry iter clones iterator while iter has next entry entry entry iter next if entry win null entry container unregister entry jedit editbus removefrombus hasnext hasnext get top docking area method public panel window container get top docking area return top gettopdockingarea panelwindowcontainer gettopdockingarea get left docking area method public panel window container get left docking area return left getleftdockingarea panelwindowcontainer getleftdockingarea get bottom docking area method public panel window container get bottom docking area return bottom getbottomdockingarea panelwindowcontainer getbottomdockingarea get right docking area method public panel window container get right docking area return right getrightdockingarea panelwindowcontainer getrightdockingarea create popup menu method public j popup menu create popup menu final dockable window container container final string dockable final boolean clone j popup menu popup new j popup menu if dockable null container instanceof panel window container action listener listener new action listener public void action performed action event evt show dockable window evt get action command string dockables panel window container container get dockables for int i 0 i dockables length i string name dockables i j menu item item new j menu item get dockable title name item set action command name item add action listener listener popup add item else j menu item caption new j menu item get dockable title dockable caption set enabled false popup add caption popup add separator string current pos j edit get property dockable dock position floating if clone string positions floating top left bottom right for int i 0 i positions length i final string pos positions i if pos equals current pos continue j menu item move menu item new j menu item j edit get property view docking menu pos move menu item add action listener new action listener public void action performed action event evt j edit set property dockable dock position pos edit bus send new dockable window update dockable window manager this dockable window update properties changed null show dockable window dockable popup add move menu item popup add separator j menu item clone menu item new j menu item j edit get property view docking menu clone clone menu item add action listener new action listener public void action performed action event evt float dockable window dockable popup add clone menu item popup add separator j menu item close menu item new j menu item j edit get property view docking menu close close menu item add action listener new action listener public void action performed action event evt if clone floating window container container dispose else remove dockable window dockable popup add close menu item if clone current pos equals floating j menu item undock menu item new j menu item j edit get property view docking menu undock undock menu item add action listener new action listener public void action performed action event evt j edit set property dockable dock position floating edit bus send new dockable window update dockable window manager this dockable window update properties changed null popup add undock menu item return popup createpopupmenu jpopupmenu createpopupmenu dockablewindowcontainer jpopupmenu jpopupmenu panelwindowcontainer actionlistener actionlistener actionperformed actionevent showdockablewindow getactioncommand panelwindowcontainer getdockables jmenuitem jmenuitem getdockabletitle setactioncommand addactionlistener jmenuitem jmenuitem getdockabletitle setenabled addseparator currentpos jedit getproperty currentpos jmenuitem movemenuitem jmenuitem jedit getproperty movemenuitem addactionlistener actionlistener actionperformed actionevent jedit setproperty editbus dockablewindowupdate dockablewindowmanager dockablewindowupdate properties_changed showdockablewindow movemenuitem addseparator jmenuitem clonemenuitem jmenuitem jedit getproperty clonemenuitem addactionlistener actionlistener actionperformed actionevent floatdockablewindow clonemenuitem addseparator jmenuitem closemenuitem jmenuitem jedit getproperty closemenuitem addactionlistener actionlistener actionperformed actionevent floatingwindowcontainer removedockablewindow closemenuitem currentpos jmenuitem undockmenuitem jmenuitem jedit getproperty undockmenuitem addactionlistener actionlistener actionperformed actionevent jedit setproperty editbus dockablewindowupdate dockablewindowmanager dockablewindowupdate properties_changed undockmenuitem action listener listener new action listener public void action performed action event evt show dockable window evt get action command actionlistener actionlistener actionperformed actionevent showdockablewindow getactioncommand public void action performed action event evt j edit set property dockable dock position pos edit bus send new dockable window update dockable window manager this dockable window update properties changed null show dockable window dockable actionperformed actionevent jedit setproperty editbus dockablewindowupdate dockablewindowmanager dockablewindowupdate properties_changed showdockablewindow clone menu item add action listener new action listener public void action performed action event evt float dockable window dockable clonemenuitem addactionlistener actionlistener actionperformed actionevent floatdockablewindow public void action performed action event evt if clone floating window container container dispose else remove dockable window dockable actionperformed actionevent floatingwindowcontainer removedockablewindow public void action performed action event evt j edit set property dockable dock position floating edit bus send new dockable window update dockable window manager this dockable window update properties changed null actionperformed actionevent jedit setproperty editbus dockablewindowupdate dockablewindowmanager dockablewindowupdate properties_changed paint children method public void paint children graphics g super paint children g if resize rect null g set color color dark gray g fill rect resize rect x resize rect y resize rect width resize rect height paintchildren paintchildren paintchildren resizerect setcolor darkgray fillrect resizerect resizerect resizerect resizerect handle message method public void handle message eb message msg if msg instanceof dockable window update if dockable window update msg get what dockable window update properties changed properties changed else if msg instanceof properties changed properties changed else if msg instanceof plugin update plugin update pmsg plugin update msg if pmsg get what plugin update loaded iterator iter dockable window factories values iterator while iter has next factory factory factory iter next if factory plugin pmsg get pluginjar add entry factory properties changed else if pmsg is exiting we don t care else if pmsg get what plugin update deactivated iterator iter get all plugin entries pmsg get pluginjar false while iter has next entry entry entry iter next if entry container null entry container remove entry else if pmsg get what plugin update unloaded iterator iter get all plugin entries pmsg get pluginjar true while iter has next entry entry entry iter next if entry container null entry container unregister entry entry win null entry container null handlemessage handlemessage ebmessage dockablewindowupdate dockablewindowupdate getwhat dockablewindowupdate properties_changed propertieschanged propertieschanged propertieschanged pluginupdate pluginupdate pluginupdate getwhat pluginupdate dockablewindowfactories hasnext getpluginjar addentry propertieschanged isexiting getwhat pluginupdate getallpluginentries getpluginjar hasnext getwhat pluginupdate getallpluginentries getpluginjar hasnext set resize pos method void set resize pos int resize pos panel window container resizing this resize pos resize pos if resize pos 0 resize pos 0 rectangle new resize rect new rectangle 0 0 panel window container splitter width 2 panel window container splitter width 2 if resizing top resize pos math min resize pos get height top button panel get height bottom dockable panel get height bottom button panel get height panel window container splitter width new resize rect x top dockable panel getx 1 new resize rect y resize pos top button panel get height 1 new resize rect width top dockable panel get width 2 else if resizing left resize pos math min resize pos get width left button panel get width right dockable panel get width right button panel get width panel window container splitter width new resize rect x resize pos left button panel get width 1 new resize rect y left dockable panel gety 1 new resize rect height left dockable panel get height 2 else if resizing bottom resize pos math min resize pos get height bottom button panel get height top dockable panel get height top button panel get height panel window container splitter width new resize rect x bottom dockable panel getx 1 new resize rect y get height bottom button panel get height resize pos panel window container splitter width 2 new resize rect width bottom dockable panel get width 2 else if resizing right resize pos math min resize pos get width right button panel get width left dockable panel get width left button panel get width panel window container splitter width new resize rect x get width right button panel get width resize pos panel window container splitter width 1 new resize rect y right dockable panel gety 1 new resize rect height right dockable panel get height 2 rectangle to repaint if resize rect null to repaint new resize rect else to repaint resize rect union new resize rect resize rect new resize rect repaint to repaint setresizepos setresizepos resizepos panelwindowcontainer resizepos resizepos resizepos resizepos newresizerect panelwindowcontainer splitter_width panelwindowcontainer splitter_width resizepos resizepos getheight buttonpanel getheight dockablepanel getheight buttonpanel getheight panelwindowcontainer splitter_width newresizerect dockablepanel newresizerect resizepos buttonpanel getheight newresizerect dockablepanel getwidth resizepos resizepos getwidth buttonpanel getwidth dockablepanel getwidth buttonpanel getwidth panelwindowcontainer splitter_width newresizerect resizepos buttonpanel getwidth newresizerect dockablepanel newresizerect dockablepanel getheight resizepos resizepos getheight buttonpanel getheight dockablepanel getheight buttonpanel getheight panelwindowcontainer splitter_width newresizerect dockablepanel newresizerect getheight buttonpanel getheight resizepos panelwindowcontainer splitter_width newresizerect dockablepanel getwidth resizepos resizepos getwidth buttonpanel getwidth dockablepanel getwidth buttonpanel getwidth panelwindowcontainer splitter_width newresizerect getwidth buttonpanel getwidth resizepos panelwindowcontainer splitter_width newresizerect dockablepanel newresizerect dockablepanel getheight torepaint resizerect torepaint newresizerect torepaint resizerect newresizerect resizerect newresizerect torepaint finish resizing method void finish resizing resize rect null repaint finishresizing finishresizing resizerect properties changed method private void properties changed if view is plain view return alternate layout j edit get boolean property view docking alternate layout string window list get registered dockable windows for int i 0 i window list length i string dockable window list i entry entry entry windows get dockable string new position j edit get property dockable dock position floating if new position equals entry position continue entry position new position if entry container null entry container unregister entry entry container null entry win null if new position equals floating do nothing else if new position equals top entry container top else if new position equals left entry container left else if new position equals bottom entry container bottom else if new position equals right entry container right else log log log warning this unknown position new position continue entry container register entry top sort dockables left sort dockables bottom sort dockables right sort dockables revalidate repaint propertieschanged propertieschanged isplainview alternatelayout jedit getbooleanproperty alternatelayout windowlist getregistereddockablewindows windowlist windowlist newposition jedit getproperty newposition newposition newposition newposition newposition newposition newposition newposition sortdockables sortdockables sortdockables sortdockables add entry method private void add entry factory factory entry e if view is plain view don t show menu items to dock into a plain view e new entry factory floating else e new entry factory if e position equals floating nothing to do else if e position equals top e container top else if e position equals left e container left else if e position equals bottom e container bottom else if e position equals right e container right else log log log warning this unknown position e position if e container null e container register e windows put factory name e addentry addentry isplainview get all plugin entries method if remove is false only remove from clones list otherwise remove from both entries and clones private iterator get all plugin entries pluginjar plugin boolean remove java util list return value new linked list iterator iter windows values iterator while iter has next entry entry entry iter next if entry factory plugin plugin return value add entry if remove iter remove iter clones iterator while iter has next entry entry entry iter next if entry factory plugin plugin return value add entry iter remove return return value iterator getallpluginentries getallpluginentries returnvalue linkedlist hasnext returnvalue hasnext returnvalue returnvalue add layout component method public void add layout component string name component comp add layout component comp name addlayoutcomponent addlayoutcomponent addlayoutcomponent add layout component method public void add layout component component comp object cons if cons null center equals cons center comp else if top toolbars equals cons top toolbars comp else if bottom toolbars equals cons bottom toolbars comp else if top equals cons top comp else if left equals cons left comp else if bottom equals cons bottom comp else if right equals cons right comp else if top buttons equals cons top buttons comp else if left buttons equals cons left buttons comp else if bottom buttons equals cons bottom buttons comp else if right buttons equals cons right buttons comp addlayoutcomponent addlayoutcomponent top_toolbars toptoolbars bottom_toolbars bottomtoolbars top_buttons topbuttons left_buttons leftbuttons bottom_buttons bottombuttons right_buttons rightbuttons remove layout component method public void remove layout component component comp if center comp center null if comp top toolbars top toolbars null if comp bottom toolbars bottom toolbars null none of the others are ever meant to be removed retarded eh this needs to be fixed eventually for plugins might want to do weird stuff to j edit s ui removelayoutcomponent removelayoutcomponent toptoolbars toptoolbars bottomtoolbars bottomtoolbars jedit preferred layout size method public dimension preferred layout size container parent dimension pref size new dimension 0 0 dimension top top get preferred size dimension left left get preferred size dimension bottom bottom get preferred size dimension right right get preferred size dimension topbuttons top buttons get preferred size dimension leftbuttons left buttons get preferred size dimension bottombuttons bottom buttons get preferred size dimension rightbuttons right buttons get preferred size dimension center center null new dimension 0 0 center get preferred size dimension toptoolbars top toolbars null new dimension 0 0 top toolbars get preferred size dimension bottomtoolbars bottom toolbars null new dimension 0 0 bottom toolbars get preferred size pref size height top height bottom height center height topbuttons height bottombuttons height toptoolbars height bottomtoolbars height pref size width left width right width math max center width math max toptoolbars width bottomtoolbars width leftbuttons width rightbuttons width return pref size preferredlayoutsize preferredlayoutsize prefsize _top getpreferredsize _left getpreferredsize _bottom getpreferredsize _right getpreferredsize _topbuttons topbuttons getpreferredsize _leftbuttons leftbuttons getpreferredsize _bottombuttons bottombuttons getpreferredsize _rightbuttons rightbuttons getpreferredsize _center getpreferredsize _toptoolbars toptoolbars toptoolbars getpreferredsize _bottomtoolbars bottomtoolbars bottomtoolbars getpreferredsize prefsize _top _bottom _center _topbuttons _bottombuttons _toptoolbars _bottomtoolbars prefsize _left _right _center _toptoolbars _bottomtoolbars _leftbuttons _rightbuttons prefsize minimum layout size method public dimension minimum layout size container parent i m lazy return preferred layout size parent minimumlayoutsize minimumlayoutsize preferredlayoutsize maximum layout size method public dimension maximum layout size container parent return new dimension integer max value integer max value maximumlayoutsize maximumlayoutsize max_value max_value layout container method public void layout container container parent dimension size parent get size dimension toptoolbars top toolbars null new dimension 0 0 top toolbars get preferred size dimension bottomtoolbars bottom toolbars null new dimension 0 0 bottom toolbars get preferred size int top button height 1 int bottom button height 1 int left button width 1 int right button width 1 dimension top top get preferred size dimension left left get preferred size dimension bottom bottom get preferred size dimension right right get preferred size int top height top height int bottom height bottom height int left width left width int right width right width boolean top empty container top buttons get component count 2 boolean left empty container left buttons get component count 2 boolean bottom empty container bottom buttons get component count 2 boolean right empty container right buttons get component count 2 dimension close box size if container top buttons get component count 0 close box size new dimension 0 0 else close box size container top buttons get component 0 get preferred size int close box width math max close box size width close box size height 1 if alternate layout lay out independent buttons int width size width int padding left empty right empty 0 close box width top button height dockable window manager this top get wrapped dimension width close box width 2 top buttons set bounds padding 0 size width padding 2 top button height bottom button height dockable window manager this bottom get wrapped dimension width bottom buttons set bounds padding size height bottom button height size width padding 2 bottom button height int height size height top button height bottom button height lay out dependent buttons left button width dockable window manager this left get wrapped dimension height left buttons set bounds 0 top height top button height left button width height top height bottom height right button width dockable window manager this right get wrapped dimension height right buttons set bounds size width right button width top height top button height right button width height top height bottom height int dimensions adjust docking areas to fit size top height left width bottom height right width top button height left button width bottom button height right button width toptoolbars bottomtoolbars top height dimensions 0 left width dimensions 1 bottom height dimensions 2 right width dimensions 3 lay out docking areas top set bounds 0 top button height size width top height bottom set bounds 0 size height bottom height bottom button height size width bottom height left set bounds left button width top button height top height left width height top height bottom height right set bounds width right button width right width top button height top height right width height top height bottom height else lay out independent buttons int height size height int padding top empty bottom empty 0 close box width left button width dockable window manager this left get wrapped dimension height close box width 2 left buttons set bounds 0 padding left button width height padding 2 right button width dockable window manager this right get wrapped dimension height right buttons set bounds size width right button width padding right button width height padding 2 int width size width left button width right button width lay out dependent buttons top button height dockable window manager this top get wrapped dimension width top buttons set bounds left button width left width 0 width left width right width top button height bottom button height dockable window manager this bottom get wrapped dimension width bottom buttons set bounds left button width left width height bottom button height width left width right width bottom button height int dimensions adjust docking areas to fit size top height left width bottom height right width top button height left button width bottom button height right button width toptoolbars bottomtoolbars top height dimensions 0 left width dimensions 1 bottom height dimensions 2 right width dimensions 3 lay out docking areas top set bounds left button width left width top button height width left width right width top height bottom set bounds left button width left width size height bottom height bottom button height width left width right width bottom height left set bounds left button width 0 left width height right set bounds size width right width right button width 0 right width height position tool bars if they are managed by us if top toolbars null top toolbars set bounds left button width left width top button height top height size width left width right width left button width right button width toptoolbars height if bottom toolbars null bottom toolbars set bounds left button width left width size height bottom height bottom button height bottomtoolbars height top button height top height size width left width right width left button width right button width bottomtoolbars height position center edit pane or split pane if center null center set bounds left button width left width top button height top height toptoolbars height size width left width right width left button width right button width size height top height top button height bottom height bottom button height toptoolbars height bottomtoolbars height layoutcontainer layoutcontainer getsize _toptoolbars toptoolbars toptoolbars getpreferredsize _bottomtoolbars bottomtoolbars bottomtoolbars getpreferredsize topbuttonheight bottombuttonheight leftbuttonwidth rightbuttonwidth _top getpreferredsize _left getpreferredsize _bottom getpreferredsize _right getpreferredsize topheight _top bottomheight _bottom leftwidth _left rightwidth _right topempty topbuttons getcomponentcount leftempty leftbuttons getcomponentcount bottomempty bottombuttons getcomponentcount rightempty rightbuttons getcomponentcount closeboxsize topbuttons getcomponentcount closeboxsize closeboxsize topbuttons getcomponent getpreferredsize closeboxwidth closeboxsize closeboxsize alternatelayout _width leftempty rightempty closeboxwidth topbuttonheight dockablewindowmanager getwrappeddimension _width closeboxwidth topbuttons setbounds topbuttonheight bottombuttonheight dockablewindowmanager getwrappeddimension _width bottombuttons setbounds bottombuttonheight bottombuttonheight _height topbuttonheight bottombuttonheight leftbuttonwidth dockablewindowmanager getwrappeddimension _height leftbuttons setbounds topheight topbuttonheight leftbuttonwidth _height topheight bottomheight rightbuttonwidth dockablewindowmanager getwrappeddimension _height rightbuttons setbounds rightbuttonwidth topheight topbuttonheight rightbuttonwidth _height topheight bottomheight adjustdockingareastofit topheight leftwidth bottomheight rightwidth topbuttonheight leftbuttonwidth bottombuttonheight rightbuttonwidth _toptoolbars _bottomtoolbars topheight leftwidth bottomheight rightwidth setbounds topbuttonheight topheight setbounds bottomheight bottombuttonheight bottomheight setbounds leftbuttonwidth topbuttonheight topheight leftwidth _height topheight bottomheight setbounds _width rightbuttonwidth rightwidth topbuttonheight topheight rightwidth _height topheight bottomheight _height topempty bottomempty closeboxwidth leftbuttonwidth dockablewindowmanager getwrappeddimension _height closeboxwidth leftbuttons setbounds leftbuttonwidth _height rightbuttonwidth dockablewindowmanager getwrappeddimension _height rightbuttons setbounds rightbuttonwidth rightbuttonwidth _height _width leftbuttonwidth rightbuttonwidth topbuttonheight dockablewindowmanager getwrappeddimension _width topbuttons setbounds leftbuttonwidth leftwidth _width leftwidth rightwidth topbuttonheight bottombuttonheight dockablewindowmanager getwrappeddimension _width bottombuttons setbounds leftbuttonwidth leftwidth _height bottombuttonheight _width leftwidth rightwidth bottombuttonheight adjustdockingareastofit topheight leftwidth bottomheight rightwidth topbuttonheight leftbuttonwidth bottombuttonheight rightbuttonwidth _toptoolbars _bottomtoolbars topheight leftwidth bottomheight rightwidth setbounds leftbuttonwidth leftwidth topbuttonheight _width leftwidth rightwidth topheight setbounds leftbuttonwidth leftwidth bottomheight bottombuttonheight _width leftwidth rightwidth bottomheight setbounds leftbuttonwidth leftwidth _height setbounds rightwidth rightbuttonwidth rightwidth _height toptoolbars toptoolbars setbounds leftbuttonwidth leftwidth topbuttonheight topheight leftwidth rightwidth leftbuttonwidth rightbuttonwidth _toptoolbars bottomtoolbars bottomtoolbars setbounds leftbuttonwidth leftwidth bottomheight bottombuttonheight _bottomtoolbars topbuttonheight topheight leftwidth rightwidth leftbuttonwidth rightbuttonwidth _bottomtoolbars setbounds leftbuttonwidth leftwidth topbuttonheight topheight _toptoolbars leftwidth rightwidth leftbuttonwidth rightbuttonwidth topheight topbuttonheight bottomheight bottombuttonheight _toptoolbars _bottomtoolbars adjust docking areas to fit method private int adjust docking areas to fit dimension size int top height int left width int bottom height int right width int top button height int left button width int bottom button height int right button width dimension toptoolbars dimension bottomtoolbars int max top height size height bottom height top button height bottom button height toptoolbars height bottomtoolbars height top height math min math max 0 max top height top height left width math min math max 0 size width left button width right button width right width left width int max bottom height size height top height top button height bottom button height toptoolbars height bottomtoolbars height bottom height math min math max 0 max bottom height bottom height right width math min math max 0 size width left button width right button width left width right width dockable window manager this top set dimension top height dockable window manager this left set dimension left width dockable window manager this bottom set dimension bottom height dockable window manager this right set dimension right width return new int top height left width bottom height right width adjustdockingareastofit adjustdockingareastofit topheight leftwidth bottomheight rightwidth topbuttonheight leftbuttonwidth bottombuttonheight rightbuttonwidth _toptoolbars _bottomtoolbars maxtopheight bottomheight topbuttonheight bottombuttonheight _toptoolbars _bottomtoolbars topheight maxtopheight topheight leftwidth leftbuttonwidth rightbuttonwidth rightwidth leftwidth maxbottomheight topheight topbuttonheight bottombuttonheight _toptoolbars _bottomtoolbars bottomheight maxbottomheight bottomheight rightwidth leftbuttonwidth rightbuttonwidth leftwidth rightwidth dockablewindowmanager setdimension topheight dockablewindowmanager setdimension leftwidth dockablewindowmanager setdimension bottomheight dockablewindowmanager setdimension rightwidth topheight leftwidth bottomheight rightwidth get layout alignmentx method public float get layout alignmentx container target return 0 5f getlayoutalignmentx getlayoutalignmentx get layout alignmenty method public float get layout alignmenty container target return 0 5f getlayoutalignmenty getlayoutalignmenty invalidate layout method public void invalidate layout container target invalidatelayout invalidatelayout entry constructor entry factory factory this factory j edit get property factory name dock position floating jedit getproperty entry constructor entry factory factory string position this factory factory this position position get the title here not in the factory constructor since the factory might be created before a plugin s props are loaded title get dockable title factory name getdockabletitle update every time method public boolean update every time return false updateeverytime updateeverytime update method public void update j menu menu final view view gui utilities get view menu action listener action listener action listener new action listener public void action performed action event evt j edit open file view evt get action command view get status set message null mouse listener mouse listener mouse listener new mouse adapter public void mouse entered mouse event evt view get status set message j menu item evt get source get action command public void mouse exited mouse event evt view get status set message null list recent vector buffer history get history if recent vector size 0 j menu item menu item new j menu item j edit get property no recent files label menu item set enabled false menu add menu item return vector menu items new vector boolean sort j edit get boolean property sort recent int max items j edit get integer property menu spillover 20 iterator iter recent vector iterator while iter has next string path buffer history entry iter next path j menu item menu item new j menu item misc utilities get file name path menu item set action command path menu item add action listener action listener menu item add mouse listener mouse listener menu item set icon file cell renderer file icon if sort menu items add element menu item else if menu get menu component count max items iter has next j menu new menu new j menu j edit get property common more menu add new menu menu new menu menu add menu item if sort misc utilities quicksort menu items new misc utilities menu item compare for int i 0 i menu items size i if menu get menu component count max items i 0 j menu new menu new j menu j edit get property common more menu add new menu menu new menu menu add j menu item menu items element at i jmenu guiutilities getview actionlistener actionlistener actionlistener actionlistener actionperformed actionevent jedit openfile getactioncommand getstatus setmessage mouselistener mouselistener mouselistener mouseadapter mouseentered mouseevent getstatus setmessage jmenuitem getsource getactioncommand mouseexited mouseevent getstatus setmessage recentvector bufferhistory gethistory recentvector jmenuitem menuitem jmenuitem jedit getproperty menuitem setenabled menuitem menuitems jedit getbooleanproperty sortrecent maxitems jedit getintegerproperty recentvector hasnext bufferhistory jmenuitem menuitem jmenuitem miscutilities getfilename menuitem setactioncommand menuitem addactionlistener actionlistener menuitem addmouselistener mouselistener menuitem seticon filecellrenderer fileicon menuitems addelement menuitem getmenucomponentcount maxitems hasnext jmenu newmenu jmenu jedit getproperty newmenu newmenu menuitem miscutilities menuitems miscutilities menuitemcompare menuitems getmenucomponentcount maxitems jmenu newmenu jmenu jedit getproperty newmenu newmenu jmenuitem menuitems elementat public void action performed action event evt j edit open file view evt get action command view get status set message null actionperformed actionevent jedit openfile getactioncommand getstatus setmessage public void mouse entered mouse event evt view get status set message j menu item evt get source get action command mouseentered mouseevent getstatus setmessage jmenuitem getsource getactioncommand public void mouse exited mouse event evt view get status set message null mouseexited mouseevent getstatus setmessage public bsh switch statement int id super id bshswitchstatement public object eval call stack callstack interpreter interpreter throws eval error int numchild jjt get num children int child 0 simple node switch exp simple node jjt get child child object switch val switch exp eval callstack interpreter note this could be made clearer by adding an inner class for the cases and an object context for the child traversal first label bsh switch label label object node return control return control null get the first label if child numchild throw new eval error empty switch statement this callstack label bsh switch label jjt get child child while more labels or blocks and haven t hit return control while child numchild return control null if label is default or equals switch val if label is default primitive equals switch val label eval callstack interpreter callstack switch exp execute nodes skipping labels until a break or return while child numchild node jjt get child child if node instanceof bsh switch label continue eval it object value simple node node eval callstack interpreter should check to disallow continue here if value instanceof return control return control return control value break else skip nodes until next label while child numchild node jjt get child child if node instanceof bsh switch label label bsh switch label node break if return control null return control kind return return return control else return primitive void callstack evalerror jjtgetnumchildren simplenode switchexp simplenode jjtgetchild switchval switchexp bshswitchlabel returncontrol returncontrol evalerror bshswitchlabel jjtgetchild returncontrol switchval isdefault primitiveequals switchval switchexp jjtgetchild bshswitchlabel simplenode returncontrol returncontrol returncontrol jjtgetchild bshswitchlabel bshswitchlabel returncontrol returncontrol returncontrol helper method for testing equals on two primitive or boxable objects yuck factor this out into primitive java private boolean primitive equals object switch val object target val call stack callstack simple node switch exp throws eval error if switch val instanceof primitive target val instanceof primitive try binary operation can return primitive or wrapper type object result primitive binary operation switch val target val parser constants eq result primitive unwrap result return result equals boolean true catch util eval error e throw e to eval error switch value switch exp get text this callstack else return switch val equals target val primitiveequals switchval targetval callstack simplenode switchexp evalerror switchval targetval binaryoperation binaryoperation switchval targetval parserconstants utilevalerror toevalerror switchexp gettext switchval targetval log viewer constructor public log viewer super new border layout j panel caption new j panel caption set layout new box layout caption box layout x axis caption set border new empty border 6 6 6 6 string settings directory j edit get settings directory if settings directory null string args misc utilities construct path settings directory activity log j label label new j label j edit get property log viewer caption args caption add label caption add box create horizontal glue tail is on j edit get boolean property log viewer tail false tail new j check box j edit get property log viewer tail label tail is on tail add action listener new action handler caption add tail caption add box create horizontal strut 12 copy new j button j edit get property log viewer copy copy add action listener new action handler caption add copy list model model log get log list model model add list data listener new list handler list new log list model add border layout north caption j scroll pane scroller new j scroll pane list dimension dim scroller get preferred size dim width math min 600 dim width scroller set preferred size dim add border layout center scroller properties changed logviewer logviewer borderlayout jpanel jpanel setlayout boxlayout boxlayout x_axis setborder emptyborder settingsdirectory jedit getsettingsdirectory settingsdirectory miscutilities constructpath settingsdirectory jlabel jlabel jedit getproperty createhorizontalglue tailison jedit getbooleanproperty jcheckbox jedit getproperty tailison addactionlistener actionhandler createhorizontalstrut jbutton jedit getproperty addactionlistener actionhandler listmodel getloglistmodel addlistdatalistener listhandler loglist borderlayout jscrollpane jscrollpane getpreferredsize setpreferredsize borderlayout propertieschanged handle message method public void handle message eb message msg if msg instanceof properties changed properties changed handlemessage handlemessage ebmessage propertieschanged propertieschanged add notify method public void add notify super add notify if tail is on int index list get model get size 1 list ensure index is visible index edit bus add to bus this addnotify addnotify addnotify tailison getmodel getsize ensureindexisvisible editbus addtobus remove notify method public void remove notify super remove notify edit bus remove from bus this removenotify removenotify removenotify editbus removefrombus focus on default component method public void focus on default component list request focus focusondefaultcomponent focusondefaultcomponent requestfocus properties changed method private void properties changed list set font j edit get font property view font list set fixed cell height list get font metrics list get font get height propertieschanged propertieschanged setfont jedit getfontproperty setfixedcellheight getfontmetrics getfont getheight public void action performed action event e object src e get source if src tail tail is on tail is on j edit set boolean property log viewer tail tail is on if tail is on int index list get model get size if index 0 list ensure index is visible index 1 else if src copy string buffer buf new string buffer object selected list get selected values if selected null selected length 0 for int i 0 i selected length i buf append selected i buf append n else list model model list get model for int i 0 i model get size i buf append model get element at i buf append n registers set register buf to string actionperformed actionevent getsource tailison tailison jedit setbooleanproperty tailison tailison getmodel getsize ensureindexisvisible stringbuffer stringbuffer getselectedvalues listmodel getmodel getsize getelementat setregister tostring class list handler implements list data listener public void interval added list data event e contents changed e listhandler listdatalistener intervaladded listdataevent contentschanged public void interval removed list data event e contents changed e intervalremoved listdataevent contentschanged public void contents changed list data event e if tail is on swing utilities invoke later new runnable public void run int index list get model get size 1 list ensure index is visible index contentschanged listdataevent tailison swingutilities invokelater getmodel getsize ensureindexisvisible public void run int index list get model get size 1 list ensure index is visible index getmodel getsize ensureindexisvisible log list list model model super model set visible row count 24 get selection model set selection mode list selection model single interval selection set autoscrolls true loglist listmodel setvisiblerowcount getselectionmodel setselectionmode listselectionmodel single_interval_selection setautoscrolls public void process mouse event mouse event evt if evt getid mouse event mouse pressed start index list location to index evt get point super process mouse event evt processmouseevent mouseevent mouseevent mouse_pressed startindex locationtoindex getpoint processmouseevent public void process mouse motion event mouse event evt if evt getid mouse event mouse dragged int row list location to index evt get point if row 1 if start index 1 list set selection interval row row start index row else list set selection interval start index row list ensure index is visible row evt consume else super process mouse motion event evt processmousemotionevent mouseevent mouseevent mouse_dragged locationtoindex getpoint startindex setselectioninterval startindex setselectioninterval startindex ensureindexisvisible processmousemotionevent plugin list constructor plugin list throws exception plugins new vector plugin hash new hashtable plugin sets new vector string path j edit get property plugin manager export url string id j edit get property plugin manager mirror id if id equals mirror list mirror none path mirror id plugin list handler handler new plugin list handler this path xml parser parser new xml parser parser set handler handler input stream in new buffered input stream new url path open stream try if in mark supported in mark 2 int b1 in read int b2 in read in reset if b1 gzip magic 1 b2 gzip magic 2 in new gzip input stream in parser parse null null new input stream reader in utf8 finally in close pluginlist pluginlist pluginhash pluginsets jedit getproperty jedit getproperty mirrorlist pluginlisthandler pluginlisthandler xmlparser xmlparser sethandler inputstream bufferedinputstream openstream marksupported gzip_magic_1 gzip_magic_2 gzipinputstream inputstreamreader add plugin method void add plugin plugin plugin plugin check if installed plugins add element plugin plugin hash put plugin name plugin addplugin addplugin checkifinstalled addelement pluginhash add plugin set method void add plugin set plugin set set plugin sets add element set addpluginset addpluginset pluginset pluginsets addelement finished method void finished after the entire list is loaded fill out plugin field in dependencies for int i 0 i plugins size i plugin plugin plugin plugins element at i for int j 0 j plugin branches size j branch branch branch plugin branches element at j for int k 0 k branch deps size k dependency dep dependency branch deps element at k if dep what equals plugin dep plugin plugin plugin hash get dep plugin name elementat elementat elementat pluginhash pluginname dump method void dump for int i 0 i plugins size i system err println plugin plugins element at i system err println elementat vector plugins new vector public string to string return plugins to string tostring tostring void check if installed check if the plugin is already installed this is a bit of hack pluginjar jars j edit get pluginja rs for int i 0 i jars length i string path jars i get path if new file path exists continue if misc utilities get file name path equals jar installed path edit plugin plugin jars i get plugin if plugin null installed version j edit get property plugin plugin get class name version break string not loaded j edit get not loaded pluginja rs for int i 0 i not loaded length i string path not loaded i if misc utilities get file name path equals jar installed path break checkifinstalled jedit getpluginjars getpath miscutilities getfilename editplugin getplugin installedversion jedit getproperty getclassname notloaded jedit getnotloadedpluginjars notloaded notloaded miscutilities getfilename string get installed version pluginjar jars j edit get pluginja rs for int i 0 i jars length i string path jars i get path if misc utilities get file name path equals jar edit plugin plugin jars i get plugin if plugin null return j edit get property plugin plugin get class name version else return null return null getinstalledversion jedit getpluginjars getpath miscutilities getfilename editplugin getplugin jedit getproperty getclassname string get installed path pluginjar jars j edit get pluginja rs for int i 0 i jars length i string path jars i get path if misc utilities get file name path equals jar return path return null getinstalledpath jedit getpluginjars getpath miscutilities getfilename find the first branch compatible with the running j edit release branch get compatible branch for int i 0 i branches size i branch branch branch branches element at i if branch can satisfy dependencies return branch return null jedit getcompatiblebranch elementat cansatisfydependencies boolean can be installed branch branch get compatible branch return branch null branch obsolete branch can satisfy dependencies canbeinstalled getcompatiblebranch cansatisfydependencies void install roster roster string install directory boolean download source string installed get installed path branch branch get compatible branch if branch obsolete if installed null roster add remove installed return branch satisfy dependencies roster install directory download source if installed null install directory misc utilities get parent of path installed roster add install installed download source branch download source branch download install directory download source branch download source size branch download size installdirectory downloadsource getinstalledpath getcompatiblebranch addremove satisfydependencies installdirectory downloadsource installdirectory miscutilities getparentofpath addinstall downloadsource downloadsource installdirectory downloadsource downloadsourcesize downloadsize public string to string return name tostring boolean can satisfy dependencies for int i 0 i deps size i dependency dep dependency deps element at i if dep can satisfy return false return true cansatisfydependencies elementat cansatisfy void satisfy dependencies roster roster string install directory boolean download source for int i 0 i deps size i dependency dep dependency deps element at i dep satisfy roster install directory download source satisfydependencies installdirectory downloadsource elementat installdirectory downloadsource public string to string return version version download download obsolete obsolete deps deps tostring dependency string what string from string to string plugin name this what what this from from this to to this plugin name plugin name pluginname pluginname pluginname boolean is satisfied if what equals plugin for int i 0 i plugin branches size i string installed version plugin get installed version if installed version null from null misc utilities compare strings installed version from false 0 to null misc utilities compare strings installed version to false 0 return true return false else if what equals jdk string java version system get property java version substring 0 3 if from null misc utilities compare strings java version from false 0 to null misc utilities compare strings java version to false 0 return true else return false else if what equals jedit string build j edit get build if from null misc utilities compare strings build from false 0 to null misc utilities compare strings build to false 0 return true else return false else log log log error this invalid dependency what return false issatisfied installedversion getinstalledversion installedversion miscutilities comparestrings installedversion miscutilities comparestrings installedversion javaversion getproperty miscutilities comparestrings javaversion miscutilities comparestrings javaversion jedit getbuild miscutilities comparestrings miscutilities comparestrings boolean can satisfy if is satisfied return true else if what equals plugin return plugin can be installed else return false cansatisfy issatisfied canbeinstalled void satisfy roster roster string install directory boolean download source if what equals plugin string installed version plugin get installed version for int i 0 i plugin branches size i branch branch branch plugin branches element at i if installed version null misc utilities compare strings installed version branch version false 0 from null misc utilities compare strings branch version from false 0 to null misc utilities compare strings branch version to false 0 plugin install roster install directory download source return installdirectory downloadsource installedversion getinstalledversion elementat installedversion miscutilities comparestrings installedversion miscutilities comparestrings miscutilities comparestrings installdirectory downloadsource public string to string return what what from from to to plugin plugin tostring load services method loads a code services xml code file since j edit 4 2pre1 public static void load services pluginjar plugin url uri pluginjar plugin cache entry cache reader in null try log log log debug j edit class loading services from uri service list handler dh new service list handler plugin uri xml parser parser new xml parser parser set handler dh in new buffered reader new input stream reader uri open stream parser parse null null in if cache null cache cached services dh get cached services catch xml exception xe int line xe get line string message xe get message log log log error service manager class uri line message catch exception e log log log error service manager class e finally try if in null in close catch io exception io log log log error service manager class io loadservices jedit loadservices plugincacheentry jedit servicelisthandler servicelisthandler xmlparser xmlparser sethandler bufferedreader inputstreamreader openstream cachedservices getcachedservices xmlexception getline getmessage servicemanager servicemanager ioexception servicemanager unload services method removes all services belonging to the specified plugin param plugin the plugin since j edit 4 2pre1 public static void unload services pluginjar plugin iterator descriptors service map key set iterator while descriptors has next descriptor d descriptor descriptors next if d plugin plugin descriptors remove unloadservices jedit unloadservices servicemap keyset hasnext register service method registers a service plugins should provide a code services xml code file instead of calling this directly param clazz the service class param name the service name param code bean shell code to create an instance of this param plugin the plugin jar or null if this is a built in service since j edit 4 2pre1 public static void register service string clazz string name string code pluginjar plugin descriptor d new descriptor clazz name code plugin service map put d d registerservice beanshell jedit registerservice servicemap unregister service method unregisters a service param clazz the service class param name the service name since j edit 4 2pre1 public static void unregister service string clazz string name descriptor d new descriptor clazz name service map remove d unregisterservice jedit unregisterservice servicemap get service types method returns all known service class types since j edit 4 2pre1 public static string get service types hash set return value new hash set iterator descriptors service map key set iterator while descriptors has next descriptor d descriptor descriptors next return value add d clazz return string return value to array new string return value size getservicetypes jedit getservicetypes hashset returnvalue hashset servicemap keyset hasnext returnvalue returnvalue toarray returnvalue get service names method returns the names of all registered services with the given class for example calling this with a parameter of org gjt sp jedit io vfs returns all known virtual file systems param clazz the class name since j edit 4 2pre1 public static string get service names string clazz array list return value new array list iterator descriptors service map key set iterator while descriptors has next descriptor d descriptor descriptors next if d clazz equals clazz return value add d name return string return value to array new string return value size getservicenames jedit getservicenames arraylist returnvalue arraylist servicemap keyset hasnext returnvalue returnvalue toarray returnvalue get service method returns an instance of the given service the first time this is called for a given service the bean shell code is evaluated the result is cached for future invocations so in effect services are singletons param clazz the service class param name the service name since j edit 4 2pre1 public static object get service string clazz string name they never taught you this in undergrad computer science descriptor key new descriptor clazz name descriptor value descriptor service map get key if value null unknown service clazz name not in table return null else if value code null load services value plugin value plugin get servicesuri null value descriptor service map get key return value get instance getservice beanshell jedit getservice servicemap loadservices getservicesuri servicemap getinstance register service method registers a service since j edit 4 2pre1 static void register service descriptor d service map put d d registerservice jedit registerservice servicemap this constructor keys the hash table descriptor string clazz string name this clazz clazz this name name this constructor is the value of the hash table descriptor string clazz string name string code pluginjar plugin this clazz clazz this name name this code code this plugin plugin object get instance if instance is null return null else if instance null lazy instantiation instance bean shell eval null bean shell get name space code if instance null avoid re running script if it gives us null instance is null true return instance getinstance instanceisnull beanshell beanshell getnamespace instanceisnull return instance public int hash code return name hash code hashcode hashcode public boolean equals object o if o instanceof descriptor descriptor d descriptor o return d clazz equals clazz d name equals name else return false enhanced button constructor public enhanced button icon icon string tool tip string action action context context super icon this action action if action null set enabled true add action listener new edit action wrapper context action add mouse listener new mouse handler else set enabled false set tool tip text tool tip enhancedbutton enhancedbutton tooltip actioncontext setenabled addactionlistener editaction addmouselistener mousehandler setenabled settooltiptext tooltip is focus traversable method public boolean is focus traversable return false isfocustraversable isfocustraversable public void mouse released mouse event evt if msg set gui utilities get view component evt get source get status set message null msg set false mousereleased mouseevent msgset guiutilities getview getsource getstatus setmessage msgset public void mouse entered mouse event evt string msg j edit get property action mouse over if msg null gui utilities get view component evt get source get status set message msg msg set true mouseentered mouseevent jedit getproperty guiutilities getview getsource getstatus setmessage msgset public void mouse exited mouse event evt if msg set gui utilities get view component evt get source get status set message null msg set false mouseexited mouseevent msgset guiutilities getview getsource getstatus setmessage msgset replaces unprintable characters by their espaced or unicode escaped equivalents in the given string protected static final string add escapes string str string buffer retval new string buffer char ch for int i 0 i str length i switch str char at i case 0 continue case b retval append b continue case t retval append t continue case n retval append n continue case f retval append f continue case r retval append r continue case retval append continue case retval append continue case retval append continue default if ch str char at i 0x20 ch 0x7e string s 0000 integer to string ch 16 retval append u s substring s length 4 s length else retval append ch continue return retval to string addescapes stringbuffer stringbuffer charat charat tostring tostring returns a detailed message for the error when it is thrown by the token manager to indicate a lexical error parameters eof seen indicates if eof caused the lexicl error cur lex state lexical state in which this error occured error line line number when the error occured error column column number when the error occured error after prefix that was seen before this error occured curchar the offending character note you can customize the lexical error message by modifying this method protected static string lexical error boolean eof seen int lex state int error line int error column string error after char cur char return lexical error at line error line column error column encountered eof seen eof add escapes string value of cur char int cur char after add escapes error after eofseen curlexstate errorline errorcolumn errorafter lexicalerror eofseen lexstate errorline errorcolumn errorafter curchar errorline errorcolumn eofseen addescapes valueof curchar curchar addescapes errorafter you can also modify the body of this method to customize your error messages for example cases like loop detected and invalid lexical state are not of end users concern so you can return something like internal error please file a bug report from this method for such cases in the release version of your parser public string get message return super get message loop_detected invalid_lexical_state getmessage getmessage public token mgr error tokenmgrerror public token mgr error string message int reason super message error code reason tokenmgrerror errorcode public token mgr error boolean eof seen int lex state int error line int error column string error after char cur char int reason this lexical error eof seen lex state error line error column error after cur char reason tokenmgrerror eofseen lexstate errorline errorcolumn errorafter curchar lexicalerror eofseen lexstate errorline errorcolumn errorafter curchar class bsh if statement extends simple node bsh if statement int id super id bshifstatement simplenode bshifstatement public object eval call stack callstack interpreter interpreter throws eval error object ret null if evaluate condition simple node jjt get child 0 callstack interpreter ret simple node jjt get child 1 eval callstack interpreter else if jjt get num children 2 ret simple node jjt get child 2 eval callstack interpreter if ret instanceof return control return ret else return primitive void callstack evalerror evaluatecondition simplenode jjtgetchild simplenode jjtgetchild jjtgetnumchildren simplenode jjtgetchild returncontrol public static boolean evaluate condition simple node cond exp call stack callstack interpreter interpreter throws eval error object obj cond exp eval callstack interpreter if obj instanceof primitive if obj primitive void throw new eval error condition evaluates to void type cond exp callstack obj primitive obj get value if obj instanceof boolean return boolean obj boolean value else throw new eval error condition must evaluate to a boolean or boolean cond exp callstack evaluatecondition simplenode condexp callstack evalerror condexp evalerror condexp getvalue booleanvalue evalerror condexp handle the start of the document p the default implementation does nothing see com microstar xml xml handler start document exception java lang exception derived methods may throw exceptions public void start document throws java lang exception xmlhandler startdocument startdocument handle the end of the document p the default implementation does nothing see com microstar xml xml handler end document exception java lang exception derived methods may throw exceptions public void end document throws java lang exception xmlhandler enddocument enddocument resolve an external entity p the default implementation simply returns the supplied system identifier see com microstar xml xml handler resolve entity exception java lang exception derived methods may throw exceptions public object resolve entity string public id string system id throws java lang exception return null xmlhandler resolveentity resolveentity publicid systemid handle the start of an external entity p the default implementation does nothing see com microstar xml xml handler start external entity exception java lang exception derived methods may throw exceptions public void start external entity string system id throws java lang exception xmlhandler startexternalentity startexternalentity systemid handle the end of an external entity p the default implementation does nothing see com microstar xml xml handler end external entity exception java lang exception derived methods may throw exceptions public void end external entity string system id throws java lang exception xmlhandler endexternalentity endexternalentity systemid handle a document type declaration p the default implementation does nothing see com microstar xml xml handler doctype decl exception java lang exception derived methods may throw exceptions public void doctype decl string name string public id string system id throws java lang exception xmlhandler doctypedecl doctypedecl publicid systemid handle an attribute assignment p the default implementation does nothing see com microstar xml xml handler attribute exception java lang exception derived methods may throw exceptions public void attribute string aname string value boolean is specified throws java lang exception xmlhandler isspecified handle the start of an element p the default implementation does nothing see com microstar xml xml handler start element exception java lang exception derived methods may throw exceptions public void start element string elname throws java lang exception xmlhandler startelement startelement handle the end of an element p the default implementation does nothing see com microstar xml xml handler end element exception java lang exception derived methods may throw exceptions public void end element string elname throws java lang exception xmlhandler endelement endelement handle character data p the default implementation does nothing see com microstar xml xml handler char data exception java lang exception derived methods may throw exceptions public void char data char ch int start int length throws java lang exception xmlhandler chardata chardata handle ignorable whitespace p the default implementation does nothing see com microstar xml xml handler ignorable whitespace exception java lang exception derived methods may throw exceptions public void ignorable whitespace char ch int start int length throws java lang exception xmlhandler ignorablewhitespace ignorablewhitespace handle a processing instruction p the default implementation does nothing see com microstar xml xml handler processing instruction exception java lang exception derived methods may throw exceptions public void processing instruction string target string data throws java lang exception xmlhandler processinginstruction processinginstruction throw an exception for a fatal error p the default implementation throws code xml exception code see com microstar xml xml handler error exception com microstar xml xml exception a specific parsing error exception java lang exception derived methods may throw exceptions public void error string message string system id int line int column throws xml exception java lang exception throw new xml exception message system id line column xmlexception xmlhandler xmlexception systemid xmlexception xmlexception systemid init method initializes the log param stdio if true standard output and error will be sent to the log param level messages with this log level or higher will be printed to the system console since j edit 3 2pre4 public static void init boolean stdio int level if stdio if system out real out system err real err system set out create print stream notice null system set err create print stream error null log level level log some stuff log message log class when reporting bugs please include the following information string props java version java vm version java runtime version java vendor java compiler os name os version os arch user home java home java class path for int i 0 i props length i log message log class props i system get property props i jedit realout realerr setout createprintstream seterr createprintstream getproperty set log writer method writes all currently logged messages to this stream if there was no stream set previously and sets the stream to write future log messages to param stream the writer since j edit 3 2pre4 public static void set log writer writer stream if log stream null stream null try if wrap for int i log line count i log length i stream write log i stream write line sep for int i 0 i log line count i stream write log i stream write line sep stream flush catch exception e do nothing who cares log stream stream setlogwriter jedit setlogwriter loglinecount linesep loglinecount linesep flush stream method flushes the log stream since j edit 2 6pre5 public static void flush stream if stream null try stream flush catch io exception io io print stack trace real err flushstream jedit flushstream ioexception printstacktrace realerr close stream method closes the log stream should be done before your program exits since j edit 2 6pre5 public static void close stream if stream null try stream close stream null catch io exception io io print stack trace real err closestream jedit closestream ioexception printstacktrace realerr get log list model method returns the list model for viewing the log contents since j edit 4 2pre1 public static list model get log list model return list model getloglistmodel jedit listmodel getloglistmodel listmodel log method logs a message this method is thread safe p the following code sends a typical debugging message to the activity log pre log log log debug this counter counter pre the corresponding activity log entry might read as follows pre debug java parser counter 15 pre param urgency the urgency can be one of code log debug code code log message code code log notice code code log warning code or code log error code param source the source of the message either an object or a class instance when writing log messages from macros set this parameter to code bean shell class code to make macro errors easier to spot in the activity log param message the message this can either be a string or an exception since j edit 2 2pre2 public static void log int urgency object source object message string source if source null source thread current thread get name if source null source thread current thread get class get name else if source instanceof class source class source get name else source source get class get name int index source last index of if index 1 source source substring index 1 if message instanceof throwable logexception urgency source throwable message else string message string value of message if multiple threads log stuff we don t want the output to get mixed up synchronized lock string tokenizer st new string tokenizer message r n int line count 0 boolean old wrap wrap while st has more tokens line count log urgency source st next token replace t list model update line count old wrap javaparser beanshell jedit _source _source currentthread getname _source _source currentthread getclass getname _source getname _source getclass getname _source lastindexof _source _source _logexception _message valueof stringtokenizer stringtokenizer _message linecount oldwrap hasmoretokens linecount _log _source nexttoken listmodel linecount oldwrap create print stream method private static print stream create print stream final int urgency final object source return new print stream new output stream public void write int b byte barray byte b write barray 0 1 public void write byte b int off int len string str new string b off len log urgency source str createprintstream printstream createprintstream printstream outputstream return new print stream new output stream public void write int b byte barray byte b write barray 0 1 printstream outputstream public void write byte b int off int len string str new string b off len log urgency source str logexception method private static void logexception final int urgency final object source final throwable message print stream out create print stream urgency source synchronized lock message print stack trace out _logexception _logexception printstream createprintstream printstacktrace log method private static void log int urgency string source string message string full message urgency to string urgency source message try log log line count full message if log line count log length wrap true log line count 0 if stream null stream write full message stream write line sep catch exception e e print stack trace real err if urgency level if urgency error real err println full message else real out println full message _log _log fullmessage urgencytostring loglinecount fullmessage loglinecount loglinecount fullmessage linesep printstacktrace realerr realerr fullmessage realout fullmessage urgency to string method private static string urgency to string int urgency switch urgency case debug return debug case message return message case notice return notice case warning return warning case error return error throw new illegal argument exception invalid urgency urgency urgencytostring urgencytostring illegalargumentexception private void fire interval added int index1 int index2 for int i 0 i listeners size i list data listener listener list data listener listeners element at i listener interval added new list data event this list data event interval added index1 index2 fireintervaladded listdatalistener listdatalistener elementat intervaladded listdataevent listdataevent interval_added private void fire interval removed int index1 int index2 for int i 0 i listeners size i list data listener listener list data listener listeners element at i listener interval removed new list data event this list data event interval removed index1 index2 fireintervalremoved listdatalistener listdatalistener elementat intervalremoved listdataevent listdataevent interval_removed public void add list data listener list data listener listener listeners add element listener addlistdatalistener listdatalistener addelement public void remove list data listener list data listener listener listeners remove element listener removelistdatalistener listdatalistener removeelement public object get element at int index if wrap if index maxlines log line count return log index log line count else return log index maxlines log line count else return log index getelementat loglinecount loglinecount loglinecount public int get size if wrap return maxlines else return log line count getsize loglinecount void update final int line count final boolean old wrap if line count 0 listeners size 0 return swing utilities invoke later new runnable public void run if wrap if old wrap fire interval removed 0 line count 1 else fire interval removed 0 log line count fire interval added maxlines line count 1 maxlines else fire interval added log line count line count 1 log line count linecount oldwrap linecount swingutilities invokelater oldwrap fireintervalremoved linecount fireintervalremoved loglinecount fireintervaladded linecount fireintervaladded loglinecount linecount loglinecount public void run if wrap if old wrap fire interval removed 0 line count 1 else fire interval removed 0 log line count fire interval added maxlines line count 1 maxlines else fire interval added log line count line count 1 log line count oldwrap fireintervalremoved linecount fireintervalremoved loglinecount fireintervaladded linecount fireintervaladded loglinecount linecount loglinecount options dialog constructor public options dialog frame frame string name string pane super frame j edit get property name title true init name pane optionsdialog optionsdialog jedit getproperty options dialog constructor public options dialog dialog dialog string name string pane super dialog j edit get property name title true init name pane optionsdialog optionsdialog jedit getproperty add option group method public void add option group option group group get default group add option group group addoptiongroup addoptiongroup optiongroup getdefaultgroup addoptiongroup add option pane method public void add option pane option pane pane get default group add option pane pane addoptionpane addoptionpane optionpane getdefaultgroup addoptionpane ok method public void ok if current pane null j edit set property name last current pane get name ok true currentpane jedit setproperty currentpane getname cancel method public void cancel if current pane null j edit set property name last current pane get name dispose currentpane jedit setproperty currentpane getname ok method public void ok boolean dispose option tree model m option tree model pane tree get model save m get root this will fire the properties changed event j edit properties changed save settings to disk j edit save settings get rid of this dialog if necessary if dispose dispose optiontreemodel optiontreemodel panetree getmodel getroot properties_changed jedit propertieschanged jedit savesettings dispose method public void dispose gui utilities save geometry this name j edit set integer property name splitter splitter get divider location super dispose guiutilities savegeometry jedit setintegerproperty getdividerlocation action performed method public void action performed action event evt object source evt get source if source ok ok else if source cancel cancel else if source apply ok false actionperformed actionperformed actionevent getsource value changed method public void value changed tree selection event evt tree path path evt get path if path null return object last path component path get last path component if last path component instanceof string last path component instanceof option pane return object nodes path get path string buffer buf new string buffer option pane option pane null int last idx nodes length 1 for int i pane tree is root visible 0 1 i last idx i string label object node nodes i if node instanceof option pane option pane option pane node label j edit get property options option pane get name label else if node instanceof option group label option group node get label else if node instanceof string label j edit get property options node label option pane option pane deferred option panes get string node if option pane null string prop name options node code string code j edit get property prop name if code null option pane option pane bean shell eval j edit get active view bean shell get name space code if option pane null deferred option panes put node option pane else continue else log log log error this prop name not defined continue else continue buf append label if i last idx buf append if option pane null return set title j edit get property options title template new object j edit get property this name title buf to string try option pane init catch throwable t log log log error this error initializing options log log log error this t if current pane null stage remove current pane get component current pane option pane stage add border layout center current pane get component stage revalidate stage repaint if is showing add notify update size current pane option pane valuechanged valuechanged treeselectionevent treepath getpath lastpathcomponent getlastpathcomponent lastpathcomponent lastpathcomponent optionpane getpath stringbuffer stringbuffer optionpane optionpane lastidx panetree isrootvisible lastidx optionpane optionpane optionpane jedit getproperty optionpane getname optiongroup optiongroup getlabel jedit getproperty optionpane optionpane deferredoptionpanes optionpane propname jedit getproperty propname optionpane optionpane beanshell jedit getactiveview beanshell getnamespace optionpane deferredoptionpanes optionpane propname lastidx optionpane settitle jedit getproperty jedit getproperty tostring optionpane currentpane currentpane getcomponent currentpane optionpane borderlayout currentpane getcomponent isshowing addnotify updatesize currentpane optionpane protected members protected abstract option tree model create option tree model optiontreemodel createoptiontreemodel protected members protected abstract option tree model create option tree model protected abstract option group get default group optiontreemodel createoptiontreemodel optiongroup getdefaultgroup init method private void init string name string pane this name name deferred option panes new hash map j panel content new j panel new border layout 12 12 content set border new empty border 12 12 12 12 set content pane content stage new j panel new border layout pane tree new j tree create option tree model pane tree set visible row count 1 pane tree set cell renderer new pane name renderer looks bad with the os x l f apparently if operating system is macoslf pane tree put client property j tree line style angled pane tree set shows root handles true pane tree set root visible false j scroll pane scroller new j scroll pane pane tree j scroll pane vertical scrollbar always j scroll pane horizontal scrollbar as needed splitter new j split pane j split pane horizontal split scroller stage content add splitter border layout center box buttons new box box layout x axis buttons add box create glue ok new j button j edit get property common ok ok add action listener this buttons add ok buttons add box create horizontal strut 6 get root pane set default button ok cancel new j button j edit get property common cancel cancel add action listener this buttons add cancel buttons add box create horizontal strut 6 apply new j button j edit get property common apply apply add action listener this buttons add apply buttons add box create glue content add buttons border layout south register the options dialog as a tree selection listener this is done before the initial selection to ensure that the first selected option pane is displayed on startup pane tree get selection model add tree selection listener this option group root node option group pane tree get model get root for int i 0 i root node get member count i pane tree expand path new tree path new object root node root node get member i returns false if no such pane exists calling with null param selects first option pane found if select pane root node pane select pane root node null splitter set divider location pane tree get preferred size width scroller get vertical scroll bar get preferred size width gui utilities load geometry this name int divider location j edit get integer property name splitter 1 if divider location 1 splitter set divider location divider location in case saved geometry is too small update size set visible true deferredoptionpanes hashmap jpanel jpanel borderlayout setborder emptyborder setcontentpane jpanel borderlayout panetree jtree createoptiontreemodel panetree setvisiblerowcount panetree setcellrenderer panenamerenderer operatingsystem ismacoslf panetree putclientproperty jtree linestyle panetree setshowsroothandles panetree setrootvisible jscrollpane jscrollpane panetree jscrollpane vertical_scrollbar_always jscrollpane horizontal_scrollbar_as_needed jsplitpane jsplitpane horizontal_split borderlayout boxlayout x_axis createglue jbutton jedit getproperty addactionlistener createhorizontalstrut getrootpane setdefaultbutton jbutton jedit getproperty addactionlistener createhorizontalstrut jbutton jedit getproperty addactionlistener createglue borderlayout treeselectionlistener optionpane panetree getselectionmodel addtreeselectionlistener optiongroup rootnode optiongroup panetree getmodel getroot rootnode getmembercount panetree expandpath treepath rootnode rootnode getmember selectpane rootnode selectpane rootnode setdividerlocation panetree getpreferredsize getverticalscrollbar getpreferredsize guiutilities loadgeometry dividerlocation jedit getintegerproperty dividerlocation setdividerlocation dividerlocation updatesize setvisible select pane method private boolean select pane option group node string name return select pane node name new array list selectpane selectpane optiongroup selectpane arraylist select pane method private boolean select pane option group node string name array list path path add node enumeration e node get members while e has more elements object obj e next element if obj instanceof option group option group grp option group obj if grp get name equals name path add grp path add grp get member 0 tree path tree path new tree path path to array pane tree scroll path to visible tree path pane tree set selection path tree path return true else if select pane option group obj name path return true else if obj instanceof option pane option pane pane option pane obj if pane get name equals name name null path add pane tree path tree path new tree path path to array pane tree scroll path to visible tree path pane tree set selection path tree path return true else if obj instanceof string string pane string obj if pane equals name name null path add pane tree path tree path new tree path path to array pane tree scroll path to visible tree path pane tree set selection path tree path return true path remove node return false selectpane selectpane optiongroup arraylist getmembers hasmoreelements nextelement optiongroup optiongroup optiongroup getname getmember treepath treepath treepath toarray panetree scrollpathtovisible treepath panetree setselectionpath treepath selectpane optiongroup optionpane optionpane optionpane getname treepath treepath treepath toarray panetree scrollpathtovisible treepath panetree setselectionpath treepath treepath treepath treepath toarray panetree scrollpathtovisible treepath panetree setselectionpath treepath save method private void save object obj if obj instanceof option group option group grp option group obj enumeration members grp get members while members has more elements save members next element else if obj instanceof option pane try option pane obj save catch throwable t log log log error this error saving options log log log error this t else if obj instanceof string save deferred option panes get obj optiongroup optiongroup optiongroup getmembers hasmoreelements nextelement optionpane optionpane deferredoptionpanes update size method private void update size dimension current size get size dimension requested size get preferred size dimension new size new dimension math max current size width requested size width math max current size height requested size height if new size width 300 new size width 300 if new size height 200 new size height 200 set size new size validate updatesize updatesize currentsize getsize requestedsize getpreferredsize newsize currentsize requestedsize currentsize requestedsize newsize newsize newsize newsize setsize newsize public pane name renderer pane font ui manager get font tree font if pane font null pane font j edit get font property metal secondary font group font pane font derive font font bold panenamerenderer panefont uimanager getfont panefont panefont jedit getfontproperty groupfont panefont derivefont public component get tree cell renderer component j tree tree object value boolean selected boolean expanded boolean leaf int row boolean has focus super get tree cell renderer component tree value selected expanded leaf row has focus string name null if value instanceof option group set text option group value get label this set font group font else if value instanceof option pane name option pane value get name this set font pane font else if value instanceof string name string value this set font pane font if name null string label j edit get property options name label if label null set text no label property name else set text label set icon null return this gettreecellrenderercomponent jtree hasfocus gettreecellrenderercomponent hasfocus optiongroup settext optiongroup getlabel setfont groupfont optionpane optionpane getname setfont panefont setfont panefont jedit getproperty settext settext seticon public class option tree model implements tree model public void add tree model listener tree model listener l listener list add tree model listener class l optiontreemodel treemodel addtreemodellistener treemodellistener listenerlist treemodellistener public void remove tree model listener tree model listener l listener list remove tree model listener class l removetreemodellistener treemodellistener listenerlist treemodellistener public object get child object parent int index if parent instanceof option group return option group parent get member index else return null getchild optiongroup optiongroup getmember public int get child count object parent if parent instanceof option group return option group parent get member count else return 0 getchildcount optiongroup optiongroup getmembercount public int get index of child object parent object child if parent instanceof option group return option group parent get member index child else return 1 getindexofchild optiongroup optiongroup getmemberindex public object get root return root getroot public boolean is leaf object node return node instanceof option group isleaf optiongroup public void value for path changed tree path path object new value this model may not be changed by the table cell editor valueforpathchanged treepath newvalue tablecelleditor protected void fire nodes changed object source object path int child indices object children object listeners listener list get listener list tree model event model event null for int i listeners length 2 i 0 i 2 if listeners i tree model listener class continue if model event null model event new tree model event source path child indices children tree model listener listeners i 1 tree nodes changed model event firenodeschanged childindices listenerlist getlistenerlist treemodelevent modelevent treemodellistener modelevent modelevent treemodelevent childindices treemodellistener treenodeschanged modelevent protected void fire nodes inserted object source object path int child indices object children object listeners listener list get listener list tree model event model event null for int i listeners length 2 i 0 i 2 if listeners i tree model listener class continue if model event null model event new tree model event source path child indices children tree model listener listeners i 1 tree nodes inserted model event firenodesinserted childindices listenerlist getlistenerlist treemodelevent modelevent treemodellistener modelevent modelevent treemodelevent childindices treemodellistener treenodesinserted modelevent protected void fire nodes removed object source object path int child indices object children object listeners listener list get listener list tree model event model event null for int i listeners length 2 i 0 i 2 if listeners i tree model listener class continue if model event null model event new tree model event source path child indices children tree model listener listeners i 1 tree nodes removed model event firenodesremoved childindices listenerlist getlistenerlist treemodelevent modelevent treemodellistener modelevent modelevent treemodelevent childindices treemodellistener treenodesremoved modelevent protected void fire tree structure changed object source object path int child indices object children object listeners listener list get listener list tree model event model event null for int i listeners length 2 i 0 i 2 if listeners i tree model listener class continue if model event null model event new tree model event source path child indices children tree model listener listeners i 1 tree structure changed model event firetreestructurechanged childindices listenerlist getlistenerlist treemodelevent modelevent treemodellistener modelevent modelevent treemodelevent childindices treemodellistener treestructurechanged modelevent update every time method public boolean update every time return false updateeverytime updateeverytime update method public void update j menu menu we build a set of lists each list contains plugin menu items that begin with a given letter int count 0 list letters new list 26 for int i 0 i letters length i letters i new array list vector plugin menu items new vector pluginjar plugin array j edit get pluginja rs for int i 0 i plugin array length i pluginjar jar plugin array i edit plugin plugin jar get plugin if plugin null continue j menu item menu item plugin create menu items if menu item null add to letter map letters menu item count old api else if j edit get property plugin plugin get class name activate null try plugin menu items clear plugin create menu items plugin menu items iterator iter plugin menu items iterator while iter has next add to letter map letters j menu item iter next count catch throwable t log log log error this error creating menu items for plugin log log log error this t if count 0 j menu item menu item new j menu item j edit get property no plugins label menu item set enabled false menu add menu item return sort each letter for int i 0 i letters length i list list letters i collections sort list new misc utilities menu item compare int max items j edit get integer property menu spillover 20 if less than 20 items put them directly in the menu if count max items for int i 0 i letters length i iterator iter letters i iterator while iter has next menu add j menu item iter next return collect blocks of up to max items of consecutive letters count 0 char first a j menu submenu new j menu menu add submenu for int i 0 i letters length i list letter letters i if count letter size max items count 0 char last char i a 1 if last first submenu set text string value of first else submenu set text first last first char char i a count 0 submenu null iterator iter letter iterator while iter has next if submenu null submenu new j menu menu add submenu submenu add j menu item iter next count letter size if submenu null char last z if last first submenu set text string value of first else submenu set text first last jmenu arraylist pluginmenuitems pluginarray jedit getpluginjars pluginarray pluginarray editplugin getplugin jmenuitem menuitem createmenuitems menuitem addtolettermap menuitem jedit getproperty getclassname pluginmenuitems createmenuitems pluginmenuitems pluginmenuitems hasnext addtolettermap jmenuitem jmenuitem menuitem jmenuitem jedit getproperty menuitem setenabled menuitem miscutilities menuitemcompare maxitems jedit getintegerproperty maxitems hasnext jmenuitem maxitems jmenu jmenu maxitems settext valueof settext hasnext jmenu jmenuitem settext valueof settext add to letter map method private void add to letter map list letters j menu item item char ch item get text char at 0 ch character to upper case ch if ch a ch z log log log error this plugin menu item label must begin with a z or a z item get text else letters ch a add item addtolettermap addtolettermap jmenuitem gettext charat touppercase gettext string type descriptors bsh formal parameters int id super id typedescriptors bshformalparameters void insure parsed if param names null return this num args jjt get num children string param names new string num args for int i 0 i num args i bsh formal parameter param bsh formal parameter jjt get child i param names i param name this param names param names insureparsed paramnames numargs jjtgetnumchildren paramnames numargs numargs bshformalparameter bshformalparameter jjtgetchild paramnames paramnames paramnames public string get param names insure parsed return param names getparamnames insureparsed paramnames public string get type descriptors call stack callstack interpreter interpreter string default package if type descriptors null return type descriptors insure parsed string type desc new string num args for int i 0 i num args i bsh formal parameter param bsh formal parameter jjt get child i type desc i param get type descriptor callstack interpreter default package this type descriptors type desc return type desc gettypedescriptors callstack defaultpackage typedescriptors typedescriptors insureparsed typedesc numargs numargs bshformalparameter bshformalparameter jjtgetchild typedesc gettypedescriptor defaultpackage typedescriptors typedesc typedesc evaluate the types note that type resolution does not require the interpreter instance public object eval call stack callstack interpreter interpreter throws eval error if param types null return param types insure parsed class param types new class num args for int i 0 i num args i bsh formal parameter param bsh formal parameter jjt get child i param types i class param eval callstack interpreter this param types param types return param types callstack evalerror paramtypes paramtypes insureparsed paramtypes numargs numargs bshformalparameter bshformalparameter jjtgetchild paramtypes paramtypes paramtypes paramtypes plugin update constructor creates a new plugin update message param jar the plugin param what what happened param exit is the editor exiting since j edit 4 2pre3 public plugin update pluginjar jar object what boolean exit super jar if what null throw new null pointer exception what must be non null this what what this exit exit pluginupdate jedit pluginupdate nullpointerexception get what method returns what caused this plugin update public object get what return what getwhat getwhat is exiting method returns true if this plugin is being unloaded as part of the shutdown process in which case some components like the help viewer and plugin manager ignore the event since j edit 4 2pre3 public boolean is exiting return exit isexiting jedit isexiting get pluginjar method returns the plugin involved public pluginjar get pluginjar return pluginjar get source getpluginjar getpluginjar getsource param string method public string param string return what what exit exit super param string paramstring paramstring paramstring public static simple node javacode new simple node 1 public string get source file return called from java code simplenode simplenode getsourcefile public int get line number return 1 getlinenumber public string get text return compiled java code gettext string source file public simple node int i id i sourcefile simplenode public void jjt open jjtopen public void jjt open public void jjt close jjtopen jjtclose public void jjt close public void jjt set parent node n parent n jjtclose jjtsetparent public void jjt set parent node n parent n public node jjt get parent return parent jjtsetparent jjtgetparent public void jjt add child node n int i if children null children new node i 1 else if i children length node c new node i 1 system arraycopy children 0 c 0 children length children c children i n jjtaddchild public node jjt get child int i return children i jjtgetchild return children i public simple node get child int i return simple node jjt get child i simplenode getchild simplenode jjtgetchild public int jjt get num children return children null 0 children length jjtgetnumchildren you need to do public string to string return parser tree constants jjt node name id tostring parsertreeconstants jjtnodename public string to string return parser tree constants jjt node name id public string to string string prefix return prefix to string tostring parsertreeconstants jjtnodename tostring tostring public void dump string prefix system out println to string prefix if children null for int i 0 i children length i simple node n simple node children i if n null n dump prefix tostring simplenode simplenode detach this node from its parent this is primarily useful in node serialization see bsh method declaration public void prune jjt set parent null bshmethoddeclaration jjtsetparent this is the general signature for evaluation of a node public object eval call stack callstack interpreter interpreter throws eval error throw new interpreter error unimplemented or inappropriate for get class get name callstack evalerror interpretererror getclass getname set the name of the source file or more generally source of the text from which this node was parsed public void set source file string source file this source file source file setsourcefile sourcefile sourcefile sourcefile get the name of the source file or more generally source of the text from which this node was parsed this will recursively search up the chain of parent nodes until a source is found or return a string indicating that the source is unknown public string get source file if source file null if parent null return simple node parent get source file else return unknown file else return source file getsourcefile sourcefile simplenode getsourcefile sourcefile get the line number of the starting token public int get line number return first token begin line getlinenumber firsttoken beginline get the text of the tokens comprising this node public string get text string buffer text new string buffer token t first token while t null text append t image if t image equals text append if t last token t image equals t image equals break t t next return text to string gettext stringbuffer stringbuffer firsttoken lasttoken tostring helptoc panel constructor helptoc panel help viewer help viewer super new border layout this help viewer help viewer nodes new hashtable toc new toc tree looks bad with the os x l f apparently if operating system is macoslf toc put client property j tree line style angled toc set cell renderer new toc cell renderer toc set editable false toc set shows root handles true add border layout center new j scroll pane toc load helptocpanel helptocpanel helpviewer helpviewer borderlayout helpviewer helpviewer toctree operatingsystem ismacoslf putclientproperty jtree linestyle setcellrenderer toccellrenderer seteditable setshowsroothandles borderlayout jscrollpane select node method void select node string shorturl if toc model null return default mutable tree node node default mutable tree node nodes get shorturl if node null return tree path path new tree path toc model get path to root node toc expand path path toc set selection path path toc scroll path to visible path selectnode selectnode tocmodel defaultmutabletreenode defaultmutabletreenode treepath treepath tocmodel getpathtoroot expandpath setselectionpath scrollpathtovisible load method void load default tree model empty new default tree model new default mutable tree node j edit get property helpviewer toc loading toc set model empty toc set root visible true vfs manager run in work thread new runnable public void run createtoc toc model reload toc root toc set model toc model toc set root visible false for int i 0 i toc root get child count i default mutable tree node node default mutable tree node toc root get child at i toc expand path new tree path node get path if help viewer get shorturl null select node help viewer get shorturl defaulttreemodel defaulttreemodel defaultmutabletreenode jedit getproperty setmodel setrootvisible vfsmanager runinworkthread tocmodel tocroot setmodel tocmodel setrootvisible tocroot getchildcount defaultmutabletreenode defaultmutabletreenode tocroot getchildat expandpath treepath getpath helpviewer getshorturl selectnode helpviewer getshorturl public void run createtoc toc model reload toc root toc set model toc model toc set root visible false for int i 0 i toc root get child count i default mutable tree node node default mutable tree node toc root get child at i toc expand path new tree path node get path if help viewer get shorturl null select node help viewer get shorturl tocmodel tocroot setmodel tocmodel setrootvisible tocroot getchildcount defaultmutabletreenode defaultmutabletreenode tocroot getchildat expandpath treepath getpath helpviewer getshorturl selectnode helpviewer getshorturl create node method private default mutable tree node create node string href string title default mutable tree node node new default mutable tree node new help node href title true nodes put href node return node createnode defaultmutabletreenode createnode defaultmutabletreenode defaultmutabletreenode helpnode createtoc method private void createtoc edit plugin plugins j edit get plugins arrays sort plugins new plugin compare toc root new default mutable tree node toc root add create node welcome html j edit get property helpviewer toc welcome toc root add create node readme txt j edit get property helpviewer toc readme toc root add create node changes txt j edit get property helpviewer toc changes toc root add create node todo txt j edit get property helpviewer toc todo toc root add create node copying txt j edit get property helpviewer toc copying toc root add create node copying doc txt j edit get property helpviewer toc copying doc toc root add create node apache license txt j edit get property helpviewer toc copying apache toc root add create node copying plugins txt j edit get property helpviewer toc copying plugins loadtoc toc root news42 toc xml loadtoc toc root users guide toc xml loadtoc toc root faq toc xml loadtoc toc root api toc xml default mutable tree node plugin tree new default mutable tree node j edit get property helpviewer toc plugins true for int i 0 i plugins length i edit plugin plugin plugins i string name plugin get class name string docs j edit get property plugin name docs string label j edit get property plugin name name if docs null if label null docs null string path plugin get pluginjar get class loader get resource as path docs plugin tree add create node path label if plugin tree get child count 0 toc root add plugin tree else so that help viewer constructor doesn t try to expand plugin tree null toc model new default tree model toc root editplugin jedit getplugins plugincompare tocroot defaultmutabletreenode tocroot createnode jedit getproperty tocroot createnode jedit getproperty tocroot createnode jedit getproperty tocroot createnode jedit getproperty tocroot createnode jedit getproperty tocroot createnode jedit getproperty tocroot createnode jedit getproperty tocroot createnode jedit getproperty tocroot tocroot tocroot tocroot defaultmutabletreenode plugintree defaultmutabletreenode jedit getproperty editplugin getclassname jedit getproperty jedit getproperty getpluginjar getclassloader getresourceaspath plugintree createnode plugintree getchildcount tocroot plugintree helpviewer plugintree tocmodel defaulttreemodel tocroot loadtoc method private void loadtoc default mutable tree node root string path toc handler h new toc handler root misc utilities get parent of path path xml parser parser new xml parser reader in null parser set handler h try in new input stream reader new url help viewer get baseurl path open stream parser parse null null in catch xml exception xe int line xe get line string message xe get message log log log error this path line message catch exception e log log log error this e finally try if in null in close catch io exception io log log log error this io defaultmutabletreenode tochandler tochandler miscutilities getparentofpath xmlparser xmlparser sethandler inputstreamreader helpviewer getbaseurl openstream xmlexception getline getmessage ioexception help node constructor help node string href string title this href href this title title helpnode helpnode to string method public string to string return title tostring tostring toc handler constructor toc handler default mutable tree node root string dir nodes new stack node root this dir dir tochandler tochandler defaultmutabletreenode attribute method public void attribute string aname string value boolean is specified if aname equals href href value isspecified char data method public void char data char c int off int len if tag equals title string buffer buf new string buffer for int i 0 i len i char ch c off i if ch character is whitespace ch buf append ch title buf to string chardata chardata stringbuffer stringbuffer iswhitespace tostring start element method public void start element string name tag name startelement startelement end element method public void end element string name if name null return if name equals title default mutable tree node new node create node dir href title node add new node nodes push node node new node else if name equals entry node default mutable tree node nodes pop endelement endelement defaultmutabletreenode newnode createnode newnode newnode defaultmutabletreenode toc tree constructor toc tree tool tip manager shared instance register component this toctree toctree tooltipmanager sharedinstance registercomponent get tool tip text method public final string get tool tip text mouse event evt tree path path get path for location evt getx evt gety if path null rectangle cell rect get path bounds path if cell rect null cell rect is visible cell rect return path get last path component to string return null gettooltiptext gettooltiptext mouseevent treepath getpathforlocation cellrect getpathbounds cellrect cellrectisvisible cellrect getlastpathcomponent tostring process mouse event method protected void process mouse event mouse event evt tool tip manager ttm tool tip manager shared instance switch evt getid case mouse event mouse entered tool tip initial delay ttm get initial delay tool tip reshow delay ttm get reshow delay ttm set initial delay 200 ttm set reshow delay 0 super process mouse event evt break case mouse event mouse exited ttm set initial delay tool tip initial delay ttm set reshow delay tool tip reshow delay super process mouse event evt break case mouse event mouse clicked tree path path get path for location evt getx evt gety if path null if is path selected path set selection path path object obj default mutable tree node path get last path component get user object if obj instanceof help node this expand path path return help node node help node obj help viewer gotourl node href true super process mouse event evt break default super process mouse event evt break processmouseevent processmouseevent mouseevent tooltipmanager tooltipmanager sharedinstance mouseevent mouse_entered tooltipinitialdelay getinitialdelay tooltipreshowdelay getreshowdelay setinitialdelay setreshowdelay processmouseevent mouseevent mouse_exited setinitialdelay tooltipinitialdelay setreshowdelay tooltipreshowdelay processmouseevent mouseevent mouse_clicked treepath getpathforlocation ispathselected setselectionpath defaultmutabletreenode getlastpathcomponent getuserobject helpnode expandpath helpnode helpnode helpviewer processmouseevent processmouseevent cell rect is visible method private boolean cell rect is visible rectangle cell rect rectangle vr toc tree this get visible rect return vr contains cell rect x cell rect y vr contains cell rect x cell rect width cell rect y cell rect height cellrectisvisible cellrectisvisible cellrect toctree getvisiblerect cellrect cellrect cellrect cellrect cellrect cellrect public component get tree cell renderer component j tree tree object value boolean sel boolean expanded boolean leaf int row boolean focus super get tree cell renderer component tree value sel expanded leaf row focus set icon leaf file cell renderer file icon expanded file cell renderer open dir icon file cell renderer dir icon set border border return this gettreecellrenderercomponent jtree gettreecellrenderercomponent seticon filecellrenderer fileicon filecellrenderer opendiricon filecellrenderer diricon setborder public int compare object o1 object o2 edit plugin p1 edit plugin o1 edit plugin p2 edit plugin o2 return misc utilities compare strings j edit get property plugin p1 get class name name j edit get property plugin p2 get class name name true editplugin editplugin editplugin editplugin miscutilities comparestrings jedit getproperty getclassname jedit getproperty getclassname public static void do version check view view view show wait cursor try url url new url j edit get property version check url input stream in url open stream buffered reader bin new buffered reader new input stream reader in string line string devel build null string stable build null while line bin read line null if line starts with build devel build line substring 6 trim else if line starts with stablebuild stable build line substring 12 trim bin close if devel build null stable build null do version check view stable build devel build catch io exception e string args j edit get property version check url e to string gui utilities error view read error args view hide wait cursor doversioncheck showwaitcursor jedit getproperty inputstream openstream bufferedreader bufferedreader inputstreamreader develbuild stablebuild readline startswith develbuild startswith stablebuild develbuild stablebuild doversioncheck stablebuild develbuild ioexception jedit getproperty tostring guiutilities hidewaitcursor public static void do version check view view string stable build string devel build string my build j edit get build string pre my build substring 6 7 string variant string build if pre equals 99 variant stable build stable build else variant devel build devel build special case no current development version if devel build compare to stable build 0 variant nodevel int ret val gui utilities confirm view version check variant new string misc utilities build to version my build misc utilities build to version stable build misc utilities build to version devel build j option pane yes no option j option pane question message if ret val j option pane yes option j edit open file view j edit get property version check url doversioncheck stablebuild develbuild mybuild jedit getbuild mybuild stablebuild develbuild develbuild compareto stablebuild retval guiutilities miscutilities buildtoversion mybuild miscutilities buildtoversion stablebuild miscutilities buildtoversion develbuild joptionpane yes_no_option joptionpane question_message retval joptionpane yes_option jedit openfile jedit getproperty creates a new editor exiting started message param view the view from which this exit was called public editor exit requested view view super view editorexitrequested returns the view involved public view get view return view get source getview getsource constructs a code jcmd process code object param jcmd directory the directory in which code jcmd exe code is located br a code null code parameter indicates that code jcmd exe code should be found in the current working directory of the jvm s process protected jcmd process string jcmd directory this jcmd directory jcmd directory jcmdprocess jcmddirectory jcmdprocess jcmddirectory jcmddirectory jcmddirectory executes the code jcmd code command interpreter on a given command line param cmd line the full command line to be passed to the interpreter param cwd the current working directory for the interpreter process br b note b in this version use of the code cwd code parameter is not implemented throws io exception the exception thrown by the call to code runtime exec code that starts code jcmd code static public jcmd process exec string cmd line string cwd throws io exception return exec cmd line cwd null cmdline ioexception jcmdprocess cmdline ioexception cmdline executes the code jcmd code command interpreter on a given command line param cmd line the full command line to be passed to the interpreter param cwd the current working directory for the interpreter process br b note b in this version use of the code cwd code parameter is not implemented param jcmd dir the directory in which the code jcmd code interpreter may be found br if the code jcmd dir code parameter is code null code the current working directory of the jvm s process will be used as the location of code jcmd code throws io exception the exception thrown by the call to code runtime exec code that starts code jcmd code static public jcmd process exec string cmd line string cwd string jcmd dir throws io exception jcmd process jp new jcmd process jcmd dir cwd not implemented in this version jp do exec cmd line return jp cmdline jcmddir jcmddir ioexception jcmdprocess cmdline jcmddir ioexception jcmdprocess jcmdprocess jcmddir doexec cmdline destroys the process in which the command interpreter is running p to terminate jcmd and any running child process in an orderly fashion use code send break code see send break public void destroy if jcmd process null jcmd process destroy sendbreak sendbreak jcmdprocess jcmdprocess terminates the code jcmd code process by sending it a ctrl c character p using code send break code instead of code destroy code will cause code jcmd code to terminate any running child process throws io exception any exception thrown by call to code output stream write code public void send break throws io exception string test string new string 003 byte bytes test string get bytes if jcmd process null output stream os jcmd process get output stream os write bytes os flush sendbreak ioexception outputstream sendbreak ioexception teststring teststring getbytes jcmdprocess outputstream jcmdprocess getoutputstream returns the exit value of the command executed by code jcmd code return the exit value of the command executed by code jcmd code or 1 if the command passed to code jcmd code cannot be found or cannot be executed p b note b since a command executed by code jcmd code may itself return 1 this return value is ambiguous use code has launched code to test whether a command was launched successfully by code jcmd code see has launched public int exit value if return value null int raw return value 1 if jcmd process null raw return value jcmd process exit value return value new integer raw return value return return value int value haslaunched haslaunched exitvalue returnvalue rawreturnvalue jcmdprocess rawreturnvalue jcmdprocess exitvalue returnvalue rawreturnvalue returnvalue intvalue returns the error stream of the process launched by code jcmd code return an code input stream code representing the error stream of both code jcmd code for purposes of its own error messages and the process it has launched public input stream get error stream return jcmd process get error stream inputstream inputstream geterrorstream jcmdprocess geterrorstream returns the input stream of the process launched by code jcmd code return an code input stream code representing the input stream of both code jcmd code and the process it has launched p currently code jcmd code does not write to this stream so the only data in the stream would come from the process launched by code jcmd code public input stream get input stream return jcmd process get input stream inputstream inputstream getinputstream jcmdprocess getinputstream returns the output stream of the process launched by code jcmd code return an code output stream code representing the output stream of both code jcmd code and the process it has launched p currently code jcmd code does not process data written to this stream and does not forward data to the process it launches except for command line parameters passed upon launching public output stream get output stream return jcmd process get output stream outputstream outputstream getoutputstream jcmdprocess getoutputstream blocks execution until code jcmd code exits returns immediately if code jcmd code has already exited return the exit code returned by code jcmd code br if code jcmd code has successfully launched another process the exit code will be that of the launched process otherwise this method will return 1 throws interrupted exception an exception thrown by the code process code object in which code jcmd code is running see exit value see has launched public int wait for throws interrupted exception if jcmd process null return exit value return jcmd process wait for interruptedexception exitvalue haslaunched waitfor interruptedexception jcmdprocess exitvalue jcmdprocess waitfor tests whether or not code jcmd code has launched a child process return the value code true code if a process has been launched and code false code otherwise p this method is more reliable than code wait for code or code exit value code to test whether code jcmd code successfully launched a process because some native executables encountering their own errors will return 1 the exit code indicating an code jcmd code launch failure public boolean has launched return jcmd process null waitfor exitvalue haslaunched jcmdprocess private void do exec string cmd line throws io exception string buffer cmd buffer new string buffer 512 if jcmd directory null cmd buffer append jcmd directory if jcmd directory ends with file separator cmd buffer append file separator cmd buffer append jcmd exe append cmd line jcmd process runtime get runtime exec cmd buffer to string doexec cmdline ioexception stringbuffer cmdbuffer stringbuffer jcmddirectory cmdbuffer jcmddirectory jcmddirectory endswith cmdbuffer cmdbuffer cmdline jcmdprocess getruntime cmdbuffer tostring reset method clears the list of tokens public void init last token first token null lasttoken firsttoken get tokens method returns the first syntax token since j edit 4 1pre1 public token get tokens return first token gettokens jedit gettokens firsttoken handle token method called by the token marker when a syntax token has been parsed param seg the segment containing the text param id the token type one of the constants in the link token class param offset the start offset of the token param length the number of characters in the token param context the line context since j edit 4 2pre3 public void handle token segment seg byte id int offset int length token marker line context context token token create token id offset length context if token null add token token context handletoken jedit handletoken tokenmarker linecontext createtoken addtoken get line context method the token handler can compare this object with the object previously given for this line to see if the token type at the end of the line has changed meaning subsequent lines might need to be retokenized since j edit 4 2pre6 public token marker line context get line context return line context getlinecontext jedit tokenmarker linecontext getlinecontext linecontext set line context method the token handler can compare this object with the object previously given for this line to see if the token type at the end of the line has changed meaning subsequent lines might need to be retokenized since j edit 4 2pre6 public void set line context token marker line context line context this line context line context setlinecontext jedit setlinecontext tokenmarker linecontext linecontext linecontext linecontext get parser rule set method protected parser rule set get parser rule set token marker line context context while context null if context rules is built in return context rules context context parent return null getparserruleset parserruleset getparserruleset tokenmarker linecontext isbuiltin create token method protected token create token byte id int offset int length token marker line context context return new token id offset length get parser rule set context createtoken createtoken tokenmarker linecontext getparserruleset add token method protected void add token token token token marker line context context if first token null first token last token token else last token next token last token last token next addtoken addtoken tokenmarker linecontext firsttoken firsttoken lasttoken lasttoken lasttoken lasttoken eb message constructor creates a new message param source the message source since j edit 4 2pre1 public eb message object source this source source ebmessage jedit ebmessage eb message constructor creates a new message param source the message source public eb message eb component source this source source ebmessage ebmessage ebcomponent get source method returns the sender of this message since j edit 4 2pre1 public object get source return source getsource jedit getsource to string method returns a string representation of this message public string to string string class name get class get name int index class name last index of return class name substring index 1 param string tostring tostring classname getclass getname classname lastindexof classname paramstring param string method returns a string representation of this message s parameters public string param string return source source paramstring paramstring deprecated methods deprecated does nothing public void veto deprecated returns false public boolean is vetoed return false isvetoed creates a new non vetoable message param source the message source public non vetoable eb component source super source nonvetoable ebcomponent disallows this message from being vetoed public void veto throw new internal error can t veto this message internalerror enhanced menu constructor public enhanced menu string name this name j edit get property name concat label j edit get action context enhancedmenu enhancedmenu jedit getproperty jedit getactioncontext enhanced menu constructor public enhanced menu string name string label this name label j edit get action context enhancedmenu enhancedmenu jedit getactioncontext enhanced menu constructor public enhanced menu string name string label action context context this context context if label null label name char mnemonic int index label index of if index 1 label length index 1 mnemonic character to lower case label char at index 1 label label substring 0 index concat label substring index else mnemonic 0 set text label if operating system is macos set mnemonic mnemonic string menu items j edit get property name if menu items null string tokenizer st new string tokenizer menu items while st has more tokens string menu item name st next token if menu item name equals add separator else add gui utilities load menu item context menu item name true initial component count get menu component count provider code j edit get property name code eb stub new edit bus stub name eb stub menu out of date true add menu listener this if provider code null edit bus add to bus eb stub enhancedmenu enhancedmenu actioncontext indexof tolowercase charat settext operatingsystem ismacos setmnemonic menuitems jedit getproperty menuitems stringtokenizer stringtokenizer menuitems hasmoretokens menuitemname nexttoken menuitemname addseparator guiutilities loadmenuitem menuitemname initialcomponentcount getmenucomponentcount providercode jedit getproperty ebstub editbusstub ebstub menuoutofdate addmenulistener providercode editbus addtobus ebstub menu selected method public void menu selected menu event evt init menuselected menuselected menuevent public void menu deselected menu event e menudeselected menuevent public void menu deselected menu event e public void menu canceled menu event e menudeselected menuevent menucanceled menuevent init method public void init if provider code null return if provider null object obj bean shell eval null bean shell get name space provider code provider dynamic menu provider obj if provider null error provider code null return if eb stub menu out of date provider update every time eb stub menu out of date false while get menu component count initial component count remove get menu component count 1 if provider null provider update this providercode beanshell beanshell getnamespace providercode dynamicmenuprovider providercode ebstub menuoutofdate updateeverytime ebstub menuoutofdate getmenucomponentcount initialcomponentcount getmenucomponentcount finalize method protected void finalize throws exception if eb stub null edit bus remove from bus eb stub ebstub editbus removefrombus ebstub edit bus stub string name this name name menu out of date true editbusstub menuoutofdate public void handle message eb message msg if msg instanceof dynamic menu changed name equals dynamic menu changed msg get menu name menu out of date true else if msg instanceof properties changed while this might be questionable some menus depend on properties menu out of date true handlemessage ebmessage dynamicmenuchanged dynamicmenuchanged getmenuname menuoutofdate propertieschanged menuoutofdate public int operator bsh assignment int id super id bshassignment public object eval call stack callstack interpreter interpreter throws eval error bsh primary expression lhs node bsh primary expression jjt get child 0 if lhs node null throw new interpreter error error null lh snode boolean strict java interpreter get strict java lhs lhs lhs node tolhs callstack interpreter if lhs null throw new interpreter error error null lhs for operator assign operations save the lhs value before evaluating the rhs this is correct java behavior for postfix operations e g i 1 i i should be 2 not 3 object lhs value null if operator assign assign doesn t need the pre value try lhs value lhs get value catch util eval error e throw e to eval error this callstack simple node rhs node simple node jjt get child 1 object rhs implement blocks foo if rhs node instanceof bsh block rsh else rhs rhs node eval callstack interpreter if rhs primitive void throw new eval error void assignment this callstack try switch operator case assign return lhs assign rhs strict java case plusassign return lhs assign operation lhs value rhs plus strict java case minusassign return lhs assign operation lhs value rhs minus strict java case starassign return lhs assign operation lhs value rhs star strict java case slashassign return lhs assign operation lhs value rhs slash strict java case andassign case andassignx return lhs assign operation lhs value rhs bit and strict java case orassign case orassignx return lhs assign operation lhs value rhs bit or strict java case xorassign return lhs assign operation lhs value rhs xor strict java case modassign return lhs assign operation lhs value rhs mod strict java case lshiftassign case lshiftassignx return lhs assign operation lhs value rhs lshift strict java case rsignedshiftassign case rsignedshiftassignx return lhs assign operation lhs value rhs rsignedshift strict java case runsignedshiftassign case runsignedshiftassignx return lhs assign operation lhs value rhs runsignedshift strict java default throw new interpreter error unimplemented operator in assignment bsh catch util eval error e throw e to eval error this callstack callstack evalerror bshprimaryexpression lhsnode bshprimaryexpression jjtgetchild lhsnode interpretererror lhsnode strictjava getstrictjava lhsnode interpretererror lhsvalue lhsvalue getvalue utilevalerror toevalerror simplenode rhsnode simplenode jjtgetchild rhsnode bshblock rhsnode evalerror strictjava lhsvalue strictjava lhsvalue strictjava lhsvalue strictjava lhsvalue strictjava lhsvalue bit_and strictjava lhsvalue bit_or strictjava lhsvalue strictjava lhsvalue strictjava lhsvalue strictjava lhsvalue strictjava lhsvalue strictjava interpretererror utilevalerror toevalerror private object operation object lhs object rhs int kind throws util eval error implement string value according to the jls value may be anything in bean shell we ll disallow void undefined values or should we map them to the empty string if lhs instanceof string rhs primitive void if kind plus throw new util eval error use of non operator with string lhs return string lhs rhs if lhs instanceof primitive rhs instanceof primitive if lhs primitive void rhs primitive void throw new util eval error illegal use of undefined object or void literal else if lhs primitive null rhs primitive null throw new util eval error illegal use of null object or null literal if lhs instanceof boolean lhs instanceof character lhs instanceof number lhs instanceof primitive rhs instanceof boolean rhs instanceof character rhs instanceof number rhs instanceof primitive return primitive binary operation lhs rhs kind throw new util eval error non primitive value in operator lhs get class token image kind rhs get class utilevalerror beanshell utilevalerror utilevalerror utilevalerror binaryoperation utilevalerror getclass tokenimage getclass x mode handler constructor public x mode handler string mode name this mode name mode name marker new token marker marker add rule set new parser rule set mode name main state stack new stack default value last no word sep xmodehandler xmodehandler modename modename modename tokenmarker addruleset parserruleset modename statestack lastnowordsep _ resolve entity method public object resolve entity string public id string system id if xmode dtd equals system id this will result in a slight speed up since we don t need to read the dtd anyway as a elfred is non validating return new string reader try return new buffered reader new input stream reader get class get resource as stream org gjt sp jedit syntax xmode dtd catch exception e error dtd e return null resolveentity resolveentity publicid systemid systemid aelfred stringreader bufferedreader inputstreamreader getclass getresourceasstream attribute method public void attribute string aname string value boolean is specified aname aname null null aname intern if aname name prop name value else if aname value prop value value else if aname type last tokenid token string to token value if last tokenid 1 error token invalid value else if aname at line start last at line start is specified value equals true false else if aname at whitespace end last at whitespace end is specified value equals true false else if aname at word start last at word start is specified value equals true false else if aname no line break last no line break is specified value equals true false else if aname no word break last no word break is specified value equals true false else if aname no escape last no escape is specified value equals true false else if aname exclude match last exclude match is specified value equals true false else if aname ignore case last ignore case is specified value equals true true else if aname highlight digits last highlight digits is specified value equals true false else if aname digit re last digitre value else if aname no word sep if is specified last no word sep value else if aname at char try if is specified term char integer parse int value catch number format exception e error termchar invalid value term char 1 else if aname escape last escape value else if aname set last set name value else if aname delegate string delegate mode delegate set name if value null int index value index of if index 1 delegate mode value substring 0 index delegate set name value substring index 2 else delegate mode mode name delegate set name value token marker delegate marker get token marker delegate mode if delegate marker null error delegate invalid value else last delegate set delegate marker get rule set delegate set name if delegate marker marker last delegate set null stupid hack to handle referencing a rule set that is defined later last delegate set new parser rule set delegate mode delegate set name last delegate set set default token invalid marker add rule set last delegate set else if last delegate set null error delegate invalid value else if aname default last defaultid token string to token value if last defaultid 1 error token invalid value last defaultid token null else if aname hash char if value length 1 error hash char invalid value last defaultid token null else last hash char value char at 0 isspecified propname propvalue lasttokenid stringtotoken lasttokenid at_line_start lastatlinestart isspecified at_whitespace_end lastatwhitespaceend isspecified at_word_start lastatwordstart isspecified no_line_break lastnolinebreak isspecified no_word_break lastnowordbreak isspecified no_escape lastnoescape isspecified exclude_match lastexcludematch isspecified ignore_case lastignorecase isspecified highlight_digits lasthighlightdigits isspecified digit_re lastdigitre no_word_sep isspecified lastnowordsep at_char isspecified termchar parseint numberformatexception termchar lastescape lastsetname delegatemode delegatesetname indexof delegatemode delegatesetname delegatemode modename delegatesetname tokenmarker delegatemarker gettokenmarker delegatemode delegatemarker lastdelegateset delegatemarker getruleset delegatesetname delegatemarker lastdelegateset lastdelegateset parserruleset delegatemode delegatesetname lastdelegateset setdefault addruleset lastdelegateset lastdelegateset lastdefaultid stringtotoken lastdefaultid lastdefaultid hash_char lastdefaultid lasthashchar charat doctype decl method public void doctype decl string name string public id string system id throws exception if mode equals ignore case name return error doctype invalid name doctypedecl doctypedecl publicid systemid equalsignorecase char data method public void char data char c int off int len string tag peek element string text new string c off len if tag eol span tag eol span regexp tag mark previous tag mark following tag seq tag seq regexp tag begin last start text last start pos match last at line start parser rule at line start 0 last at whitespace end parser rule at whitespace end 0 last at word start parser rule at word start 0 last at line start false last at word start false last at whitespace end false else if tag end last end text last end pos match last at line start parser rule at line start 0 last at whitespace end parser rule at whitespace end 0 last at word start parser rule at word start 0 last at line start false last at word start false last at whitespace end false else last keyword text chardata chardata peekelement eol_span eol_span_regexp mark_previous mark_following seq_regexp laststart laststartposmatch lastatlinestart parserrule at_line_start lastatwhitespaceend parserrule at_whitespace_end lastatwordstart parserrule at_word_start lastatlinestart lastatwordstart lastatwhitespaceend lastend lastendposmatch lastatlinestart parserrule at_line_start lastatwhitespaceend parserrule at_whitespace_end lastatwordstart parserrule at_word_start lastatlinestart lastatwordstart lastatwhitespaceend lastkeyword start element method public void start element string tag tag push element tag if tag whitespace log log log warning this mode name whitespace rule no longer needed else if tag keywords keywords new keyword map rules get ignore case else if tag rules if last set name null last set name main rules marker get rule set last set name if rules null rules new parser rule set mode name last set name marker add rule set rules rules set ignore case last ignore case rules set highlight digits last highlight digits if last digitre null try rules set digit regexp new re last digitre last ignore case re reg icase 0 parser rule re syntax jedit catch re exception e error regexp e if last escape null rules set escape rule parser rule create escape rule last escape rules set default last defaultid rules set no word sep last no word sep startelement startelement pushelement modename keywordmap getignorecase lastsetname lastsetname getruleset lastsetname parserruleset modename lastsetname addruleset setignorecase lastignorecase sethighlightdigits lasthighlightdigits lastdigitre setdigitregexp lastdigitre lastignorecase reg_icase parserrule re_syntax_jedit reexception lastescape setescaperule parserrule createescaperule lastescape setdefault lastdefaultid setnowordsep lastnowordsep end element method public void end element string name if name null return string tag pop element if name equals tag property if tag property props put prop name prop value props else if tag props if peek element equals rules rules set properties props else mode props props props new hashtable rules else if tag rules rules set keywords keywords keywords null last set name null last escape null last ignore case true last highlight digits false last digitre null last defaultid token null last no word sep rules null import else if tag import rules add rule set last delegate set last delegate set null terminate else if tag terminate rules set terminate char term char term char 1 seq else if tag seq if last start null error empty tag seq return rules add rule parser rule create sequence rule last start pos match last start last delegate set last tokenid reset seq regexp else if tag seq regexp if last start null error empty tag seq regexp return try rules add rule parser rule create regexp sequence rule last hash char last start pos match last start last delegate set last tokenid last ignore case catch re exception re error regexp re reset span else if tag span if last start null error empty tag begin return if last end null error empty tag end return rules add rule parser rule create span rule last start pos match last start last end pos match last end last delegate set last tokenid last exclude match last no line break last no word break last no escape reset span regexp else if tag span regexp if last start null error empty tag begin return if last end null error empty tag end return try rules add rule parser rule create regexp span rule last hash char last start pos match last start last end pos match last end last delegate set last tokenid last exclude match last no line break last no word break last ignore case last no escape catch re exception re error regexp re reset eol span else if tag eol span if last start null error empty tag eol span return rules add rule parser rule createeol span rule last start pos match last start last delegate set last tokenid last exclude match reset eol span regexp else if tag eol span regexp if last start null error empty tag eol span regexp return try rules add rule parser rule create regexpeol span rule last hash char last start pos match last start last delegate set last tokenid last exclude match last ignore case catch re exception re error regexp re reset mark following else if tag mark following if last start null error empty tag mark following return rules add rule parser rule create mark following rule last start pos match last start last tokenid last exclude match reset mark previous else if tag mark previous if last start null error empty tag mark previous return rules add rule parser rule create mark previous rule last start pos match last start last tokenid last exclude match reset keywords else byte token token string to token tag if token 1 add keyword last keyword token else can t happen throw new internal error endelement endelement popelement propname propvalue peekelement setproperties modeprops setkeywords lastsetname lastescape lastignorecase lasthighlightdigits lastdigitre lastdefaultid lastnowordsep _ addruleset lastdelegateset lastdelegateset setterminatechar termchar termchar laststart addrule parserrule createsequencerule laststartposmatch laststart lastdelegateset lasttokenid seq_regexp seq_regexp laststart seq_regexp addrule parserrule createregexpsequencerule lasthashchar laststartposmatch laststart lastdelegateset lasttokenid lastignorecase reexception laststart lastend addrule parserrule createspanrule laststartposmatch laststart lastendposmatch lastend lastdelegateset lasttokenid lastexcludematch lastnolinebreak lastnowordbreak lastnoescape span_regexp span_regexp laststart lastend addrule parserrule createregexpspanrule lasthashchar laststartposmatch laststart lastendposmatch lastend lastdelegateset lasttokenid lastexcludematch lastnolinebreak lastnowordbreak lastignorecase lastnoescape reexception eol_span eol_span laststart eol_span addrule parserrule createeolspanrule laststartposmatch laststart lastdelegateset lasttokenid lastexcludematch eol_span_regexp eol_span_regexp laststart eol_span_regexp addrule parserrule createregexpeolspanrule lasthashchar laststartposmatch laststart lastdelegateset lasttokenid lastexcludematch lastignorecase reexception mark_following mark_following laststart mark_following addrule parserrule createmarkfollowingrule laststartposmatch laststart lasttokenid lastexcludematch mark_previous mark_previous laststart mark_previous addrule parserrule createmarkpreviousrule laststartposmatch laststart lasttokenid lastexcludematch stringtotoken addkeyword lastkeyword internalerror start document method public void start document props new hashtable push element null startdocument startdocument pushelement end document method public void end document parser rule set rulesets marker get rule sets for int i 0 i rulesets length i rulesets i resolve imports enddocument enddocument parserruleset getrulesets resolveimports get token marker method public token marker get token marker return marker gettokenmarker tokenmarker gettokenmarker get mode properties method public hashtable get mode properties return mode props getmodeproperties getmodeproperties modeprops error method reports an error you must override this method so that the mode loader can do error reporting param msg the error type param subst a code string code or a code throwable code containing specific information since j edit 4 2pre1 jedit get token marker method returns the token marker for the given mode you must override this method so that the mode loader can resolve delegate targets param mode the mode name since j edit 4 2pre1 gettokenmarker jedit reset method private void reset last hash char 0 last start pos match 0 last start null last end pos match 0 last end null last delegate set null last tokenid token null last exclude match false last no line break false last no word break false last no escape false lasthashchar laststartposmatch laststart lastendposmatch lastend lastdelegateset lasttokenid lastexcludematch lastnolinebreak lastnowordbreak lastnoescape add keyword method private void add keyword string k byte id if k null error empty keyword null return if keywords null return keywords add k id addkeyword addkeyword push element method private string push element string name name name null null name intern state stack push name return name pushelement pushelement statestack peek element method private string peek element return string state stack peek peekelement peekelement statestack pop element method private string pop element return string state stack pop popelement popelement statestack constructs a new label public label puts a reference to this label in the bytecode of a method if the position of the label is known the offset is computed and written directly otherwise a null offset is written and a new forward reference is declared for this label param owner the code writer that calls this method param out the bytecode of the method param source the position of first byte of the bytecode instruction that contains this label param wide offset tt true tt if the reference must be stored in 4 bytes or tt false tt if it must be stored with 2 bytes throws illegal argument exception if this label has not been created by the given code writer void put final code writer owner final byte vector out final int source final boolean wide offset if code writer check if this owner null this owner owner else if this owner owner throw new illegal argument exception if resolved if wide offset out put4 position source else out put2 position source else if wide offset add reference 1 source out length out put4 1 else add reference source out length out put2 1 wideoffset illegalargumentexception codewriter bytevector wideoffset codewriter illegalargumentexception wideoffset wideoffset addreference addreference adds a forward reference to this label this method must be called only for a true forward reference i e only if this label is not resolved yet for backward references the offset of the reference can be and must be computed and stored directly param source position the position of the referencing instruction this position will be used to compute the offset of this forward reference param reference position the position where the offset for this forward reference must be stored private void add reference final int source position final int reference position if src and ref positions null src and ref positions new int 6 if reference count src and ref positions length int a new int src and ref positions length 6 system arraycopy src and ref positions 0 a 0 src and ref positions length src and ref positions a src and ref positions reference count source position src and ref positions reference count reference position sourceposition referenceposition addreference sourceposition referenceposition srcandrefpositions srcandrefpositions referencecount srcandrefpositions srcandrefpositions srcandrefpositions srcandrefpositions srcandrefpositions srcandrefpositions referencecount sourceposition srcandrefpositions referencecount referenceposition resolves all forward references to this label this method must be called when this label is added to the bytecode of the method i e when its position becomes known this method fills in the blanks that where left in the bytecode by each forward reference previously added to this label param owner the code writer that calls this method param position the position of this label in the bytecode param data the bytecode of the method return tt true tt if a blank that was left for this label was to small to store the offset in such a case the corresponding jump instruction is replaced with a pseudo instruction using unused opcodes using an unsigned two bytes offset these pseudo instructions will need to be replaced with true instructions with wider offsets 4 bytes instead of 2 this is done in link code writer resize instructions throws illegal argument exception if this label has already been resolved or if it has not been created by the given code writer boolean resolve final code writer owner final int position final byte data if code writer check if this owner null this owner owner if resolved this owner owner throw new illegal argument exception boolean need update false this resolved true this position position int i 0 while i reference count int source src and ref positions i int reference src and ref positions i int offset if source 0 offset position source if offset short min value offset short max value changes the opcode of the jump instruction in order to be able to find it later see resize instructions in code writer these temporary opcodes are similar to jump instruction opcodes except that the 2 bytes offset is unsigned and can therefore represent values from 0 to 65535 which is sufficient since the size of a method is limited to 65535 bytes int opcode data reference 1 0xff if opcode constants jsr changes ifeq jsr to opcodes 202 to 217 inclusive data reference 1 byte opcode 49 else changes ifnull and ifnonnull to opcodes 218 and 219 inclusive data reference 1 byte opcode 20 need update true data reference byte offset 8 data reference byte offset else offset position source 1 data reference byte offset 24 data reference byte offset 16 data reference byte offset 8 data reference byte offset return need update codewriter resizeinstructions illegalargumentexception codewriter codewriter illegalargumentexception needupdate referencecount srcandrefpositions srcandrefpositions min_value max_value resizeinstructions codewriter needupdate needupdate work thread pool constructor creates a new work thread pool with the specified number of work threads param name the thread name prefix param count the number of work threads public work thread pool string name int count listener list new event listener list if count 0 thread group new thread group name threads new work thread count for int i 0 i threads length i threads i new work thread this thread group name i 1 else log log log warning this async i o disabled workthreadpool workthreadpool listenerlist eventlistenerlist threadgroup threadgroup workthread workthread threadgroup start method starts all the threads in this thread pool public void start not really needed since threads don t start until after synchronized lock started true if awt request count 0 request count 0 queueawt runner if threads null for int i 0 i threads length i threads i start awtrequestcount requestcount queueawtrunner add work request method adds a work request to the queue param run the runnable param inawt if true will be executed in awt thread otherwise will be executed in work thread public void add work request runnable run boolean inawt if threads null run run return synchronized lock if there are no requests execute awt requests immediately if started inawt request count 0 awt request count 0 log log log debug this awt immediate run if swing utilities is event dispatch thread run run else swing utilities invoke later run return request request new request run add to awt queue if inawt if firstawt request null lastawt request null firstawt request lastawt request request else lastawt request next request lastawt request request awt request count if no requests are running request done will not be called so we must queue the awt runner ourselves if started request count 0 queueawt runner add to work thread queue else if first request null last request null first request last request request else last request next request last request request request count lock notify all addworkrequest addworkrequest requestcount awtrequestcount swingutilities iseventdispatchthread swingutilities invokelater firstawtrequest lastawtrequest firstawtrequest lastawtrequest lastawtrequest lastawtrequest awtrequestcount requestdone requestcount queueawtrunner firstrequest lastrequest firstrequest lastrequest lastrequest lastrequest requestcount notifyall wait for requests method waits until all requests are complete public void wait for requests if threads null return synchronized wait for all lock while request count 0 try wait for all lock wait catch interrupted exception ie log log log error this ie if swing utilities is event dispatch thread do any queued awt runnables doawt requests else try swing utilities invoke and wait new run requests inawt thread catch exception e log log log error this e waitforrequests waitforrequests waitforalllock requestcount waitforalllock interruptedexception swingutilities iseventdispatchthread doawtrequests swingutilities invokeandwait runrequestsinawtthread get request count method returns the number of pending requests public int get request count return request count getrequestcount getrequestcount requestcount get thread count method returns the number of threads in this pool public int get thread count if threads null return 0 else return threads length getthreadcount getthreadcount get thread method returns the specified thread param index the index of the thread public work thread get thread int index return threads index getthread workthread getthread add progress listener method adds a progress listener to this thread pool param listener the listener public void add progress listener work thread progress listener listener listener list add work thread progress listener class listener addprogresslistener addprogresslistener workthreadprogresslistener listenerlist workthreadprogresslistener remove progress listener method removes a progress listener from this thread pool param listener the listener public void remove progress listener work thread progress listener listener listener list remove work thread progress listener class listener removeprogresslistener removeprogresslistener workthreadprogresslistener listenerlist workthreadprogresslistener fire status changed method void fire status changed work thread thread final object listeners listener list get listener list if listeners length 0 int index 0 for int i 0 i threads length i if threads i thread index i break for int i listeners length 2 i 0 i if listeners i work thread progress listener class work thread progress listener listeners i 1 status update work thread pool this index firestatuschanged firestatuschanged workthread listenerlist getlistenerlist workthreadprogresslistener workthreadprogresslistener statusupdate workthreadpool fire progress changed method void fire progress changed work thread thread final object listeners listener list get listener list if listeners length 0 int index 0 for int i 0 i threads length i if threads i thread index i break for int i listeners length 2 i 0 i if listeners i work thread progress listener class work thread progress listener listeners i 1 progress update work thread pool this index fireprogresschanged fireprogresschanged workthread listenerlist getlistenerlist workthreadprogresslistener workthreadprogresslistener progressupdate workthreadpool request done method void request done synchronized lock request count if request count 0 firstawt request null queueawt runner requestdone requestdone requestcount requestcount firstawtrequest queueawtrunner get next request method request get next request synchronized lock request request first request if request null return null first request first request next if first request null last request null if request already run throw new internal error aiee request run twice request run request already run true string buffer buf new string buffer request queue is now request request request next while request null buf append request id if request next null buf append request request next log log log debug this buf to string return request getnextrequest getnextrequest firstrequest firstrequest firstrequest firstrequest lastrequest alreadyrun internalerror alreadyrun stringbuffer stringbuffer _request _request _request _request _request _request tostring doawt requests method must always be called with the lock held private void doawt requests while request count 0 firstawt request null doawt request get nextawt request doawtrequests doawtrequests requestcount firstawtrequest doawtrequest getnextawtrequest doawt request method must always be called with the lock held private void doawt request request request log log log debug this running in awt thread request try request run run catch throwable t log log log error work thread class exception in awt thread log log log error work thread class t awt request count doawtrequest doawtrequest workthread workthread awtrequestcount queueawt runner method must always be called with the lock held private void queueawt runner if awt runner queued awt runner queued true swing utilities invoke later new run requests inawt thread log log log debug this awt runner queued queueawtrunner queueawtrunner awtrunnerqueued awtrunnerqueued swingutilities invokelater runrequestsinawtthread get nextawt request method private request get nextawt request request request firstawt request firstawt request firstawt request next if firstawt request null lastawt request null if request already run throw new internal error aiee request run twice request run request already run true string buffer buf new string buffer awt request queue is now request request request next while request null buf append request id if request next null buf append request request next log log log debug this buf to string return request getnextawtrequest getnextawtrequest firstawtrequest firstawtrequest firstawtrequest firstawtrequest lastawtrequest alreadyrun internalerror alreadyrun stringbuffer stringbuffer _request _request _request _request _request _request tostring request next request runnable run this run run public string to string return id id run run tostring public void run synchronized lock awt runner queued false if request count 0 doawt requests awtrunnerqueued requestcount doawtrequests enhanced check box menu item constructor creates a new menu item most plugins should call gui utilities load menu item instead param label the menu item label param action the edit action param context an action context since j edit 4 2pre1 public enhanced check box menu item string label string action action context context this context context this action action this shortcut get shortcut if operating system has screen menu bar shortcut null set text label shortcut shortcut null else set text label if action null set enabled true add action listener new edit action wrapper context action add mouse listener new mouse handler else set enabled false set model new model enhancedcheckboxmenuitem guiutilities loadmenuitem jedit enhancedcheckboxmenuitem actioncontext getshortcut operatingsystem hasscreenmenubar settext settext setenabled addactionlistener editaction addmouselistener mousehandler setenabled setmodel get preferred size method public dimension get preferred size dimension d super get preferred size if shortcut null d width get font metrics enhanced menu item accelerator font string width shortcut 15 return d getpreferredsize getpreferredsize getpreferredsize getfontmetrics enhancedmenuitem acceleratorfont stringwidth paint method public void paint graphics g super paint g if shortcut null g set font enhanced menu item accelerator font g set color get model is armed enhanced menu item accelerator selection foreground enhanced menu item accelerator foreground font metrics fm g get font metrics insets insets get insets g draw string shortcut get width fm string width shortcut insets right insets left 5 get font get size insets top operating system is macoslf 0 1 xxx magic number setfont enhancedmenuitem acceleratorfont setcolor getmodel isarmed enhancedmenuitem acceleratorselectionforeground enhancedmenuitem acceleratorforeground fontmetrics getfontmetrics getinsets drawstring getwidth stringwidth getfont getsize operatingsystem ismacoslf get shortcut method private string get shortcut if action null return null else string shortcut1 j edit get property action shortcut string shortcut2 j edit get property action shortcut2 if shortcut1 null shortcut1 length 0 if shortcut2 null shortcut2 length 0 return null else return shortcut2 else if shortcut2 null shortcut2 length 0 return shortcut1 else return shortcut1 or shortcut2 getshortcut getshortcut jedit getproperty jedit getproperty public boolean is selected if is showing return false edit action a context get action action if a null log log log warning this unknown action action return false try return a is selected enhanced check box menu item this catch throwable t log log log error this t return false isselected isshowing editaction getaction isselected enhancedcheckboxmenuitem public void set selected boolean b setselected public void mouse released mouse event evt if msg set gui utilities get view component evt get source get status set message null msg set false mousereleased mouseevent msgset guiutilities getview getsource getstatus setmessage msgset public void mouse entered mouse event evt string msg j edit get property action mouse over if msg null gui utilities get view component evt get source get status set message msg msg set true mouseentered mouseevent jedit getproperty guiutilities getview getsource getstatus setmessage msgset public void mouse exited mouse event evt if msg set gui utilities get view component evt get source get status set message null msg set false mouseexited mouseevent msgset guiutilities getview getsource getstatus setmessage msgset public non interactive install string args string install dir args 1 installer new install operating system os operating system get operating system operating system os task os tasks os getos tasks installer for int i 2 i args length i string arg args i int index arg index of if index 1 system err println invalid parameter arg continue string task name arg substring 0 index string task dir arg substring index 1 for int j 0 j os tasks length j operating system os task os task os tasks j if os task get name equals task name if task dir equals off os task set enabled false else os task set enabled true os task set directory task dir break int comp count installer get integer property comp count vector components new vector comp count for int i 0 i comp count i string fileset installer get property comp i fileset string os dep installer get property comp i os if os dep null if os get class get name ends with os dep continue components add element fileset console progress progress new console progress install thread thread new install thread installer progress install dir os tasks 0 xxx components thread start noninteractiveinstall installdir operatingsystem operatingsystem getoperatingsystem operatingsystem ostask ostasks getostasks indexof taskname taskdir ostasks operatingsystem ostask ostask ostasks ostask getname taskname taskdir ostask setenabled ostask setenabled ostask setdirectory taskdir compcount getintegerproperty compcount compcount getproperty osdep getproperty osdep getclass getname endswith osdep addelement consoleprogress consoleprogress installthread installthread installdir ostasks public class shortcuts option pane extends abstract option pane public shortcuts option pane super shortcuts shortcutsoptionpane abstractoptionpane shortcutsoptionpane protected members protected void init all bindings new vector set layout new border layout 12 12 init models select model new j combo box models select model add action listener new action handler box north box create horizontal box north add new j label j edit get property options shortcuts select label north add box create horizontal strut 6 north add select model key table new j table current model key table get table header set reordering allowed false key table get table header add mouse listener new header mouse handler key table add mouse listener new table mouse handler dimension d key table get preferred size d height math min d height 200 j scroll pane scroller new j scroll pane key table scroller set preferred size d add border layout north north add border layout center scroller _init allbindings setlayout borderlayout initmodels selectmodel jcombobox selectmodel addactionlistener actionhandler createhorizontalbox jlabel jedit getproperty createhorizontalstrut selectmodel keytable jtable currentmodel keytable gettableheader setreorderingallowed keytable gettableheader addmouselistener headermousehandler keytable addmouselistener tablemousehandler keytable getpreferredsize jscrollpane jscrollpane keytable setpreferredsize borderlayout borderlayout protected void save if key table get cell editor null key table get cell editor stop cell editing enumeration e models elements while e has more elements shortcuts model e next element save macros load macros _save keytable getcelleditor keytable getcelleditor stopcellediting hasmoreelements shortcutsmodel nextelement loadmacros private void init models models new vector action set action sets j edit get action sets for int i 0 i action sets length i action set action set action sets i if action set get action count 0 string model label action set get label if model label null system err println empty action set action set get pluginjar models add element create model model label action set get action names collections sort models new misc utilities stringi case compare current model shortcuts model models element at 0 initmodels actionset actionsets jedit getactionsets actionsets actionset actionset actionsets actionset getactioncount modellabel actionset getlabel modellabel actionset getpluginjar addelement createmodel modellabel actionset getactionnames miscutilities stringicasecompare currentmodel shortcutsmodel elementat private shortcuts model create model string model label string actions vector bindings new vector actions length for int i 0 i actions length i string name actions i string label j edit get property actions i label skip certain actions this way if label null continue label gui utilities prettify menu label label add bindings name label bindings return new shortcuts model model label bindings shortcutsmodel createmodel modellabel jedit getproperty guiutilities prettifymenulabel addbindings shortcutsmodel modellabel private void add bindings string name string label vector bindings grab key dialog key binding b new grab key dialog key binding 2 b 0 create binding name label j edit get property name shortcut b 1 create binding name label j edit get property name shortcut2 bindings add element b addbindings grabkeydialog keybinding grabkeydialog keybinding createbinding jedit getproperty createbinding jedit getproperty addelement private grab key dialog key binding create binding string name string label string shortcut if shortcut null shortcut length 0 shortcut null grab key dialog key binding binding new grab key dialog key binding name label shortcut false all bindings add element binding return binding grabkeydialog keybinding createbinding grabkeydialog keybinding grabkeydialog keybinding allbindings addelement public void mouse clicked mouse event evt switch key table get table header column at point evt get point case 0 current model sort 0 break case 1 current model sort 1 break case 2 current model sort 2 break mouseclicked mouseevent keytable gettableheader columnatpoint getpoint currentmodel currentmodel currentmodel public void mouse clicked mouse event evt int row key table get selected row int col key table get selected column if col 0 row 1 grab key dialog gkd new grab key dialog gui utilities get parent dialog shortcuts option pane this current model get binding at row col 1 all bindings null if gkd isok current model set value at gkd get shortcut row col mouseclicked mouseevent keytable getselectedrow keytable getselectedcolumn grabkeydialog grabkeydialog guiutilities getparentdialog shortcutsoptionpane currentmodel getbindingat allbindings currentmodel setvalueat getshortcut public void action performed action event evt shortcuts model new model shortcuts model select model get selected item if current model new model current model new model key table set model current model actionperformed actionevent shortcutsmodel newmodel shortcutsmodel selectmodel getselecteditem currentmodel newmodel currentmodel newmodel keytable setmodel currentmodel shortcuts model string name vector bindings this name name this bindings bindings sort 0 shortcutsmodel public void sort int col misc utilities quicksort bindings new key compare col fire table data changed miscutilities keycompare firetabledatachanged public int get column count return 3 getcolumncount public int get row count return bindings size getrowcount public object get value at int row int col switch col case 0 return get binding at row 0 label case 1 return get binding at row 0 shortcut case 2 return get binding at row 1 shortcut default return null getvalueat getbindingat getbindingat getbindingat public void set value at object value int row int col if col 0 return get binding at row col 1 shortcut string value redraw the whole table because a second shortcut might have changed too fire table data changed setvalueat getbindingat firetabledatachanged public string get column name int index switch index case 0 return j edit get property options shortcuts name case 1 return j edit get property options shortcuts shortcut1 case 2 return j edit get property options shortcuts shortcut2 default return null getcolumnname jedit getproperty jedit getproperty jedit getproperty public void save enumeration e bindings elements while e has more elements grab key dialog key binding binding grab key dialog key binding e next element j edit set property binding 0 name shortcut binding 0 shortcut j edit set property binding 1 name shortcut2 binding 1 shortcut hasmoreelements grabkeydialog keybinding grabkeydialog keybinding nextelement jedit setproperty jedit setproperty public grab key dialog key binding get binding at int row int nr grab key dialog key binding binding grab key dialog key binding bindings element at row return binding nr grabkeydialog keybinding getbindingat grabkeydialog keybinding grabkeydialog keybinding elementat public string to string return name tostring int col key compare int col this col col keycompare public int compare object obj1 object obj2 grab key dialog key binding k1 grab key dialog key binding obj1 grab key dialog key binding k2 grab key dialog key binding obj2 string label1 k1 0 label to lower case string label2 k2 0 label to lower case if col 0 return misc utilities compare strings label1 label2 true else string shortcut1 shortcut2 if col 1 shortcut1 k1 0 shortcut shortcut2 k2 0 shortcut else shortcut1 k1 1 shortcut shortcut2 k2 1 shortcut if shortcut1 null shortcut2 null return 1 else if shortcut2 null shortcut1 null return 1 else if shortcut1 null shortcut2 null return misc utilities compare strings label1 label2 true else return misc utilities compare strings shortcut1 shortcut2 true grabkeydialog keybinding grabkeydialog keybinding grabkeydialog keybinding grabkeydialog keybinding tolowercase tolowercase miscutilities comparestrings miscutilities comparestrings miscutilities comparestrings get view method returns the view containing this edit pane since j edit 2 5pre2 public view get view return view getview jedit getview get buffer method returns the current buffer since j edit 2 5pre2 public buffer get buffer return buffer getbuffer jedit getbuffer set buffer method sets the current buffer param buffer the buffer to edit since j edit 2 5pre2 public void set buffer final buffer buffer if buffer null throw new null pointer exception if this buffer buffer return if buffer inside compound edit buffer end compound edit recent buffer this buffer if recent buffer null save caret info this buffer buffer text area set buffer buffer if init view update title if buffer switcher null if buffer switcher get selected item buffer buffer switcher set selected item buffer edit bus send new edit pane update this edit pane update buffer changed swing utilities invoke later new runnable public void run only do this if we are the current edit pane if view get edit pane edit pane this buffer switcher null buffer switcher is popup visible text area request focus only do this after all i o requests are complete runnable runnable new runnable public void run avoid a race condition see bug 834338 if buffer get buffer load caret info if buffer is performingio vfs manager run inawt thread runnable else runnable run setbuffer jedit setbuffer nullpointerexception insidecompoundedit endcompoundedit recentbuffer recentbuffer savecaretinfo textarea setbuffer updatetitle bufferswitcher bufferswitcher getselecteditem bufferswitcher setselecteditem editbus editpaneupdate editpaneupdate buffer_changed swingutilities invokelater geteditpane editpane bufferswitcher bufferswitcher ispopupvisible textarea requestfocus getbuffer loadcaretinfo isperformingio vfsmanager runinawtthread public void run only do this if we are the current edit pane if view get edit pane edit pane this buffer switcher null buffer switcher is popup visible text area request focus geteditpane editpane bufferswitcher bufferswitcher ispopupvisible textarea requestfocus public void run avoid a race condition see bug 834338 if buffer get buffer load caret info getbuffer loadcaretinfo prev buffer method selects the previous buffer since j edit 2 7pre2 public void prev buffer buffer buffer this buffer get prev if buffer null set buffer j edit get last buffer else set buffer buffer prevbuffer jedit prevbuffer getprev setbuffer jedit getlastbuffer setbuffer next buffer method selects the next buffer since j edit 2 7pre2 public void next buffer buffer buffer this buffer get next if buffer null set buffer j edit get first buffer else set buffer buffer nextbuffer jedit nextbuffer getnext setbuffer jedit getfirstbuffer setbuffer recent buffer method selects the most recently edited buffer since j edit 2 7pre2 public void recent buffer if recent buffer null set buffer recent buffer else get toolkit beep recentbuffer jedit recentbuffer recentbuffer setbuffer recentbuffer gettoolkit focus on text area method sets the focus onto the text area since j edit 2 5pre2 public void focus on text area swing utilities invoke later new runnable public void run text area request focus focusontextarea jedit focusontextarea swingutilities invokelater textarea requestfocus swing utilities invoke later new runnable public void run text area request focus swingutilities invokelater textarea requestfocus get text area method returns the view s text area since j edit 2 5pre2 public j edit text area get text area return text area gettextarea jedit jedittextarea gettextarea textarea get buffer switcher method returns the buffer switcher combo box instance since j edit 4 1pre8 public buffer switcher get buffer switcher return buffer switcher getbufferswitcher jedit bufferswitcher getbufferswitcher bufferswitcher show buffer switcher method shows the buffer switcher combo box since j edit 4 1pre8 public void show buffer switcher if buffer switcher null get toolkit beep else buffer switcher request focus buffer switcher show popup showbufferswitcher jedit showbufferswitcher bufferswitcher gettoolkit bufferswitcher requestfocus bufferswitcher showpopup save caret info method saves the caret information to the current buffer since j edit 2 5pre2 public void save caret info if buffer is loaded return buffer set integer property buffer caret text area get caret position selection selection text area get selection if selection null buffer set property buffer selection selection buffer set integer property buffer scroll vert text area get first physical line buffer set integer property buffer scroll horiz text area get horizontal offset savecaretinfo jedit savecaretinfo isloaded setintegerproperty textarea getcaretposition textarea getselection setproperty setintegerproperty scroll_vert textarea getfirstphysicalline setintegerproperty scroll_horiz textarea gethorizontaloffset load caret info method loads the caret information from the current buffer since j edit 2 5pre2 public void load caret info integer caret integer buffer get property buffer caret selection selection selection buffer get property buffer selection integer first line integer buffer get property buffer scroll vert integer horizontal offset integer buffer get property buffer scroll horiz if caret null text area set caret position math min caret int value buffer get length if selection null text area set selection selection if first line null text area set first physical line first line int value if horizontal offset null text area set horizontal offset horizontal offset int value silly bug workaround 8694 if you look at the above code note that we restore the saved caret position first then scroll to the saved location however the caret changing can itself result in scrolling to a different location than what was saved and since move caret position calls update bracket highlight the bracket highlight s out of bounds calculation will rely on a different set of physical first last lines than what we will end up with eventually instead of confusing the user with status messages that appear at random when switching buffers we simply hide the message altogether view get status set message null loadcaretinfo jedit loadcaretinfo getproperty getproperty firstline getproperty scroll_vert horizontaloffset getproperty scroll_horiz textarea setcaretposition intvalue getlength textarea setselection firstline textarea setfirstphysicalline firstline intvalue horizontaloffset textarea sethorizontaloffset horizontaloffset intvalue movecaretposition updatebrackethighlight getstatus setmessage handle message method public void handle message eb message msg if msg instanceof properties changed properties changed load buffer switcher else if msg instanceof buffer update handle buffer update buffer update msg handlemessage handlemessage ebmessage propertieschanged propertieschanged loadbufferswitcher bufferupdate handlebufferupdate bufferupdate get minimum size method returns 0 0 for split pane compatibility public final dimension get minimum size return new dimension 0 0 getminimumsize getminimumsize to string method public string to string return get class get name view get edit pane this active inactive tostring tostring getclass getname geteditpane edit pane constructor edit pane view view buffer buffer super new border layout init true this view view edit bus add to bus this text area new j edit text area view add border layout center text area properties changed if buffer null set buffer j edit get first buffer else set buffer buffer load buffer switcher init false editpane editpane borderlayout editbus addtobus textarea jedittextarea borderlayout textarea propertieschanged setbuffer jedit getfirstbuffer setbuffer loadbufferswitcher close method void close save caret info edit bus send new edit pane update this edit pane update destroyed edit bus remove from bus this text area dispose savecaretinfo editbus editpaneupdate editpaneupdate editbus removefrombus textarea properties changed method private void properties changed text area painter painter text area get painter painter set font j edit get font property view font painter set structure highlight enabled j edit get boolean property view structure highlight painter set structure highlight color j edit get color property view structure highlight color painter seteol markers painted j edit get boolean property view eol markers painter seteol marker color j edit get color property view eol marker color painter set wrap guide painted j edit get boolean property view wrap guide painter set wrap guide color j edit get color property view wrap guide color painter set caret color j edit get color property view caret color painter set selection color j edit get color property view selection color painter set multiple selection color j edit get color property view multiple selection color painter set background j edit get color property view bg color painter set foreground j edit get color property view fg color painter set block caret enabled j edit get boolean property view block caret painter set line highlight enabled j edit get boolean property view line highlight painter set line highlight color j edit get color property view line highlight color painter set anti alias enabled j edit get boolean property view anti alias painter set fractional font metrics enabled j edit get boolean property view frac font metrics string default font j edit get property view font int default font size j edit get integer property view fontsize 12 painter set styles gui utilities load styles default font default font size syntax style fold line style new syntax style 4 for int i 0 i 3 i fold line style i gui utilities parse style j edit get property view style fold line i default font default font size painter set fold line style fold line style gutter gutter text area get gutter gutter set expanded j edit get boolean property view gutter line numbers int interval j edit get integer property view gutter highlight interval 5 gutter set highlight interval interval gutter set current line highlight enabled j edit get boolean property view gutter highlight current line gutter set structure highlight enabled j edit get boolean property view gutter structure highlight gutter set structure highlight color j edit get color property view gutter structure highlight color gutter set background j edit get color property view gutter bg color gutter set foreground j edit get color property view gutter fg color gutter set highlighted foreground j edit get color property view gutter highlight color gutter set fold color j edit get color property view gutter fold color gutter set marker highlight color j edit get color property view gutter marker color gutter set marker highlight enabled j edit get boolean property view gutter marker highlight gutter set current line foreground j edit get color property view gutter current line color string alignment j edit get property view gutter number alignment if right equals alignment gutter set line number alignment gutter right else if center equals alignment gutter set line number alignment gutter center else left default case gutter set line number alignment gutter left gutter set font j edit get font property view gutter font int width j edit get integer property view gutter border width 3 gutter set border width j edit get color property view gutter focus border color j edit get color property view gutter no focus border color text area get painter get background text area set caret blink enabled j edit get boolean property view caret blink text area set electric scroll j edit get integer property view electric borders 0 set up the right click popup menu j popup menu popup gui utilities load popup menu view context j menu item customize new j menu item j edit get property view context customize customize add action listener new action listener public void action performed action event evt new global options view context popup add separator popup add customize text area set right click popup popup use old property name for backwards compatibility text area set quick copy enabled j edit get boolean property view middle mouse paste text area set drag enabled j edit get boolean property view drag and drop text area properties changed propertieschanged propertieschanged textareapainter textarea getpainter setfont jedit getfontproperty setstructurehighlightenabled jedit getbooleanproperty structurehighlight setstructurehighlightcolor jedit getcolorproperty structurehighlightcolor seteolmarkerspainted jedit getbooleanproperty eolmarkers seteolmarkercolor jedit getcolorproperty eolmarkercolor setwrapguidepainted jedit getbooleanproperty wrapguide setwrapguidecolor jedit getcolorproperty wrapguidecolor setcaretcolor jedit getcolorproperty caretcolor setselectioncolor jedit getcolorproperty selectioncolor setmultipleselectioncolor jedit getcolorproperty multipleselectioncolor setbackground jedit getcolorproperty bgcolor setforeground jedit getcolorproperty fgcolor setblockcaretenabled jedit getbooleanproperty blockcaret setlinehighlightenabled jedit getbooleanproperty linehighlight setlinehighlightcolor jedit getcolorproperty linehighlightcolor setantialiasenabled jedit getbooleanproperty antialias setfractionalfontmetricsenabled jedit getbooleanproperty fracfontmetrics defaultfont jedit getproperty defaultfontsize jedit getintegerproperty setstyles guiutilities loadstyles defaultfont defaultfontsize syntaxstyle foldlinestyle syntaxstyle foldlinestyle guiutilities parsestyle jedit getproperty foldline defaultfont defaultfontsize setfoldlinestyle foldlinestyle textarea getgutter setexpanded jedit getbooleanproperty linenumbers jedit getintegerproperty highlightinterval sethighlightinterval setcurrentlinehighlightenabled jedit getbooleanproperty highlightcurrentline setstructurehighlightenabled jedit getbooleanproperty structurehighlight setstructurehighlightcolor jedit getcolorproperty structurehighlightcolor setbackground jedit getcolorproperty bgcolor setforeground jedit getcolorproperty fgcolor sethighlightedforeground jedit getcolorproperty highlightcolor setfoldcolor jedit getcolorproperty foldcolor setmarkerhighlightcolor jedit getcolorproperty markercolor setmarkerhighlightenabled jedit getbooleanproperty markerhighlight setcurrentlineforeground jedit getcolorproperty currentlinecolor jedit getproperty numberalignment setlinenumberalignment setlinenumberalignment setlinenumberalignment setfont jedit getfontproperty jedit getintegerproperty borderwidth setborder jedit getcolorproperty focusbordercolor jedit getcolorproperty nofocusbordercolor textarea getpainter getbackground textarea setcaretblinkenabled jedit getbooleanproperty caretblink textarea setelectricscroll jedit getintegerproperty electricborders jpopupmenu guiutilities loadpopupmenu jmenuitem jmenuitem jedit getproperty addactionlistener actionlistener actionperformed actionevent globaloptions addseparator textarea setrightclickpopup textarea setquickcopyenabled jedit getbooleanproperty middlemousepaste textarea setdragenabled jedit getbooleanproperty draganddrop textarea propertieschanged customize add action listener new action listener public void action performed action event evt new global options view context addactionlistener actionlistener actionperformed actionevent globaloptions load buffer switcher method private void load buffer switcher if j edit get boolean property view show buffer switcher if buffer switcher null buffer switcher new buffer switcher this if init buffer switcher null try init buffer switcher invoke null new object edit pane this buffer switcher catch exception e log log log error this e add border layout north buffer switcher buffer switcher update buffer list revalidate else if buffer switcher null remove buffer switcher revalidate buffer switcher null loadbufferswitcher loadbufferswitcher jedit getbooleanproperty showbufferswitcher bufferswitcher bufferswitcher bufferswitcher initbufferswitcher initbufferswitcher editpane bufferswitcher borderlayout bufferswitcher bufferswitcher updatebufferlist bufferswitcher bufferswitcher bufferswitcher handle buffer update method private void handle buffer update buffer update msg buffer buffer msg get buffer if msg get what buffer update created if buffer switcher null buffer switcher update buffer list when closing the last buffer the buffer update closed handler doesn t call set buffer because null buffers are not supported instead it waits for the subsequent untitled file creation if buffer is closed set buffer j edit get first buffer since recent buffer will be set to the one that was closed recent buffer null else if msg get what buffer update closed if buffer switcher null buffer switcher update buffer list if buffer buffer buffer new buffer recent buffer null recent buffer buffer get prev if new buffer null new buffer is closed set buffer new buffer else if j edit get buffer count 0 set buffer j edit get first buffer recent buffer null else if buffer recent buffer recent buffer null else if msg get what buffer update load started if buffer buffer text area set caret position 0 text area get painter repaint else if msg get what buffer update loaded if buffer buffer text area repaint if buffer switcher null buffer switcher update buffer list if view get edit pane this status bar status view get status status update caret status status update buffer status status update misc status load caret info else if msg get what buffer update dirty changed if buffer buffer if buffer switcher null if buffer is dirty buffer switcher repaint else buffer switcher update buffer list else if msg get what buffer update markers changed if buffer buffer text area get gutter repaint else if msg get what buffer update properties changed if buffer buffer text area properties changed if view get edit pane this view get status update buffer status else if msg get what buffer update saved if buffer buffer text area properties changed handlebufferupdate handlebufferupdate bufferupdate _buffer getbuffer getwhat bufferupdate bufferswitcher bufferswitcher updatebufferlist bufferupdate setbuffer isclosed setbuffer jedit getfirstbuffer recentbuffer recentbuffer getwhat bufferupdate bufferswitcher bufferswitcher updatebufferlist _buffer newbuffer recentbuffer recentbuffer _buffer getprev newbuffer newbuffer isclosed setbuffer newbuffer jedit getbuffercount setbuffer jedit getfirstbuffer recentbuffer _buffer recentbuffer recentbuffer getwhat bufferupdate load_started _buffer textarea setcaretposition textarea getpainter getwhat bufferupdate _buffer textarea bufferswitcher bufferswitcher updatebufferlist geteditpane statusbar getstatus updatecaretstatus updatebufferstatus updatemiscstatus loadcaretinfo getwhat bufferupdate dirty_changed _buffer bufferswitcher isdirty bufferswitcher bufferswitcher updatebufferlist getwhat bufferupdate markers_changed _buffer textarea getgutter getwhat bufferupdate properties_changed _buffer textarea propertieschanged geteditpane getstatus updatebufferstatus getwhat bufferupdate _buffer textarea propertieschanged paint chunk list method paints a chunk list param chunks the chunk list param gfx the graphics context param x the x co ordinate param y the y co ordinate return the width of the painted text since j edit 4 2pre1 public static float paint chunk list chunk chunks graphics2d gfx float x float y boolean glyph vector rectangle clip rect gfx get clip bounds float x 0 0f while chunks null only paint visible chunks if x x chunks width clip rect x x x clip rect x clip rect width useful for debugging purposes if debug chunk paint debug gfx draw new rectangle2d float x x y 10 chunks width 10 if chunks accessable chunks visible gfx set font chunks style get font gfx set color chunks style get foreground color if glyph vector chunks gv null gfx draw glyph vector chunks gv x x y else if chunks str null gfx draw string chunks str int x x int y x chunks width chunks chunk chunks next return x paintchunklist jedit paintchunklist glyphvector cliprect getclipbounds _x _x cliprect _x cliprect cliprect chunk_paint_debug _x setfont getfont setcolor getforegroundcolor glyphvector drawglyphvector _x drawstring _x _x _x paint chunk backgrounds method paints the background highlights of a chunk list param chunks the chunk list param gfx the graphics context param x the x co ordinate param y the y co ordinate return the width of the painted backgrounds since j edit 4 2pre1 public static float paint chunk backgrounds chunk chunks graphics2d gfx float x float y rectangle clip rect gfx get clip bounds float x 0 0f font metrics for background gfx get font metrics int ascent for background get ascent int height for background get height while chunks null only paint visible chunks if x x chunks width clip rect x x x clip rect x clip rect width if chunks accessable paint token background color if necessary color bg color chunks background if bg color null gfx set color bg color gfx fill new rectangle2d float x x y ascent x chunks width x height x chunks width chunks chunk chunks next return x paintchunkbackgrounds jedit paintchunkbackgrounds cliprect getclipbounds _x fontmetrics forbackground getfontmetrics forbackground getascent forbackground getheight _x cliprect _x cliprect cliprect bgcolor bgcolor setcolor bgcolor _x _x _x _x _x offset tox method converts an offset in a chunk list into an x co ordinate param chunks the chunk list param offset the offset since j edit 4 1pre1 public static float offset tox chunk chunks int offset if chunks null offset chunks offset throw new array index out of bounds exception offset chunks offset float x 0 0f while chunks null if chunks accessable offset chunks offset chunks length return x chunks offset tox offset chunks offset x chunks width chunks chunk chunks next return x offsettox jedit offsettox arrayindexoutofboundsexception offsettox x to offset method converts an x co ordinate in a chunk list into an offset param chunks the chunk list param x the x co ordinate param round round up to next letter if past the middle of a letter return the offset within the line or 1 if the x co ordinate is too far to the right since j edit 4 1pre1 public static int x to offset chunk chunks float x boolean round float x 0 0f while chunks null if chunks accessable x x chunks width return chunks x to offset x x round x chunks width chunks chunk chunks next return 1 xtooffset jedit xtooffset _x _x xtooffset _x _x chunk constructor public chunk float width int offset parser rule set rules super token null offset 0 rules this width width parserruleset chunk constructor public chunk byte id int offset int length parser rule set rules syntax style styles byte defaultid super id offset length rules accessable true style styles id background style get background color if background null background styles defaultid get background color parserruleset syntaxstyle getbackgroundcolor getbackgroundcolor get positions method public final float get positions if gv null return null if positions null positions gv get glyph positions 0 length null return positions getpositions getpositions getglyphpositions offset tox method public final float offset tox int offset if visible return 0 0f else if monospaced return offset char width else return get positions offset 2 offsettox offsettox charwidth getpositions x to offset method public final int x to offset float x boolean round if visible if round width x x return offset length else return offset else if monospaced x math max 0 x float remainder x char width int i int x char width if round remainder char width 2 return offset i 1 else return offset i else float pos get positions for int i 0 i length i float glyphx pos i 2 float nextx i length 1 width pos i 2 2 if nextx x if round nextx x x glyphx return offset i else return offset i 1 wtf return 1 xtooffset xtooffset charwidth charwidth charwidth getpositions init method public void init segment seg tab expander expander float x font render context font render context initialized true if style null char width style get char width if accessable do nothing else if length 1 seg array seg offset offset t visible false float newx expander next tab stop x offset length width newx x else if char width 0 debug disable monospace hack visible monospaced true str new string seg array seg offset offset length width char width length else visible true str new string seg array seg offset offset length gv style get font create glyph vector font render context str width float gv get logical bounds get width tabexpander fontrendercontext fontrendercontext charwidth getcharwidth nexttabstop charwidth disable_monospace_hack charwidth getfont createglyphvector fontrendercontext getlogicalbounds getwidth used to add source file info to exception public void set error source file string file this source file file seterrorsourcefile sourcefile public string get error source file return source file geterrorsourcefile sourcefile this constructor is used by the method generate parse exception in the generated parser calling this constructor generates a new object of this type with the fields current token expected token sequences and token image set the boolean flag special constructor is also set to true to indicate that this constructor was used to create this object this constructor calls its super class with the empty string to force the to string method of parent class throwable to print the error message in the form parse exception result of get message public parse exception token current token val int expected token sequences val string token image val begin bean shell modification constructor this end bean shell modification constructor special constructor true current token current token val expected token sequences expected token sequences val token image token image val generateparseexception currenttoken expectedtokensequences tokenimage specialconstructor tostring parseexception getmessage parseexception currenttokenval expectedtokensequencesval tokenimageval beanshell beanshell specialconstructor currenttoken currenttokenval expectedtokensequences expectedtokensequencesval tokenimage tokenimageval the following constructors are for use by you for whatever purpose you can think of constructing the exception in this manner makes the exception behave in the normal way i e as documented in the class throwable the fields error token expected token sequences and token image do not contain relevant information the javacc generated code does not use these constructors public parse exception begin bean shell modification constructor this end bean shell modification constructor special constructor false errortoken expectedtokensequences tokenimage parseexception beanshell beanshell specialconstructor public parse exception string message begin bean shell modification super constructor args null node null callstack parse exception knows where the error is super message null null end bean shell modification super constructor args special constructor false parseexception beanshell parseexception beanshell specialconstructor begin bean shell modification moved body to overloaded get message public string get message return get message false end bean shell modification moved body to overloaded get message beanshell getmessage getmessage getmessage beanshell getmessage this method has the standard behavior when this object has been created using the standard constructors otherwise it uses current token and expected token sequences to generate a parse error message and returns it if this object has been created due to a parse error and you do not catch it it gets thrown from the parser then this method is called during the printing of the final stack trace and hence the correct error message gets displayed begin bean shell modification added debug param public string get message boolean debug end bean shell modification added debug param if special constructor return super get message string expected int max size 0 for int i 0 i expected token sequences length i if max size expected token sequences i length max size expected token sequences i length for int j 0 j expected token sequences i length j expected token image expected token sequences i j if expected token sequences i expected token sequences i length 1 0 expected expected eol begin bean shell modification added source file info string retval in file source file encountered end bean shell modification added source file info token tok current token next for int i 0 i max size i if i 0 retval if tok kind 0 retval token image 0 break retval add escapes tok image tok tok next retval at line current token next begin line column current token next begin column eol begin bean shell modification made conditional on debug if debug if expected token sequences length 1 retval was expecting eol else retval was expecting one of eol retval expected end bean shell modification made conditional on debug return retval currenttoken expectedtokensequences beanshell getmessage beanshell specialconstructor getmessage maxsize expectedtokensequences maxsize expectedtokensequences maxsize expectedtokensequences expectedtokensequences tokenimage expectedtokensequences expectedtokensequences expectedtokensequences beanshell sourcefile sourcefile beanshell sourcefile currenttoken maxsize tokenimage add_escapes currenttoken beginline currenttoken begincolumn beanshell expectedtokensequences beanshell used to convert raw characters to their escaped version when these raw version cannot be used as part of an ascii string literal protected string add escapes string str string buffer retval new string buffer char ch for int i 0 i str length i switch str char at i case 0 continue case b retval append b continue case t retval append t continue case n retval append n continue case f retval append f continue case r retval append r continue case retval append continue case retval append continue case retval append continue default if ch str char at i 0x20 ch 0x7e string s 0000 integer to string ch 16 retval append u s substring s length 4 s length else retval append ch continue return retval to string add_escapes stringbuffer stringbuffer charat charat tostring tostring public int get error line number return current token next begin line geterrorlinenumber currenttoken beginline public string get error text copied from generated get message int max size 0 for int i 0 i expected token sequences length i if max size expected token sequences i length max size expected token sequences i length string retval token tok current token next for int i 0 i max size i if i 0 retval if tok kind 0 retval token image 0 break retval add escapes tok image tok tok next return retval geterrortext getmessage maxsize expectedtokensequences maxsize expectedtokensequences maxsize expectedtokensequences currenttoken maxsize tokenimage add_escapes public string to string return get message tostring getmessage public eval error string s simple node node call stack callstack set message s this node node freeze the callstack for the stack trace if callstack null this callstack callstack copy evalerror simplenode callstack setmessage print the error with line number and stack trace public string to string string trace if node null trace at line node get line number in file node get source file node get text else users should not normally see this trace at unknown location if callstack null trace trace n get script stack trace return get message trace tostring getlinenumber getsourcefile gettext getscriptstacktrace getmessage re throw the error prepending the specified message public void re throw string msg throws eval error prepend message msg throw this rethrow evalerror prependmessage the error has trace info associated with it i e it has an ast node that can print its location and source text simple node get node return node simplenode getnode void set node simple node node this node node setnode simplenode public string get error text if node null return node get text else return unknown error geterrortext gettext public int get error line number if node null return node get line number else return 1 geterrorlinenumber getlinenumber public string get error source file if node null return node get source file else return unknown file geterrorsourcefile getsourcefile public string get script stack trace if callstack null return unknown string trace call stack stack callstack copy while stack depth 0 name space ns stack pop simple node node ns get node if ns is method trace trace n called from method ns get name if node null trace at line node get line number in file node get source file node get text return trace getscriptstacktrace callstack namespace simplenode getnode ismethod ncalled getname getlinenumber getsourcefile gettext see to string for a full display of the information public string get message return message tostring getmessage public string get message return message public void set message string s message s getmessage setmessage prepend the message if it is non null protected void prepend message string s if s null return if message null message s else message s message prependmessage browser view constructor public browser view final vfs browser browser this browser browser tmp expanded new hash set parent directories new j list parent directories get selection model set selection mode list selection model single selection parent directories set cell renderer new parent directory renderer parent directories set visible row count 5 parent directories add mouse listener new parent mouse handler final j scroll pane parent scroller new j scroll pane parent directories parent scroller set minimum size new dimension 0 0 table new vfs directory entry table this table add mouse listener new table mouse handler j scroll pane table scroller new j scroll pane table table scroller set minimum size new dimension 0 0 table scroller get viewport set background table get background table scroller get viewport add mouse listener new table mouse handler split pane new j split pane browser is horizontal layout j split pane horizontal split j split pane vertical split parent scroller table scroller split pane set one touch expandable true swing utilities invoke later new runnable public void run string prop browser is horizontal layout vfs browser horizontal splitter vfs browser splitter int loc j edit get integer property prop 1 if loc 1 loc parent scroller get preferred size height split pane set divider location loc parent directories ensure index is visible parent directories get model get size if browser is multiple selection enabled table get selection model set selection mode list selection model multiple interval selection else table get selection model set selection mode list selection model single selection set layout new border layout add border layout center split pane properties changed browserview browserview vfsbrowser tmpexpanded hashset parentdirectories jlist parentdirectories getselectionmodel setselectionmode listselectionmodel single_selection parentdirectories setcellrenderer parentdirectoryrenderer parentdirectories setvisiblerowcount parentdirectories addmouselistener parentmousehandler jscrollpane parentscroller jscrollpane parentdirectories parentscroller setminimumsize vfsdirectoryentrytable addmouselistener tablemousehandler jscrollpane tablescroller jscrollpane tablescroller setminimumsize tablescroller getviewport setbackground getbackground tablescroller getviewport addmouselistener tablemousehandler splitpane jsplitpane ishorizontallayout jsplitpane horizontal_split jsplitpane vertical_split parentscroller tablescroller splitpane setonetouchexpandable swingutilities invokelater ishorizontallayout horizontalsplitter jedit getintegerproperty parentscroller getpreferredsize splitpane setdividerlocation parentdirectories ensureindexisvisible parentdirectories getmodel getsize ismultipleselectionenabled getselectionmodel setselectionmode listselectionmodel multiple_interval_selection getselectionmodel setselectionmode listselectionmodel single_selection setlayout borderlayout borderlayout splitpane propertieschanged public void run string prop browser is horizontal layout vfs browser horizontal splitter vfs browser splitter int loc j edit get integer property prop 1 if loc 1 loc parent scroller get preferred size height split pane set divider location loc parent directories ensure index is visible parent directories get model get size ishorizontallayout horizontalsplitter jedit getintegerproperty parentscroller getpreferredsize splitpane setdividerlocation parentdirectories ensureindexisvisible parentdirectories getmodel getsize focus on file view method public void focus on file view table request focus focusonfileview focusonfileview requestfocus remove notify method public void remove notify string prop browser is horizontal layout vfs browser horizontal splitter vfs browser splitter j edit set integer property prop split pane get divider location super remove notify removenotify removenotify ishorizontallayout horizontalsplitter jedit setintegerproperty splitpane getdividerlocation removenotify get selected files method public vfs directory entry get selected files return table get selected files getselectedfiles directoryentry getselectedfiles getselectedfiles select none method public void select none table clear selection selectnone selectnone clearselection save expansion state method public void save expansion state tmp expanded clear table get expanded directories tmp expanded saveexpansionstate saveexpansionstate tmpexpanded getexpandeddirectories tmpexpanded clear expansion state method public void clear expansion state tmp expanded clear clearexpansionstate clearexpansionstate tmpexpanded load directory method public void load directory object node string path path misc utilities construct path browser get directory path vfs vfs vfs manager getvfs for path path object session vfs createvfs session path this if session null return if node null parent directories set list data new object new loading placeholder object load info new object 2 vfs manager run in work thread new browserio request browserio request list directory browser session vfs path null load info browser directory loaded node load info loaddirectory loaddirectory miscutilities constructpath getdirectory vfsmanager getvfsforpath createvfssession parentdirectories setlistdata loadingplaceholder loadinfo vfsmanager runinworkthread browseriorequest browseriorequest list_directory loadinfo directoryloaded loadinfo directory loaded method public void directory loaded object node string path array list directory if reloading root update parent directory list if node null default list model parent list new default list model string parent path for vfs vfs vfs manager getvfs for path parent create a directory entry manually instead of using vfs getdirectoryentry since so many vfs s have broken implementations of this method parent list insert element at new vfs directory entry vfs get file name parent parent parent vfs directory entry directory 0l false 0 string new parent vfs get parent of path parent if new parent null vfs browser paths equal parent new parent break else parent new parent parent directories set model parent list int index parent list get size 1 parent directories set selected index index parent directories ensure index is visible index table set directory vfs manager getvfs for path path node directory tmp expanded directoryloaded directoryloaded arraylist defaultlistmodel parentlist defaultlistmodel _vfs vfsmanager getvfsforpath directoryentry _vfs _getdirectoryentry parentlist insertelementat directoryentry _vfs getfilename directoryentry newparent _vfs getparentofpath newparent vfsbrowser pathsequal newparent newparent parentdirectories setmodel parentlist parentlist getsize parentdirectories setselectedindex parentdirectories ensureindexisvisible setdirectory vfsmanager getvfsforpath tmpexpanded update file view method public void update file view table repaint updatefileview updatefileview maybe reload directory method public void maybe reload directory string path string browser dir browser get directory string symlink browser dir if misc utilities isurl browser dir symlink browser dir browser dir else symlink browser dir misc utilities resolve symlinks browser dir if vfs browser paths equal path symlink browser dir save expansion state load directory null browser dir because this method is called for every vfs update we don t want to scan the tree all the time so we use the following algorithm to determine if the path might be part of the tree if the path starts with the browser s current directory we do the tree scan if the browser s directory is favorites we have to do the tree scan as every path can appear under the favorites list if the browser s directory is roots and path is on the local filesystem do a tree scan if browser dir starts with favoritesvfs protocol browser dir starts with file rootsvfs protocol path starts with symlink browser dir return if browser dir starts with file rootsvfs protocol misc utilities isurl path misc utilities get protocol ofurl path equals file return table maybe reload directory path maybereloaddirectory maybereloaddirectory browserdir getdirectory symlinkbrowserdir miscutilities browserdir symlinkbrowserdir browserdir symlinkbrowserdir miscutilities resolvesymlinks browserdir vfsbrowser pathsequal symlinkbrowserdir saveexpansionstate loaddirectory browserdir browserdir startswith browserdir startswith filerootsvfs startswith symlinkbrowserdir browserdir startswith filerootsvfs miscutilities miscutilities getprotocolofurl maybereloaddirectory properties changed method public void properties changed show icons j edit get boolean property vfs browser show icons table properties changed split pane set border null propertieschanged propertieschanged showicons jedit getbooleanproperty showicons propertieschanged splitpane setborder get browser method returns the associated code vfs browser code instance since j edit 4 2pre1 public vfs browser get browser return browser getbrowser vfsbrowser jedit vfsbrowser getbrowser get table method public vfs directory entry table get table return table gettable vfsdirectoryentrytable gettable get parent directory list method public j list get parent directory list return parent directories getparentdirectorylist jlist getparentdirectorylist parentdirectories show file popup method private void show file popup vfs directory entry files component comp point point popup new browser commands menu browser files for the parent directory right click on the click we select the clicked item but when the popup goes away we select the currently showing directory popup add popup menu listener new popup menu listener public void popup menu canceled popup menu event e public void popup menu will become visible popup menu event e public void popup menu will become invisible popup menu event e we use swing utilities invoke later so that the action is executed before the popup is hidden swing utilities invoke later new runnable public void run int index parent directories get model get size 1 parent directories set selected index index gui utilities show popup menu popup comp point x point y showfilepopup showfilepopup directoryentry browsercommandsmenu addpopupmenulistener popupmenulistener popupmenucanceled popupmenuevent popupmenuwillbecomevisible popupmenuevent popupmenuwillbecomeinvisible popupmenuevent swingutilities invokelater swingutilities invokelater parentdirectories getmodel getsize parentdirectories setselectedindex guiutilities showpopupmenu popup add popup menu listener new popup menu listener public void popup menu canceled popup menu event e addpopupmenulistener popupmenulistener popupmenucanceled popupmenuevent public void popup menu canceled popup menu event e public void popup menu will become visible popup menu event e popupmenucanceled popupmenuevent popupmenuwillbecomevisible popupmenuevent public void popup menu will become invisible popup menu event e we use swing utilities invoke later so that the action is executed before the popup is hidden swing utilities invoke later new runnable public void run int index parent directories get model get size 1 parent directories set selected index index popupmenuwillbecomeinvisible popupmenuevent swingutilities invokelater swingutilities invokelater parentdirectories getmodel getsize parentdirectories setselectedindex public void run int index parent directories get model get size 1 parent directories set selected index index parentdirectories getmodel getsize parentdirectories setselectedindex parent directory renderer plain font ui manager get font tree font if plain font null plain font j edit get font property metal secondary font bold font new font plain font get name font bold plain font get size parentdirectoryrenderer plainfont uimanager getfont plainfont plainfont jedit getfontproperty boldfont plainfont getname plainfont getsize public component get list cell renderer component j list list object value int index boolean is selected boolean cell has focus super get list cell renderer component list value index is selected cell has focus parent directory renderer this set border new empty border 1 index 5 1 1 1 if value instanceof loading placeholder parent directory renderer this set font plain font set icon show icons file cell renderer loading icon null set text j edit get property vfs browser tree loading else if value instanceof vfs directory entry vfs directory entry dir entry vfs directory entry value parent directory renderer this set font bold font set icon show icons file cell renderer get icon for file dir entry true null set text dir entry name else if value null set text vfs does not follow vfs api return this getlistcellrenderercomponent jlist isselected cellhasfocus getlistcellrenderercomponent isselected cellhasfocus parentdirectoryrenderer setborder emptyborder loadingplaceholder parentdirectoryrenderer setfont plainfont seticon showicons filecellrenderer loadingicon settext jedit getproperty directoryentry directoryentry direntry directoryentry parentdirectoryrenderer setfont boldfont seticon showicons filecellrenderer geticonforfile direntry settext direntry settext public void mouse pressed mouse event evt int row parent directories location to index evt get point if row 1 object obj parent directories get model get element at row if obj instanceof vfs directory entry vfs directory entry dir entry vfs directory entry obj if gui utilities is popup trigger evt if popup null popup is visible popup set visible false popup null else parent directories set selected index row show file popup new vfs directory entry dir entry parent directories evt get point mousepressed mouseevent parentdirectories locationtoindex getpoint parentdirectories getmodel getelementat directoryentry directoryentry direntry directoryentry guiutilities ispopuptrigger isvisible setvisible parentdirectories setselectedindex showfilepopup directoryentry direntry parentdirectories getpoint public void mouse released mouse event evt if evt get click count 2 0 gui utilities is middle button evt get modifiers return int row parent directories location to index evt get point if row 1 object obj parent directories get model get element at row if obj instanceof vfs directory entry vfs directory entry dir entry vfs directory entry obj if gui utilities is popup trigger evt browser set directory dir entry path if browser get mode vfs browser browser focus on file view mousereleased mouseevent getclickcount guiutilities ismiddlebutton getmodifiers parentdirectories locationtoindex getpoint parentdirectories getmodel getelementat directoryentry directoryentry direntry directoryentry guiutilities ispopuptrigger setdirectory direntry getmode vfsbrowser focusonfileview mouse clicked method public void mouse clicked mouse event evt point p evt get point int row table row at point p int column table column at point p if row 1 return if column 0 vfs directory entry table model entry entry vfs directory entry table model entry table get model get value at row 0 if file cell renderer expansion toggle border is expansion toggle entry level p x return if evt get modifiers mouse event button1 mask 0 evt get click count 2 0 browser files activated evt is shift down vfs browser m open new view vfs browser m open true else if gui utilities is middle button evt get modifiers if evt is shift down table get selection model add selection interval row row else table get selection model set selection interval row row browser files activated evt is shift down vfs browser m open new view vfs browser m open true mouseclicked mouseclicked mouseevent getpoint rowatpoint columnatpoint vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel getmodel getvalueat filecellrenderer expansiontoggleborder isexpansiontoggle getmodifiers mouseevent button1_mask getclickcount filesactivated isshiftdown vfsbrowser m_open_new_view vfsbrowser m_open guiutilities ismiddlebutton getmodifiers isshiftdown getselectionmodel addselectioninterval getselectionmodel setselectioninterval filesactivated isshiftdown vfsbrowser m_open_new_view vfsbrowser m_open mouse pressed method public void mouse pressed mouse event evt point p evt get point if evt get source table p x table getx p y table gety int row table row at point p int column table column at point p if column 0 row 1 vfs directory entry table model entry entry vfs directory entry table model entry table get model get value at row 0 if file cell renderer expansion toggle border is expansion toggle entry level p x table toggle expanded row return if gui utilities is middle button evt get modifiers if row 1 nothing else if evt is shift down table get selection model add selection interval row row else table get selection model set selection interval row row else if gui utilities is popup trigger evt if popup null popup is visible popup set visible false popup null return if row 1 show file popup null table evt get point else if table get selection model is selected index row table get selection model set selection interval row row show file popup get selected files table evt get point mousepressed mousepressed mouseevent getpoint getsource rowatpoint columnatpoint vfsdirectoryentrytablemodel vfsdirectoryentrytablemodel getmodel getvalueat filecellrenderer expansiontoggleborder isexpansiontoggle toggleexpanded guiutilities ismiddlebutton getmodifiers isshiftdown getselectionmodel addselectioninterval getselectionmodel setselectioninterval guiutilities ispopuptrigger isvisible setvisible showfilepopup getpoint getselectionmodel isselectedindex getselectionmodel setselectioninterval showfilepopup getselectedfiles getpoint mouse released method public void mouse released mouse event evt if gui utilities is popup trigger evt table get selected row 1 browser files selected mousereleased mousereleased mouseevent guiutilities ispopuptrigger getselectedrow filesselected public modifiers modifiers bsh typed variable declaration int id super id bshtypedvariabledeclaration bsh typed variable declaration int id super id private bsh type get type node return bsh type jjt get child 0 bshtypedvariabledeclaration bshtype gettypenode bshtype jjtgetchild class eval type call stack callstack interpreter interpreter throws eval error bsh type type node get type node return type node get type callstack interpreter evaltype callstack evalerror bshtype typenode gettypenode typenode gettype bsh variable declarator get declarators int n jjt get num children int start 1 bsh variable declarator bvda new bsh variable declarator n start for int i start i n i bvda i start bsh variable declarator jjt get child i return bvda bshvariabledeclarator getdeclarators jjtgetnumchildren bshvariabledeclarator bshvariabledeclarator bshvariabledeclarator jjtgetchild evaluate the type and one or more variable declarators e g int a b 5 c public object eval call stack callstack interpreter interpreter throws eval error try name space namespace callstack top bsh type type node get type node class type type node get type callstack interpreter bsh variable declarator bvda get declarators for int i 0 i bvda length i bsh variable declarator dec bvda i type node is passed down the chain for array initializers which need it under some circumstances object value dec eval type node callstack interpreter try namespace set typed variable dec name type value modifiers catch util eval error e throw e to eval error this callstack catch eval error e e re throw typed variable declaration return primitive void callstack evalerror namespace bshtype typenode gettypenode typenode gettype bshvariabledeclarator getdeclarators bshvariabledeclarator typenode settypedvariable utilevalerror toevalerror evalerror rethrow public string get type descriptor call stack callstack interpreter interpreter string default package return get type node get type descriptor callstack interpreter default package gettypedescriptor callstack defaultpackage gettypenode gettypedescriptor defaultpackage edit action constructor creates a new edit action with the specified name param name the action name public edit action string name this name name editaction editaction get name method returns the internal name of this action public string get name return name getname getname get label method returns the action s label this returns the value of the property named by link get name suffixed with code label code public final string get label return j edit get property name label getlabel getname getlabel jedit getproperty get mouse over text method returns the action s mouse over message this returns the value of the property named by link get name suffixed with code mouse over code public final string get mouse over text return j edit get property name mouse over getmouseovertext getname getmouseovertext jedit getproperty invoke method invokes the action param view the view since j edit 2 7pre2 public void invoke view view jedit get view method deprecated call code gui utilities get view code instead public static view get view component comp moved to gui utilities as it makes no sense being here return gui utilities get view comp getview guiutilities getview getview guiutilities guiutilities getview is toggle method returns if this edit action should be displayed as a check box in menus this returns the value of the property named by link get name suffixed with code toggle code since j edit 2 2pre4 public final boolean is toggle return j edit get boolean property name toggle istoggle getname jedit istoggle jedit getbooleanproperty is selected method if this edit action is a toggle returns if it is selected or not param comp the component since j edit 4 2pre1 public boolean is selected component comp return false isselected jedit isselected no repeat method returns if this edit action should not be repeated returns false by default since j edit 2 7pre2 public boolean no repeat return false norepeat jedit norepeat no record method returns if this edit action should not be recorded returns false by default since j edit 2 7pre2 public boolean no record return false norecord jedit norecord no remember last method returns if this edit action should not be remembered as the most recently invoked action since j edit 4 2pre1 public boolean no remember last return false norememberlast jedit norememberlast get code method returns the bean shell code that will replay this action since j edit 2 7pre2 getcode beanshell jedit to string method public string to string return name tostring tostring creates a new action listener wrapper since j edit 4 2pre1 public wrapper action context context string action name this context context this action name action name jedit actioncontext actionname actionname actionname called when the user selects this action from a menu it passes the action through the link org gjt sp jedit gui input handler invoke action edit action method which performs any recording or repeating param evt the action event public void action performed action event evt edit action action context get action action name if action null log log log warning this unknown action action name else context invoke action evt action inputhandler invokeaction editaction actionperformed actionevent editaction getaction actionname actionname invokeaction root element constructor public root element buffer buffer this buffer buffer rootelement rootelement get document method public document get document return null getdocument getdocument get parent element method public element get parent element return null getparentelement getparentelement get name method public string get name return null getname getname get attributes method public attribute set get attributes return null getattributes attributeset getattributes get start offset method public int get start offset return 0 getstartoffset getstartoffset get end offset method public int get end offset return buffer get length 1 getendoffset getendoffset getlength get element index method public int get element index int offset return buffer get line of offset offset getelementindex getelementindex getlineofoffset get element count method public int get element count return buffer get line count getelementcount getelementcount getlinecount get element method public element get element int line return new line element buffer line getelement getelement lineelement is leaf method public boolean is leaf return false isleaf isleaf set search string method sets the current search string param search the new search string public static void set search string string search if search equals search and replace search return search and replace search search matcher null edit bus send new search settings changed null setsearchstring setsearchstring searchandreplace searchandreplace editbus searchsettingschanged get search string method returns the current search string public static string get search string return search getsearchstring getsearchstring set replace string method sets the current replacement string param replace the new replacement string public static void set replace string string replace if replace equals search and replace replace return search and replace replace replace edit bus send new search settings changed null setreplacestring setreplacestring searchandreplace searchandreplace editbus searchsettingschanged get replace string method returns the current replacement string public static string get replace string return replace getreplacestring getreplacestring set ignore case method sets the ignore case flag param ignore case true if searches should be case insensitive false otherwise public static void set ignore case boolean ignore case if ignore case search and replace ignore case return search and replace ignore case ignore case matcher null edit bus send new search settings changed null setignorecase ignorecase setignorecase ignorecase ignorecase searchandreplace ignorecase searchandreplace ignorecase ignorecase editbus searchsettingschanged get ignore case method returns the state of the ignore case flag return true if searches should be case insensitive false otherwise public static boolean get ignore case return ignore case getignorecase getignorecase ignorecase set regexp method sets the state of the regular expression flag param regexp true if regular expression searches should be performed public static void set regexp boolean regexp if regexp search and replace regexp return search and replace regexp regexp if regexp reverse reverse false matcher null edit bus send new search settings changed null setregexp setregexp searchandreplace searchandreplace editbus searchsettingschanged get regexp method returns the state of the regular expression flag return true if regular expression searches should be performed public static boolean get regexp return regexp getregexp getregexp set reverse search method determines whether a reverse search will conducted from the current position to the beginning of a buffer note that reverse search and regular expression search is mutually exclusive enabling one will disable the other param reverse true if searches should go backwards false otherwise public static void set reverse search boolean reverse if reverse search and replace reverse return search and replace reverse reverse edit bus send new search settings changed null setreversesearch setreversesearch searchandreplace searchandreplace editbus searchsettingschanged get reverse search method returns the state of the reverse search flag return true if searches should go backwards false otherwise public static boolean get reverse search return reverse getreversesearch getreversesearch set bean shell replace method sets the state of the bean shell replace flag param beanshell true if the replace string is a bean shell expression since j edit 3 2pre2 public static void set bean shell replace boolean beanshell if beanshell search and replace beanshell return search and replace beanshell beanshell edit bus send new search settings changed null setbeanshellreplace beanshell beanshell jedit setbeanshellreplace searchandreplace searchandreplace editbus searchsettingschanged get bean shell replace method returns the state of the bean shell replace flag return true if the replace string is a bean shell expression since j edit 3 2pre2 public static boolean get bean shell replace return beanshell getbeanshellreplace beanshell beanshell jedit getbeanshellreplace set auto wrap method sets the state of the auto wrap around flag param wrap if true the continue search from start dialog will not be displayed since j edit 3 2pre2 public static void set auto wrap around boolean wrap if wrap search and replace wrap return search and replace wrap wrap edit bus send new search settings changed null setautowrap jedit setautowraparound searchandreplace searchandreplace editbus searchsettingschanged get auto wrap method returns the state of the auto wrap around flag since j edit 3 2pre2 public static boolean get auto wrap around return wrap getautowrap jedit getautowraparound set search matcher method sets a custom search string matcher note that calling link set search string string link set ignore case boolean or link set regexp boolean will reset the matcher to the default public static void set search matcher search matcher matcher search and replace matcher matcher edit bus send new search settings changed null setsearchmatcher setsearchstring setignorecase setregexp setsearchmatcher searchmatcher searchandreplace editbus searchsettingschanged get search matcher method returns the current search string matcher exception illegal argument exception if regular expression search is enabled the search string or replacement string is invalid since j edit 4 1pre7 public static search matcher get search matcher throws exception if matcher null return matcher if search null equals search return null if regexp matcher new re search matcher search ignore case else matcher new boyer moore search matcher search ignore case return matcher getsearchmatcher illegalargumentexception jedit searchmatcher getsearchmatcher researchmatcher ignorecase boyermooresearchmatcher ignorecase set search file set method sets the current search file set param fileset the file set to perform searches in see all buffer set see current buffer set see directory list set public static void set search file set search file set fileset search and replace fileset fileset edit bus send new search settings changed null setsearchfileset allbufferset currentbufferset directorylistset setsearchfileset searchfileset searchandreplace editbus searchsettingschanged get search file set method returns the current search file set public static search file set get search file set return fileset getsearchfileset searchfileset getsearchfileset get smart case replace method returns if the replacement string will assume the same case as each specific occurrence of the search string since j edit 4 2pre10 public static boolean get smart case replace return replace null text utilities get string case replace text utilities lower case getsmartcasereplace jedit getsmartcasereplace textutilities getstringcase textutilities lower_case hyper search method performs a hyper search param view the view since j edit 2 7pre3 public static boolean hyper search view view return hyper search view false hypersearch hypersearch jedit hypersearch hypersearch hyper search method performs a hyper search param view the view param selection if true will only search in the current selection note that the file set must be the current buffer file set for this to work since j edit 4 0pre1 public static boolean hyper search view view boolean selection component that will parent any dialog boxes component comp search dialog get search dialog view if comp null comp view record view hyper search view selection false selection view get dockable window manager add dockable window hyper search results name final hyper search results results hyper search results view get dockable window manager get dockable hyper search results name results search started try search matcher matcher get search matcher if matcher null view get toolkit beep results search failed return false selection s if selection s view get text area get selection if s null results search failed return false else s null vfs manager run in work thread new hyper search request view matcher results s return true catch exception e results search failed handle error comp e return false hypersearch hypersearch jedit hypersearch searchdialog getsearchdialog hypersearch getdockablewindowmanager adddockablewindow hypersearchresults hypersearchresults hypersearchresults getdockablewindowmanager getdockable hypersearchresults searchstarted searchmatcher getsearchmatcher gettoolkit searchfailed gettextarea getselection searchfailed vfsmanager runinworkthread hypersearchrequest searchfailed handleerror find method finds the next occurance of the search string param view the view return true if the operation was successful false otherwise public static boolean find view view component that will parent any dialog boxes component comp search dialog get search dialog view if comp null comp is showing comp view boolean repeat false string path fileset get next file view null if path null gui utilities error comp empty fileset null return false boolean reverse reverse fileset instanceof current buffer set if reverse regexp gui utilities error comp regexp reverse null return false try view show wait cursor search matcher matcher get search matcher if matcher null view get toolkit beep return false record view find view false true loop for while path null buffer buffer j edit open temporary view null path false this is stupid and misleading but path is not used anywhere except the above line and if this is done after the continue then we will either hang or be forced to duplicate it inside the buffer null or add a finally clause you decide which one s worse path fileset get next file view path if buffer null continue loop wait for the buffer to load if buffer is loaded vfs manager wait for requests int start if view get buffer buffer repeat j edit text area text area view get text area selection s text area get selection at offset text area get caret position if s null start text area get caret position else if reverse start s get start else start s get end else if reverse start buffer get length else start 0 if find view buffer start repeat reverse return true if repeat if bean shell is script running view get status set message and clear j edit get property view status search not found view get toolkit beep return false boolean restart if auto wrap is on always restart search if auto wrap is off and we re called from a macro stop search if we re called interactively ask the user what to do if wrap if bean shell is script running view get status set message and clear j edit get property view status auto wrap beep if beep property set if j edit get boolean property search beep on search auto wrap view get toolkit beep restart true else if bean shell is script running restart false else integer args new integer reverse 1 0 int result gui utilities confirm comp keepsearching args j option pane yes no option j option pane question message restart result j option pane yes option if restart start search from beginning path fileset get first file view repeat true else break loop catch exception e handle error comp e finally view hide wait cursor return false searchdialog getsearchdialog isshowing getnextfile guiutilities _reverse currentbufferset _reverse guiutilities showwaitcursor searchmatcher getsearchmatcher gettoolkit jedit opentemporary getnextfile isloaded vfsmanager waitforrequests getbuffer jedittextarea textarea gettextarea textarea getselectionatoffset textarea getcaretposition textarea getcaretposition _reverse getstart getend _reverse getlength _reverse beanshell isscriptrunning getstatus setmessageandclear jedit getproperty gettoolkit beanshell isscriptrunning getstatus setmessageandclear jedit getproperty jedit getbooleanproperty beeponsearchautowrap gettoolkit beanshell isscriptrunning _reverse guiutilities joptionpane yes_no_option joptionpane question_message joptionpane yes_option getfirstfile handleerror hidewaitcursor find method finds the next instance of the search string in the specified buffer param view the view param buffer the buffer param start location where to start the search public static boolean find view view buffer buffer int start throws exception return find view buffer start false false find method finds the next instance of the search string in the specified buffer param view the view param buffer the buffer param start location where to start the search param first time see link search matcher next match char indexed boolean boolean boolean boolean since j edit 4 1pre7 public static boolean find view view buffer buffer int start boolean first time boolean reverse throws exception search matcher matcher get search matcher if matcher null view get toolkit beep return false segment text new segment if reverse buffer get text 0 start text else buffer get text start buffer get length start text the start and end flags will be wrong with reverse search enabled but they are only used by the regexp matcher which doesn t support reverse search yet remind fix flags when adding reverse regexp search search matcher match match matcher next match new char indexed segment text reverse start 0 true first time reverse if match null j edit commit temporary buffer view set buffer buffer j edit text area text area view get text area if reverse text area set selection new selection range start match end start match start make sure end of match is visible text area scroll to start match start false text area move caret position start match end else text area set selection new selection range start match start start match end text area move caret position start match end make sure start of match is visible text area scroll to start match start false return true else return false firsttime searchmatcher nextmatch charindexed jedit firsttime searchmatcher getsearchmatcher gettoolkit gettext gettext getlength searchmatcher nextmatch charindexedsegment firsttime jedit committemporary setbuffer jedittextarea textarea gettextarea textarea setselection textarea scrollto textarea movecaretposition textarea setselection textarea movecaretposition textarea scrollto replace method replaces the current selection with the replacement string param view the view return true if the operation was successful false otherwise public static boolean replace view view component that will parent any dialog boxes component comp search dialog get search dialog view if comp null comp view j edit text area text area view get text area buffer buffer view get buffer if buffer is editable return false boolean smart case replace get smart case replace selection selection text area get selection if selection length 0 view get toolkit beep return false record view replace view true false a little hack for reverse replace and find int caret text area get caret position selection s text area get selection at offset caret if s null caret s get start try buffer begin compound edit search matcher matcher get search matcher if matcher null return false init replace int ret val 0 for int i 0 i selection length i s selection i ret val replace in selection text area buffer matcher smart case replace s boolean reverse regexp reverse fileset instanceof current buffer set if reverse so that replace and find continues from the right location text area move caret position caret else s text area get selection at offset text area get caret position if s null text area move caret position s get end if ret val 0 view get toolkit beep return false return true catch exception e handle error comp e finally buffer end compound edit return false searchdialog getsearchdialog jedittextarea textarea gettextarea getbuffer iseditable smartcasereplace getsmartcasereplace textarea getselection gettoolkit textarea getcaretposition textarea getselectionatoffset getstart begincompoundedit searchmatcher getsearchmatcher initreplace retval retval replaceinselection textarea smartcasereplace _reverse currentbufferset _reverse textarea movecaretposition textarea getselectionatoffset textarea getcaretposition textarea movecaretposition getend retval gettoolkit handleerror endcompoundedit replace method replaces text in the specified range with the replacement string param view the view param buffer the buffer param start the start offset param end the end offset return true if the operation was successful false otherwise public static boolean replace view view buffer buffer int start int end if buffer is editable return false component that will parent any dialog boxes component comp search dialog get search dialog view if comp null comp view boolean smart case replace get smart case replace try buffer begin compound edit search matcher matcher get search matcher if matcher null return false init replace int ret val 0 ret val replace buffer matcher start end smart case replace if ret val 0 return true catch exception e handle error comp e finally buffer end compound edit return false iseditable searchdialog getsearchdialog smartcasereplace getsmartcasereplace begincompoundedit searchmatcher getsearchmatcher initreplace retval retval _replace smartcasereplace retval handleerror endcompoundedit replace all method replaces all occurances of the search string with the replacement string param view the view public static boolean replace all view view component that will parent any dialog boxes component comp search dialog get search dialog view if comp null comp view int file count 0 int occur count 0 if fileset get file count view 0 gui utilities error comp empty fileset null return false record view replace all view true true view show wait cursor boolean smart case replace replace null text utilities get string case replace text utilities lower case try search matcher matcher get search matcher if matcher null return false init replace string path fileset get first file view loop while path null buffer buffer j edit open temporary view null path false this is stupid and misleading but path is not used anywhere except the above line and if this is done after the continue then we will either hang or be forced to duplicate it inside the buffer null or add a finally clause you decide which one s worse path fileset get next file view path if buffer null continue loop wait for buffer to finish loading if buffer is performingio vfs manager wait for requests if buffer is editable continue loop leave buffer in a consistent state if an error occurs int ret val 0 try buffer begin compound edit ret val replace buffer matcher 0 buffer get length smart case replace finally buffer end compound edit if ret val 0 file count occur count ret val j edit commit temporary buffer catch exception e handle error comp e finally view hide wait cursor don t do this when playing a macro cos it s annoying if bean shell is script running object args new integer occur count new integer file count view get status set message and clear j edit get property view status replace all args if occur count 0 view get toolkit beep return file count 0 replaceall replaceall searchdialog getsearchdialog filecount occurcount getfilecount guiutilities replaceall showwaitcursor smartcasereplace textutilities getstringcase textutilities lower_case searchmatcher getsearchmatcher initreplace getfirstfile jedit opentemporary getnextfile isperformingio vfsmanager waitforrequests iseditable retval begincompoundedit retval _replace getlength smartcasereplace endcompoundedit retval filecount occurcount retval jedit committemporary handleerror hidewaitcursor beanshell isscriptrunning occurcount filecount getstatus setmessageandclear jedit getproperty occurcount gettoolkit filecount load method loads search and replace state from the properties public static void load search j edit get property search find value replace j edit get property search replace value ignore case j edit get boolean property search ignore case toggle regexp j edit get boolean property search regexp toggle beanshell j edit get boolean property search beanshell toggle wrap j edit get boolean property search wrap toggle fileset new current buffer set tags plugin likes to call this method at times other than startup so we need to fire a search settings changed to notify the search bar and so on matcher null edit bus send new search settings changed null jedit getproperty jedit getproperty ignorecase jedit getbooleanproperty ignorecase jedit getbooleanproperty jedit getbooleanproperty jedit getbooleanproperty currentbufferset searchsettingschanged editbus searchsettingschanged save method saves search and replace state to the properties public static void save j edit set property search find value search j edit set property search replace value replace j edit set boolean property search ignore case toggle ignore case j edit set boolean property search regexp toggle regexp j edit set boolean property search beanshell toggle beanshell j edit set boolean property search wrap toggle wrap jedit setproperty jedit setproperty jedit setbooleanproperty ignorecase ignorecase jedit setbooleanproperty jedit setbooleanproperty jedit setbooleanproperty handle error method static void handle error component comp exception e log log log error search and replace class e if comp instanceof dialog new text area dialog dialog comp beanshell searcherror bsh searcherror e else new text area dialog frame comp beanshell searcherror bsh searcherror e handleerror handleerror searchandreplace textareadialog textareadialog init replace method set up bean shell replace if necessary private static void init replace throws exception if beanshell replace length 0 replace method bean shell cache block replace return replace true else replace method null initreplace beanshell initreplace replacemethod beanshell cacheblock replacemethod record method private static void record view view string action boolean replace action boolean record file set macros recorder recorder view get macro recorder if recorder null recorder record search and replace set search string misc utilities chars to escapes search if replace action recorder record search and replace set replace string misc utilities chars to escapes replace recorder record search and replace set bean shell replace beanshell else only record this if doing a find next recorder record search and replace set auto wrap around wrap recorder record search and replace set reverse search reverse recorder record search and replace set ignore case ignore case recorder record search and replace set regexp regexp if record file set recorder record search and replace set search file set fileset get code recorder record search and replace action replaceaction recordfileset getmacrorecorder searchandreplace setsearchstring miscutilities charstoescapes replaceaction searchandreplace setreplacestring miscutilities charstoescapes searchandreplace setbeanshellreplace searchandreplace setautowraparound searchandreplace setreversesearch searchandreplace setignorecase ignorecase searchandreplace setregexp recordfileset searchandreplace setsearchfileset getcode searchandreplace replace in selection method private static int replace in selection j edit text area text area buffer buffer search matcher matcher boolean smart case replace selection s throws exception if an occurence occurs at the beginning of the selection the selection start will get moved this sucks so we hack to avoid it int start s get start int return value if s instanceof selection range return value replace buffer matcher s get start s get end smart case replace text area remove from selection s text area add to selection new selection range start s get end else if s instanceof selection rect selection rect rect selection rect s int start col rect get start column buffer int end col rect get end column buffer return value 0 for int j s get start line j s get end line j return value replace buffer matcher get column on other line buffer j start col get column on other line buffer j end col smart case replace text area add to selection new selection rect start s get end else throw new runtime exception unsupported s return return value replaceinselection replaceinselection jedittextarea textarea searchmatcher smartcasereplace getstart returnvalue returnvalue _replace getstart getend smartcasereplace textarea removefromselection textarea addtoselection getend startcol getstartcolumn endcol getendcolumn returnvalue getstartline getendline returnvalue _replace getcolumnonotherline startcol getcolumnonotherline endcol smartcasereplace textarea addtoselection getend runtimeexception returnvalue replace method replaces all occurances of the search string with the replacement string param buffer the buffer param start the start offset param end the end offset param matcher the search matcher to use param smart case replace see user s guide return the number of occurrences replaced private static int replace buffer buffer search matcher matcher int start int end boolean smart case replace throws exception int occur count 0 boolean end of line buffer get line end offset buffer get line of offset end 1 end segment text new segment int offset start loop for int counter 0 counter buffer get text offset end offset text boolean start of line buffer get line start offset buffer get line of offset offset offset search matcher match occur matcher next match new char indexed segment text false start of line end of line counter 0 false if occur null break loop string found new string text array text offset occur start occur end occur start int length replace one buffer occur offset found smart case replace if length 1 offset occur end else offset occur start length end length found length occur count return occur count _replace smartcasereplace _replace searchmatcher smartcasereplace occurcount endofline getlineendoffset getlineofoffset gettext startofline getlinestartoffset getlineofoffset searchmatcher nextmatch charindexedsegment startofline endofline replaceone smartcasereplace occurcount occurcount replace one method replace one occurrence of the search string with the replacement string private static int replace one buffer buffer search matcher match occur int offset string found boolean smart case replace throws exception string subst replace one occur found if smart case replace ignore case int str case text utilities get string case found if str case text utilities lower case subst subst to lower case else if str case text utilities upper case subst subst to upper case else if str case text utilities title case subst text utilities to title case subst if subst null int start offset occur start int end offset occur end buffer remove start end start buffer insert start subst return subst length else return 1 replaceone replaceone searchmatcher smartcasereplace replaceone smartcasereplace ignorecase strcase textutilities getstringcase strcase textutilities lower_case tolowercase strcase textutilities upper_case touppercase strcase textutilities title_case textutilities totitlecase replace one method private static string replace one search matcher match occur string found throws exception if regexp if replace method null return regexp bean shell replace occur else return regexp replace occur found else if replace method null return literal bean shell replace found else return replace replaceone replaceone searchmatcher replacemethod regexpbeanshellreplace regexpreplace replacemethod literalbeanshellreplace regexp bean shell replace method private static string regexp bean shell replace search matcher match occur throws exception for int i 0 i occur substitutions length i replacens set variable i occur substitutions i object obj bean shell run cached block replace method null replacens if obj null return else return obj to string regexpbeanshellreplace regexpbeanshellreplace searchmatcher setvariable _ beanshell runcachedblock replacemethod tostring regexp replace method private static string regexp replace search matcher match occur string found throws exception string buffer buf new string buffer for int i 0 i replace length i char ch replace char at i switch ch case if i replace length 1 buf append ch break ch replace char at i if ch buf append else if ch 0 buf append found else if character is digit ch int n ch 0 if n occur substitutions length buf append occur substitutions n break case if i replace length 1 buf append break ch replace char at i switch ch case n buf append n break case t buf append t break default buf append ch break break default buf append ch break return buf to string regexpreplace regexpreplace searchmatcher stringbuffer stringbuffer charat charat isdigit charat tostring literal bean shell replace method private static string literal bean shell replace string found throws exception replacens set variable 0 found object obj bean shell run cached block replace method null replacens if obj null return else return obj to string literalbeanshellreplace literalbeanshellreplace setvariable _0 beanshell runcachedblock replacemethod tostring get column on other line method should be somewhere else private static int get column on other line buffer buffer int line int col int return value buffer get offset of virtual column line col null if return value 1 return buffer get line end offset line 1 else return buffer get line start offset line return value getcolumnonotherline getcolumnonotherline returnvalue getoffsetofvirtualcolumn returnvalue getlineendoffset getlinestartoffset returnvalue re token look ahead re token re boolean negative throws re exception super 0 this re re this negative negative retokenlookahead retoken reexception boolean match char indexed input re match mymatch re match trymatch re match mymatch clone re match trymatch1 re match mymatch clone re match new match null if re match input trymatch if negative return false if next input trymatch1 new match trymatch1 if new match null if negative return false else mymatch assign from new match return true else no match if negative return next input mymatch else return false charindexed rematch rematch rematch rematch rematch rematch newmatch newmatch newmatch assignfrom newmatch void dump string buffer os os append os append negative re dump all os os append stringbuffer dumpall public quick notepad view view string position super new border layout this view view this floating position equals dockable window manager floating if j edit get settings directory null this filename j edit get property quick notepad plugin option prefix filepath if this filename null this filename length 0 this filename new string j edit get settings directory file separator qn txt j edit set property quick notepad plugin option prefix filepath this filename this default filename this filename this tool panel new quick notepad tool panel this add border layout north this tool panel if floating this set preferred size new dimension 500 250 text area new quick notepad text area text area set font quick notepad option pane make font text area add key listener new key handler j scroll pane pane new j scroll pane text area add border layout center pane read file quicknotepad borderlayout dockablewindowmanager jedit getsettingsdirectory jedit getproperty quicknotepadplugin option_prefix jedit getsettingsdirectory jedit setproperty quicknotepadplugin option_prefix defaultfilename toolpanel quicknotepadtoolpanel borderlayout toolpanel setpreferredsize textarea quicknotepadtextarea textarea setfont quicknotepadoptionpane makefont textarea addkeylistener keyhandler jscrollpane jscrollpane textarea borderlayout readfile public void focus on default component text area request focus focusondefaultcomponent textarea requestfocus for toolbar display public string get filename return filename getfilename public void handle message eb message message if message instanceof properties changed properties changed handlemessage ebmessage propertieschanged propertieschanged private void properties changed string property filename j edit get property quick notepad plugin option prefix filepath if misc utilities objects equal default filename property filename save file tool panel properties changed default filename property filename filename default filename read file font new font quick notepad option pane make font if new font equals text area get font text area set font new font propertieschanged propertyfilename jedit getproperty quicknotepadplugin option_prefix miscutilities objectsequal defaultfilename propertyfilename savefile toolpanel propertieschanged defaultfilename propertyfilename defaultfilename readfile newfont quicknotepadoptionpane makefont newfont textarea getfont textarea setfont newfont public void add notify super add notify edit bus add to bus this addnotify addnotify editbus addtobus public void remove notify save file super remove notify edit bus remove from bus this removenotify savefile removenotify editbus removefrombus public void save file if filename null filename length 0 return try file writer out new file writer filename out write text area get text out close catch io exception ioe log log log error quick notepad class could not write notepad text to filename savefile filewriter filewriter textarea gettext ioexception quicknotepad public void choose file string paths gui utilities showvfs file dialog view null j file chooser open dialog false if paths null paths 0 equals filename save file filename paths 0 tool panel properties changed read file choosefile guiutilities showvfsfiledialog jfilechooser open_dialog savefile toolpanel propertieschanged readfile public void copy to buffer j edit new file view view get edit pane get text area set text text area get text copytobuffer jedit newfile geteditpane gettextarea settext textarea gettext private void read file if filename null filename length 0 return buffered reader bf null try bf new buffered reader new file reader filename string buffer sb new string buffer 2048 string str while str bf read line null sb append str append n bf close text area set text sb to string catch file not found exception fnf log log log error quick notepad class notepad file filename does not exist catch io exception ioe log log log error quick notepad class could not read notepad file filename readfile bufferedreader bufferedreader filereader stringbuffer stringbuffer readline textarea settext tostring filenotfoundexception quicknotepad ioexception quicknotepad private class key handler extends key adapter public void key pressed key event evt if quick notepad this floating evt get key code key event vk escape evt consume dockable window manager wm quick notepad this view get dockable window manager wm remove dockable window quick notepad plugin name keyhandler keyadapter keypressed keyevent quicknotepad getkeycode keyevent vk_escape dockablewindowmanager quicknotepad getdockablewindowmanager removedockablewindow quicknotepadplugin tool bar option pane constructor public tool bar option pane super toolbar toolbaroptionpane toolbaroptionpane init method protected void init set layout new border layout j panel panel new j panel new grid layout 2 1 show toolbar show toolbar new j check box j edit get property options toolbar show toolbar show toolbar set selected j edit get boolean property view show toolbar panel add show toolbar panel add new j label j edit get property options toolbar caption add border layout north panel string toolbar j edit get property view toolbar string tokenizer st new string tokenizer toolbar list model new default list model while st has more tokens string action name string st next token if action name equals list model add element new tool bar option pane button null null else edit action action j edit get action action name if action null continue string label action get label if label null continue icon icon string icon name if action name equals icon name null icon null else icon name j edit get property action name icon if icon name null icon gui utilities load icon broken image png else icon gui utilities load icon icon name if icon null icon gui utilities load icon broken image png list model add element new button action name icon name icon label list new j list list model list set selection mode list selection model single selection list add list selection listener new list handler list set cell renderer new button cell renderer add border layout center new j scroll pane list create buttons j panel buttons new j panel buttons set border new empty border 3 0 0 0 buttons set layout new box layout buttons box layout x axis action handler action handler new action handler add new rollover button gui utilities load icon plus png add set tool tip text j edit get property options toolbar add add add action listener action handler buttons add add buttons add box create horizontal strut 6 remove new rollover button gui utilities load icon minus png remove set tool tip text j edit get property options toolbar remove remove add action listener action handler buttons add remove buttons add box create horizontal strut 6 move up new rollover button gui utilities load icon arrowu png move up set tool tip text j edit get property options toolbar move up move up add action listener action handler buttons add move up buttons add box create horizontal strut 6 move down new rollover button gui utilities load icon arrowd png move down set tool tip text j edit get property options toolbar move down move down add action listener action handler buttons add move down buttons add box create horizontal strut 6 edit new rollover button gui utilities load icon button properties png edit set tool tip text j edit get property options toolbar edit edit add action listener action handler buttons add edit buttons add box create glue update buttons add border layout south buttons ceate icons list icon list new default combo box model st new string tokenizer j edit get property icons while st has more elements string icon st next token icon list add element new icon list entry gui utilities load icon icon icon _init _init setlayout borderlayout jpanel jpanel gridlayout showtoolbar jcheckbox jedit getproperty showtoolbar showtoolbar setselected jedit getbooleanproperty showtoolbar showtoolbar jlabel jedit getproperty borderlayout jedit getproperty stringtokenizer stringtokenizer listmodel defaultlistmodel hasmoretokens actionname nexttoken actionname listmodel addelement toolbaroptionpane editaction jedit getaction actionname getlabel iconname actionname iconname iconname jedit getproperty actionname iconname guiutilities loadicon brokenimage guiutilities loadicon iconname guiutilities loadicon brokenimage listmodel addelement actionname iconname jlist listmodel setselectionmode listselectionmodel single_selection addlistselectionlistener listhandler setcellrenderer buttoncellrenderer borderlayout jscrollpane jpanel jpanel setborder emptyborder setlayout boxlayout boxlayout x_axis actionhandler actionhandler actionhandler rolloverbutton guiutilities loadicon settooltiptext jedit getproperty addactionlistener actionhandler createhorizontalstrut rolloverbutton guiutilities loadicon settooltiptext jedit getproperty addactionlistener actionhandler createhorizontalstrut moveup rolloverbutton guiutilities loadicon moveup settooltiptext jedit getproperty moveup moveup addactionlistener actionhandler moveup createhorizontalstrut movedown rolloverbutton guiutilities loadicon movedown settooltiptext jedit getproperty movedown movedown addactionlistener actionhandler movedown createhorizontalstrut rolloverbutton guiutilities loadicon buttonproperties settooltiptext jedit getproperty addactionlistener actionhandler createglue updatebuttons borderlayout iconlist defaultcomboboxmodel stringtokenizer jedit getproperty hasmoreelements nexttoken iconlist addelement iconlistentry guiutilities loadicon save method protected void save j edit set boolean property view show toolbar show toolbar is selected string buffer buf new string buffer for int i 0 i list model get size i if i 0 buf append button button button list model element at i buf append button action name j edit set property button action name icon button icon name j edit set property view toolbar buf to string _save _save jedit setbooleanproperty showtoolbar showtoolbar isselected stringbuffer stringbuffer listmodel getsize listmodel elementat actionname jedit setproperty actionname iconname jedit setproperty tostring update buttons method private void update buttons int index list get selected index remove set enabled index 1 list model get size 0 move up set enabled index 0 move down set enabled index 1 index list model get size 1 edit set enabled index 1 updatebuttons updatebuttons getselectedindex setenabled listmodel getsize moveup setenabled movedown setenabled listmodel getsize setenabled public int compare object obj1 object obj2 return misc utilities compare strings button obj1 label button obj2 label true miscutilities comparestrings button string action name string icon name icon icon string label this action name action name this icon name icon name this icon icon this label gui utilities prettify menu label label actionname iconname actionname actionname iconname iconname guiutilities prettifymenulabel public string to string return label tostring public boolean equals object o if o instanceof button return button o action name equals action name else return false actionname actionname icon list entry icon icon string name this icon icon this name name iconlistentry public string to string return name tostring public component get list cell renderer component j list list object value int index boolean is selected boolean cell has focus super get list cell renderer component list value index is selected cell has focus button button button value set icon button icon return this getlistcellrenderercomponent jlist isselected cellhasfocus getlistcellrenderercomponent isselected cellhasfocus seticon public component get list cell renderer component j list list object value int index boolean is selected boolean cell has focus super get list cell renderer component list value index is selected cell has focus icon list entry icon icon list entry value set icon icon icon return this getlistcellrenderercomponent jlist isselected cellhasfocus getlistcellrenderercomponent isselected cellhasfocus iconlistentry iconlistentry seticon public void action performed action event evt object source evt get source if source add tool bar edit dialog dialog new tool bar edit dialog tool bar option pane this icon list null button selection dialog get selection if selection null return int index list get selected index if index 1 index list model get size else index list model insert element at selection index list set selected index index list ensure index is visible index else if source remove int index list get selected index list model remove element at index if list model get size 0 if list model get size index list set selected index index 1 else list set selected index index update buttons else if source move up int index list get selected index object selected list get selected value list model remove element at index list model insert element at selected index 1 list set selected index index 1 list ensure index is visible index 1 else if source move down int index list get selected index object selected list get selected value list model remove element at index list model insert element at selected index 1 list set selected index index 1 list ensure index is visible index 1 else if source edit tool bar edit dialog dialog new tool bar edit dialog tool bar option pane this icon list button list get selected value button selection dialog get selection if selection null return int index list get selected index list model set element at selection index list set selected index index list ensure index is visible index actionperformed actionevent getsource toolbareditdialog toolbareditdialog toolbaroptionpane iconlist getselection getselectedindex listmodel getsize listmodel insertelementat setselectedindex ensureindexisvisible getselectedindex listmodel removeelementat listmodel getsize listmodel getsize setselectedindex setselectedindex updatebuttons moveup getselectedindex getselectedvalue listmodel removeelementat listmodel insertelementat setselectedindex ensureindexisvisible movedown getselectedindex getselectedvalue listmodel removeelementat listmodel insertelementat setselectedindex ensureindexisvisible toolbareditdialog toolbareditdialog toolbaroptionpane iconlist getselectedvalue getselection getselectedindex listmodel setelementat setselectedindex ensureindexisvisible class list handler implements list selection listener public void value changed list selection event evt update buttons listhandler listselectionlistener valuechanged listselectionevent updatebuttons tool bar edit dialog constructor public tool bar edit dialog component comp default combo box model icon list model tool bar option pane button current super gui utilities get parent dialog comp j edit get property options toolbar edit title true j panel content new j panel new border layout content set border new empty border 12 12 12 12 set content pane content action handler action handler new action handler button group grp new button group j panel type panel new j panel new grid layout 3 1 6 6 type panel set border new empty border 0 0 6 0 type panel add new j label j edit get property options toolbar edit caption separator new j radio button j edit get property options toolbar edit separator separator add action listener action handler grp add separator type panel add separator action new j radio button j edit get property options toolbar edit action action add action listener action handler grp add action type panel add action content add border layout north type panel j panel action panel new j panel new border layout 6 6 action set actions list j edit get action sets vector vec new vector actions list length for int i 0 i actions list length i action set action set actions list i if action set get action count 0 vec add element action set combo new j combo box vec combo add action listener action handler action panel add border layout north combo list new j list list set visible row count 8 list set selection mode list selection model single selection action panel add border layout center new j scroll pane list icon selection j panel icon panel new j panel new border layout 0 3 j panel label panel new j panel new grid layout 2 1 label panel set border new empty border 0 0 0 12 j panel comp panel new j panel new grid layout 2 1 grp new button group label panel add builtin new j radio button j edit get property options toolbar edit builtin builtin add action listener action handler grp add builtin label panel add file new j radio button j edit get property options toolbar edit file grp add file file add action listener action handler icon panel add border layout west label panel builtin combo new j combo box icon list model builtin combo set renderer new tool bar option pane icon cell renderer comp panel add builtin combo file button new j button j edit get property options toolbar edit no icon file button set margin new insets 1 1 1 1 file button set icon gui utilities load icon blank24 gif file button set horizontal alignment swing constants left file button add action listener action handler comp panel add file button icon panel add border layout center comp panel action panel add border layout south icon panel content add border layout center action panel j panel south panel new j panel south panel set layout new box layout south panel box layout x axis south panel set border new empty border 12 0 0 0 south panel add box create glue ok new j button j edit get property common ok ok add action listener action handler get root pane set default button ok south panel add ok south panel add box create horizontal strut 6 cancel new j button j edit get property common cancel cancel add action listener action handler south panel add cancel south panel add box create glue content add border layout south south panel if current null action set selected true builtin set selected true update list else if current action name equals separator set selected true builtin set selected true else action set selected true action set set j edit get action set for action current action name combo set selected item set update list list set selected value current true if misc utilities isurl current icon name file set selected true file icon current icon name try file button set icon new image icon new url file icon catch malformedurl exception mf log log log error this mf file button set text misc utilities get file name file icon else string icon name misc utilities get file name current icon name builtin set selected true list model model builtin combo get model for int i 0 i model get size i tool bar option pane icon list entry entry tool bar option pane icon list entry model get element at i if entry name equals icon name builtin combo set selected index i break update enabled pack set location relative to gui utilities get parent dialog comp set visible true toolbareditdialog toolbareditdialog defaultcomboboxmodel iconlistmodel toolbaroptionpane guiutilities getparentdialog jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane actionhandler actionhandler actionhandler buttongroup buttongroup jpanel typepanel jpanel gridlayout typepanel setborder emptyborder typepanel jlabel jedit getproperty jradiobutton jedit getproperty addactionlistener actionhandler typepanel jradiobutton jedit getproperty addactionlistener actionhandler typepanel borderlayout typepanel jpanel actionpanel jpanel borderlayout actionset actionslist jedit getactionsets actionslist actionslist actionset actionset actionslist actionset getactioncount addelement actionset jcombobox addactionlistener actionhandler actionpanel borderlayout jlist setvisiblerowcount setselectionmode listselectionmodel single_selection actionpanel borderlayout jscrollpane jpanel iconpanel jpanel borderlayout jpanel labelpanel jpanel gridlayout labelpanel setborder emptyborder jpanel comppanel jpanel gridlayout buttongroup labelpanel jradiobutton jedit getproperty addactionlistener actionhandler labelpanel jradiobutton jedit getproperty addactionlistener actionhandler iconpanel borderlayout labelpanel builtincombo jcombobox iconlistmodel builtincombo setrenderer toolbaroptionpane iconcellrenderer comppanel builtincombo filebutton jbutton jedit getproperty filebutton setmargin filebutton seticon guiutilities loadicon filebutton sethorizontalalignment swingconstants filebutton addactionlistener actionhandler comppanel filebutton iconpanel borderlayout comppanel actionpanel borderlayout iconpanel borderlayout actionpanel jpanel southpanel jpanel southpanel setlayout boxlayout southpanel boxlayout x_axis southpanel setborder emptyborder southpanel createglue jbutton jedit getproperty addactionlistener actionhandler getrootpane setdefaultbutton southpanel southpanel createhorizontalstrut jbutton jedit getproperty addactionlistener actionhandler southpanel southpanel createglue borderlayout southpanel setselected setselected updatelist actionname setselected setselected setselected actionset jedit getactionsetforaction actionname setselecteditem updatelist setselectedvalue miscutilities iconname setselected fileicon iconname filebutton seticon imageicon fileicon malformedurlexception filebutton settext miscutilities getfilename fileicon iconname miscutilities getfilename iconname setselected listmodel builtincombo getmodel getsize toolbaroptionpane iconlistentry toolbaroptionpane iconlistentry getelementat iconname builtincombo setselectedindex updateenabled setlocationrelativeto guiutilities getparentdialog setvisible ok method public void ok isok true dispose cancel method public void cancel dispose get selection method public tool bar option pane button get selection if isok return null if separator is selected return new tool bar option pane button null null else icon icon string icon name if builtin is selected tool bar option pane icon list entry selected icon tool bar option pane icon list entry builtin combo get selected item icon selected icon icon icon name selected icon name else icon file button get icon icon name file icon if icon name null icon name blank24 gif string label string action name if action is selected tool bar option pane button button tool bar option pane button list get selected value label button label action name button action name else throw new internal error return new tool bar option pane button action name icon name icon label getselection toolbaroptionpane getselection isselected toolbaroptionpane iconname isselected toolbaroptionpane iconlistentry selectedicon toolbaroptionpane iconlistentry builtincombo getselecteditem selectedicon iconname selectedicon filebutton geticon iconname fileicon iconname iconname actionname isselected toolbaroptionpane toolbaroptionpane getselectedvalue actionname actionname internalerror toolbaroptionpane actionname iconname update enabled method private void update enabled combo set enabled action is selected list set enabled action is selected boolean icon controls enabled separator is selected builtin set enabled icon controls enabled file set enabled icon controls enabled builtin combo set enabled icon controls enabled builtin is selected file button set enabled icon controls enabled file is selected updateenabled updateenabled setenabled isselected setenabled isselected iconcontrolsenabled isselected setenabled iconcontrolsenabled setenabled iconcontrolsenabled builtincombo setenabled iconcontrolsenabled isselected filebutton setenabled iconcontrolsenabled isselected update list method private void update list action set action set action set combo get selected item edit action actions action set get actions vector list model new vector actions length for int i 0 i actions length i edit action action actions i string label action get label if label null continue list model add element new tool bar option pane button action get name null null label misc utilities quicksort list model new tool bar option pane button compare list set list data list model updatelist updatelist actionset actionset actionset getselecteditem editaction actionset getactions listmodel editaction getlabel listmodel addelement toolbaroptionpane getname miscutilities listmodel toolbaroptionpane buttoncompare setlistdata listmodel public void action performed action event evt object source evt get source if source instanceof j radio button update enabled if source ok ok else if source cancel cancel else if source combo update list else if source file button string directory if file icon null directory null else directory misc utilities get parent of path file icon string paths gui utilities showvfs file dialog null directory vfs browser open dialog false if paths null return file icon file paths 0 try file button set icon new image icon new url file icon catch malformedurl exception mf log log log error this mf file button set text misc utilities get file name file icon actionperformed actionevent getsource jradiobutton updateenabled updatelist filebutton fileicon miscutilities getparentofpath fileicon guiutilities showvfsfiledialog vfsbrowser open_dialog fileicon filebutton seticon imageicon fileicon malformedurlexception filebutton settext miscutilities getfilename fileicon bean shell action constructor public bean shell action string name string code string is selected boolean no repeat boolean no record boolean no remember last super name this code code this is selected is selected this no repeat no repeat this no record no record this no remember last no remember last some characters that we like to use in action names are not allowed in bean shell identifiers sanitized name name replace replace j edit set temporary property name toggle is selected null true false beanshellaction beanshellaction isselected norepeat norecord norememberlast isselected isselected norepeat norepeat norecord norecord norememberlast norememberlast beanshell sanitizedname _ _ jedit settemporaryproperty isselected invoke method public void invoke view view try if cached code null string cached code name action sanitized name cached code bean shell cache block cached code name code true bean shell run cached block cached code view new name space bean shell get name space bean shell action invoke catch throwable e log log log error this e new bean shell error dialog view e cachedcode cachedcodename action_ sanitizedname cachedcode beanshell cacheblock cachedcodename beanshell runcachedblock cachedcode namespace beanshell getnamespace beanshellaction beanshellerrordialog is selected method public boolean is selected component comp if is selected null return false name space global bean shell get name space try if cached is selected null string cached is selected name selected sanitized name cached is selected bean shell cache block cached is selected name is selected true view view gui utilities get view comp undocumented hack to allow browser actions to work xxx clean up in 4 3 global set variable comp comp return boolean true equals bean shell run cached block cached is selected view new name space bean shell get name space bean shell action is selected catch throwable e log log log error this e dialogs fuck things up if a menu is visible etc new bean shell error dialog view e so that in the future we don t see streams of exceptions is selected null return false finally try global set variable comp null catch util eval error err log log log error this err isselected isselected isselected namespace beanshell getnamespace cachedisselected cachedisselectedname selected_ sanitizedname cachedisselected beanshell cacheblock cachedisselectedname isselected guiutilities getview setvariable _comp beanshell runcachedblock cachedisselected namespace beanshell getnamespace beanshellaction isselected beanshellerrordialog isselected setvariable _comp utilevalerror no repeat method public boolean no repeat return no repeat norepeat norepeat norepeat no record method public boolean no record return no record norecord norecord norecord no remember last method returns if this edit action should not be remembered as the most recently invoked action since j edit 4 2pre1 public boolean no remember last return no remember last norememberlast jedit norememberlast norememberlast get code method public string get code return code trim getcode getcode keyword map constructor creates a new code keyword map code param ignore case true if keys are case insensitive public keyword map boolean ignore case this ignore case 52 this ignore case ignore case no word sep new string buffer keywordmap keywordmap ignorecase keywordmap ignorecase ignorecase ignorecase ignorecase nowordsep stringbuffer keyword map constructor creates a new code keyword map code param ignore case true if the keys are case insensitive param map length the number of buckets to create a value of 52 will give good performance for most maps public keyword map boolean ignore case int map length this map length map length this ignore case ignore case map new keyword map length keywordmap keywordmap ignorecase maplength keywordmap ignorecase maplength maplength maplength ignorecase ignorecase maplength lookup method looks up a key param text the text segment param offset the offset of the substring within the text segment param length the length of the substring public byte lookup segment text int offset int length if length 0 return token null keyword k map get segment map key text offset length while k null if length k keyword length k k next continue if syntax utilities region matches ignore case text offset k keyword return k id k k next return token null getsegmentmapkey syntaxutilities regionmatches ignorecase add method adds a key value mapping param keyword the key param id the value public void add string keyword byte id add keyword to char array id tochararray add method adds a key value mapping param keyword the key param id the value since j edit 4 2pre3 public void add char keyword byte id int key get string map key keyword complete word command needs a list of all non alphanumeric characters used in a keyword map loop for int i 0 i keyword length i char ch keyword i if character is letter or digit ch for int j 0 j no word sep length j if no word sep char at j ch continue loop no word sep append ch map key new keyword keyword id map key jedit getstringmapkey isletterordigit nowordsep nowordsep charat nowordsep get non alpha numeric chars method returns all non alphanumeric characters that appear in the keywords of this keyword map since j edit 4 0pre3 public string get non alpha numeric chars return no word sep to string getnonalphanumericchars jedit getnonalphanumericchars nowordsep tostring get keywords method returns an array containing all keywords in this keyword map since j edit 4 0pre3 public string get keywords vector vector new vector 100 for int i 0 i map length i keyword keyword map i while keyword null vector add element new string keyword keyword keyword keyword next string ret val new string vector size vector copy into ret val return ret val getkeywords jedit getkeywords addelement retval copyinto retval retval get ignore case method returns true if the keyword map is set to be case insensitive false otherwise public boolean get ignore case return ignore case getignorecase getignorecase ignorecase set ignore case method sets if the keyword map should be case insensitive param ignore case true if the keyword map should be case insensitive false otherwise public void set ignore case boolean ignore case this ignore case ignore case setignorecase ignorecase setignorecase ignorecase ignorecase ignorecase add method adds the content of another keyword map to this one since j edit 4 2pre3 public void add keyword map map for int i 0 i map map length i keyword k map map i while k null add k keyword k id k k next jedit keywordmap get string map key method private int get string map key char s return character to upper case s 0 character to upper case s s length 1 map length getstringmapkey getstringmapkey touppercase touppercase maplength get segment map key method protected int get segment map key segment s int off int len return character to upper case s array off character to upper case s array off len 1 map length getsegmentmapkey getsegmentmapkey touppercase touppercase maplength public keyword char keyword byte id keyword next this keyword keyword this id id this next next the main test routine param argv command line parameters br this method expects a conventional command line that will be passed as a parameter string to the windows executable code jcmd exe code public static void main string argv system out println testing jcmd process class string cmd line null jcmd process process null get full command line if argv length 0 string buffer sb new string buffer argv 0 for int i 1 i argv length i sb append append argv i cmd line sb to string system out println command line cmd line else system err println no command line provided system exit 1 try process jcmd process exec cmd line null buffered reader p input new buffered reader new input stream reader process get input stream string s p input read line call send break after fixed number of lines of stdout are read int n read 0 while s null system out println s if n read 5 process send break s p input read line catch io exception e system err println i o error e to string catch exception e system err println jcmd process error e to string system out println child process exited with code string value of process exit value system exit 0 jcmdprocess cmdline jcmdprocess stringbuffer stringbuffer cmdline tostring cmdline jcmdprocess cmdline bufferedreader pinput bufferedreader inputstreamreader getinputstream pinput readline sendbreak nread nread sendbreak pinput readline ioexception tostring jcmdprocess tostring valueof exitvalue return the singleton bsh reflect manager throws unavailable public static reflect manager get reflect manager throws unavailable if rfm null class clas try clas class for name bsh reflect reflect manager impl rfm reflect manager clas new instance catch exception e throw new unavailable reflect manager unavailable e return rfm reflectmanager reflectmanager getreflectmanager forname reflectmanagerimpl reflectmanager newinstance reflect manager set accessible convenience method to invoke the reflect manager throws unavailable public static boolean rm set accessible object obj throws unavailable return get reflect manager set accessible obj rmsetaccessible getreflectmanager setaccessible set a java lang reflect field method constructor or array of accessible objects to accessible mode return true if the object was accessible or false if it was not public variable grid layout int mode int size int hgap int vgap if mode fixed num rows mode fixed num columns throw new illegal argument exception illegal mode value is mode if size 0 throw new illegal argument exception size cannot be zero or less value is size if hgap 0 throw new illegal argument exception hgap cannot be negative value is hgap if vgap 0 throw new illegal argument exception vgap cannot be negative value is vgap this mode mode this size size this hgap hgap this vgap vgap variablegridlayout fixed_num_rows fixed_num_columns illegalargumentexception illegalargumentexception illegalargumentexception illegalargumentexception creates a variable grid layout manager with the specified mode and zero horizontal and vertical gap public variable grid layout int mode int size this mode size 0 0 variablegridlayout creates a variable grid layout manager with mode fixed num rows number of rows 1 and zero horizontal and vertical gap public variable grid layout this fixed num rows 1 0 0 fixed_num_rows variablegridlayout fixed_num_rows not used in this class public void add layout component string name component component addlayoutcomponent not used in this class public void add layout component component component object constraints addlayoutcomponent not used in this class public void remove layout component component component removelayoutcomponent always returns 0 5 public float get layout alignmentx container container return 0 5f getlayoutalignmentx always returns 0 5 public float get layout alignmenty container container return 0 5f getlayoutalignmenty public dimension preferred layout size container parent return get layout size parent 2 preferredlayoutsize getlayoutsize public dimension minimum layout size container parent return get layout size parent 0 minimumlayoutsize getlayoutsize public dimension maximum layout size container parent return get layout size parent 1 maximumlayoutsize getlayoutsize public void layout container container parent synchronized parent get tree lock update parent int ncomponents parent get component count if ncomponents 0 return pass 1 compute preferred row heights column widths int total height 0 for int r 0 i 0 r nrows r for int c 0 c ncols c i if i ncomponents dimension d parent get component i get preferred size row heights r math max row heights r d height col widths c math max col widths c d width else break total height row heights r int total width 0 for int c 0 c ncols c total width col widths c pass 2 redistribute free space dimension parent size parent get size insets insets parent get insets int free height parent size height insets top insets bottom nrows 1 vgap int free width parent size width insets left insets right ncols 1 hgap if total height free height double dy double free height double total height for int r 0 r nrows r row heights r int double row heights r dy if total width free width double dx double free width double total width for int c 0 c ncols c col widths c int double col widths c dx pass 3 layout components for int r 0 y insets top i 0 r nrows y row heights r vgap r for int c 0 x insets left c ncols x col widths c hgap c i if i ncomponents parent get component i set bounds x y col widths c row heights r synchronized layoutcontainer gettreelock getcomponentcount total_height getcomponent getpreferredsize row_heights row_heights col_widths col_widths total_height row_heights total_width total_width col_widths parent_size getsize getinsets free_height parent_size free_width parent_size total_height free_height free_height total_height row_heights row_heights total_width free_width free_width total_width col_widths col_widths row_heights col_widths getcomponent setbounds col_widths row_heights public void invalidate layout container container invalidatelayout returns the string representation of this variable grid layout s values return a string representation of this variable grid layout public string to string return get class get name mode mode size size hgap hgap vgap vgap tostring getclass getname param which if 0 compute minimum layout size if 1 compute maximum layout size otherwise compute preferred layout size private dimension get layout size container parent int which synchronized parent get tree lock update parent int ncomponents parent get component count int h 0 int w 0 for int r 0 i 0 r nrows r int row height 0 for int c 0 c ncols c i if i ncomponents switch which case 0 row height math max row height parent get component i get minimum size height break case 1 row height math max row height parent get component i get maximum size height break default row height math max row height parent get component i get preferred size height break else break h row height for int c 0 c ncols c int col width 0 for int r 0 r nrows r int i r ncols c if i ncomponents switch which case 0 col width math max col width parent get component i get minimum size width break case 1 col width math max col width parent get component i get maximum size width break default col width math max col width parent get component i get preferred size width break else break w col width insets insets parent get insets return new dimension w insets left insets right ncols 1 hgap h insets top insets bottom nrows 1 vgap getlayoutsize gettreelock getcomponentcount row_height row_height row_height getcomponent getminimumsize row_height row_height getcomponent getmaximumsize row_height row_height getcomponent getpreferredsize row_height col_width col_width col_width getcomponent getminimumsize col_width col_width getcomponent getmaximumsize col_width col_width getcomponent getpreferredsize col_width getinsets private void update container container int ncomponents container get component count int old nrows nrows int old ncols ncols if this mode fixed num rows nrows this size ncols ncomponents nrows 1 nrows else ncols this size nrows ncomponents ncols 1 ncols if old nrows nrows row heights new int nrows if old ncols ncols col widths new int ncols getcomponentcount old_nrows old_ncols fixed_num_rows old_nrows row_heights old_ncols col_widths get shortcut method returns the marker s shortcut character since j edit 3 2pre1 public char get shortcut return shortcut getshortcut jedit getshortcut get position method returns the position of this marker since j edit 3 2pre1 public int get position return position null pos position get offset getposition jedit getposition getoffset marker constructor marker buffer buffer char shortcut int position this buffer buffer this shortcut shortcut this pos position set shortcut method sets the marker s shortcut param shortcut the new shortcut since j edit 3 2pre1 void set shortcut char shortcut this shortcut shortcut setshortcut jedit setshortcut create position method void create position position buffer create position pos createposition createposition createposition remove position method void remove position forget the cached position instance if position null pos position get offset position null removeposition removeposition getoffset set position method sets the position of this marker since j edit 4 0pre5 void set position int pos this pos pos setposition jedit setposition update every time method public boolean update every time return true updateeverytime updateeverytime update method public void update j menu menu final view view gui utilities get view menu buffer buffer view get buffer vector markers buffer get markers if markers size 0 j menu item mi new j menu item j edit get property no markers label mi set enabled false menu add mi return int max items j edit get integer property menu spillover 20 j menu current menu for int i 0 i markers size i final marker marker marker markers element at i int line no buffer get line of offset marker get position if current get item count max items i markers size 1 current add separator j menu new current new j menu j edit get property common more current add new current current new current j menu item mi new markers menu item buffer line no marker get shortcut mi add action listener new action listener public void action performed action event evt view get text area set caret position marker get position current add mi jmenu guiutilities getview getbuffer getmarkers jmenuitem jmenuitem jedit getproperty setenabled maxitems jedit getintegerproperty jmenu elementat lineno getlineofoffset getposition getitemcount maxitems addseparator jmenu newcurrent jmenu jedit getproperty newcurrent newcurrent jmenuitem markersmenuitem lineno getshortcut addactionlistener actionlistener actionperformed actionevent gettextarea setcaretposition getposition public void action performed action event evt view get text area set caret position marker get position actionperformed actionevent gettextarea setcaretposition getposition markers menu item constructor markers menu item buffer buffer int line no char shortcut string text buffer get line text line no trim if text length 0 text j edit get property markers blank line set text line no 1 text shortcut prop goto marker shortcut markers menu item this shortcut shortcut markersmenuitem markersmenuitem lineno getlinetext lineno jedit getproperty settext lineno shortcutprop markersmenuitem get preferred size method public dimension get preferred size dimension d super get preferred size string shortcut get shortcut if shortcut null d width get font metrics accelerator font string width shortcut 15 return d getpreferredsize getpreferredsize getpreferredsize getshortcut getfontmetrics acceleratorfont stringwidth paint method public void paint graphics g super paint g string shortcut get shortcut if shortcut null g set font accelerator font g set color get model is armed accelerator selection foreground accelerator foreground font metrics fm g get font metrics insets insets get insets g draw string shortcut get width fm string width shortcut insets right insets left 5 get font get size insets top 1 xxx magic number getshortcut setfont acceleratorfont setcolor getmodel isarmed acceleratorselectionforeground acceleratorforeground fontmetrics getfontmetrics getinsets drawstring getwidth stringwidth getfont getsize get shortcut method private string get shortcut if shortcut 0 return null else string shortcut prefix j edit get property shortcut prop if shortcut prefix null return null else return shortcut prefix shortcut getshortcut getshortcut shortcutprefix jedit getproperty shortcutprop shortcutprefix shortcutprefix vfs file chooser dialog constructor public vfs file chooser dialog view view string path int mode boolean multiple selection super view j edit get property vfs browser title true j panel content new j panel new border layout content set border new empty border 12 12 12 12 set content pane content string name if mode vfs browser choose directory dialog name null else if path null path ends with file separator path ends with name null else vfs vfs vfs manager getvfs for path path name vfs get file name path path vfs get parent of path path browser new vfs browser view path mode multiple selection null browser get browser view get table set request focus enabled false browser get browser view get parent directory list set request focus enabled false browser get browser view get table add key listener new key handler browser add browser listener new browser handler content add border layout center browser j panel panel new j panel panel set layout new box layout panel box layout x axis panel set border new empty border 12 0 0 0 filename field new vfs file name field browser null filename field set text name filename field select all box box new box box layout y axis box add box create glue box add filename field box add box create glue j label label new j label j edit get property vfs browser dialog filename label set displayed mnemonic j edit get property vfs browser dialog filename mnemonic char at 0 label set label for filename field panel add label panel add box create horizontal strut 12 panel add box panel add box create horizontal strut 12 gui utilities request focus this filename field ok new j button get root pane set default button ok switch mode case vfs browser open dialog case vfs browser browser dialog ok set text j edit get property vfs browser dialog open break case vfs browser choose directory dialog ok set text j edit get property vfs browser dialog choose dir so that it doesn t resize dimension dim ok get preferred size ok set preferred size dim break case vfs browser save dialog ok set text j edit get property vfs browser dialog save break ok add action listener new action handler panel add ok panel add box create horizontal strut 6 cancel new j button j edit get property common cancel cancel add action listener new action handler panel add cancel content add border layout south panel vfs manager getio thread pool add progress listener work thread handler new work thread handler pack gui utilities load geometry this vfs browser dialog set visible true vfsfilechooserdialog vfsfilechooserdialog multipleselection jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane vfsbrowser choose_directory_dialog endswith endswith vfsmanager getvfsforpath getfilename getparentofpath vfsbrowser multipleselection getbrowserview gettable setrequestfocusenabled getbrowserview getparentdirectorylist setrequestfocusenabled getbrowserview gettable addkeylistener keyhandler addbrowserlistener browserhandler borderlayout jpanel jpanel setlayout boxlayout boxlayout x_axis setborder emptyborder filenamefield vfsfilenamefield filenamefield settext filenamefield selectall boxlayout y_axis createglue filenamefield createglue jlabel jlabel jedit getproperty setdisplayedmnemonic jedit getproperty charat setlabelfor filenamefield createhorizontalstrut createhorizontalstrut guiutilities requestfocus filenamefield jbutton getrootpane setdefaultbutton vfsbrowser open_dialog vfsbrowser browser_dialog settext jedit getproperty vfsbrowser choose_directory_dialog settext jedit getproperty getpreferredsize setpreferredsize vfsbrowser save_dialog settext jedit getproperty addactionlistener actionhandler createhorizontalstrut jbutton jedit getproperty addactionlistener actionhandler borderlayout vfsmanager getiothreadpool addprogresslistener workthreadhandler workthreadhandler guiutilities loadgeometry setvisible dispose method public void dispose gui utilities save geometry this vfs browser dialog vfs manager getio thread pool remove progress listener work thread handler super dispose guiutilities savegeometry vfsmanager getiothreadpool removeprogresslistener workthreadhandler ok method public void ok vfs directory entry files browser get selected files filename filename field get text if files length 0 browser files activated vfs browser m open false return else if browser get mode vfs browser choose directory dialog filename null filename length 0 isok true dispose return else if filename null filename length 0 get toolkit beep return string buffer dir browser get view get buffer get directory if filename equals filename buffer dir else if filename starts with filename starts with file separator filename misc utilities construct path buffer dir filename substring 2 final int type 1 final string path misc utilities construct path browser get directory filename final vfs vfs vfs manager getvfs for path path object session vfs createvfs session path this if session null return vfs manager run in work thread new get file type request vfs session path type vfs manager run inawt thread new runnable public void run switch type 0 case vfs directory entry file if browser get mode vfs browser choose directory dialog break if vfs instanceof filevfs if do file exists warning path break isok true if browser get mode vfs browser browser dialog hashtable props new hashtable props put buffer encoding browser current encoding j edit open file browser get view browser get directory path false props dispose break case vfs directory entry directory case vfs directory entry filesystem browser set directory path break directoryentry getselectedfiles filenamefield gettext filesactivated vfsbrowser m_open getmode vfsbrowser choose_directory_dialog gettoolkit bufferdir getview getbuffer getdirectory bufferdir startswith startswith miscutilities constructpath bufferdir miscutilities constructpath getdirectory vfsmanager getvfsforpath createvfssession vfsmanager runinworkthread getfiletyperequest vfsmanager runinawtthread directoryentry getmode vfsbrowser choose_directory_dialog dofileexistswarning getmode vfsbrowser browser_dialog currentencoding jedit openfile getview getdirectory directoryentry directoryentry setdirectory public void run switch type 0 case vfs directory entry file if browser get mode vfs browser choose directory dialog break if vfs instanceof filevfs if do file exists warning path break isok true if browser get mode vfs browser browser dialog hashtable props new hashtable props put buffer encoding browser current encoding j edit open file browser get view browser get directory path false props dispose break case vfs directory entry directory case vfs directory entry filesystem browser set directory path break directoryentry getmode vfsbrowser choose_directory_dialog dofileexistswarning getmode vfsbrowser browser_dialog currentencoding jedit openfile getview getdirectory directoryentry directoryentry setdirectory cancel method public void cancel dispose get selected files method public string get selected files if isok return null string filename filename field get text if browser get mode vfs browser choose directory dialog return new string browser get directory else if filename null filename length 0 string path browser get directory return new string misc utilities construct path path filename else vector vector new vector vfs directory entry selected files browser get selected files for int i 0 i selected files length i vfs directory entry file selected files i if file type vfs directory entry file vector add element file path string ret val new string vector size vector copy into ret val return ret val getselectedfiles getselectedfiles filenamefield gettext getmode vfsbrowser choose_directory_dialog getdirectory getdirectory miscutilities constructpath directoryentry selectedfiles getselectedfiles selectedfiles directoryentry selectedfiles directoryentry addelement retval copyinto retval retval do file exists warning method private boolean do file exists warning string filename if browser get mode vfs browser save dialog new file filename exists string args misc utilities get file name filename int result gui utilities confirm browser fileexists args j option pane yes no option j option pane warning message if result j option pane yes option return true return false dofileexistswarning dofileexistswarning getmode vfsbrowser save_dialog miscutilities getfilename guiutilities joptionpane yes_no_option joptionpane warning_message joptionpane yes_option public void action performed action event evt if evt get source ok if browser get directory equals browser get directory field get text browser set directory browser get directory field get text else ok else if evt get source cancel cancel actionperformed actionevent getsource getdirectory getdirectoryfield gettext setdirectory getdirectoryfield gettext getsource files selected method public void files selected vfs browser browser vfs directory entry files if files length 0 if browser get mode vfs browser choose directory dialog ok set text j edit get property vfs browser dialog choose dir return else if files length 1 if browser get mode vfs browser choose directory dialog ok set text j edit get property vfs browser dialog open vfs directory entry file files 0 if file type vfs directory entry file string path file path string directory browser get directory string parent misc utilities get parent of path path if vfs browser paths equal parent directory path file name filename field set text path filename field select all else if browser get mode vfs browser choose directory dialog ok set text j edit get property vfs browser dialog open filename field set text null filesselected filesselected vfsbrowser directoryentry getmode vfsbrowser choose_directory_dialog settext jedit getproperty getmode vfsbrowser choose_directory_dialog settext jedit getproperty directoryentry directoryentry getdirectory miscutilities getparentofpath vfsbrowser pathsequal filenamefield settext filenamefield selectall getmode vfsbrowser choose_directory_dialog settext jedit getproperty filenamefield settext files activated method public void files activated vfs browser browser vfs directory entry files filename field select all if files length 0 user pressed enter when the vfs table or file name field has focus with nothing selected ok return for int i 0 i files length i if files i type vfs directory entry file string path files i path vfs vfs vfs manager getvfs for path path if browser get mode vfs browser save dialog vfs instanceof filevfs if do file exists warning path return isok true filename field set text null if browser get mode vfs browser choose directory dialog dispose return else return filesactivated filesactivated vfsbrowser directoryentry filenamefield selectall directoryentry vfsmanager getvfsforpath getmode vfsbrowser save_dialog dofileexistswarning filenamefield settext getmode vfsbrowser choose_directory_dialog public void key typed key event evt switch evt get key char case case case filename field process key event evt filename field request focus break keytyped keyevent getkeychar filenamefield processkeyevent filenamefield requestfocus status update method public void status update final work thread pool thread pool final int thread index swing utilities invoke later new runnable public void run int request count thread pool get request count if request count 0 get content pane set cursor cursor get default cursor else if request count 1 get content pane set cursor cursor get predefined cursor cursor wait cursor statusupdate statusupdate workthreadpool threadpool threadindex swingutilities invokelater requestcount threadpool getrequestcount requestcount getcontentpane setcursor getdefaultcursor requestcount getcontentpane setcursor getpredefinedcursor wait_cursor public void run int request count thread pool get request count if request count 0 get content pane set cursor cursor get default cursor else if request count 1 get content pane set cursor cursor get predefined cursor cursor wait cursor requestcount threadpool getrequestcount requestcount getcontentpane setcursor getdefaultcursor requestcount getcontentpane setcursor getpredefinedcursor wait_cursor progress update method public void progress update work thread pool thread pool int thread index progressupdate progressupdate workthreadpool threadpool threadindex get file type request vfs vfs object session string path int type this vfs vfs this session session this path path this type type getfiletyperequest public void run try vfs directory entry entry vfs getdirectoryentry session path browser if entry null non existent file type 0 vfs directory entry file else type 0 entry type catch io exception e log log log error this e vfs manager error browser path ioerror new string e to string return finally try vfs endvfssession session browser catch io exception e log log log error this e vfs manager error browser path ioerror new string e to string return directoryentry _getdirectoryentry directoryentry ioexception vfsmanager tostring _endvfssession ioexception vfsmanager tostring manage panel constructor public manage panel plugin manager window super new border layout 12 12 this window window set border new empty border 12 12 12 12 box top box new box box layout x axis top box add hide libraries new hide libraries button add border layout north top box create the plugin table table new j table plugin model new plugin table model table set show grid false table set intercell spacing new dimension 0 0 table set row height table get row height 2 table set preferred scrollable viewport size new dimension 500 300 table set request focus enabled false table set default renderer object class new text renderer default table cell renderer table get default renderer object class table column col1 table get column model get column 0 table column col2 table get column model get column 1 table column col3 table get column model get column 2 table column col4 table get column model get column 3 col1 set preferred width 30 col1 set min width 30 col1 set max width 30 col1 set resizable false col2 set preferred width 300 col3 set preferred width 100 col4 set preferred width 100 j table header header table get table header header set reordering allowed false header add mouse listener new header mouse handler j scroll pane scrollpane new j scroll pane table scrollpane get viewport set background table get background add border layout center scrollpane create button panel box buttons new box box layout x axis buttons add new remove button buttons add box create glue buttons add new help button add border layout south buttons managepanel managepanel pluginmanager borderlayout setborder emptyborder topbox boxlayout x_axis topbox hidelibraries hidelibrariesbutton borderlayout topbox jtable pluginmodel plugintablemodel setshowgrid setintercellspacing setrowheight getrowheight setpreferredscrollableviewportsize setrequestfocusenabled setdefaultrenderer textrenderer defaulttablecellrenderer getdefaultrenderer tablecolumn getcolumnmodel getcolumn tablecolumn getcolumnmodel getcolumn tablecolumn getcolumnmodel getcolumn tablecolumn getcolumnmodel getcolumn setpreferredwidth setminwidth setmaxwidth setresizable setpreferredwidth setpreferredwidth setpreferredwidth jtableheader gettableheader setreorderingallowed addmouselistener headermousehandler jscrollpane jscrollpane getviewport setbackground getbackground borderlayout boxlayout x_axis removebutton createglue helpbutton borderlayout update method public void update plugin model update pluginmodel show list confirm method private int show list confirm string name string args vector list model j list list new j list list model list set visible row count 8 object message j edit get property name message args new j scroll pane list return j option pane show confirm dialog window message j edit get property name title j option pane yes no option j option pane question message showlistconfirm showlistconfirm listmodel jlist jlist listmodel setvisiblerowcount jedit getproperty jscrollpane joptionpane showconfirmdialog jedit getproperty joptionpane yes_no_option joptionpane question_message entry string jar jars new linked list this jar jar jars add this jar status not loaded linkedlist not_loaded entry pluginjar jar jars new linked list this jar jar get path jars add this jar edit plugin plugin jar get plugin if plugin null status plugin instanceof edit plugin broken error loaded clazz plugin get class name name j edit get property plugin clazz name version j edit get property plugin clazz version author j edit get property plugin clazz author docs j edit get property plugin clazz docs string jars prop j edit get property plugin clazz jars if jars prop null string directory misc utilities get parent of path this jar string tokenizer st new string tokenizer jars prop while st has more elements jars add misc utilities construct path directory st next token else status loaded linkedlist getpath editplugin getplugin editplugin getclassname jedit getproperty jedit getproperty jedit getproperty jedit getproperty jarsprop jedit getproperty jarsprop miscutilities getparentofpath stringtokenizer stringtokenizer jarsprop hasmoreelements miscutilities constructpath nexttoken constructor public plugin table model entries new array list update plugintablemodel arraylist get column count method public int get column count return 4 getcolumncount getcolumncount get column class method public class get column class int column index switch column index case 0 return boolean class default return object class getcolumnclass getcolumnclass columnindex columnindex get column name method public string get column name int column switch column case 0 return case 1 return j edit get property manage plugins info name case 2 return j edit get property manage plugins info version case 3 return j edit get property manage plugins info status default throw new error column out of range getcolumnname getcolumnname jedit getproperty jedit getproperty jedit getproperty get entry method public entry get entry int row index return entry entries get row index getentry getentry rowindex rowindex get row count method public int get row count return entries size getrowcount getrowcount get value at method public object get value at int row index int column index entry entry entry entries get row index switch column index case 0 return new boolean entry status equals entry not loaded case 1 if entry name null return misc utilities get file name entry jar else return entry name case 2 return entry version case 3 return j edit get property plugin manager status entry status default throw new error column out of range getvalueat getvalueat rowindex columnindex rowindex columnindex not_loaded miscutilities getfilename jedit getproperty is cell editable method public boolean is cell editable int row index int column index return column index 0 iscelleditable iscelleditable rowindex columnindex columnindex set value at method public void set value at object value int row index int column index entry entry entry entries get row index if column index 0 pluginjar jar j edit get pluginjar entry jar if jar null if value equals boolean false return load pluginjar entry jar else if value equals boolean true return unload pluginjar with dialog jar update setvalueat setvalueat rowindex columnindex rowindex columnindex jedit getpluginjar loadpluginjar unloadpluginjarwithdialog set sort type method public void set sort type int type sort type type sort type setsorttype setsorttype sorttype sort method public void sort int type collections sort entries new entry compare type fire table changed new table model event this entrycompare firetablechanged tablemodelevent update method public void update entries clear string system jar dir misc utilities construct path j edit getj edit home jars string user jar dir if j edit get settings directory null user jar dir null else user jar dir misc utilities construct path j edit get settings directory jars pluginjar plugins j edit get pluginja rs for int i 0 i plugins length i string path plugins i get path if path starts with system jar dir user jar dir null path starts with user jar dir entry e new entry plugins i if hide libraries is selected e clazz null entries add e string new plugins j edit get not loaded pluginja rs for int i 0 i new plugins length i entry e new entry new plugins i entries add e sort sort type systemjardir miscutilities constructpath jedit getjedithome userjardir jedit getsettingsdirectory userjardir userjardir miscutilities constructpath jedit getsettingsdirectory jedit getpluginjars getpath startswith systemjardir userjardir startswith userjardir hidelibraries isselected newplugins jedit getnotloadedpluginjars newplugins newplugins sorttype load extraja rs if necessary method this should go into the core private void load pluginjar string jar path j edit add pluginjar jar path pluginjar jar j edit get pluginjar jar path if jar null jar get plugin null return string jars j edit get property plugin jar get plugin get class name jars if jars null string dir misc utilities get parent of path jar path string tokenizer st new string tokenizer jars while st has more tokens string jarpath misc utilities construct path dir st next token pluginjar jar j edit get pluginjar jarpath if jar null j edit add pluginjar jarpath jar check dependencies jar activate plugin if necessary loadextrajarsifnecessary loadpluginjar jarpath jedit addpluginjar jarpath jedit getpluginjar jarpath getplugin jedit getproperty getplugin getclassname miscutilities getparentofpath jarpath stringtokenizer stringtokenizer hasmoretokens _jarpath miscutilities constructpath nexttoken _jar jedit getpluginjar _jarpath _jar jedit addpluginjar _jarpath checkdependencies activatepluginifnecessary unload pluginjar with dialog method private void unload pluginjar with dialog pluginjar jar string dependents jar get dependent plugins if dependents length 0 unload pluginjar jar else vector list model new vector transitive closure dependents list model int button show list confirm plugin manager dependency new string jar get file get name list model if button j option pane yes option unload pluginjar jar unloadpluginjarwithdialog unloadpluginjarwithdialog getdependentplugins unloadpluginjar listmodel transitiveclosure listmodel showlistconfirm getfile getname listmodel joptionpane yes_option unloadpluginjar transitive closure method if plugin a is needed by b and b is needed by c we want to tell the user that a is needed by b and c when they try to unload a private void transitive closure string dependents vector list model for int i 0 i dependents length i string jar path dependents i if list model contains jar path list model add jar path pluginjar jar j edit get pluginjar jar path transitive closure jar get dependent plugins list model transitiveclosure transitiveclosure listmodel jarpath listmodel jarpath listmodel jarpath jedit getpluginjar jarpath transitiveclosure getdependentplugins listmodel unload pluginjar method this should go into a public method somewhere private void unload pluginjar pluginjar jar string dependents jar get dependent plugins for int i 0 i dependents length i pluginjar jar j edit get pluginjar dependents i if jar null unload pluginjar jar j edit remove pluginjar jar false unloadpluginjar unloadpluginjar getdependentplugins _jar jedit getpluginjar _jar unloadpluginjar _jar jedit removepluginjar private default table cell renderer tcr public text renderer default table cell renderer tcr this tcr tcr defaulttablecellrenderer textrenderer defaulttablecellrenderer public component get table cell renderer component j table table object value boolean is selected boolean has focus int row int column entry entry plugin model get entry row if entry status equals entry error tcr set foreground color red else tcr set foreground ui manager get color table foreground return tcr get table cell renderer component table value is selected false row column gettablecellrenderercomponent jtable isselected hasfocus pluginmodel getentry setforeground setforeground uimanager getcolor gettablecellrenderercomponent isselected hide libraries button super j edit get property plugin manager hide libraries set selected j edit get boolean property plugin manager hide libraries toggle add action listener this hidelibrariesbutton jedit getproperty setselected jedit getbooleanproperty addactionlistener public void action performed action event evt j edit set boolean property plugin manager hide libraries toggle is selected manage panel this update actionperformed actionevent jedit setbooleanproperty isselected managepanel public remove button super j edit get property manage plugins remove table get selection model add list selection listener this add action listener this set enabled false removebutton jedit getproperty getselectionmodel addlistselectionlistener addactionlistener setenabled public void action performed action event evt int selected table get selected rows vector list model new vector roster roster new roster for int i 0 i selected length i entry entry plugin model get entry selected i iterator iter entry jars iterator while iter has next string jar string iter next list model add element jar roster add remove jar int button show list confirm plugin manager remove confirm null list model if button j option pane yes option roster perform operations inawt thread window plugin model update actionperformed actionevent getselectedrows listmodel pluginmodel getentry hasnext listmodel addelement addremove showlistconfirm listmodel joptionpane yes_option performoperationsinawtthread pluginmodel public void value changed list selection event e if table get selected row count 0 set enabled false else set enabled true valuechanged listselectionevent getselectedrowcount setenabled setenabled public help button super j edit get property manage plugins help table get selection model add list selection listener this add action listener this set enabled false helpbutton jedit getproperty getselectionmodel addlistselectionlistener addactionlistener setenabled public void action performed action event evt new help viewer docurl actionperformed actionevent helpviewer public void value changed list selection event e if table get selected row count 1 try entry entry plugin model get entry table get selected row string label entry clazz string docs entry docs pluginjar jar j edit get plugin label get pluginjar if jar null label null docs null url url jar get class loader get resource docs if url null docurl url set enabled true return catch exception ex set enabled false valuechanged listselectionevent getselectedrowcount pluginmodel getentry getselectedrow jedit getplugin getpluginjar getclassloader getresource setenabled setenabled private int type public entry compare int type this type type entrycompare public int compare object o1 object o2 manage panel entry e1 manage panel entry o1 manage panel entry e2 manage panel entry o2 if type name return compare names e1 e2 else int result if result e1 status compare to ignore case e2 status 0 return compare names e1 e2 return result managepanel managepanel managepanel managepanel comparenames comparetoignorecase comparenames private int compare names manage panel entry e1 manage panel entry e2 string s1 s2 if e1 name null s1 misc utilities get file name e1 jar else s1 e1 name if e2 name null s2 misc utilities get file name e2 jar else s2 e2 name return s1 compare to ignore case s2 comparenames managepanel managepanel miscutilities getfilename miscutilities getfilename comparetoignorecase public void mouse clicked mouse event evt switch table get table header column at point evt get point case 1 plugin model set sort type entry compare name break case 3 plugin model set sort type entry compare status break default break mouseclicked mouseevent gettableheader columnatpoint getpoint pluginmodel setsorttype entrycompare pluginmodel setsorttype entrycompare char indexed reader reader reader int index if reader instanceof buffered reader br buffered reader reader else br new buffered reader reader buffer increment next if index 0 move index charindexedreader bufferedreader bufferedreader bufferedreader buffer_increment private boolean next look behind 1 look behind 0 look behind 0 cached if end 1 cached out of bounds return false end closer to end try if index 1 br reset int i br read br mark bufsize if i 1 end 1 cached out of bounds return false convert the byte read into a char cached char i index 1 catch io exception e e print stack trace cached out of bounds return false return true lookbehind lookbehind lookbehind out_of_bounds out_of_bounds ioexception printstacktrace out_of_bounds public char char at int index if index 0 return cached else if index end return out of bounds else if index bufsize allocate more space in the buffer try while bufsize index bufsize buffer increment br reset br mark bufsize br skip index 1 catch io exception e else if this index index try br reset br skip index 1 catch io exception e else if index 1 return look behind 0 else if index 2 return look behind 1 else if index 2 return out of bounds char ch out of bounds try int i br read this index index 1 this index is index of next pos relative to char at 0 if i 1 set flag that next should fail next time end index return ch ch char i catch io exception ie return ch charat out_of_bounds buffer_increment ioexception ioexception lookbehind lookbehind out_of_bounds out_of_bounds charat ioexception public boolean move int index move read position index clicks from char at 0 boolean retval true while retval index 0 retval next return retval charat public boolean is valid return cached out of bounds isvalid out_of_bounds public add abbrev dialog view view string abbrev super view j edit get property add abbrev title true this view view j panel content new j panel new border layout content set border new empty border 12 12 12 12 set content pane content editor new abbrev editor editor set abbrev abbrev editor set border new empty border 6 0 12 0 content add border layout center editor box box new box box layout x axis box add box create glue global new j button j edit get property add abbrev global global add action listener new action handler box add global box add box create horizontal strut 6 mode specific new j button j edit get property add abbrev mode mode specific add action listener new action handler box add mode specific box add box create horizontal strut 6 cancel new j button j edit get property common cancel cancel add action listener new action handler box add cancel box add box create glue content add border layout south box key listener listener new key handler add key listener listener editor get before caret text area add key listener listener editor get after caret text area add key listener listener set default close operation dispose on close if abbrev null gui utilities request focus this editor get abbrev field else gui utilities request focus this editor get before caret text area pack set location relative to view set visible true addabbrevdialog jedit getproperty jpanel jpanel borderlayout setborder emptyborder setcontentpane abbreveditor setabbrev setborder emptyborder borderlayout boxlayout x_axis createglue jbutton jedit getproperty addactionlistener actionhandler createhorizontalstrut modespecific jbutton jedit getproperty modespecific addactionlistener actionhandler modespecific createhorizontalstrut jbutton jedit getproperty addactionlistener actionhandler createglue borderlayout keylistener keyhandler addkeylistener getbeforecarettextarea addkeylistener getaftercarettextarea addkeylistener setdefaultcloseoperation dispose_on_close guiutilities requestfocus getabbrevfield guiutilities requestfocus getbeforecarettextarea setlocationrelativeto setvisible public void action performed action event evt object source evt get source if source global string abbrev editor get abbrev if abbrev null abbrev length 0 get toolkit beep return abbrevs add global abbrev abbrev editor get expansion abbrevs expand abbrev view false else if source mode specific string abbrev editor get abbrev if abbrev null abbrev length 0 get toolkit beep return abbrevs add mode abbrev view get buffer get mode get name abbrev editor get expansion abbrevs expand abbrev view false dispose actionperformed actionevent getsource _abbrev getabbrev _abbrev _abbrev gettoolkit addglobalabbrev _abbrev getexpansion expandabbrev modespecific _abbrev getabbrev _abbrev _abbrev gettoolkit addmodeabbrev getbuffer getmode getname _abbrev getexpansion expandabbrev public void key pressed key event evt if evt get key code key event vk escape dispose keypressed keyevent getkeycode keyevent vk_escape public boolean postfix false bsh unary expression int id super id bshunaryexpression public object eval call stack callstack interpreter interpreter throws eval error simple node node simple node jjt get child 0 if this is a unary increment of decrement either pre or postfix then we need an lhs to which to assign the result otherwise just do the unary operation for the value try if kind incr kind decr lhs lhs bsh primary expression node tolhs callstack interpreter return lhs unary operation lhs interpreter get strict java else return unary operation node eval callstack interpreter kind catch util eval error e throw e to eval error this callstack callstack evalerror simplenode simplenode jjtgetchild bshprimaryexpression lhsunaryoperation getstrictjava unaryoperation utilevalerror toevalerror private object lhs unary operation lhs lhs boolean strict java throws util eval error if interpreter debug interpreter debug lhs unary operation object prevalue postvalue prevalue lhs get value postvalue unary operation prevalue kind object ret val if postfix ret val prevalue else ret val postvalue lhs assign postvalue strict java return ret val lhsunaryoperation strictjava utilevalerror lhsunaryoperation getvalue unaryoperation retval retval retval strictjava retval private object unary operation object op int kind throws util eval error if op instanceof boolean op instanceof character op instanceof number return primitive wrapper unary operation op kind if op instanceof primitive throw new util eval error unary operation token image kind inappropriate for object return primitive unary operation primitive op kind unaryoperation utilevalerror primitivewrapperunaryoperation utilevalerror tokenimage unaryoperation private object primitive wrapper unary operation object val int kind throws util eval error class operand type val get class object operand primitive promote to integer val if operand instanceof boolean return new boolean primitive boolean unary operation boolean operand kind else if operand instanceof integer int result primitive int unary operation integer operand kind and must be cast back the original type if kind incr kind decr if operand type byte type return new byte byte result if operand type short type return new short short result if operand type character type return new character char result return new integer result else if operand instanceof long return new long primitive long unary operation long operand kind else if operand instanceof float return new float primitive float unary operation float operand kind else if operand instanceof double return new double primitive double unary operation double operand kind else throw new interpreter error an error occurred please call technical support primitivewrapperunaryoperation utilevalerror operandtype getclass promotetointeger booleanunaryoperation intunaryoperation operandtype operandtype operandtype longunaryoperation floatunaryoperation doubleunaryoperation interpretererror public splash screen set cursor cursor get predefined cursor cursor wait cursor set background color white font font new font dialog font plain 10 set font font fm get font metrics font image get toolkit get image get class get resource org gjt sp jedit icons splash png media tracker tracker new media tracker this tracker add image image 0 try tracker wait for all catch exception e log log log error this e win new j window dimension screen get toolkit get screen size dimension size new dimension image get width this 2 image get height this 2 progress height win set size size win get content pane add border layout center this win set location screen width size width 2 screen height size height 2 win validate win set visible true synchronized this try wait catch interrupted exception ie log log log error this ie splashscreen setcursor getpredefinedcursor wait_cursor setbackground setfont getfontmetrics gettoolkit getimage getclass getresource mediatracker mediatracker addimage waitforall jwindow gettoolkit getscreensize getwidth getheight progress_height setsize getcontentpane borderlayout setlocation setvisible interruptedexception public void dispose win dispose public synchronized void advance progress repaint wait for it to be painted to ensure progress is updated continuously try wait catch interrupted exception ie log log log error this ie interruptedexception public synchronized void paint component graphics g dimension size get size g set color color black g draw rect 0 0 size width 1 size height 1 g draw image image 1 1 this xxx this should not be hardcoded g set color color white g fill rect 1 image get height this 1 win get width 2 progress 5 progress height g set color color black string str version j edit get version g draw string str get width fm string width str 2 image get height this progress height fm get ascent fm get descent 2 notify paintcomponent getsize setcolor drawrect drawimage setcolor fillrect getheight getwidth progress_height setcolor jedit getversion drawstring getwidth stringwidth getheight progress_height getascent getdescent public boolean is do statement bsh while statement int id super id isdostatement bshwhilestatement public object eval call stack callstack interpreter interpreter throws eval error int num child jjt get num children order of body and condition is swapped for do while simple node cond exp body null if is do statement cond exp simple node jjt get child 1 body simple node jjt get child 0 else cond exp simple node jjt get child 0 if num child 1 has body else just for side effects body simple node jjt get child 1 boolean do once flag is do statement while do once flag bsh if statement evaluate condition cond exp callstack interpreter if body null no body continue object ret body eval callstack interpreter boolean breakout false if ret instanceof return control switch return control ret kind case return return ret case continue continue case break breakout true break if breakout break do once flag false return primitive void callstack evalerror numchild jjtgetnumchildren simplenode condexp isdostatement condexp simplenode jjtgetchild simplenode jjtgetchild condexp simplenode jjtgetchild numchild simplenode jjtgetchild doonceflag isdostatement doonceflag bshifstatement evaluatecondition condexp returncontrol returncontrol doonceflag public java io print stream debug stream system out public void set debug stream java io print stream ds debug stream ds printstream debugstream setdebugstream printstream debugstream public void set debug stream java io print stream ds debug stream ds private final int jjstopstringliteraldfa 0 int pos long active0 long active1 long active2 switch pos case 0 if active1 0x200020000000000l 0l return 56 if active0 0x3el 0l return 0 if active1 0x10000l 0l return 11 if active0 0xffffffffffffc00l 0l jjmatched kind 69 return 35 return 1 case 1 if active0 0x100600000l 0l return 35 if active0 0xffffffeff9ffc00l 0l if jjmatched pos 1 jjmatched kind 69 jjmatched pos 1 return 35 return 1 case 2 if active0 0xefffecebfdffc00l 0l if jjmatched pos 2 jjmatched kind 69 jjmatched pos 2 return 35 if active0 0x100013040000000l 0l return 35 return 1 case 3 if active0 0xc7ffcae3e5d3c00l 0l if jjmatched pos 3 jjmatched kind 69 jjmatched pos 3 return 35 if active0 0x28002408182c000l 0l return 35 return 1 case 4 if active0 0x86080003c053000l 0l return 35 if active0 0x41f7cae02580c00l 0l if jjmatched pos 4 jjmatched kind 69 jjmatched pos 4 return 35 return 1 case 5 if active0 0x41a1c2a12180c00l 0l jjmatched kind 69 jjmatched pos 5 return 35 if active0 0x45608400400000l 0l return 35 return 1 case 6 if active0 0x41a102a00080400l 0l jjmatched kind 69 jjmatched pos 6 return 35 if active0 0xc0012100800l 0l return 35 return 1 case 7 if active0 0x402000000080400l 0l return 35 if active0 0x18102a00000000l 0l jjmatched kind 69 jjmatched pos 7 return 35 return 1 case 8 if active0 0x8000a00000000l 0l jjmatched kind 69 jjmatched pos 8 return 35 if active0 0x10102000000000l 0l return 35 return 1 case 9 if active0 0x8000000000000l 0l jjmatched kind 69 jjmatched pos 9 return 35 if active0 0xa00000000l 0l return 35 return 1 case 10 if active0 0x8000000000000l 0l if jjmatched pos 10 jjmatched kind 69 jjmatched pos 10 return 35 return 1 case 11 if active0 0x8000000000000l 0l return 35 return 1 default return 1 setdebugstream printstream debugstream jjstopstringliteraldfa_0 jjmatchedkind jjmatchedpos jjmatchedkind jjmatchedpos jjmatchedpos jjmatchedkind jjmatchedpos jjmatchedpos jjmatchedkind jjmatchedpos jjmatchedpos jjmatchedkind jjmatchedpos jjmatchedkind jjmatchedpos jjmatchedkind jjmatchedpos jjmatchedkind jjmatchedpos jjmatchedkind jjmatchedpos jjmatchedkind jjmatchedpos jjmatchedpos jjmatchedkind jjmatchedpos private final int jjstartnfa 0 int pos long active0 long active1 long active2 return jjmovenfa 0 jjstopstringliteraldfa 0 pos active0 active1 active2 pos 1 jjstartnfa_0 jjmovenfa_0 jjstopstringliteraldfa_0 private final int jj stop at pos int pos int kind jjmatched kind kind jjmatched pos pos return pos 1 jjstopatpos jjmatchedkind jjmatchedpos private final int jjstartnfawithstates 0 int pos int kind int state jjmatched kind kind jjmatched pos pos try cur char input stream read char catch java io io exception e return pos 1 return jjmovenfa 0 state pos 1 jjstartnfawithstates_0 jjmatchedkind jjmatchedpos curchar input_stream readchar ioexception jjmovenfa_0 private final int jjmovestringliteraldfa0 0 switch cur char case 9 return jjstartnfawithstates 0 0 2 0 case 10 return jjstartnfawithstates 0 0 5 0 case 12 return jjstartnfawithstates 0 0 4 0 case 13 return jjstartnfawithstates 0 0 3 0 case 32 return jjstartnfawithstates 0 0 1 0 case 33 jjmatched kind 86 return jjmovestringliteraldfa1 0 0x0l 0x80000000l 0x0l case 37 jjmatched kind 111 return jjmovestringliteraldfa1 0 0x0l 0x8000000000000000l 0x0l case 38 jjmatched kind 106 return jjmovestringliteraldfa1 0 0x0l 0x400000400000000l 0x0l case 40 return jj stop at pos 0 72 case 41 return jj stop at pos 0 73 case 42 jjmatched kind 104 return jjmovestringliteraldfa1 0 0x0l 0x100000000000000l 0x0l case 43 jjmatched kind 102 return jjmovestringliteraldfa1 0 0x0l 0x40001000000000l 0x0l case 44 return jj stop at pos 0 79 case 45 jjmatched kind 103 return jjmovestringliteraldfa1 0 0x0l 0x80002000000000l 0x0l case 46 return jjstartnfawithstates 0 0 80 11 case 47 jjmatched kind 105 return jjmovestringliteraldfa1 0 0x0l 0x200000000000000l 0x0l case 58 return jj stop at pos 0 89 case 59 return jj stop at pos 0 78 case 60 jjmatched kind 84 return jjmovestringliteraldfa1 0 0x0l 0x1000008000000l 0x1l case 61 jjmatched kind 81 return jjmovestringliteraldfa1 0 0x0l 0x4000000l 0x0l case 62 jjmatched kind 82 return jjmovestringliteraldfa1 0 0x0l 0x14000020000000l 0x14l case 63 return jj stop at pos 0 88 case 64 return jjmovestringliteraldfa1 0 0x0l 0x282a280a50280000l 0x2al case 91 return jj stop at pos 0 76 case 93 return jj stop at pos 0 77 case 94 jjmatched kind 110 return jjmovestringliteraldfa1 0 0x0l 0x4000000000000000l 0x0l case 97 return jjmovestringliteraldfa1 0 0x400l 0x0l 0x0l case 98 return jjmovestringliteraldfa1 0 0x5800l 0x0l 0x0l case 99 return jjmovestringliteraldfa1 0 0xfa000l 0x0l 0x0l case 100 return jjmovestringliteraldfa1 0 0x700000l 0x0l 0x0l case 101 return jjmovestringliteraldfa1 0 0x3800000l 0x0l 0x0l case 102 return jjmovestringliteraldfa1 0 0x7c000000l 0x0l 0x0l case 103 return jjmovestringliteraldfa1 0 0x80000000l 0x0l 0x0l case 105 return jjmovestringliteraldfa1 0 0x3f00000000l 0x0l 0x0l case 108 return jjmovestringliteraldfa1 0 0x4000000000l 0x0l 0x0l case 110 return jjmovestringliteraldfa1 0 0x38000000000l 0x0l 0x0l case 112 return jjmovestringliteraldfa1 0 0x3c0000000000l 0x0l 0x0l case 114 return jjmovestringliteraldfa1 0 0x400000000000l 0x0l 0x0l case 115 return jjmovestringliteraldfa1 0 0xf800000000000l 0x0l 0x0l case 116 return jjmovestringliteraldfa1 0 0x1f0000000000000l 0x0l 0x0l case 118 return jjmovestringliteraldfa1 0 0x600000000000000l 0x0l 0x0l case 119 return jjmovestringliteraldfa1 0 0x800000000000000l 0x0l 0x0l case 123 return jj stop at pos 0 74 case 124 jjmatched kind 108 return jjmovestringliteraldfa1 0 0x0l 0x1000000100000000l 0x0l case 125 return jj stop at pos 0 75 case 126 return jj stop at pos 0 87 default return jjmovenfa 0 6 0 jjmovestringliteraldfa0_0 curchar jjstartnfawithstates_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjmatchedkind jjmovestringliteraldfa1_0 jjmatchedkind jjmovestringliteraldfa1_0 jjmatchedkind jjmovestringliteraldfa1_0 jjstopatpos jjstopatpos jjmatchedkind jjmovestringliteraldfa1_0 jjmatchedkind jjmovestringliteraldfa1_0 jjstopatpos jjmatchedkind jjmovestringliteraldfa1_0 jjstartnfawithstates_0 jjmatchedkind jjmovestringliteraldfa1_0 jjstopatpos jjstopatpos jjmatchedkind jjmovestringliteraldfa1_0 jjmatchedkind jjmovestringliteraldfa1_0 jjmatchedkind jjmovestringliteraldfa1_0 jjstopatpos jjmovestringliteraldfa1_0 jjstopatpos jjstopatpos jjmatchedkind jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjmovestringliteraldfa1_0 jjstopatpos jjmatchedkind jjmovestringliteraldfa1_0 jjstopatpos jjstopatpos jjmovenfa_0 private final int jjmovestringliteraldfa1 0 long active0 long active1 long active2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 0 active0 active1 active2 return 1 switch cur char case 38 if active1 0x400000000l 0l return jj stop at pos 1 98 break case 43 if active1 0x1000000000l 0l return jj stop at pos 1 100 break case 45 if active1 0x2000000000l 0l return jj stop at pos 1 101 break case 60 if active1 0x1000000000000l 0l jjmatched kind 112 jjmatched pos 1 return jjmovestringliteraldfa2 0 active0 0l active1 0l active2 0x1l case 61 if active1 0x4000000l 0l return jj stop at pos 1 90 else if active1 0x8000000l 0l return jj stop at pos 1 91 else if active1 0x20000000l 0l return jj stop at pos 1 93 else if active1 0x80000000l 0l return jj stop at pos 1 95 else if active1 0x40000000000000l 0l return jj stop at pos 1 118 else if active1 0x80000000000000l 0l return jj stop at pos 1 119 else if active1 0x100000000000000l 0l return jj stop at pos 1 120 else if active1 0x200000000000000l 0l return jj stop at pos 1 121 else if active1 0x400000000000000l 0l return jj stop at pos 1 122 else if active1 0x1000000000000000l 0l return jj stop at pos 1 124 else if active1 0x4000000000000000l 0l return jj stop at pos 1 126 else if active1 0x8000000000000000l 0l return jj stop at pos 1 127 break case 62 if active1 0x4000000000000l 0l jjmatched kind 114 jjmatched pos 1 return jjmovestringliteraldfa2 0 active0 0l active1 0x10000000000000l active2 0x14l case 97 return jjmovestringliteraldfa2 0 active0 0x48004018000l active1 0x800000800000000l active2 0l case 98 return jjmovestringliteraldfa2 0 active0 0x400l active1 0x280000000000l active2 0l case 101 return jjmovestringliteraldfa2 0 active0 0x410000100000l active1 0l active2 0l case 102 if active0 0x100000000l 0l return jjstartnfawithstates 0 1 32 35 break case 103 return jjmovestringliteraldfa2 0 active0 0l active1 0x40080000l active2 0l case 104 return jjmovestringliteraldfa2 0 active0 0x860800000020000l active1 0l active2 0l case 105 return jjmovestringliteraldfa2 0 active0 0x18000000l active1 0l active2 0l case 108 return jjmovestringliteraldfa2 0 active0 0x20802000l active1 0x2000010200000l active2 0x2l case 109 return jjmovestringliteraldfa2 0 active0 0x600000000l active1 0l active2 0l case 110 return jjmovestringliteraldfa2 0 active0 0x3801000000l active1 0l active2 0l case 111 if active0 0x200000l 0l jjmatched kind 21 jjmatched pos 1 return jjmovestringliteraldfa2 0 active0 0x6000040c04c0800l active1 0x2000000200000000l active2 0l case 114 return jjmovestringliteraldfa2 0 active0 0x190180000001000l active1 0x28000000000000l active2 0x28l case 116 return jjmovestringliteraldfa2 0 active0 0x3000000000000l active1 0l active2 0l case 117 return jjmovestringliteraldfa2 0 active0 0x220000000000l active1 0l active2 0l case 119 return jjmovestringliteraldfa2 0 active0 0x4000000000000l active1 0l active2 0l case 120 return jjmovestringliteraldfa2 0 active0 0x2000000l active1 0l active2 0l case 121 return jjmovestringliteraldfa2 0 active0 0x8000000004000l active1 0l active2 0l case 124 if active1 0x100000000l 0l return jj stop at pos 1 96 break default break return jjstartnfa 0 0 active0 active1 active2 jjmovestringliteraldfa1_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjstopatpos jjstopatpos jjstopatpos jjmatchedkind jjmatchedpos jjmovestringliteraldfa2_0 jjstopatpos jjstopatpos jjstopatpos jjstopatpos jjstopatpos jjstopatpos jjstopatpos jjstopatpos jjstopatpos jjstopatpos jjstopatpos jjstopatpos jjmatchedkind jjmatchedpos jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjstartnfawithstates_0 jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjmatchedkind jjmatchedpos jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjmovestringliteraldfa2_0 jjstopatpos jjstartnfa_0 private final int jjmovestringliteraldfa2 0 long old0 long active0 long old1 long active1 long old2 long active2 if active0 old0 active1 old1 active2 old2 0l return jjstartnfa 0 0 old0 old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 1 active0 active1 active2 return 2 switch cur char case 61 if active2 0x1l 0l return jj stop at pos 2 128 else if active2 0x4l 0l return jj stop at pos 2 130 break case 62 if active1 0x10000000000000l 0l jjmatched kind 116 jjmatched pos 2 return jjmovestringliteraldfa3 0 active0 0l active1 0l active2 0x10l case 97 return jjmovestringliteraldfa3 0 active0 0x11000000022000l active1 0l active2 0l case 98 return jjmovestringliteraldfa3 0 active0 0x200000000000l active1 0l active2 0l case 99 return jjmovestringliteraldfa3 0 active0 0x40000000000l active1 0l active2 0l case 101 return jjmovestringliteraldfa3 0 active0 0x1000l active1 0x2000000000000l active2 0x2l case 102 return jjmovestringliteraldfa3 0 active0 0x100000l active1 0l active2 0l case 105 return jjmovestringliteraldfa3 0 active0 0xa04080000000000l active1 0x28280000000000l active2 0x28l case 108 return jjmovestringliteraldfa3 0 active0 0x400020004000000l active1 0l active2 0l case 110 return jjmovestringliteraldfa3 0 active0 0x80040180c0000l active1 0x800000800000000l active2 0l case 111 return jjmovestringliteraldfa3 0 active0 0x900020000800l active1 0l active2 0l case 112 return jjmovestringliteraldfa3 0 active0 0x600000000l active1 0l active2 0l case 114 if active0 0x40000000l 0l return jjstartnfawithstates 0 2 30 35 else if active1 0x200000000l 0l jjmatched kind 97 jjmatched pos 2 return jjmovestringliteraldfa3 0 active0 0x62000000000000l active1 0x2000000000000000l active2 0l case 115 return jjmovestringliteraldfa3 0 active0 0x800808400l active1 0l active2 0l case 116 if active0 0x1000000000l 0l jjmatched kind 36 jjmatched pos 2 else if active1 0x80000l 0l jjmatched kind 83 jjmatched pos 2 else if active1 0x200000l 0l jjmatched kind 85 jjmatched pos 2 return jjmovestringliteraldfa3 0 active0 0x40a082014000l active1 0x50000000l active2 0l case 117 return jjmovestringliteraldfa3 0 active0 0x80000001400000l active1 0l active2 0l case 119 if active0 0x10000000000l 0l return jjstartnfawithstates 0 2 40 35 break case 121 if active0 0x100000000000000l 0l return jjstartnfawithstates 0 2 56 35 break default break return jjstartnfa 0 1 active0 active1 active2 jjmovestringliteraldfa2_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjstopatpos jjstopatpos jjmatchedkind jjmatchedpos jjmovestringliteraldfa3_0 jjmovestringliteraldfa3_0 jjmovestringliteraldfa3_0 jjmovestringliteraldfa3_0 jjmovestringliteraldfa3_0 jjmovestringliteraldfa3_0 jjmovestringliteraldfa3_0 jjmovestringliteraldfa3_0 jjmovestringliteraldfa3_0 jjmovestringliteraldfa3_0 jjmovestringliteraldfa3_0 jjstartnfawithstates_0 jjmatchedkind jjmatchedpos jjmovestringliteraldfa3_0 jjmovestringliteraldfa3_0 jjmatchedkind jjmatchedpos jjmatchedkind jjmatchedpos jjmatchedkind jjmatchedpos jjmovestringliteraldfa3_0 jjmovestringliteraldfa3_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjstartnfa_0 private final int jjmovestringliteraldfa3 0 long old0 long active0 long old1 long active1 long old2 long active2 if active0 old0 active1 old1 active2 old2 0l return jjstartnfa 0 1 old0 old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 2 active0 active1 active2 return 3 switch cur char case 61 if active2 0x10l 0l return jj stop at pos 3 132 break case 95 return jjmovestringliteraldfa4 0 active0 0l active1 0x2000000000000000l active2 0l case 97 return jjmovestringliteraldfa4 0 active0 0x400000038101000l active1 0l active2 0l case 98 return jjmovestringliteraldfa4 0 active0 0x400000l active1 0l active2 0l case 99 return jjmovestringliteraldfa4 0 active0 0x8000000010000l active1 0l active2 0l case 100 if active0 0x200000000000000l 0l return jjstartnfawithstates 0 3 57 35 else if active1 0x800000000l 0l jjmatched kind 99 jjmatched pos 3 return jjmovestringliteraldfa4 0 active0 0l active1 0x800000000000000l active2 0l case 101 if active0 0x4000l 0l return jjstartnfawithstates 0 3 14 35 else if active0 0x8000l 0l return jjstartnfawithstates 0 3 15 35 else if active0 0x800000l 0l return jjstartnfawithstates 0 3 23 35 else if active0 0x80000000000000l 0l return jjstartnfawithstates 0 3 55 35 return jjmovestringliteraldfa4 0 active0 0x2002000000l active1 0x50000000l active2 0l case 102 return jjmovestringliteraldfa4 0 active0 0l active1 0x2000000000000l active2 0x2l case 103 if active0 0x4000000000l 0l return jjstartnfawithstates 0 3 38 35 return jjmovestringliteraldfa4 0 active0 0l active1 0x28000000000000l active2 0x28l case 105 return jjmovestringliteraldfa4 0 active0 0x2008000000000l active1 0l active2 0l case 107 return jjmovestringliteraldfa4 0 active0 0x40000000000l active1 0l active2 0l case 108 if active0 0x20000000000l 0l return jjstartnfawithstates 0 3 41 35 return jjmovestringliteraldfa4 0 active0 0x800200200000800l active1 0l active2 0l case 109 if active0 0x1000000l 0l return jjstartnfawithstates 0 3 24 35 break case 110 return jjmovestringliteraldfa4 0 active0 0x10000000000000l active1 0l active2 0l case 111 if active0 0x80000000l 0l return jjstartnfawithstates 0 3 31 35 return jjmovestringliteraldfa4 0 active0 0x60000400000000l active1 0l active2 0l case 114 if active0 0x20000l 0l return jjstartnfawithstates 0 3 17 35 return jjmovestringliteraldfa4 0 active0 0x800000000000l active1 0l active2 0l case 115 return jjmovestringliteraldfa4 0 active0 0x4042000l active1 0l active2 0l case 116 return jjmovestringliteraldfa4 0 active0 0x5100800080400l active1 0x280000000000l active2 0l case 117 return jjmovestringliteraldfa4 0 active0 0x400000000000l active1 0l active2 0l case 118 return jjmovestringliteraldfa4 0 active0 0x80000000000l active1 0l active2 0l default break return jjstartnfa 0 2 active0 active1 active2 jjmovestringliteraldfa3_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjstopatpos jjmovestringliteraldfa4_0 jjmovestringliteraldfa4_0 jjmovestringliteraldfa4_0 jjmovestringliteraldfa4_0 jjstartnfawithstates_0 jjmatchedkind jjmatchedpos jjmovestringliteraldfa4_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjmovestringliteraldfa4_0 jjmovestringliteraldfa4_0 jjstartnfawithstates_0 jjmovestringliteraldfa4_0 jjmovestringliteraldfa4_0 jjmovestringliteraldfa4_0 jjstartnfawithstates_0 jjmovestringliteraldfa4_0 jjstartnfawithstates_0 jjmovestringliteraldfa4_0 jjstartnfawithstates_0 jjmovestringliteraldfa4_0 jjstartnfawithstates_0 jjmovestringliteraldfa4_0 jjmovestringliteraldfa4_0 jjmovestringliteraldfa4_0 jjmovestringliteraldfa4_0 jjmovestringliteraldfa4_0 jjstartnfa_0 private final int jjmovestringliteraldfa4 0 long old0 long active0 long old1 long active1 long old2 long active2 if active0 old0 active1 old1 active2 old2 0l return jjstartnfa 0 2 old0 old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 3 active0 active1 active2 return 4 switch cur char case 95 return jjmovestringliteraldfa5 0 active0 0l active1 0x800000000000000l active2 0l case 97 return jjmovestringliteraldfa5 0 active0 0xc0800000000l active1 0x2000000000000000l active2 0l case 99 return jjmovestringliteraldfa5 0 active0 0x6000000000000l active1 0l active2 0l case 101 if active0 0x4000000l 0l return jjstartnfawithstates 0 4 26 35 else if active0 0x800000000000000l 0l return jjstartnfawithstates 0 4 59 35 return jjmovestringliteraldfa5 0 active0 0x100200000800l active1 0l active2 0l case 104 if active0 0x10000l 0l return jjstartnfawithstates 0 4 16 35 return jjmovestringliteraldfa5 0 active0 0x8000000000000l active1 0x28000000000000l active2 0x28l case 105 return jjmovestringliteraldfa5 0 active0 0x1200000080000l active1 0l active2 0l case 107 if active0 0x1000l 0l return jjstartnfawithstates 0 4 12 35 break case 108 if active0 0x8000000l 0l jjmatched kind 27 jjmatched pos 4 return jjmovestringliteraldfa5 0 active0 0x10400000l active1 0l active2 0l case 110 return jjmovestringliteraldfa5 0 active0 0x2000000l active1 0l active2 0l case 113 if active1 0x10000000l 0l return jj stop at pos 4 92 else if active1 0x40000000l 0l return jj stop at pos 4 94 break case 114 return jjmovestringliteraldfa5 0 active0 0x402400000400l active1 0l active2 0l case 115 if active0 0x2000l 0l return jjstartnfawithstates 0 4 13 35 return jjmovestringliteraldfa5 0 active0 0x10000000000000l active1 0l active2 0l case 116 if active0 0x40000l 0l return jjstartnfawithstates 0 4 18 35 else if active0 0x20000000l 0l return jjstartnfawithstates 0 4 29 35 else if active0 0x800000000000l 0l return jjstartnfawithstates 0 4 47 35 return jjmovestringliteraldfa5 0 active0 0x400000000000000l active1 0x2000000000000l active2 0x2l case 117 return jjmovestringliteraldfa5 0 active0 0x100000l active1 0l active2 0l case 118 return jjmovestringliteraldfa5 0 active0 0x8000000000l active1 0l active2 0l case 119 if active0 0x20000000000000l 0l jjmatched kind 53 jjmatched pos 4 return jjmovestringliteraldfa5 0 active0 0x40000000000000l active1 0x280000000000l active2 0l default break return jjstartnfa 0 3 active0 active1 active2 jjmovestringliteraldfa4_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa5_0 jjmovestringliteraldfa5_0 jjmovestringliteraldfa5_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjmovestringliteraldfa5_0 jjstartnfawithstates_0 jjmovestringliteraldfa5_0 jjmovestringliteraldfa5_0 jjstartnfawithstates_0 jjmatchedkind jjmatchedpos jjmovestringliteraldfa5_0 jjmovestringliteraldfa5_0 jjstopatpos jjstopatpos jjmovestringliteraldfa5_0 jjstartnfawithstates_0 jjmovestringliteraldfa5_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjmovestringliteraldfa5_0 jjmovestringliteraldfa5_0 jjmovestringliteraldfa5_0 jjmatchedkind jjmatchedpos jjmovestringliteraldfa5_0 jjstartnfa_0 private final int jjmovestringliteraldfa5 0 long old0 long active0 long old1 long active1 long old2 long active2 if active0 old0 active1 old1 active2 old2 0l return jjstartnfa 0 3 old0 old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 4 active0 active1 active2 return 5 switch cur char case 95 return jjmovestringliteraldfa6 0 active0 0l active1 0x2000000000000l active2 0x2l case 97 return jjmovestringliteraldfa6 0 active0 0xc00l active1 0x800000000000000l active2 0l case 99 if active0 0x200000000000l 0l return jjstartnfawithstates 0 5 45 35 else if active0 0x1000000000000l 0l return jjstartnfawithstates 0 5 48 35 return jjmovestringliteraldfa6 0 active0 0x100000000000l active1 0l active2 0l case 100 return jjmovestringliteraldfa6 0 active0 0x2000000l active1 0l active2 0l case 101 if active0 0x400000l 0l return jjstartnfawithstates 0 5 22 35 else if active0 0x8000000000l 0l return jjstartnfawithstates 0 5 39 35 break case 102 return jjmovestringliteraldfa6 0 active0 0x2000000000l active1 0l active2 0l case 103 return jjmovestringliteraldfa6 0 active0 0x40000000000l active1 0l active2 0l case 104 if active0 0x4000000000000l 0l return jjstartnfawithstates 0 5 50 35 break case 105 return jjmovestringliteraldfa6 0 active0 0x410000000000000l active1 0x280000000000l active2 0l case 108 return jjmovestringliteraldfa6 0 active0 0x10100000l active1 0l active2 0l case 109 return jjmovestringliteraldfa6 0 active0 0x200000000l active1 0l active2 0l case 110 if active0 0x400000000000l 0l return jjstartnfawithstates 0 5 46 35 return jjmovestringliteraldfa6 0 active0 0x800080000l active1 0l active2 0l case 114 return jjmovestringliteraldfa6 0 active0 0x8000000000000l active1 0l active2 0l case 115 if active0 0x40000000000000l 0l return jjstartnfawithstates 0 5 54 35 return jjmovestringliteraldfa6 0 active0 0l active1 0x2000000000000000l active2 0l case 116 if active0 0x400000000l 0l return jjstartnfawithstates 0 5 34 35 return jjmovestringliteraldfa6 0 active0 0x2080000000000l active1 0x28000000000000l active2 0x28l default break return jjstartnfa 0 4 active0 active1 active2 jjmovestringliteraldfa5_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa6_0 jjmovestringliteraldfa6_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjmovestringliteraldfa6_0 jjmovestringliteraldfa6_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjmovestringliteraldfa6_0 jjmovestringliteraldfa6_0 jjstartnfawithstates_0 jjmovestringliteraldfa6_0 jjmovestringliteraldfa6_0 jjmovestringliteraldfa6_0 jjstartnfawithstates_0 jjmovestringliteraldfa6_0 jjmovestringliteraldfa6_0 jjstartnfawithstates_0 jjmovestringliteraldfa6_0 jjstartnfawithstates_0 jjmovestringliteraldfa6_0 jjstartnfa_0 private final int jjmovestringliteraldfa6 0 long old0 long active0 long old1 long active1 long old2 long active2 if active0 old0 active1 old1 active2 old2 0l return jjstartnfa 0 4 old0 old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 5 active0 active1 active2 return 6 switch cur char case 95 return jjmovestringliteraldfa7 0 active0 0l active1 0x28000000000000l active2 0x28l case 97 return jjmovestringliteraldfa7 0 active0 0x2000000000l active1 0l active2 0l case 99 return jjmovestringliteraldfa7 0 active0 0x800000400l active1 0l active2 0l case 101 if active0 0x40000000000l 0l return jjstartnfawithstates 0 6 42 35 else if active0 0x80000000000l 0l return jjstartnfawithstates 0 6 43 35 return jjmovestringliteraldfa7 0 active0 0x10000200000000l active1 0l active2 0l case 102 return jjmovestringliteraldfa7 0 active0 0x2000000000000l active1 0l active2 0l case 108 return jjmovestringliteraldfa7 0 active0 0x400000000000000l active1 0l active2 0l case 110 if active0 0x800l 0l return jjstartnfawithstates 0 6 11 35 break case 111 return jjmovestringliteraldfa7 0 active0 0x8000000000000l active1 0l active2 0l case 115 if active0 0x2000000l 0l return jjstartnfawithstates 0 6 25 35 return jjmovestringliteraldfa7 0 active0 0l active1 0x2802280000000000l active2 0x2l case 116 if active0 0x100000l 0l return jjstartnfawithstates 0 6 20 35 return jjmovestringliteraldfa7 0 active0 0x100000000000l active1 0l active2 0l case 117 return jjmovestringliteraldfa7 0 active0 0x80000l active1 0l active2 0l case 121 if active0 0x10000000l 0l return jjstartnfawithstates 0 6 28 35 break default break return jjstartnfa 0 5 active0 active1 active2 jjmovestringliteraldfa6_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa7_0 jjmovestringliteraldfa7_0 jjmovestringliteraldfa7_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjmovestringliteraldfa7_0 jjmovestringliteraldfa7_0 jjmovestringliteraldfa7_0 jjstartnfawithstates_0 jjmovestringliteraldfa7_0 jjstartnfawithstates_0 jjmovestringliteraldfa7_0 jjstartnfawithstates_0 jjmovestringliteraldfa7_0 jjmovestringliteraldfa7_0 jjstartnfawithstates_0 jjstartnfa_0 private final int jjmovestringliteraldfa7 0 long old0 long active0 long old1 long active1 long old2 long active2 if active0 old0 active1 old1 active2 old2 0l return jjstartnfa 0 5 old0 old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 6 active0 active1 active2 return 7 switch cur char case 99 return jjmovestringliteraldfa8 0 active0 0x2000000000l active1 0l active2 0l case 101 if active0 0x80000l 0l return jjstartnfawithstates 0 7 19 35 else if active0 0x400000000000000l 0l return jjstartnfawithstates 0 7 58 35 return jjmovestringliteraldfa8 0 active0 0x100800000000l active1 0x280000000000l active2 0l case 104 return jjmovestringliteraldfa8 0 active0 0l active1 0x2000000000000l active2 0x2l case 105 return jjmovestringliteraldfa8 0 active0 0l active1 0x2000000000000000l active2 0l case 110 return jjmovestringliteraldfa8 0 active0 0x18000200000000l active1 0l active2 0l case 112 if active0 0x2000000000000l 0l return jjstartnfawithstates 0 7 49 35 break case 115 return jjmovestringliteraldfa8 0 active0 0l active1 0x808000000000000l active2 0x8l case 116 if active0 0x400l 0l return jjstartnfawithstates 0 7 10 35 break case 117 return jjmovestringliteraldfa8 0 active0 0l active1 0x20000000000000l active2 0x20l default break return jjstartnfa 0 6 active0 active1 active2 jjmovestringliteraldfa7_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa8_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjmovestringliteraldfa8_0 jjmovestringliteraldfa8_0 jjmovestringliteraldfa8_0 jjmovestringliteraldfa8_0 jjstartnfawithstates_0 jjmovestringliteraldfa8_0 jjstartnfawithstates_0 jjmovestringliteraldfa8_0 jjstartnfa_0 private final int jjmovestringliteraldfa8 0 long old0 long active0 long old1 long active1 long old2 long active2 if active0 old0 active1 old1 active2 old2 0l return jjstartnfa 0 6 old0 old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 7 active0 active1 active2 return 8 switch cur char case 95 return jjmovestringliteraldfa9 0 active0 0l active1 0x280000000000l active2 0l case 100 if active0 0x100000000000l 0l return jjstartnfawithstates 0 8 44 35 break case 101 if active0 0x2000000000l 0l return jjstartnfawithstates 0 8 37 35 break case 103 return jjmovestringliteraldfa9 0 active0 0l active1 0x2000000000000000l active2 0l case 104 return jjmovestringliteraldfa9 0 active0 0l active1 0x8000000000000l active2 0x8l case 105 return jjmovestringliteraldfa9 0 active0 0x8000000000000l active1 0x802000000000000l active2 0x2l case 110 return jjmovestringliteraldfa9 0 active0 0l active1 0x20000000000000l active2 0x20l case 111 return jjmovestringliteraldfa9 0 active0 0x800000000l active1 0l active2 0l case 116 if active0 0x10000000000000l 0l return jjstartnfawithstates 0 8 52 35 return jjmovestringliteraldfa9 0 active0 0x200000000l active1 0l active2 0l default break return jjstartnfa 0 7 active0 active1 active2 jjmovestringliteraldfa8_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa9_0 jjstartnfawithstates_0 jjstartnfawithstates_0 jjmovestringliteraldfa9_0 jjmovestringliteraldfa9_0 jjmovestringliteraldfa9_0 jjmovestringliteraldfa9_0 jjmovestringliteraldfa9_0 jjstartnfawithstates_0 jjmovestringliteraldfa9_0 jjstartnfa_0 private final int jjmovestringliteraldfa9 0 long old0 long active0 long old1 long active1 long old2 long active2 if active0 old0 active1 old1 active2 old2 0l return jjstartnfa 0 7 old0 old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 8 active0 active1 active2 return 9 switch cur char case 97 return jjmovestringliteraldfa10 0 active0 0l active1 0x80000000000l active2 0l case 102 if active0 0x800000000l 0l return jjstartnfawithstates 0 9 35 35 return jjmovestringliteraldfa10 0 active0 0l active1 0x2000000000000l active2 0x2l case 103 return jjmovestringliteraldfa10 0 active0 0l active1 0x800000000000000l active2 0l case 105 return jjmovestringliteraldfa10 0 active0 0l active1 0x8000000000000l active2 0x8l case 110 if active1 0x2000000000000000l 0l return jj stop at pos 9 125 break case 111 return jjmovestringliteraldfa10 0 active0 0l active1 0x200000000000l active2 0l case 115 if active0 0x200000000l 0l return jjstartnfawithstates 0 9 33 35 return jjmovestringliteraldfa10 0 active0 0l active1 0x20000000000000l active2 0x20l case 122 return jjmovestringliteraldfa10 0 active0 0x8000000000000l active1 0l active2 0l default break return jjstartnfa 0 8 active0 active1 active2 jjmovestringliteraldfa9_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa10_0 jjstartnfawithstates_0 jjmovestringliteraldfa10_0 jjmovestringliteraldfa10_0 jjmovestringliteraldfa10_0 jjstopatpos jjmovestringliteraldfa10_0 jjstartnfawithstates_0 jjmovestringliteraldfa10_0 jjmovestringliteraldfa10_0 jjstartnfa_0 private final int jjmovestringliteraldfa10 0 long old0 long active0 long old1 long active1 long old2 long active2 if active0 old0 active1 old1 active2 old2 0l return jjstartnfa 0 8 old0 old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 9 active0 active1 active2 return 10 switch cur char case 101 return jjmovestringliteraldfa11 0 active0 0x8000000000000l active1 0l active2 0l case 102 return jjmovestringliteraldfa11 0 active0 0l active1 0x8000000000000l active2 0x8l case 105 return jjmovestringliteraldfa11 0 active0 0l active1 0x20000000000000l active2 0x20l case 110 if active1 0x800000000000000l 0l return jj stop at pos 10 123 return jjmovestringliteraldfa11 0 active0 0l active1 0x80000000000l active2 0l case 114 if active1 0x200000000000l 0l return jj stop at pos 10 109 break case 116 if active1 0x2000000000000l 0l jjmatched kind 113 jjmatched pos 10 return jjmovestringliteraldfa11 0 active0 0l active1 0l active2 0x2l default break return jjstartnfa 0 9 active0 active1 active2 jjmovestringliteraldfa10_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa11_0 jjmovestringliteraldfa11_0 jjmovestringliteraldfa11_0 jjstopatpos jjmovestringliteraldfa11_0 jjstopatpos jjmatchedkind jjmatchedpos jjmovestringliteraldfa11_0 jjstartnfa_0 private final int jjmovestringliteraldfa11 0 long old0 long active0 long old1 long active1 long old2 long active2 if active0 old0 active1 old1 active2 old2 0l return jjstartnfa 0 9 old0 old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 10 active0 active1 active2 return 11 switch cur char case 95 return jjmovestringliteraldfa12 0 active0 0l active1 0l active2 0x2l case 100 if active0 0x8000000000000l 0l return jjstartnfawithstates 0 11 51 35 else if active1 0x80000000000l 0l return jj stop at pos 11 107 break case 103 return jjmovestringliteraldfa12 0 active0 0l active1 0x20000000000000l active2 0x20l case 116 if active1 0x8000000000000l 0l jjmatched kind 115 jjmatched pos 11 return jjmovestringliteraldfa12 0 active0 0l active1 0l active2 0x8l default break return jjstartnfa 0 10 active0 active1 active2 jjmovestringliteraldfa11_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa12_0 jjstartnfawithstates_0 jjstopatpos jjmovestringliteraldfa12_0 jjmatchedkind jjmatchedpos jjmovestringliteraldfa12_0 jjstartnfa_0 private final int jjmovestringliteraldfa12 0 long old0 long active0 long old1 long active1 long old2 long active2 if active0 old0 active1 old1 active2 old2 0l return jjstartnfa 0 10 old0 old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 11 0l active1 active2 return 12 switch cur char case 95 return jjmovestringliteraldfa13 0 active1 0l active2 0x8l case 97 return jjmovestringliteraldfa13 0 active1 0l active2 0x2l case 110 return jjmovestringliteraldfa13 0 active1 0x20000000000000l active2 0x20l default break return jjstartnfa 0 11 0l active1 active2 jjmovestringliteraldfa12_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa13_0 jjmovestringliteraldfa13_0 jjmovestringliteraldfa13_0 jjstartnfa_0 private final int jjmovestringliteraldfa13 0 long old1 long active1 long old2 long active2 if active1 old1 active2 old2 0l return jjstartnfa 0 11 0l old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 12 0l active1 active2 return 13 switch cur char case 97 return jjmovestringliteraldfa14 0 active1 0l active2 0x8l case 101 return jjmovestringliteraldfa14 0 active1 0x20000000000000l active2 0x20l case 115 return jjmovestringliteraldfa14 0 active1 0l active2 0x2l default break return jjstartnfa 0 12 0l active1 active2 jjmovestringliteraldfa13_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa14_0 jjmovestringliteraldfa14_0 jjmovestringliteraldfa14_0 jjstartnfa_0 private final int jjmovestringliteraldfa14 0 long old1 long active1 long old2 long active2 if active1 old1 active2 old2 0l return jjstartnfa 0 12 0l old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 13 0l active1 active2 return 14 switch cur char case 100 return jjmovestringliteraldfa15 0 active1 0x20000000000000l active2 0x20l case 115 return jjmovestringliteraldfa15 0 active1 0l active2 0xal default break return jjstartnfa 0 13 0l active1 active2 jjmovestringliteraldfa14_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa15_0 jjmovestringliteraldfa15_0 jjstartnfa_0 private final int jjmovestringliteraldfa15 0 long old1 long active1 long old2 long active2 if active1 old1 active2 old2 0l return jjstartnfa 0 13 0l old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 14 0l active1 active2 return 15 switch cur char case 95 return jjmovestringliteraldfa16 0 active1 0x20000000000000l active2 0x20l case 105 return jjmovestringliteraldfa16 0 active1 0l active2 0x2l case 115 return jjmovestringliteraldfa16 0 active1 0l active2 0x8l default break return jjstartnfa 0 14 0l active1 active2 jjmovestringliteraldfa15_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa16_0 jjmovestringliteraldfa16_0 jjmovestringliteraldfa16_0 jjstartnfa_0 private final int jjmovestringliteraldfa16 0 long old1 long active1 long old2 long active2 if active1 old1 active2 old2 0l return jjstartnfa 0 14 0l old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 15 0l active1 active2 return 16 switch cur char case 103 return jjmovestringliteraldfa17 0 active1 0l active2 0x2l case 105 return jjmovestringliteraldfa17 0 active1 0l active2 0x8l case 115 return jjmovestringliteraldfa17 0 active1 0x20000000000000l active2 0x20l default break return jjstartnfa 0 15 0l active1 active2 jjmovestringliteraldfa16_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa17_0 jjmovestringliteraldfa17_0 jjmovestringliteraldfa17_0 jjstartnfa_0 private final int jjmovestringliteraldfa17 0 long old1 long active1 long old2 long active2 if active1 old1 active2 old2 0l return jjstartnfa 0 15 0l old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 16 0l active1 active2 return 17 switch cur char case 103 return jjmovestringliteraldfa18 0 active1 0l active2 0x8l case 104 return jjmovestringliteraldfa18 0 active1 0x20000000000000l active2 0x20l case 110 if active2 0x2l 0l return jj stop at pos 17 129 break default break return jjstartnfa 0 16 0l active1 active2 jjmovestringliteraldfa17_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa18_0 jjmovestringliteraldfa18_0 jjstopatpos jjstartnfa_0 private final int jjmovestringliteraldfa18 0 long old1 long active1 long old2 long active2 if active1 old1 active2 old2 0l return jjstartnfa 0 16 0l old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 17 0l active1 active2 return 18 switch cur char case 105 return jjmovestringliteraldfa19 0 active1 0x20000000000000l active2 0x20l case 110 if active2 0x8l 0l return jj stop at pos 18 131 break default break return jjstartnfa 0 17 0l active1 active2 jjmovestringliteraldfa18_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa19_0 jjstopatpos jjstartnfa_0 private final int jjmovestringliteraldfa19 0 long old1 long active1 long old2 long active2 if active1 old1 active2 old2 0l return jjstartnfa 0 17 0l old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 18 0l active1 active2 return 19 switch cur char case 102 return jjmovestringliteraldfa20 0 active1 0x20000000000000l active2 0x20l default break return jjstartnfa 0 18 0l active1 active2 jjmovestringliteraldfa19_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa20_0 jjstartnfa_0 private final int jjmovestringliteraldfa20 0 long old1 long active1 long old2 long active2 if active1 old1 active2 old2 0l return jjstartnfa 0 18 0l old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 19 0l active1 active2 return 20 switch cur char case 116 if active1 0x20000000000000l 0l jjmatched kind 117 jjmatched pos 20 return jjmovestringliteraldfa21 0 active1 0l active2 0x20l default break return jjstartnfa 0 19 0l active1 active2 jjmovestringliteraldfa20_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmatchedkind jjmatchedpos jjmovestringliteraldfa21_0 jjstartnfa_0 private final int jjmovestringliteraldfa21 0 long old1 long active1 long old2 long active2 if active1 old1 active2 old2 0l return jjstartnfa 0 19 0l old1 old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 20 0l 0l active2 return 21 switch cur char case 95 return jjmovestringliteraldfa22 0 active2 0x20l default break return jjstartnfa 0 20 0l 0l active2 jjmovestringliteraldfa21_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa22_0 jjstartnfa_0 private final int jjmovestringliteraldfa22 0 long old2 long active2 if active2 old2 0l return jjstartnfa 0 20 0l 0l old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 21 0l 0l active2 return 22 switch cur char case 97 return jjmovestringliteraldfa23 0 active2 0x20l default break return jjstartnfa 0 21 0l 0l active2 jjmovestringliteraldfa22_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa23_0 jjstartnfa_0 private final int jjmovestringliteraldfa23 0 long old2 long active2 if active2 old2 0l return jjstartnfa 0 21 0l 0l old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 22 0l 0l active2 return 23 switch cur char case 115 return jjmovestringliteraldfa24 0 active2 0x20l default break return jjstartnfa 0 22 0l 0l active2 jjmovestringliteraldfa23_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa24_0 jjstartnfa_0 private final int jjmovestringliteraldfa24 0 long old2 long active2 if active2 old2 0l return jjstartnfa 0 22 0l 0l old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 23 0l 0l active2 return 24 switch cur char case 115 return jjmovestringliteraldfa25 0 active2 0x20l default break return jjstartnfa 0 23 0l 0l active2 jjmovestringliteraldfa24_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa25_0 jjstartnfa_0 private final int jjmovestringliteraldfa25 0 long old2 long active2 if active2 old2 0l return jjstartnfa 0 23 0l 0l old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 24 0l 0l active2 return 25 switch cur char case 105 return jjmovestringliteraldfa26 0 active2 0x20l default break return jjstartnfa 0 24 0l 0l active2 jjmovestringliteraldfa25_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa26_0 jjstartnfa_0 private final int jjmovestringliteraldfa26 0 long old2 long active2 if active2 old2 0l return jjstartnfa 0 24 0l 0l old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 25 0l 0l active2 return 26 switch cur char case 103 return jjmovestringliteraldfa27 0 active2 0x20l default break return jjstartnfa 0 25 0l 0l active2 jjmovestringliteraldfa26_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjmovestringliteraldfa27_0 jjstartnfa_0 private final int jjmovestringliteraldfa27 0 long old2 long active2 if active2 old2 0l return jjstartnfa 0 25 0l 0l old2 try cur char input stream read char catch java io io exception e jjstopstringliteraldfa 0 26 0l 0l active2 return 27 switch cur char case 110 if active2 0x20l 0l return jj stop at pos 27 133 break default break return jjstartnfa 0 26 0l 0l active2 jjmovestringliteraldfa27_0 jjstartnfa_0 curchar input_stream readchar ioexception jjstopstringliteraldfa_0 curchar jjstopatpos jjstartnfa_0 private final void jj checkn add int state if jjrounds state jjround jjstate set jjnew state cnt state jjrounds state jjround jjchecknadd jjstateset jjnewstatecnt private final void jj add states int start int end do jjstate set jjnew state cnt jjnext states start while start end jjaddstates jjstateset jjnewstatecnt jjnextstates private final void jj checkn add two states int state1 int state2 jj checkn add state1 jj checkn add state2 jjchecknaddtwostates jjchecknadd jjchecknadd private final void jj checkn add states int start int end do jj checkn add jjnext states start while start end jjchecknaddstates jjchecknadd jjnextstates private final void jj checkn add states int start jj checkn add jjnext states start jj checkn add jjnext states start 1 jjchecknaddstates jjchecknadd jjnextstates jjchecknadd jjnextstates private final int jjmovenfa 0 int start state int cur pos int next states int starts at 0 jjnew state cnt 74 int i 1 jjstate set 0 start state int j kind 0x7fffffff for if jjround 0x7fffffff re init rounds if cur char 64 long l 1l cur char match loop do switch jjstate set i case 6 if 0x1ffffffffl l 0l if kind 6 kind 6 jj checkn add 0 else if 0x3ff000000000000l l 0l jj checkn add states 0 6 else if cur char 47 jj add states 7 9 else if cur char 36 if kind 69 kind 69 jj checkn add 35 else if cur char 34 jj checkn add states 10 12 else if cur char 39 jj add states 13 14 else if cur char 46 jj checkn add 11 else if cur char 35 jjstate set jjnew state cnt 1 if 0x3fe000000000000l l 0l if kind 60 kind 60 jj checkn add two states 8 9 else if cur char 48 if kind 60 kind 60 jj checkn add states 15 17 break case 56 if cur char 42 jjstate set jjnew state cnt 67 else if cur char 47 if kind 7 kind 7 jj checkn add states 18 20 if cur char 42 jj checkn add 62 break case 0 if 0x1ffffffffl l 0l break if kind 6 kind 6 jj checkn add 0 break case 1 if cur char 33 jj checkn add states 21 23 break case 2 if 0xffffffffffffdbffl l 0l jj checkn add states 21 23 break case 3 if 0x2400l l 0l kind 8 kind 8 break case 4 if cur char 10 kind 8 kind 8 break case 5 if cur char 13 jjstate set jjnew state cnt 4 break case 7 if 0x3fe000000000000l l 0l break if kind 60 kind 60 jj checkn add two states 8 9 break case 8 if 0x3ff000000000000l l 0l break if kind 60 kind 60 jj checkn add two states 8 9 break case 10 if cur char 46 jj checkn add 11 break case 11 if 0x3ff000000000000l l 0l break if kind 64 kind 64 jj checkn add states 24 26 break case 13 if 0x280000000000l l 0l jj checkn add 14 break case 14 if 0x3ff000000000000l l 0l break if kind 64 kind 64 jj checkn add two states 14 15 break case 16 if cur char 39 jj add states 13 14 break case 17 if 0xffffff7fffffdbffl l 0l jj checkn add 18 break case 18 if cur char 39 kind 66 kind 66 break case 20 if 0x8400000000l l 0l jj checkn add 18 break case 21 if 0xff000000000000l l 0l jj checkn add two states 22 18 break case 22 if 0xff000000000000l l 0l jj checkn add 18 break case 23 if 0xf000000000000l l 0l jjstate set jjnew state cnt 24 break case 24 if 0xff000000000000l l 0l jj checkn add 22 break case 25 if cur char 34 jj checkn add states 10 12 break case 26 if 0xfffffffbffffdbffl l 0l jj checkn add states 10 12 break case 28 if 0x8400000000l l 0l jj checkn add states 10 12 break case 29 if cur char 34 kind 67 kind 67 break case 30 if 0xff000000000000l l 0l jj checkn add states 27 30 break case 31 if 0xff000000000000l l 0l jj checkn add states 10 12 break case 32 if 0xf000000000000l l 0l jjstate set jjnew state cnt 33 break case 33 if 0xff000000000000l l 0l jj checkn add 31 break case 34 if cur char 36 break if kind 69 kind 69 jj checkn add 35 break case 35 if 0x3ff001000000000l l 0l break if kind 69 kind 69 jj checkn add 35 break case 36 if 0x3ff000000000000l l 0l jj checkn add states 0 6 break case 37 if 0x3ff000000000000l l 0l jj checkn add two states 37 38 break case 38 if cur char 46 break if kind 64 kind 64 jj checkn add states 31 33 break case 39 if 0x3ff000000000000l l 0l break if kind 64 kind 64 jj checkn add states 31 33 break case 41 if 0x280000000000l l 0l jj checkn add 42 break case 42 if 0x3ff000000000000l l 0l break if kind 64 kind 64 jj checkn add two states 42 15 break case 43 if 0x3ff000000000000l l 0l jj checkn add two states 43 44 break case 45 if 0x280000000000l l 0l jj checkn add 46 break case 46 if 0x3ff000000000000l l 0l break if kind 64 kind 64 jj checkn add two states 46 15 break case 47 if 0x3ff000000000000l l 0l jj checkn add states 34 36 break case 49 if 0x280000000000l l 0l jj checkn add 50 break case 50 if 0x3ff000000000000l l 0l jj checkn add two states 50 15 break case 51 if cur char 48 break if kind 60 kind 60 jj checkn add states 15 17 break case 53 if 0x3ff000000000000l l 0l break if kind 60 kind 60 jj checkn add two states 53 9 break case 54 if 0xff000000000000l l 0l break if kind 60 kind 60 jj checkn add two states 54 9 break case 55 if cur char 47 jjmovenfa_0 startstate curpos nextstates startsat jjnewstatecnt jjstateset startstate reinitrounds curchar curchar matchloop jjstateset jjchecknadd jjchecknaddstates curchar jjaddstates curchar jjchecknadd curchar jjchecknaddstates curchar jjaddstates curchar jjchecknadd curchar jjstateset jjnewstatecnt jjchecknaddtwostates curchar jjchecknaddstates curchar jjstateset jjnewstatecnt curchar jjchecknaddstates curchar jjchecknadd jjchecknadd curchar jjchecknaddstates jjchecknaddstates curchar curchar jjstateset jjnewstatecnt jjchecknaddtwostates jjchecknaddtwostates curchar jjchecknadd jjchecknaddstates jjchecknadd jjchecknaddtwostates curchar jjaddstates jjchecknadd curchar jjchecknadd jjchecknaddtwostates jjchecknadd jjstateset jjnewstatecnt jjchecknadd curchar jjchecknaddstates jjchecknaddstates jjchecknaddstates curchar jjchecknaddstates jjchecknaddstates jjstateset jjnewstatecnt jjchecknadd curchar jjchecknadd jjchecknadd jjchecknaddstates jjchecknaddtwostates curchar jjchecknaddstates jjchecknaddstates jjchecknadd jjchecknaddtwostates jjchecknaddtwostates jjchecknadd jjchecknaddtwostates jjchecknaddstates jjchecknadd jjchecknaddtwostates curchar jjchecknaddstates jjchecknaddtwostates jjchecknaddtwostates curchar private static final boolean jjcanmove 0 int hi byte int i1 int i2 long l1 long l2 switch hi byte case 0 return jjbit vec0 i2 l2 0l default return false jjcanmove_0 hibyte hibyte jjbitvec0 private static final boolean jjcanmove 1 int hi byte int i1 int i2 long l1 long l2 switch hi byte case 0 return jjbit vec0 i2 l2 0l default if jjbit vec1 i1 l1 0l return true return false jjcanmove_1 hibyte hibyte jjbitvec0 jjbitvec1 private static final boolean jjcanmove 2 int hi byte int i1 int i2 long l1 long l2 switch hi byte case 0 return jjbit vec4 i2 l2 0l case 48 return jjbit vec5 i2 l2 0l case 49 return jjbit vec6 i2 l2 0l case 51 return jjbit vec7 i2 l2 0l case 61 return jjbit vec8 i2 l2 0l default if jjbit vec3 i1 l1 0l return true return false jjcanmove_2 hibyte hibyte jjbitvec4 jjbitvec5 jjbitvec6 jjbitvec7 jjbitvec8 jjbitvec3 protected char cur char public parser token manager java char stream stream if java char stream static flag throw new error error cannot use a static char stream class with a non static lexical analyzer input stream stream curchar parsertokenmanager javacharstream javacharstream staticflag charstream input_stream public parser token manager java char stream stream int lex state this stream switch to lex state parsertokenmanager javacharstream lexstate switchto lexstate public void re init java char stream stream jjmatched pos jjnew state cnt 0 cur lex state default lex state input stream stream re init rounds reinit javacharstream jjmatchedpos jjnewstatecnt curlexstate defaultlexstate input_stream reinitrounds private final void re init rounds int i jjround 0x80000001 for i 74 i 0 jjrounds i 0x80000000 reinitrounds public void re init java char stream stream int lex state re init stream switch to lex state reinit javacharstream lexstate reinit switchto lexstate public void switch to int lex state if lex state 1 lex state 0 throw new token mgr error error ignoring invalid lexical state lex state state unchanged token mgr error invalid lexical state else cur lex state lex state switchto lexstate lexstate lexstate tokenmgrerror lexstate tokenmgrerror invalid_lexical_state curlexstate lexstate protected token jj fill token token t token new token jjmatched kind t kind jjmatched kind string im jjstr literal images jjmatched kind t image im null input stream get image im t begin line input stream get begin line t begin column input stream get begin column t end line input stream get end line t end column input stream get end column return t jjfilltoken newtoken jjmatchedkind jjmatchedkind jjstrliteralimages jjmatchedkind input_stream getimage beginline input_stream getbeginline begincolumn input_stream getbegincolumn endline input_stream getendline endcolumn input_stream getendcolumn public token get next token int kind token special token null token matched token int cur pos 0 eof loop for try cur char input stream begin token catch java io io exception e jjmatched kind 0 matched token jj fill token matched token special token special token return matched token jjmatched kind 0x7fffffff jjmatched pos 0 cur pos jjmovestringliteraldfa0 0 if jjmatched kind 0x7fffffff if jjmatched pos 1 cur pos input stream backup cur pos jjmatched pos 1 if jjto token jjmatched kind 6 1l jjmatched kind 077 0l matched token jj fill token matched token special token special token return matched token else if jjto special jjmatched kind 6 1l jjmatched kind 077 0l matched token jj fill token if special token null special token matched token else matched token special token special token special token special token next matched token continue eof loop int error line input stream get end line int error column input stream get end column string error after null boolean eof seen false try input stream read char input stream backup 1 catch java io io exception e1 eof seen true error after cur pos 1 input stream get image if cur char n cur char r error line error column 0 else error column if eof seen input stream backup 1 error after cur pos 1 input stream get image throw new token mgr error eof seen cur lex state error line error column error after cur char token mgr error lexical error getnexttoken specialtoken matchedtoken curpos eofloop curchar input_stream begintoken ioexception jjmatchedkind matchedtoken jjfilltoken matchedtoken specialtoken specialtoken matchedtoken jjmatchedkind jjmatchedpos curpos jjmovestringliteraldfa0_0 jjmatchedkind jjmatchedpos curpos input_stream curpos jjmatchedpos jjtotoken jjmatchedkind jjmatchedkind matchedtoken jjfilltoken matchedtoken specialtoken specialtoken matchedtoken jjtospecial jjmatchedkind jjmatchedkind matchedtoken jjfilltoken specialtoken specialtoken matchedtoken matchedtoken specialtoken specialtoken specialtoken specialtoken matchedtoken eofloop error_line input_stream getendline error_column input_stream getendcolumn error_after eofseen input_stream readchar input_stream ioexception eofseen error_after curpos input_stream getimage curchar curchar error_line error_column error_column eofseen input_stream error_after curpos input_stream getimage tokenmgrerror eofseen curlexstate error_line error_column error_after curchar tokenmgrerror lexical_error create position method public synchronized position create position int offset pos bottom half bh new pos bottom half offset pos bottom half existing pos bottom half positions get bh if existing null positions put bh bh existing bh return new pos top half existing createposition createposition posbottomhalf posbottomhalf posbottomhalf posbottomhalf postophalf content inserted method public synchronized void content inserted int offset int length if positions size 0 return get all positions from offset to the end inclusive iterator iter positions tail map new pos bottom half offset key set iterator iteration true while iter has next pos bottom half bh pos bottom half iter next bh offset length iteration false contentinserted contentinserted tailmap posbottomhalf keyset hasnext posbottomhalf posbottomhalf content removed method public synchronized void content removed int offset int length if positions size 0 return get all positions from offset to the end inclusive iterator iter positions tail map new pos bottom half offset key set iterator iteration true while iter has next pos bottom half bh pos bottom half iter next if bh offset offset length bh offset offset else bh offset length iteration false contentremoved contentremoved tailmap posbottomhalf keyset hasnext posbottomhalf posbottomhalf pos top half constructor pos top half pos bottom half bh this bh bh bh ref postophalf postophalf posbottomhalf get offset method public int get offset return bh offset getoffset getoffset finalize method protected void finalize synchronized position manager this bh unref positionmanager pos bottom half constructor pos bottom half int offset this offset offset posbottomhalf posbottomhalf ref method void ref ref unref method void unref if ref 0 positions remove this equals method public boolean equals object o if o instanceof pos bottom half return false return pos bottom half o offset offset posbottomhalf posbottomhalf compare to method public int compare to object o if iteration log log log error this consistency failure return offset pos bottom half o offset compareto compareto posbottomhalf constructor public macos menu super macosmenu update every time method public boolean update every time return true updateeverytime updateeverytime update method public void update j menu menu file buff new file j edit get active view get buffer get path j menu item show current new j menu item j edit get property macos plugin menu show current show current add action listener new show file action buff get path show current set enabled buff exists j menu item show current dir new j menu item j edit get property macos plugin menu show current dir show current dir add action listener new show dir action buff get parent show current set enabled buff get parent file exists menu add show current menu add show current dir menu add separator menu add new show buffer menu menu add new show recent menu menu add new show recent dir menu jmenu jedit getactiveview getbuffer getpath jmenuitem showcurrent jmenuitem jedit getproperty macosplugin showcurrent showcurrent addactionlistener showfileaction getpath showcurrent setenabled jmenuitem showcurrentdir jmenuitem jedit getproperty macosplugin showcurrentdir showcurrentdir addactionlistener showdiraction getparent showcurrent setenabled getparentfile showcurrent showcurrentdir addseparator showbuffermenu showrecentmenu showrecentdirmenu private string path public show file action string path this path path showfileaction public void action performed action event e macos actions show in finder path actionperformed actionevent macosactions showinfinder private string path public show dir action string path this path path showdiraction public void action performed action event e macos actions show in finder path actionperformed actionevent macosactions showinfinder re search matcher constructor creates a new regular expression string matcher since j edit 4 2pre4 public re search matcher string search boolean ignore case throws re exception re new re search ignore case re reg icase 0 re reg multiline re syntax jedit return value new match researchmatcher jedit researchmatcher ignorecase reexception ignorecase reg_icase reg_multiline re_syntax_jedit returnvalue next match method returns the offset of the first match of the specified text within this matcher param text the text to search in param start true if the start of the segment is the beginning of the buffer param end true if the end of the segment is the end of the buffer param first time if false and the search string matched at the start offset with length zero automatically find next match param reverse if true searching will be performed in a backward direction return an array where the first element is the start offset of the match and the second element is the end offset of the match since j edit 4 2pre4 public search matcher match next match char indexed text boolean start boolean end boolean first time boolean reverse int flags 0 unless we are matching from the start of the buffer should not match on the beginning of the substring if start flags re reg notbol unless we are matching to the end of the buffer should not match on the end of the substring if end flags re reg noteol re match match re get match text 0 flags if match null return null return value substitutions new string re get num subs 1 for int i 0 i return value substitutions length i return value substitutions i match to string i int start match get start index int end match get end index some regexps eg by itself have a length 0 so we implement this hack if you don t understand what s going on here then go back to watching mtv if first time start 0 end 0 text move 1 if text char at 0 char indexed out of bounds never mind return null match re get match text 0 flags re reg notbol if match null return null else start match get start index 1 end match get end index 1 return value start start return value end end return return value nextmatch firsttime jedit searchmatcher nextmatch charindexed firsttime reg_notbol reg_noteol rematch getmatch returnvalue getnumsubs returnvalue returnvalue tostring _start getstartindex _end getendindex firsttime _start _end charat charindexed out_of_bounds getmatch reg_notbol _start getstartindex _end getendindex returnvalue _start returnvalue _end returnvalue error list cell renderer constructor error list cell renderer fucking gtk look and feel plain font new j label get font ui manager get font label font bold font new font plain font get name font bold plain font get size plainfm get font metrics plain font boldfm get font metrics bold font set border new empty border 2 2 2 2 errorlistcellrenderer errorlistcellrenderer plainfont jlabel getfont uimanager getfont boldfont plainfont getname plainfont getsize getfontmetrics plainfont getfontmetrics boldfont setborder emptyborder get list cell renderer component method public component get list cell renderer component j list list object value int index boolean is selected boolean cell has focus error list dialog error entry entry error list dialog error entry value this path entry path this messages entry messages return this getlistcellrenderercomponent getlistcellrenderercomponent jlist isselected cellhasfocus errorlistdialog errorentry errorlistdialog errorentry get preferred size method public dimension get preferred size int width boldfm string width path int height boldfm get height for int i 0 i messages length i width math max plainfm string width messages i width height plainfm get height insets insets get border get border insets this width insets left insets right height insets top insets bottom return new dimension width height getpreferredsize getpreferredsize stringwidth getheight stringwidth getheight getborder getborderinsets paint component method public void paint component graphics g insets insets get border get border insets this g set font bold font g draw string path insets left insets top boldfm get ascent int y insets top boldfm get height 2 g set font plain font for int i 0 i messages length i g draw string messages i insets left y plainfm get ascent y plainfm get height paintcomponent paintcomponent getborder getborderinsets setfont boldfont drawstring getascent getheight setfont plainfont drawstring getascent getheight paint screen line range method paints a range of screen lines the default implementation calls link paint valid line graphics2d int int int int int and link paint invalid line graphics2d int int param gfx a graphics context param first line the first screen line param last line the last screen line param physical lines the list of physical line numbers entries are 1 if the screen line is out of range param start an array of screen line start offsets param end an array of screen line end offsets param y the y co ordinate param line height the line height since j edit 4 2pre2 public void paint screen line range graphics2d gfx int first line int last line int physical lines int start int end int y int line height for int i 0 i physical lines length i int screen line i first line if physical lines i 1 paint invalid line gfx screen line y else paint valid line gfx screen line physical lines i start i end i y y line height paintscreenlinerange paintvalidline paintinvalidline firstline lastline physicallines lineheight jedit paintscreenlinerange firstline lastline physicallines lineheight physicallines screenline firstline physicallines paintinvalidline screenline paintvalidline screenline physicallines lineheight paint valid line method called by the text area when the extension is to paint a screen line which has an associated physical line number in the buffer note that since one physical line may consist of several screen lines due to soft wrap the start and end offsets of the screen line are passed in as well param gfx the graphics context param screen line the screen line number param physical line the physical line number param start the offset where the screen line begins from the start of the buffer param end the offset where the screen line ends from the start of the buffer param y the y co ordinate of the top of the line s bounding box since j edit 4 0pre4 public void paint valid line graphics2d gfx int screen line paintvalidline screenline physicalline jedit paintvalidline screenline paint invalid line method called by the text area when the extension is to paint a screen line which is not part of the buffer this can happen if the buffer is shorter than the height of the text area for example param gfx the graphics context param screen line the screen line number param y the y co ordinate of the top of the line s bounding box since j edit 4 0pre4 public void paint invalid line graphics2d gfx int screen line paintinvalidline screenline jedit paintinvalidline screenline get tool tip text method called by the text area when the mouse hovers over the location specified in the mouse event param x the x co ordinate param y the y co ordinate since j edit 4 0pre4 public string get tool tip text int x int y return null gettooltiptext jedit gettooltiptext invocation handler invocation handler new handler x this name space namespace interpreter declaring interp super namespace declaring interp invocationhandler invocationhandler xthis namespace declaringinterp declaringinterp public string to string return this reference x this to bsh object namespace tostring xthis get dynamic proxy for interface caching those it creates public object get interface class clas return get interface new class clas getinterface getinterface get dynamic proxy for interface caching those it creates public object get interface class ca if interfaces null interfaces new hashtable make a hash of the interface hashcodes in order to cache them int hash 21 for int i 0 i ca length i hash ca i hash code 3 object hash key new integer hash object interf interfaces get hash key if interf null class loader class loader ca 0 get class loader interf proxy new proxy instance class loader ca invocation handler interfaces put hash key interf return interf getinterface hashcode hashkey hashkey classloader classloader getclassloader newproxyinstance classloader invocationhandler hashkey public object invoke object proxy method method object args throws throwable try return invoke impl proxy method args catch target error te unwrap target exception if the interface declares that it throws the ex it will be delivered if not it will be wrapped in an undeclared throwable throw te get target catch eval error ee ease debugging x this this refers to the enclosing class instance if interpreter debug interpreter debug eval error in scripted interface x this this to string ee throw ee invokeimpl targeterror undeclaredthrowable gettarget evalerror xthis evalerror xthis tostring public object invoke impl object proxy method method object args throws eval error string method name method get name call stack callstack new call stack namespace if equals is not explicitly defined we must override the default implemented by the this object protocol for scripted object to support x this equals must test for equality with the generated proxy object not the scripted bsh this object otherwise callers from outside in java will not see a the proxy object as equal to itself bsh method equals method null try equals method namespace get method equals new class object class catch util eval error e leave null if method name equals equals equals method null object obj args 0 return new boolean proxy obj if to string is not explicitly defined override the default to show the proxy interfaces bsh method to string method null try to string method namespace get method to string new class catch util eval error e leave null if method name equals to string to string method null class ints proxy get class get interfaces x this this refers to the enclosing class instance string buffer sb new string buffer x this this to string nimplements for int i 0 i ints length i sb append ints i get name ints length 1 return sb to string class param types method get parameter types return primitive unwrap invoke method method name primitive wrap args param types invokeimpl evalerror methodname getname callstack callstack xthis bshmethod equalsmethod equalsmethod getmethod utilevalerror methodname equalsmethod tostring bshmethod tostringmethod tostringmethod getmethod tostring utilevalerror methodname tostring tostringmethod getclass getinterfaces xthis stringbuffer stringbuffer xthis tostring getname tostring paramtypes getparametertypes invokemethod methodname paramtypes private int anchor char indexed char array char str int index s str anchor index charindexedchararray public char char at int index int pos anchor index return pos s length pos 0 s pos out of bounds charat out_of_bounds public boolean is valid return anchor s length isvalid public boolean move int index return anchor index s length accept method public boolean accept string path return ffilter accept new file path create macro method public macros macro create macro string macro name string path if macro name to lower case ends with scpt macro name macro name substring 0 macro name length 5 else if macro name to lower case ends with applescript macro name macro name substring 0 macro name length 12 return new macros macro this macro name macros macro macro name to label macro name path createmacro createmacro macroname macroname tolowercase endswith macroname macroname macroname macroname tolowercase endswith macroname macroname macroname macroname macronametolabel macroname run macro method public void run macro view view macros macro macro macos actions run script macro get path runmacro runmacro macosactions runscript getpath run macro method public void run macro view view macros macro macro boolean own namespace run macro view macro runmacro runmacro ownnamespace runmacro handler constructor public apple script handler super applescript ffilter new script filter applescripthandler scriptfilter public plugin resurl connection url url throws io exception super url string file url get file int index file index of 0 if index 1 plugin null resource file else int start if file char at 0 start 1 else start 0 plugin file substring start index resource file substring index 1 if plugin null resource starts with resource resource substring 1 pluginresurlconnection ioexception getfile indexof charat startswith public void connect throws io exception if connected if plugin null in j edit class get resource as stream resource else pluginjar plugins j edit get pluginja rs for int i 0 i plugins length i pluginjar jar plugins i if misc utilities get file name jar get path equals ignore case plugin in jar get class loader get resource as stream resource break if in null throw new io exception resource not found resource connected true ioexception jedit getresourceasstream jedit getpluginjars miscutilities getfilename getpath equalsignorecase getclassloader getresourceasstream ioexception public input stream get input stream throws io exception connect return in inputstream getinputstream ioexception public string get header field string name if name equals content type string lc resource resource to lower case if lc resource ends with html return text html else if lc resource ends with txt return text plain else if lc resource ends with rtf return text rtf else if lc resource ends with gif return image gif else if lc resource ends with jpg lc resource ends with jpeg return image jpeg else return null else return null getheaderfield lcresource tolowercase lcresource endswith lcresource endswith lcresource endswith lcresource endswith lcresource endswith lcresource endswith protected int sub index protected re token int sub index this sub index sub index subindex retoken subindex subindex subindex int get minimum length return 0 getminimumlength void set uncle re token an uncle uncle an uncle setuncle retoken anuncle anuncle returns true if the match succeeded false if it failed abstract boolean match char indexed input re match mymatch charindexed rematch returns true if the rest of the tokens match false if they fail protected boolean next char indexed input re match mymatch if next null if uncle null return true else return uncle match input mymatch else return next match input mymatch charindexed rematch boolean chain re token token next token return true token was accepted retoken abstract void dump string buffer os stringbuffer abstract void dump string buffer os void dump all string buffer os dump os if next null next dump all os stringbuffer dumpall stringbuffer dumpall get print job method private static printer job get print job job printer job get printer job int orientation j edit get integer property print orientation page format portrait double width j edit get double property print width 0 double height j edit get double property print height 0 double x j edit get double property print x 0 double y j edit get double property print y 0 double pagewidth j edit get double property print pagewidth 0 double pageheight j edit get double property print pageheight 0 format job default page format set orientation page format portrait if width 0 height 0 paper pap format get paper pap set imageable area x y width height pap set size pagewidth pageheight format set paper pap format set orientation orientation return job getprintjob printerjob getprintjob printerjob getprinterjob jedit getintegerproperty pageformat jedit getdoubleproperty jedit getdoubleproperty jedit getdoubleproperty jedit getdoubleproperty jedit getdoubleproperty jedit getdoubleproperty defaultpage setorientation pageformat getpaper setimageablearea setsize setpaper setorientation page setup method public static void page setup view view job get print job page format new format job page dialog format if new format null format new format j edit set integer property print orientation format get orientation paper paper format get paper j edit set double property print width paper get imageable width j edit set double property print height paper get imageable height j edit set double property print x paper get imageablex j edit set double property print y paper get imageabley j edit set double property print pagewidth paper get width j edit set double property print pageheight paper get height pagesetup pagesetup getprintjob pageformat newformat pagedialog newformat newformat jedit setintegerproperty getorientation getpaper jedit setdoubleproperty getimageablewidth jedit setdoubleproperty getimageableheight jedit setdoubleproperty getimageablex jedit setdoubleproperty getimageabley jedit setdoubleproperty getwidth jedit setdoubleproperty getheight print method public static void print final view view final buffer buffer boolean selection job get print job job set job name buffer get path boolean header j edit get boolean property print header boolean footer j edit get boolean property print footer boolean line numbers j edit get boolean property print line numbers boolean color j edit get boolean property print color font font j edit get font property print font buffer printable printable new buffer printable job null view buffer font header footer line numbers color job set printable printable format if job print dialog return printable print getprintjob setjobname getpath jedit getbooleanproperty jedit getbooleanproperty linenumbers jedit getbooleanproperty linenumbers jedit getbooleanproperty jedit getfontproperty bufferprintable bufferprintable linenumbers setprintable printdialog get page format method public static page format get page format return format getpageformat pageformat getpageformat get display manager method static display manager get display manager buffer buffer j edit text area text area list l list buffer map get buffer display manager dmgr if l null l new linked list buffer map put buffer l iterator liter l iterator while liter has next dmgr display manager liter next if dmgr in use dmgr text area text area dmgr in use true return dmgr if we got here no unused display manager in list dmgr new display manager buffer text area dmgr in use true l add dmgr return dmgr getdisplaymanager displaymanager getdisplaymanager jedittextarea textarea buffermap displaymanager linkedlist buffermap hasnext displaymanager inuse textarea textarea inuse displaymanager textarea inuse release display manager method static void release display manager display manager dmgr dmgr in use false releasedisplaymanager releasedisplaymanager displaymanager inuse buffer closed method public static void buffer closed buffer buffer buffer map remove buffer bufferclosed bufferclosed buffermap text area disposed method static void text area disposed j edit text area text area iterator biter buffer map values iterator while biter has next list l list biter next iterator liter l iterator while liter has next display manager dmgr display manager liter next if dmgr text area text area dmgr dispose liter remove textareadisposed textareadisposed jedittextarea textarea buffermap hasnext hasnext displaymanager displaymanager textarea textarea is line visible method returns if the specified line is visible param line a physical line index since j edit 4 2pre1 public final boolean is line visible int line return fvmget line 2 0 islinevisible jedit islinevisible get first visible line method returns the physical line number of the first visible line since j edit 4 2pre1 public int get first visible line return fvm 0 getfirstvisibleline jedit getfirstvisibleline get last visible line method returns the physical line number of the last visible line since j edit 4 2pre1 public int get last visible line return fvm fvmcount 1 1 getlastvisibleline jedit getlastvisibleline get next visible line method returns the next visible line after the specified line index param line a physical line index since j edit 4 0pre1 public int get next visible line int line if line 0 line buffer get line count throw new array index out of bounds exception line int index fvmget line in collapsed range if index 2 0 beyond last visible line if fvmcount index 1 return 1 start of next expanded range else return fvm index 1 last in expanded range else if line fvm index 1 1 equal to last visible line if fvmcount index 2 return 1 start of next expanded range else return fvm index 2 next in expanded range else return line 1 getnextvisibleline jedit getnextvisibleline getlinecount arrayindexoutofboundsexception get prev visible line method returns the previous visible line before the specified line index param line a physical line index since j edit 4 0pre1 public int get prev visible line int line if line 0 line buffer get line count throw new array index out of bounds exception line int index fvmget line before first visible line if index 1 return 1 in collapsed range else if index 2 1 end of prev expanded range return fvm index 1 first in expanded range else if line fvm index equal to first visible line if index 0 return 1 end of prev expanded range else return fvm index 1 1 prev in expanded range else return line 1 getprevvisibleline jedit getprevvisibleline getlinecount arrayindexoutofboundsexception get screen line count method public final int get screen line count int line if line mgr is screen line count valid line return line mgr get screen line count line else int new count text area chunk cache get line subregion count line set screen line count line new count return new count getscreenlinecount getscreenlinecount linemgr isscreenlinecountvalid linemgr getscreenlinecount newcount textarea chunkcache getlinesubregioncount setscreenlinecount newcount newcount get scroll line count method public final int get scroll line count return scroll line count scroll line getscrolllinecount getscrolllinecount scrolllinecount scrollline collapse fold method collapses the fold at the specified physical line index param line a physical line index since j edit 4 2pre1 public void collapse fold int line int line count buffer get line count int start 0 int end line count 1 if the caret is on a collapsed fold collapse the parent fold if line 0 line buffer get line count 1 buffer is fold start line is line visible line 1 line int initial fold level buffer get fold level line find fold start and end if line line count 1 buffer get fold level line 1 initial fold level this line is the start of a fold start line 1 for int i line 1 i line count i if buffer get fold level i initial fold level end i 1 break else boolean ok false scan backwards looking for the start for int i line 1 i 0 i if buffer get fold level i initial fold level start i 1 ok true break if ok no folds in buffer return for int i line 1 i line count i if buffer get fold level i initial fold level end i 1 break collapse the fold hide line range start end notifyscreenlinechanges text area fold structure changed collapsefold jedit collapsefold linecount getlinecount linecount getlinecount isfoldstart islinevisible initialfoldlevel getfoldlevel linecount getfoldlevel initialfoldlevel linecount getfoldlevel initialfoldlevel getfoldlevel initialfoldlevel linecount getfoldlevel initialfoldlevel hidelinerange _notifyscreenlinechanges textarea foldstructurechanged expand fold method expands the fold at the specified physical line index param line a physical line index param fully if true all subfolds will also be expanded since j edit 4 2pre1 public int expand fold int line boolean fully the first sub fold used by j edit text area expand fold int return value 1 int line count buffer get line count int start 0 int end line count 1 int initial fold level buffer get fold level line find fold start and fold end if line line count 1 is line visible line is line visible line 1 buffer get fold level line 1 initial fold level this line is the start of a fold int index fvmget line 1 if index 1 expand all folds return 1 start fvm index if index fvmcount 1 end fvm index 1 1 else start line 1 for int i line 1 i line count i if is line visible i buffer get fold level i initial fold level end i 1 break else int index fvmget line if index 1 expand all folds return 1 start fvm index if index fvmcount 1 end fvm index 1 1 else for int i line 1 i line count i xxx if is line visible i buffer get fold level i initial fold level i get last visible line end i 1 break expand the fold if fully show line range start end else we need a different value of initial fold level here initial fold level buffer get fold level start int first visible start for int i start i end i if buffer get fold level i initial fold level if return value 1 i 0 buffer is fold start i 1 return value i 1 if first visible i show line range first visible i 1 first visible i 1 if first visible end 1 show line range first visible end if is line visible line this is a hack and really needs to be done better expand fold line false return return value notifyscreenlinechanges text area fold structure changed return return value expandfold jedit expandfold jedittextarea expandfold returnvalue linecount getlinecount linecount initialfoldlevel getfoldlevel linecount islinevisible islinevisible getfoldlevel initialfoldlevel expandallfolds linecount islinevisible getfoldlevel initialfoldlevel expandallfolds linecount islinevisible getfoldlevel initialfoldlevel getlastvisibleline showlinerange initialfoldlevel initialfoldlevel getfoldlevel firstvisible getfoldlevel initialfoldlevel returnvalue isfoldstart returnvalue firstvisible showlinerange firstvisible firstvisible firstvisible showlinerange firstvisible islinevisible expandfold returnvalue _notifyscreenlinechanges textarea foldstructurechanged returnvalue expand all folds method expands all folds since j edit 4 2pre1 public void expand all folds show line range 0 buffer get line count 1 notifyscreenlinechanges text area fold structure changed expandallfolds jedit expandallfolds showlinerange getlinecount _notifyscreenlinechanges textarea foldstructurechanged expand folds method this method should only be called from code actions xml code since j edit 4 2pre1 public void expand folds char digit if digit 1 digit 9 toolkit get default toolkit beep return else expand folds int digit 1 1 expandfolds jedit expandfolds getdefaulttoolkit expandfolds expand folds method expands all folds with the specified fold level param fold level the fold level since j edit 4 2pre1 public void expand folds int fold level if buffer get fold handler instanceof indent fold handler fold level fold level 1 buffer get indent size 1 show line range 0 buffer get line count 1 this ensures that the first line is always visible boolean seen visible line false int first invisible 0 for int i 0 i buffer get line count i if seen visible line buffer get fold level i fold level if first invisible i hide line range first invisible i 1 first invisible i 1 seen visible line true if first invisible buffer get line count hide line range first invisible buffer get line count 1 notifyscreenlinechanges text area fold structure changed expandfolds foldlevel jedit expandfolds foldlevel getfoldhandler indentfoldhandler foldlevel foldlevel getindentsize showlinerange getlinecount seenvisibleline firstinvisible getlinecount seenvisibleline getfoldlevel foldlevel firstinvisible hidelinerange firstinvisible firstinvisible seenvisibleline firstinvisible getlinecount hidelinerange firstinvisible getlinecount _notifyscreenlinechanges textarea foldstructurechanged narrow method narrows the visible portion of the buffer to the specified line range param start the first line param end the last line since j edit 4 2pre1 public void narrow int start int end if start end start 0 end buffer get line count throw new array index out of bounds exception start end if start get first visible line end get last visible line expand all folds if start 0 hide line range 0 start 1 if end buffer get line count 1 hide line range end 1 buffer get line count 1 if we narrowed to a single collapsed fold if start buffer get line count 1 is line visible start 1 expand fold start false hack need a more direct way of obtaining a view j edit text area get view method gui utilities get view text area get status set message and clear j edit get property view status narrow notifyscreenlinechanges text area fold structure changed jedit getlinecount arrayindexoutofboundsexception getfirstvisibleline getlastvisibleline expandallfolds hidelinerange getlinecount hidelinerange getlinecount getlinecount islinevisible expandfold jedittextarea getview guiutilities getview textarea getstatus setmessageandclear jedit getproperty _notifyscreenlinechanges textarea foldstructurechanged init method void init if initialized initialized true fvm new int 2 if buffer is loaded buffer change handler fold handler changed buffer else fvmreset notifyscreenlinechanges else update wrap settings if buffer is loaded notifyscreenlinechanges text area update scroll bars text area recalculate last physical line isloaded bufferchangehandler foldhandlerchanged _notifyscreenlinechanges updatewrapsettings isloaded _notifyscreenlinechanges textarea updatescrollbars textarea recalculatelastphysicalline set screen line count method sets the number of screen lines that the specified physical line is split into since j edit 4 2pre1 void set screen line count int line int count int old count line mgr get screen line count line still have to call this even if it equals the old one so that the offset manager sets the validity flag line mgr set screen line count line count this notifies each display manager editing this buffer of the screen line count change if count old count iterator iter list buffer map get buffer iterator while iter has next display manager iter next setscreenlinecount line old count count setscreenlinecount jedit setscreenlinecount oldcount linemgr getscreenlinecount linemgr setscreenlinecount oldcount buffermap hasnext displaymanager _setscreenlinecount oldcount update wrap settings method void update wrap settings string wrap buffer get string property wrap soft wrap wrap equals soft if text area max line len 0 soft wrap false wrap margin 0 else stupidity char foo new char text area max line len for int i 0 i foo length i foo i text area painter painter text area get painter wrap margin int painter get font get string bounds foo 0 foo length painter get font render context get width updatewrapsettings updatewrapsettings getstringproperty softwrap textarea maxlinelen softwrap wrapmargin textarea maxlinelen textareapainter textarea getpainter wrapmargin getfont getstringbounds getfontrendercontext getwidth notifyscreenlinechanges method void notifyscreenlinechanges if debug scroll debug log log log debug this notifyscreenlinechanges when the text area switches to us it will do a reset anyway if text area get display manager this try if first line call reset first line reset else if first line call changed first line changed if scroll line count call reset scroll line count reset else if scroll line count call changed scroll line count changed finally first line call reset first line call changed false scroll line count call reset scroll line count call changed false _notifyscreenlinechanges _notifyscreenlinechanges scroll_debug _notifyscreenlinechanges textarea getdisplaymanager firstline callreset firstline firstline callchanged firstline scrolllinecount callreset scrolllinecount scrolllinecount callchanged scrolllinecount firstline callreset firstline callchanged scrolllinecount callreset scrolllinecount callchanged display manager constructor private display manager buffer buffer j edit text area text area this buffer buffer this line mgr buffer getlinemanager this text area text area scroll line count new scroll line count first line new first line buffer change handler new buffer change handler this listener priority thing is a bad hack buffer add buffer change listener buffer change handler buffer high priority displaymanager displaymanager jedittextarea textarea linemgr _getlinemanager textarea textarea scrolllinecount scrolllinecount firstline firstline bufferchangehandler bufferchangehandler addbufferchangelistener bufferchangehandler high_priority dispose method private void dispose buffer remove buffer change listener buffer change handler removebufferchangelistener bufferchangehandler fvmreset method private void fvmreset lastfvmget 1 fvmcount 2 fvm 0 0 fvm 1 buffer get line count getlinecount fvmget method returns the fold visibility map index for the given line private int fvmget int line scan count if line fvm 0 return 1 if line fvm fvmcount 1 return fvmcount 1 if lastfvmget 1 if line fvm lastfvmget if lastfvmget fvmcount 1 line fvm lastfvmget 1 return lastfvmget int start 0 int end fvmcount 1 loop for scanned lines switch end start case 0 lastfvmget start break loop case 1 int value fvm end if value line lastfvmget end else lastfvmget start break loop default int pivot end start 2 value fvm pivot if value line lastfvmget pivot break loop else if value line start pivot else end pivot 1 break return lastfvmget scancount scannedlines fvmput method replaces from code start code to code end 1 code inclusive with code put code update code fvmcount code private void fvmput int start int end int put if debug fold vis debug string buffer buf new string buffer if put null for int i 0 i put length i if i 0 buf append buf append put i buf append log log log debug this fvmput start end buf int putl put null 0 put length int delta putl end start if fvmcount delta fvm length int newfvm new int fvm length 2 1 system arraycopy fvm 0 newfvm 0 fvmcount fvm newfvm if delta 0 system arraycopy fvm end fvm start putl fvmcount end if putl 0 system arraycopy put 0 fvm start put length fvmcount delta fvmdump if fvmcount 0 throw new internal error fold_vis_debug stringbuffer stringbuffer internalerror fvmput2 method merge previous and next entry if necessary private void fvmput2 int starti int endi int start int end if debug fold vis debug log log log debug this fvmput2 starti endi start end if starti 1 fvm starti start if endi fvmcount 2 fvm endi 1 end 1 fvmput starti endi 2 null else fvmput starti endi 1 new int end 1 else if endi fvmcount 1 fvm endi 1 end 1 fvmput starti 1 endi 2 new int start else fvmput starti 1 endi 1 new int start end 1 fold_vis_debug fvmdump method private void fvmdump if debug fold vis debug string buffer buf new string buffer for int i 0 i fvmcount i if i 0 buf append buf append fvm i buf append log log log debug this fvm buf fold_vis_debug stringbuffer stringbuffer show line range method private void show line range int start int end if debug fold vis debug log log log debug this show line range start end for int i start i end i xxx if is line visible i important not line mgr get screen line count int screen lines get screen line count i if first line physical line i first line scroll line screen lines first line call changed true scroll line count scroll line screen lines scroll line count call changed true update fold visibility map int starti fvmget start int endi fvmget end if starti 2 0 if endi 2 0 fvmput starti 1 endi 1 null else if endi fvmcount 1 fvm endi 1 end 1 fvmput starti 1 endi 2 null else fvmput starti 1 endi null fvm starti 1 end 1 else if endi 2 0 if starti 1 fvm starti start fvmput starti endi 1 null else fvmput starti 1 endi null fvm starti 1 start else fvmput2 starti endi start end lastfvmget 1 showlinerange showlinerange fold_vis_debug showlinerange islinevisible linemgr getscreenlinecount screenlines getscreenlinecount firstline physicalline firstline scrollline screenlines firstline callchanged scrolllinecount scrollline screenlines scrolllinecount callchanged hide line range method private void hide line range int start int end if debug fold vis debug log log log debug this hide line range start end int i start if is line visible i i get next visible line i while i 1 i end int screen lines line mgr get screen line count i if i first line physical line first line scroll line screen lines first line skew 0 first line call changed true scroll line count scroll line screen lines scroll line count call changed true i get next visible line i update fold visibility map int starti fvmget start int endi fvmget end if starti 2 0 if endi 2 0 fvmput2 starti endi start end else if start fvm 0 fvmput starti endi 1 null else fvmput starti 1 endi null fvm starti 1 start else if endi 2 0 if end 1 fvm fvmcount 1 fvmput starti 1 endi 2 null else fvmput starti 1 endi null fvm starti 1 end 1 else fvmput starti 1 endi 1 null lastfvmget 1 if is line visible first line physical line int first visible get first visible line if first line physical line first visible first line physical line first visible first line scroll line 0 else first line physical line get prev visible line first line physical line first line scroll line line mgr get screen line count first line physical line first line call changed true hidelinerange hidelinerange fold_vis_debug hidelinerange islinevisible getnextvisibleline screenlines linemgr getscreenlinecount firstline physicalline firstline scrollline screenlines firstline firstline callchanged scrolllinecount scrollline screenlines scrolllinecount callchanged getnextvisibleline islinevisible firstline physicalline firstvisible getfirstvisibleline firstline physicalline firstvisible firstline physicalline firstvisible firstline scrollline firstline physicalline getprevvisibleline firstline physicalline firstline scrollline linemgr getscreenlinecount firstline physicalline firstline callchanged setscreenlinecount method private void setscreenlinecount int line int old count int count if is line visible line return if first line physical line line if first line physical line line first line call changed true else first line scroll line count old count first line call changed true scroll line count scroll line count old count scroll line count call changed true _setscreenlinecount _setscreenlinecount oldcount islinevisible firstline physicalline firstline physicalline firstline callchanged firstline scrollline oldcount firstline callchanged scrolllinecount scrollline oldcount scrolllinecount callchanged boolean call reset abstract void reset callreset abstract void reset abstract void changed public string to string return get class get name physical line scroll line tostring getclass getname physicalline scrollline changed method public void changed if debug scroll debug log log log debug this changed text area update scroll bars text area recalculate last physical line scroll_debug textarea updatescrollbars textarea recalculatelastphysicalline reset method public void reset if debug scroll debug log log log debug this reset physical line get first visible line scroll line 0 while physical line 1 scroll line get screen line count physical line physical line get next visible line physical line physical line buffer get line count first line ensure physical line is visible text area recalculate last physical line text area update scroll bars scroll_debug physicalline getfirstvisibleline scrollline physicalline scrollline getscreenlinecount physicalline physicalline getnextvisibleline physicalline physicalline getlinecount firstline ensurephysicallineisvisible textarea recalculatelastphysicalline textarea updatescrollbars changed method public void changed debug code if debug scroll debug log log log debug this changed before physical line scroll line ensure physical line is visible int screen lines get screen line count physical line if skew screen lines skew screen lines 1 debug code if debug scroll verify system err println scroll verify int verify scroll line 0 for int i 0 i buffer get line count i if is line visible i continue if i physical line break verify scroll line get screen line count i if verify scroll line scroll line exception ex new exception scroll line verify scroll line log log log error this ex new org gjt sp jedit gui bean shell error dialog null ex if debug scroll debug log log log debug this changed after physical line scroll line if scroll line count call changed scroll line count call reset text area update scroll bars text area recalculate last physical line else scroll line count changed does the same thing scroll_debug physicalline scrollline ensurephysicallineisvisible screenlines getscreenlinecount physicalline screenlines screenlines scroll_verify scroll_verify verifyscrollline getlinecount islinevisible physicalline verifyscrollline getscreenlinecount verifyscrollline scrollline scrollline verifyscrollline beanshellerrordialog scroll_debug physicalline scrollline scrolllinecount callchanged scrolllinecount callreset textarea updatescrollbars textarea recalculatelastphysicalline scrolllinecount reset method public void reset if debug scroll debug log log log debug this reset string wrap buffer get string property wrap soft wrap wrap equals soft if text area max line len 0 soft wrap false wrap margin 0 else stupidity char foo new char text area max line len for int i 0 i foo length i foo i text area painter painter text area get painter wrap margin int painter get font get string bounds foo 0 foo length painter get font render context get width scroll line 0 int i get first visible line for if i physical line break scroll line get screen line count i int next line get next visible line i if next line 1 break else i next line physical line i int screen lines get screen line count physical line if skew screen lines skew screen lines 1 text area update scroll bars scroll_debug getstringproperty softwrap textarea maxlinelen softwrap wrapmargin textarea maxlinelen textareapainter textarea getpainter wrapmargin getfont getstringbounds getfontrendercontext getwidth scrollline getfirstvisibleline physicalline scrollline getscreenlinecount nextline getnextvisibleline nextline nextline physicalline screenlines getscreenlinecount physicalline screenlines screenlines textarea updatescrollbars scroll down by physical line amount void phys down int amount int screen amount if debug scroll debug log log log debug this phys down start physical line scroll line skew 0 if is line visible physical line int last visible line get last visible line if physical line last visible line physical line last visible line else int next physical line get next visible line physical line amount next physical line physical line scroll line get screen line count physical line physical line next physical line for int next physical line get next visible line physical line if next physical line 1 break else if next physical line physical line amount break else scroll line get screen line count physical line amount next physical line physical line physical line next physical line if debug scroll debug log log log debug this phys down end physical line scroll line call changed true j edit text area scroll to needs this to simplify its code if screen amount 0 scroll up screen amount else if screen amount 0 scroll down screen amount physdown screenamount scroll_debug physdown physicalline scrollline islinevisible physicalline lastvisibleline getlastvisibleline physicalline lastvisibleline physicalline lastvisibleline nextphysicalline getnextvisibleline physicalline nextphysicalline physicalline scrollline getscreenlinecount physicalline physicalline nextphysicalline nextphysicalline getnextvisibleline physicalline nextphysicalline nextphysicalline physicalline scrollline getscreenlinecount physicalline nextphysicalline physicalline physicalline nextphysicalline scroll_debug physdown physicalline scrollline callchanged jedittextarea scrollto screenamount scrollup screenamount screenamount scrolldown screenamount scroll up by physical line amount void phys up int amount int screen amount if debug scroll debug log log log debug this phys up start physical line scroll line skew 0 if is line visible physical line int first visible line get first visible line if physical line first visible line physical line first visible line else int prev physical line get prev visible line physical line amount physical line prev physical line for int prev physical line get prev visible line physical line if prev physical line 1 break else if prev physical line physical line amount break else amount physical line prev physical line physical line prev physical line scroll line get screen line count prev physical line if debug scroll debug log log log debug this phys up end physical line scroll line call changed true j edit text area scroll to needs this to simplify its code if screen amount 0 scroll up screen amount else if screen amount 0 scroll down screen amount physup screenamount scroll_debug physup physicalline scrollline islinevisible physicalline firstvisibleline getfirstvisibleline physicalline firstvisibleline physicalline firstvisibleline prevphysicalline getprevvisibleline physicalline physicalline prevphysicalline prevphysicalline getprevvisibleline physicalline prevphysicalline prevphysicalline physicalline physicalline prevphysicalline physicalline prevphysicalline scrollline getscreenlinecount prevphysicalline scroll_debug physup physicalline scrollline callchanged jedittextarea scrollto screenamount scrollup screenamount screenamount scrolldown screenamount scroll down by screen line amount void scroll down int amount if debug scroll debug log log log debug this scroll down ensure physical line is visible amount skew skew 0 while amount 0 int screen lines get screen line count physical line if amount screen lines skew amount break else int next line get next visible line physical line if next line 1 break boolean visible is line visible physical line physical line next line if visible amount screen lines scroll line screen lines call changed true scrolldown scroll_debug scrolldown ensurephysicallineisvisible screenlines getscreenlinecount physicalline screenlines nextline getnextvisibleline physicalline nextline islinevisible physicalline physicalline nextline screenlines scrollline screenlines callchanged scroll up by screen line amount void scroll up int amount if debug scroll debug log log log debug this scroll up ensure physical line is visible if amount skew skew amount else amount skew skew 0 while amount 0 int prev line get prev visible line physical line if prev line 1 break physical line prev line int screen lines get screen line count physical line scroll line screen lines if amount screen lines skew screen lines amount break else amount screen lines call changed true scrollup scroll_debug scrollup ensurephysicallineisvisible prevline getprevvisibleline physicalline prevline physicalline prevline screenlines getscreenlinecount physicalline scrollline screenlines screenlines screenlines screenlines callchanged ensure physical line is visible method private void ensure physical line is visible if is line visible physical line if physical line get last visible line physical line get last visible line scroll line get scroll line count 1 else if physical line get first visible line physical line get first visible line scroll line 0 else physical line get next visible line physical line scroll line get screen line count physical line ensurephysicallineisvisible ensurephysicallineisvisible islinevisible physicalline physicalline getlastvisibleline physicalline getlastvisibleline scrollline getscrolllinecount physicalline getfirstvisibleline physicalline getfirstvisibleline scrollline physicalline getnextvisibleline physicalline scrollline getscreenlinecount physicalline fold handler changed method public void fold handler changed buffer buffer fvmreset first line call reset true scroll line count call reset true int collapse folds buffer get integer property collapse folds 0 if collapse folds 0 expand folds collapse folds notifyscreenlinechanges foldhandlerchanged foldhandlerchanged firstline callreset scrolllinecount callreset collapsefolds getintegerproperty collapsefolds collapsefolds expandfolds collapsefolds _notifyscreenlinechanges fold level changed method public void fold level changed buffer buffer int start int end system err println fold level changed start 1 to text area get last physical line end if text area get display manager display manager this end 0 buffer is loaded text area invalidate line range start 1 text area get last physical line foldlevelchanged foldlevelchanged foldlevelchanged textarea getlastphysicalline textarea getdisplaymanager displaymanager isloaded textarea invalidatelinerange textarea getlastphysicalline content inserted method public void content inserted buffer buffer int start line int offset int num lines int length if buffer is loaded fvmreset return int end line start line num lines if num lines 0 delayed multiline update true this is a sloppy hack to fix bug 677902 hitting return after collapsed fold the idea is that if we extend the range then the problem described in the bug happends so if the insert is at the very end of the range we don t extend it instead we push the insert into the next range however for this to work properly we also have to mess with screen line counts int index fvmget start line int start index 1 if start 1 fvmcount fvm start start line 1 if index 2 0 system err println case 1 scroll line count scroll line get screen line count start line 1 start for int i start i fvmcount i fvm i num lines lastfvmget 1 fvmdump if text area get display manager display manager this if num lines 0 content inserted first line start line num lines content inserted scroll line count start line num lines if delayed update end start line delayed update end num lines delayed update start line end line resize selections if necessary for int i 0 i text area selection size i selection s selection text area selection element at i if s content inserted buffer start line offset num lines length delayed update s start line s end line int caret text area get caret position if caret offset int scroll mode caret auto scroll j edit text area electric scroll j edit text area no scroll text area move caret position caret length scroll mode else int scroll mode caret auto scroll j edit text area normal scroll j edit text area no scroll text area move caret position caret scroll mode else first line call reset true scroll line count call reset true contentinserted contentinserted startline numlines isloaded endline startline numlines numlines delayedmultilineupdate startline startline scrolllinecount scrollline getscreenlinecount startline numlines textarea getdisplaymanager displaymanager numlines contentinserted firstline startline numlines contentinserted scrolllinecount startline numlines delayedupdateend startline delayedupdateend numlines delayedupdate startline endline textarea textarea elementat contentinserted startline numlines delayedupdate startline endline textarea getcaretposition scrollmode caretautoscroll jedittextarea electric_scroll jedittextarea no_scroll textarea movecaretposition scrollmode scrollmode caretautoscroll jedittextarea normal_scroll jedittextarea no_scroll textarea movecaretposition scrollmode firstline callreset scrolllinecount callreset pre content removed method public void pre content removed buffer buffer int start line int offset int num lines int length if buffer is loaded return if text area get display manager display manager this if num lines 0 pre content removed first line start line num lines pre content removed scroll line count start line num lines if delayed update end start line delayed update end num lines delayed update start line start line else first line call reset true scroll line count call reset true if num lines 0 return delayed multiline update true int end line start line num lines update fold visibility map int starti fvmget start line int endi fvmget end line both have same visibility just remove anything in between if math abs starti 2 math abs endi 2 if endi starti fvmcount we re removing from before the first visible to after the last visible fvmreset first line call reset true scroll line count call reset true starti 1 else fvmput starti 1 endi 1 null starti collapse 2 else if starti 1 fvm starti start line if endi starti fvmcount 1 we re removing from the first visible to after the last visible fvmreset first line call reset true scroll line count call reset true starti 1 else fvmput starti endi 1 null shift else fvmput starti 1 endi null fvm starti 1 start line starti 2 update for int i starti i fvmcount i fvm i num lines if first line physical line get last visible line first line physical line get first visible line will be handled later see comments at the end of transaction complete very subtle if we leave this for ensure physical line is visible an extra line will be added to the scroll line count else if is line visible first line physical line first line physical line get next visible line first line physical line lastfvmget 1 fvmdump precontentremoved precontentremoved startline numlines isloaded textarea getdisplaymanager displaymanager numlines precontentremoved firstline startline numlines precontentremoved scrolllinecount startline numlines delayedupdateend startline delayedupdateend numlines delayedupdate startline startline firstline callreset scrolllinecount callreset numlines delayedmultilineupdate endline startline numlines startline endline firstline callreset scrolllinecount callreset startline firstline callreset scrolllinecount callreset startline numlines firstline physicalline getlastvisibleline firstline physicalline getfirstvisibleline transactioncomplete ensurephysicallineisvisible islinevisible firstline physicalline firstline physicalline getnextvisibleline firstline physicalline content removed method public void content removed buffer buffer int start line int start int num lines int length if buffer is loaded return if text area get display manager display manager this resize selections if necessary for int i 0 i text area selection size i selection s selection text area selection element at i if s content removed buffer start line start num lines length delayed update s start line s end line if s start s end text area selection remove element at i i int caret text area get caret position if caret start length int scroll mode caret auto scroll j edit text area electric scroll j edit text area no scroll text area move caret position caret length scroll mode else if caret start int scroll mode caret auto scroll j edit text area electric scroll j edit text area no scroll text area move caret position start scroll mode else int scroll mode caret auto scroll j edit text area normal scroll j edit text area no scroll text area move caret position caret scroll mode contentremoved contentremoved startline numlines isloaded textarea getdisplaymanager displaymanager textarea textarea elementat contentremoved startline numlines delayedupdate startline endline textarea removeelementat textarea getcaretposition scrollmode caretautoscroll jedittextarea electric_scroll jedittextarea no_scroll textarea movecaretposition scrollmode scrollmode caretautoscroll jedittextarea electric_scroll jedittextarea no_scroll textarea movecaretposition scrollmode scrollmode caretautoscroll jedittextarea normal_scroll jedittextarea no_scroll textarea movecaretposition scrollmode transaction complete method public void transaction complete buffer buffer if text area get display manager display manager this delayed update false return if delayed update do delayed update text area finishcaretupdate delayed update false debug code if debug scroll verify int scroll line count 0 int line delayed update start if is line visible line line get next visible line line system err println delayed update start delayed update end text area get line count while line 1 line delayed update end scroll line count get screen line count line line get next visible line line if scroll line count get scroll line count throw new internal error scroll line count get scroll line count transactioncomplete transactioncomplete textarea getdisplaymanager displaymanager delayedupdate delayedupdate dodelayedupdate textarea _finishcaretupdate delayedupdate scroll_verify scrolllinecount delayedupdatestart islinevisible getnextvisibleline delayedupdatestart delayedupdateend textarea getlinecount delayedupdateend scrolllinecount getscreenlinecount getnextvisibleline scrolllinecount getscrolllinecount internalerror scrolllinecount getscrolllinecount do delayed update method private void do delayed update must update screen line counts before we call notifyscreenlinechanges since that calls update scroll bars which needs valid info int firstline text area get first physical line int lastline text area get last physical line int line delayed update start if is line visible line line get next visible line line while line 1 line delayed update end if line firstline line lastline get screen line count line line get next visible line line must be before the below call so that the chunk cache is not updated with an invisible first line see above notifyscreenlinechanges if delayed multiline update text area invalidate screen line range text area chunk cache get screen line of offset delayed update start 0 text area get visible lines delayed multiline update false else text area invalidate line range delayed update start delayed update end update visible lines int visible lines text area get visible lines if visible lines 0 text area chunk cache get line info visible lines 1 force the fold levels to be updated when painting the last line of a buffer buffer is fold start doesn t call get fold level hence the fold level changed event might not be sent for the previous line buffer get fold level delayed update end dodelayedupdate dodelayedupdate _notifyscreenlinechanges updatescrollbars _firstline textarea getfirstphysicalline _lastline textarea getlastphysicalline delayedupdatestart islinevisible getnextvisibleline delayedupdateend _firstline _lastline getscreenlinecount getnextvisibleline _notifyscreenlinechanges delayedmultilineupdate textarea invalidatescreenlinerange textarea chunkcache getscreenlineofoffset delayedupdatestart textarea getvisiblelines delayedmultilineupdate textarea invalidatelinerange delayedupdatestart delayedupdateend visiblelines textarea getvisiblelines visiblelines textarea chunkcache getlineinfo visiblelines isfoldstart getfoldlevel foldlevelchanged getfoldlevel delayedupdateend content inserted method private void content inserted anchor anchor int start line int num lines if anchor physical line start line if anchor physical line start line anchor physical line num lines anchor call changed true contentinserted contentinserted startline numlines physicalline startline physicalline startline physicalline numlines callchanged pre content removed method private void pre content removed anchor anchor int start line int num lines if anchor physical line start line if anchor physical line start line anchor call changed true else int end math min start line num lines anchor physical line for int i start line i end i xxx if is line visible i anchor scroll line line mgr get screen line count i anchor physical line end start line anchor call changed true precontentremoved precontentremoved startline numlines physicalline startline physicalline startline callchanged startline numlines physicalline startline islinevisible scrollline linemgr getscreenlinecount physicalline startline callchanged delayed update method private void delayed update int start line int end line text area chunk cache invalidate chunks from phys start line if delayed update delayed update start start line delayed update end end line delayed update true else delayed update start math min delayed update start start line delayed update end math max delayed update end end line delayedupdate delayedupdate startline endline textarea chunkcache invalidatechunksfromphys startline delayedupdate delayedupdatestart startline delayedupdateend endline delayedupdate delayedupdatestart delayedupdatestart startline delayedupdateend delayedupdateend endline caret auto scroll method return if change in buffer should scroll this text area private boolean caret auto scroll view view text area get view return view j edit get active view view get text area text area caretautoscroll caretautoscroll textarea getview jedit getactiveview gettextarea textarea re token word boundary int sub index int where boolean negated super sub index this where where this negated negated retokenwordboundary subindex subindex boolean match char indexed input re match mymatch word boundary means input index 1 was a word character and input index is not or input index is a word character and input index 1 was not in the string one two three these positions match o n e t w o t h r e e boolean after false is current character a letter or digit boolean before false is previous character a letter or digit char ch todo also check reg anchorindex vs anchor if mymatch eflags re reg anchorindex re reg anchorindex mymatch offset mymatch index mymatch anchor if ch input char at mymatch index 1 char indexed out of bounds before character is letter or digit ch ch if ch input char at mymatch index char indexed out of bounds after character is letter or digit ch ch if before and after we re at end if after and before we re at beginning boolean do next false if where begin begin do next after before if where end end do next before after if negated do next do next return do next next input mymatch false charindexed rematch reg_anchorindex reg_anchorindex reg_anchorindex charat charindexed out_of_bounds isletterordigit _ charat charindexed out_of_bounds isletterordigit _ donext donext donext donext donext donext void dump string buffer os if where begin end os append negated b b else if where begin os append else os append stringbuffer dynamic menu changed constructor creates a new dynamic menu changed message param name the menu name all dynamic menus with this name will be recreated next time they are displayed public dynamic menu changed string name super null this name name dynamicmenuchanged dynamicmenuchanged get menu name method returns the name of the menu in question public string get menu name return name getmenuname getmenuname param string method public string param string return menu name super param string paramstring paramstring paramstring interface quick notepad actions void choose file quicknotepadactions choosefile void choose file void save file choosefile savefile void choose file void save file void copy to buffer choosefile savefile copytobuffer visits the header of the class param access the class s access flags see link constants this parameter also indicates if the class is deprecated param name the internal name of the class see link type get internal name get internal name param super name the internal of name of the super class see link type get internal name get internal name for interfaces the super class is link object may be tt null tt but only for the link object java lang object class param interfaces the internal names of the class s interfaces see link type get internal name get internal name may be tt null tt param source file the name of the source file from which this class was compiled may be tt null tt void visit int access string name string super name string interfaces getinternalname getinternalname supername getinternalname getinternalname getinternalname getinternalname sourcefile supername visits information about an inner class this inner class is not necessarily a member of the class being visited param name the internal name of an inner class see link type get internal name get internal name param outer name the internal name of the class to which the inner class belongs see link type get internal name get internal name may be tt null tt param inner name the simple name of the inner class inside its enclosing class may be tt null tt for anonymous inner classes param access the access flags of the inner class as originally declared in the enclosing class void visit inner class string name string outer name string inner name getinternalname getinternalname outername getinternalname getinternalname innername visitinnerclass outername innername visits a field of the class param access the field s access flags see link constants this parameter also indicates if the field is synthetic and or deprecated param name the field s name param desc the field s descriptor see link type type param value the field s initial value this parameter which may be tt null tt if the field does not have an initial value must be an link java lang integer integer a link java lang float float a link java lang long long a link java lang double double or a link string string visits a method of the class this method i must i return a new link code visitor code visitor instance or tt null tt each time it is called i e it should not return a previously returned visitor param access the method s access flags see link constants this parameter also indicates if the method is synthetic and or deprecated param name the method s name param desc the method s descriptor see link type type param exceptions the internal names of the method s exception classes see link type get internal name get internal name may be tt null tt return an object to visit the byte code of the method or tt null tt if this class visitor is not interested in visiting the code of this method code visitor visit method int access string name string desc codevisitor codevisitor getinternalname getinternalname codevisitor visitmethod visits the end of the class this method which is the last one to be called is used to inform the visitor that all the fields and methods of the class have been visited visits a zero operand instruction param opcode the opcode of the instruction to be visited this opcode is either nop aconst null iconst m1 iconst 0 iconst 1 iconst 2 iconst 3 iconst 4 iconst 5 lconst 0 lconst 1 fconst 0 fconst 1 fconst 2 dconst 0 dconst 1 iaload laload faload daload aaload baload caload saload iastore lastore fastore dastore aastore bastore castore sastore pop pop2 dup dup x1 dup x2 dup2 dup2 x1 dup2 x2 swap iadd ladd fadd dadd isub lsub fsub dsub imul lmul fmul dmul idiv ldiv fdiv ddiv irem lrem frem drem ineg lneg fneg dneg ishl lshl ishr lshr iushr lushr iand land ior lor ixor lxor i2l i2f i2d l2i l2f l2d f2i f2l f2d d2i d2l d2f i2b i2c i2s lcmp fcmpl fcmpg dcmpl dcmpg ireturn lreturn freturn dreturn areturn return arraylength athrow monitorenter or monitorexit aconst_null iconst_m1 iconst_0 iconst_1 iconst_2 iconst_3 iconst_4 iconst_5 lconst_0 lconst_1 fconst_0 fconst_1 fconst_2 dconst_0 dconst_1 dup_x1 dup_x2 dup2_x1 dup2_x2 visits an instruction with a single int operand param opcode the opcode of the instruction to be visited this opcode is either bipush sipush or newarray param operand the operand of the instruction to be visited visits a local variable instruction a local variable instruction is an instruction that loads or stores the value of a local variable param opcode the opcode of the local variable instruction to be visited this opcode is either iload lload fload dload aload istore lstore fstore dstore astore or ret param var the operand of the instruction to be visited this operand is the index of a local variable visits a type instruction a type instruction is an instruction that takes a type descriptor as parameter param opcode the opcode of the type instruction to be visited this opcode is either new anewarray checkcast or instanceof param desc the operand of the instruction to be visited this operand is must be a fully qualified class name in internal form or the type descriptor of an array type see link type type visits a field instruction a field instruction is an instruction that loads or stores the value of a field of an object param opcode the opcode of the type instruction to be visited this opcode is either getstatic putstatic getfield or putfield param owner the internal name of the field s owner class see link type get internal name get internal name param name the field s name param desc the field s descriptor see link type type getinternalname getinternalname visits a method instruction a method instruction is an instruction that invokes a method param opcode the opcode of the type instruction to be visited this opcode is either invokevirtual invokespecial invokestatic or invokeinterface param owner the internal name of the method s owner class see link type get internal name get internal name param name the method s name param desc the method s descriptor see link type type getinternalname getinternalname visits a jump instruction a jump instruction is an instruction that may jump to another instruction param opcode the opcode of the type instruction to be visited this opcode is either ifeq ifne iflt ifge ifgt ifle if icmpeq if icmpne if icmplt if icmpge if icmpgt if icmple if acmpeq if acmpne goto jsr ifnull or ifnonnull param label the operand of the instruction to be visited this operand is a label that designates the instruction to which the jump instruction may jump if_icmpeq if_icmpne if_icmplt if_icmpge if_icmpgt if_icmple if_acmpeq if_acmpne visits a label a label designates the instruction that will be visited just after it param label a link label label object visits a ldc instruction param cst the constant to be loaded on the stack this parameter must be a non null link java lang integer integer a link java lang float float a link java lang long long a link java lang double double or a link string string visits an iinc instruction param var index of the local variable to be incremented param increment amount to increment the local variable by visits a tableswitch instruction param min the minimum key value param max the maximum key value param dflt beginning of the default handler block param labels beginnings of the handler blocks tt labels i tt is the beginning of the handler block for the tt min i tt key visits a lookupswitch instruction param dflt beginning of the default handler block param keys the values of the keys param labels beginnings of the handler blocks tt labels i tt is the beginning of the handler block for the tt keys i tt key visits a multianewarray instruction param desc an array type descriptor see link type type param dims number of dimensions of the array to allocate visits a try catch block param start beginning of the exception handler s scope inclusive param end end of the exception handler s scope exclusive param handler beginning of the exception handler s code param type internal name of the type of exceptions handled by the handler or tt null tt to catch any exceptions for finally blocks throws illegal argument exception if one of the labels has not already been visited by this visitor by the link visit label visit label method illegalargumentexception visitlabel visitlabel visits the maximum stack size and the maximum number of local variables of the method param max stack maximum stack size of the method param max locals maximum number of local variables for the method maxstack maxlocals visits a local variable declaration param name the name of a local variable param desc the type descriptor of this local variable param start the first instruction corresponding to the scope of this local variable inclusive param end the last instruction corresponding to the scope of this local variable exclusive param index the local variable s index throws illegal argument exception if one of the labels has not already been visited by this visitor by the link visit label visit label method void visit local variable string name string desc label start label end illegalargumentexception visitlabel visitlabel visitlocalvariable visits a line number declaration param line a line number this number refers to the source file from which the class was compiled param start the first instruction corresponding to this line number throws illegal argument exception if tt start tt has not already been visited by this visitor by the link visit label visit label method illegalargumentexception visitlabel visitlabel status message changed operation started operation ends void status update work thread pool thread pool int thread index statusupdate workthreadpool threadpool threadindex progress bar value change void progress update work thread pool thread pool int thread index progressupdate workthreadpool threadpool threadindex public interface scroll listener extends java util event listener void scrolled vertically j edit text area text area scrolllistener eventlistener scrolledvertically jedittextarea textarea void scrolled vertically j edit text area text area void scrolled horizontally j edit text area text area scrolledvertically jedittextarea textarea scrolledhorizontally jedittextarea textarea get match method returns the element matching the one at the given text area s caret position or null since j edit 4 2pre3 getmatch jedit select match method selects from the caret to the matching structure element if there is one otherwise the behavior of this method is undefined since j edit 4 2pre3 selectmatch jedit public match get match j edit text area text area int offset text area get caret position text area get line start offset text area get caret line if offset 0 int bracket offset text utilities find matching bracket text area get buffer text area get caret line offset 1 if bracket offset 1 int bracket line text area get line of offset bracket offset return new match this bracket line bracket offset bracket line bracket offset 1 return null getmatch jedittextarea textarea textarea getcaretposition textarea getlinestartoffset textarea getcaretline bracketoffset textutilities findmatchingbracket textarea getbuffer textarea getcaretline bracketoffset bracketline textarea getlineofoffset bracketoffset bracketline bracketoffset bracketline bracketoffset public void select match j edit text area text area text area select to matching bracket selectmatch jedittextarea textarea textarea selecttomatchingbracket public int end public match public match public match structure matcher matcher this matcher matcher structurematcher public match structure matcher matcher int start line int start int end line int end this matcher this start line start line this start start this end line end line this end end structurematcher startline endline startline startline endline endline static class highlight extends text area extension highlight j edit text area text area this text area text area textareaextension jedittextarea textarea textarea textarea public void paint valid line graphics2d gfx int screen line int physical line int start int end int y if text area get painter is structure highlight enabled return match match text area get structure match if match null paint highlight gfx screen line start end y match paintvalidline screenline physicalline textarea getpainter isstructurehighlightenabled textarea getstructurematch painthighlight screenline private int get offsets int screen line match match int x1 x2 int match start line text area get screen line of offset match start int match end line text area get screen line of offset match end if match start line screen line x1 match start else x1 text area get screen line start offset screen line if match end line screen line x2 match end else x2 text area get screen line end offset screen line 1 return new int text area offset toxy x1 x text area offset toxy x2 x getoffsets screenline matchstartline textarea getscreenlineofoffset matchendline textarea getscreenlineofoffset matchstartline screenline textarea getscreenlinestartoffset screenline matchendline screenline textarea getscreenlineendoffset screenline textarea offsettoxy textarea offsettoxy private void paint highlight graphics gfx int screen line int start int end int y match match if text area is structure highlight visible return if match start end match end start return int match start line text area get screen line of offset match start int match end line text area get screen line of offset match end font metrics fm text area get painter get font metrics int height fm get height int offsets get offsets screen line match int x1 offsets 0 int x2 offsets 1 gfx set color text area get painter get structure highlight color gfx draw line x1 y x1 y height 1 gfx draw line x2 y x2 y height 1 if match start line screen line screen line 0 gfx draw line x1 y x2 y else offsets get offsets screen line 1 match int prevx1 offsets 0 int prevx2 offsets 1 gfx draw line math min x1 prevx1 y math max x1 prevx1 y gfx draw line math min x2 prevx2 y math max x2 prevx2 y if match end line screen line gfx draw line x1 y height 1 x2 y height 1 painthighlight screenline textarea isstructurehighlightvisible matchstartline textarea getscreenlineofoffset matchendline textarea getscreenlineofoffset fontmetrics textarea getpainter getfontmetrics getheight getoffsets screenline setcolor textarea getpainter getstructurehighlightcolor drawline drawline matchstartline screenline screenline drawline getoffsets screenline drawline drawline matchendline screenline drawline called by the token marker when a syntax token has been parsed param seg the segment containing the text param id the token type one of the constants in the link token class param offset the start offset of the token param length the number of characters in the token param context the line context since j edit 4 2pre3 public void handle token segment seg byte id int offset int length jedit handletoken the token handler can compare this object with the object previously given for this line to see if the token type at the end of the line has changed meaning subsequent lines might need to be retokenized since j edit 4 2pre6 jedit returns the first file to search param view the view performing the search returns the next file to search param view the view performing the search param path the last file searched returns all path names in this file set param view the view performing the search string get files view view returns the number of files in this file set int get file count view view getfiles getfilecount int get file count view view returns the bean shell code that will recreate this file set string get code getfilecount beanshell getcode returns true if the menu should be updated each time it is shown otherwise it will only be updated when the menu is first created and if the menu receives a link org gjt sp jedit msg dynamic menu changed message dynamicmenuchanged adds the menu items to the given menu param menu the menu public interface dockable window container void register dockable window manager entry entry dockablewindowcontainer dockablewindowmanager void register dockable window manager entry entry void remove dockable window manager entry entry dockablewindowmanager dockablewindowmanager void register dockable window manager entry entry void remove dockable window manager entry entry void unregister dockable window manager entry entry dockablewindowmanager dockablewindowmanager dockablewindowmanager void remove dockable window manager entry entry void unregister dockable window manager entry entry void show dockable window manager entry entry dockablewindowmanager dockablewindowmanager dockablewindowmanager void unregister dockable window manager entry entry void show dockable window manager entry entry boolean is visible dockable window manager entry entry dockablewindowmanager dockablewindowmanager isvisible dockablewindowmanager sets focus on the default component since j edit 4 2pre1 jedit fold level changed method called when line fold levels change param buffer the buffer in question param start line the start line number param end line the end line number since j edit 4 0pre1 foldlevelchanged startline endline jedit content inserted method called when text is inserted into the buffer param buffer the buffer in question param start line the first line param offset the start offset from the beginning of the buffer param num lines the number of lines inserted param length the number of characters inserted since j edit 4 0pre1 void content inserted buffer buffer int start line int offset contentinserted startline numlines jedit contentinserted startline content removed method called when text is removed from the buffer param buffer the buffer in question param start line the first line param offset the start offset from the beginning of the buffer param num lines the number of lines removed param length the number of characters removed since j edit 4 0pre1 void content removed buffer buffer int start line int offset contentremoved startline numlines jedit contentremoved startline pre content removed method called when text is about to be removed from the buffer but is still present param buffer the buffer in question param start line the first line param offset the start offset from the beginning of the buffer param num lines the number of lines to be removed param length the number of characters to be removed since j edit 4 2pre1 public void pre content removed buffer buffer int start line int offset precontentremoved startline numlines jedit precontentremoved startline transaction complete method called after an undo or compound edit has finished the text area uses this event to queue up and collapse cleanup operations so they are only run once during a long transaction such as a replace all operation param buffer the buffer in question since j edit 4 0pre6 transactioncomplete jedit fold handler changed method called to notify the text area that folds need to be collapsed if the collapse folds property is set this method is called after the buffer has been loaded and also if the user changes the fold handler param buffer the buffer in question since j edit 4 2pre2 foldhandlerchanged collapsefolds jedit the user has selected a set of files param browser the vfs browser param files the selected files the user has double clicked a set of files param browser the vfs browser param files the selected files handles a message sent on the edit bus this method must specify the type of responses the plugin will have for various subclasses of the link eb message class typically this is done with one or more code if code blocks that test whether the message is an instance of a derived message class in which the component has an interest for example pre if msg instanceof buffer update a buffer s state has changed else if msg instanceof view update a view s state has changed and so on pre param message the message editbus ebmessage bufferupdate viewupdate returns the internal name of this option pane the option pane s label is set to the value of the property named code options i name i label code see j edit get property string jedit getproperty string get name returns the component that should be displayed for this option pane component get component getname getcomponent component get component this method is called every time the option pane is displayed void init getcomponent called when the options dialog s ok button is clicked this should save any properties being edited in this option pane public interface progress public void set maximum int max setmaximum public void set maximum int max public void advance int value setmaximum public void advance int value public void done public void done public void error string message returns the character at the given offset past the current cursor position in the input the index of the current position is zero it is possible for this method to be called with a negative index this happens when using the operator in multiline matching mode or the b or word boundary operators in any case the lower bound is currently fixed at 2 for with a two character newline param index the offset position in the character field to examine return the character at the specified index or the out of bounds character defined by this interface out_of_bounds shifts the input buffer by a given number of positions returns true if the new cursor position is valid returns true if the most recent move operation placed the cursor position at a valid position in the input start the document p a elig lfred will call this method just before it attempts to read the first entity the root of the document it is guaranteed that this will be the first method called exception java lang exception the handler may throw any exception see end document public void start document aelig enddocument startdocument end the document p a elig lfred will call this method once when it has finished parsing the xml document it is guaranteed that this will be the last method called exception java lang exception the handler may throw any exception see start document public void end document aelig startdocument enddocument resolve an external entity p give the handler a chance to redirect external entities to different ur is a elig lfred will call this method for the top level document entity for external text xml entities and the external dtd subset if any param public id the public identifier or null if none was supplied param system id the system identifier return the replacement system identifier or null to use the default exception java lang exception the handler may throw any exception see start external entity see end external entity public object resolve entity string public id string system id uris aelig publicid systemid startexternalentity endexternalentity resolveentity publicid systemid begin an external entity p a elig lfred will call this method at the beginning of each external entity including the top level document entity and the external dtd subset if any p if necessary you can use this method to track the location of the current entity so that you can resolve relative ur is correctly param system id the uri of the external entity that is starting exception java lang exception the handler may throw any exception see end external entity see resolve entity public void start external entity string system id aelig uris systemid endexternalentity resolveentity startexternalentity systemid end an external entity p a elig lfred will call this method at the end of each external entity including the top level document entity and the external dtd subset p if necessary you can use this method to track the location of the current entity so that you can resolve relative ur is correctly param system id the uri of the external entity that is ending exception java lang exception the handler may throw any exception see start external entity see resolve entity public void end external entity string system id aelig uris systemid startexternalentity resolveentity endexternalentity systemid document type declaration p a elig lfred will call this method when or if it encounters the document type doctype declaration p please note that the public and system identifiers will not always be a reliable indication of the dtd in use param name the document type name param public id the public identifier or null if unspecified param system id the system identifier or null if unspecified exception java lang exception the handler may throw any exception public void doctype decl string name string public id string system id aelig publicid systemid doctypedecl publicid systemid attribute p a elig lfred will call this method once for each attribute specified or defaulted before reporting a start element event it is up to your handler to collect the attributes if necessary p you may use xml parser get attribute type to find the attribute s declared type param name the name of the attribute param type the type of the attribute see below param value the value of the attribute or null if the attribute is code implied code param is specified true if the value was specified false if it was defaulted from the dtd exception java lang exception the handler may throw any exception see start element see xml parser declared attributes see xml parser get attribute type see xml parser get attribute default value public void attribute string aname string value boolean is specified aelig startelement xmlparser getattributetype isspecified startelement xmlparser declaredattributes xmlparser getattributetype xmlparser getattributedefaultvalue isspecified start an element p a elig lfred will call this method at the beginning of each element by the time this is called all of the attributes for the element will already have been reported using the code attribute code method param elname the element type name exception java lang exception the handler may throw any exception see attribute see end element see xml parser declared elements see xml parser get element content type public void start element string elname aelig endelement xmlparser declaredelements xmlparser getelementcontenttype startelement end an element p a elig lfred will call this method at the end of each element including empty elements param elname the element type name exception java lang exception the handler may throw any exception see start element see xml parser declared elements see xml parser get element content type public void end element string elname aelig startelement xmlparser declaredelements xmlparser getelementcontenttype endelement character data p a elig lfred will call this method once for each chunk of character data found in the contents of elements note that the parser may break up a long sequence of characters into smaller chunks and call this method once for each chunk p do em not em attempt to read more than var length var characters from the array or to read before the var start var position param ch the character data param start the starting position in the array param length the number of characters available exception java lang exception the handler may throw any exception public void char data char ch int start int length aelig chardata ignorable whitespace p a elig lfred will call this method once for each sequence of ignorable whitespace in element content never in mixed content p for details see section 2 10 of the xml 1 0 recommendation p do em not em attempt to read more than var length var characters from the array or to read before the var start var position param ch the literal whitespace characters param start the starting position in the array param length the number of whitespace characters available exception java lang exception the handler may throw any exception public void ignorable whitespace char ch int start int length aelig ignorablewhitespace processing instruction p a elig lfred will call this method once for each processing instruction note that processing instructions may appear outside of the top level element the param target the target the name at the start of the pi param data the data if any the rest of the pi exception java lang exception the handler may throw any exception public void processing instruction string target string data aelig processinginstruction fatal xml parsing error p a elig lfred will call this method whenever it encounters a serious error the parser will attempt to continue past this point so that you can find more possible error points but if this method is called you should assume that the document is corrupt and you should not try to use its contents p note that you can use the code xml exception code class to encapsulate all of the information provided though the use of the class is not mandatory param message the error message param system id the system identifier of the entity that contains the error param line the approximate line number of the error param column the approximate column number of the error exception java lang exception the handler may throw any exception see xml exception public void error string message string system id int line int column aelig xmlexception systemid xmlexception systemid public interface name source public string get all names namesource getallnames public string get all names public void add name source listener name source listener listener getallnames addnamesourcelistener namesource public static interface listener public void name source changed name source src namesourcechanged namesource fetch the next object in the iteration return the next object returns true if and only if there are more objects available via the code next code method return the next object public interface console interface public reader get in consoleinterface getin public interface console interface public reader get in public print stream get out consoleinterface getin printstream getout public reader get in public print stream get out public print stream get err getin printstream getout printstream geterr public print stream get out public print stream get err public void println object o printstream getout printstream geterr public print stream get err public void println object o public void print object o printstream geterr public void println object o public void print object o public void error object o this method is called after the node has been made the current node it indicates that child nodes can now be added to it this method is called after all the child nodes have been added this pair of methods are used to inform the node of its parent public void jjt set parent node n public node jjt get parent jjtsetparent jjtgetparent this method tells the node to add its argument to the node s list of children this method returns a child node the children are numbered from zero left to right public node jjt get child int i return the number of children the node has public int jjt get num children jjtgetchild jjtgetnumchildren