The following variables are always available for use in BeanShell scripts:
buffer
-
a Buffer object represents the contents of the currently visible open text
file.
view
-
A View
represents the current top-level editor 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.
This variable has the same value as the return value of:
jEdit.getActiveView()
editPane
-
an EditPane object contains a text area and
buffer switcher. A view can be split to display edit panes. 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 the return value of:
view.getEditPane()
textArea
-
a JEditTextArea is the visible component that
displays the current buffer.
This variable has the same value as the return value of:
editPane.getTextArea()
wm
-
a DockableWindowManager is the visible component that
manages dockable windows in the current view. This class is discussed in detail in Part IV, “Writing Plugins”. This object is useful for writing macros that interface with, open, or close plugin windows.
This variable has the same value the return value of:
view.getDockableWindowManager()
scriptPath
- set to the full path
of the script currently being executed.
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 variable values will be out of date. In that case, you can use the equivalent method calls.