The following variables are always available for use in BeanShell scripts:
buffer - a Buffer object represents the contents of an open text file. The variable buffer is predefined as the current, visible buffer being edited.
view - A View represents a top-level window, extending Java's JFrame class, that contains the various visible components of the program, including the text area, menu bar, toolbar, and any docked windows. The variable view is defined as the current, active View object.
This variable has the same value as calling:
jEdit.getActiveView() |
editPane - an EditPane object contains a text area and buffer switcher. A view can be split to display multiple buffers, each in its own edit pane. Among other things, the EditPane class contains methods for selecting the buffer to edit.
Most of the time your macros will manipulate the buffer or the textArea. Sometimes you will need to use view as a parameter in a method call. You will probably only need to use editPane if your macros work with split views.
This variable has the same value as calling:
view.getEditPane() |
textArea - a JEditTextArea is the visible component that displays the file being edited. It is derived from the JComponent class. The variable textArea represents the current JEditTextArea object, which in turn displays the current buffer.
This variable has the same value as calling:
editPane.getTextArea() |
scriptPath - set to the full path of the script currently being executed.
Note that these variables are set at the beginning of macro execution. If the macro switches views, buffers or edit panes, the variables will be out of date. In that case, you can use the method calls equivalent to the values of the variables.