Module jEdit

Class EditPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, BufferSetListener

public class EditPane extends JPanel implements BufferSetListener
A panel containing a text area.

In a BeanShell script, you can obtain the current edit pane from the editPane variable.

Each View can have multiple editPanes, one is active at a time. Each EditPane has a single JEditTextArea, and is operating on single buffer. The EditPane also can switch buffers. This is the "controller" between a JEditTextArea (view) and a buffer (model). This class does not have a public constructor. Edit panes can be created and destroyed using methods in the View class.

Version:
$Id: EditPane.java 25334 2020-05-10 09:51:15Z kpouer $
Author:
Slava Pestov
See Also:
  • Method Details

    • getView

      public View getView()
      Returns the view containing this edit pane.
      Returns:
      the view that contains this EditPane
      Since:
      jEdit 2.5pre2
    • get

      public static EditPane get(TextArea ta)
      Returns the EditPane of a TextArea.
      Parameters:
      ta - the textArea
      Returns:
      the EditPane containing the TextArea.
    • getBuffer

      public Buffer getBuffer()
      Returns the current buffer.
      Returns:
      the current buffer
      Since:
      jEdit 2.5pre2
    • setBuffer

      public void setBuffer(@Nonnull Buffer buffer)
      Sets the current buffer.
      Parameters:
      buffer - The buffer to edit.
      Since:
      jEdit 2.5pre2
    • setBuffer

      public void setBuffer(@Nonnull Buffer buffer, boolean requestFocus)
      Sets the current buffer.
      Parameters:
      buffer - The buffer to edit.
      requestFocus - true if the textarea should request focus, false otherwise
      Since:
      jEdit 4.3pre6
    • prevBuffer

      public void prevBuffer()
      Selects the previous buffer.
      Since:
      jEdit 2.7pre2
    • nextBuffer

      public void nextBuffer()
      Selects the next buffer.
      Since:
      jEdit 2.7pre2
    • recentBuffer

      public void recentBuffer()
      Selects the most recently edited buffer.
      Since:
      jEdit 2.7pre2
    • focusOnTextArea

      public void focusOnTextArea()
      Sets the focus onto the text area.
      Since:
      jEdit 2.5pre2
    • getTextArea

      public JEditTextArea getTextArea()
      Returns the view's text area.
      Returns:
      the text area of the edit pane
      Since:
      jEdit 2.5pre2
    • getBufferSwitcher

      public BufferSwitcher getBufferSwitcher()
      Returns the buffer switcher combo box instance.
      Returns:
      the buffer switcher (it can be null)
      Since:
      jEdit 4.1pre8
    • focusBufferSwitcher

      public void focusBufferSwitcher()
      Pops up and focuses on the buffer switcher combo box.
      Since:
      jEdit 4.3pre18 (previously known as showBufferSwitcher)
    • saveCaretInfo

      public void saveCaretInfo()
      Saves the caret information to the current buffer.
      Since:
      jEdit 2.5pre2
    • loadCaretInfo

      public void loadCaretInfo()
      Loads the caret and selection information from this EditPane, fall back to the information from the current buffer if none is already in this EditPane.
      Since:
      jEdit 2.5pre2
    • goToNextMarker

      public void goToNextMarker(boolean select)
      Moves the caret to the next marker.
      Parameters:
      select - whether to select the marker
      Since:
      jEdit 4.3pre3
    • goToPrevMarker

      public void goToPrevMarker(boolean select)
      Moves the caret to the previous marker.
      Parameters:
      select - whether to select the marker
      Since:
      jEdit 2.7pre2
    • goToMarker

      public void goToMarker(char shortcut, boolean select)
      Moves the caret to the marker with the specified shortcut.
      Parameters:
      shortcut - The shortcut
      select - True if the selection should be extended, false otherwise
      Since:
      jEdit 3.2pre2
    • addMarker

      public void addMarker()
      Adds a marker at the caret position.
      Since:
      jEdit 3.2pre1
    • swapMarkerAndCaret

      public void swapMarkerAndCaret(char shortcut)
      Moves the caret to the marker with the specified shortcut, then sets the marker position to the former caret position.
      Parameters:
      shortcut - The shortcut
      Since:
      jEdit 3.2pre2
    • handlePropertiesChanged

      public void handlePropertiesChanged(PropertiesChanged msg)
    • getMinimumSize

      public final Dimension getMinimumSize()
      Returns 0,0 for split pane compatibility.
      Overrides:
      getMinimumSize in class JComponent
    • getBufferSet

      public BufferSet getBufferSet()
      Returns the current buffer set. This can be changed by setBufferSetScope().
      Returns:
      the buffer set which is currently used by this EditPane
      Since:
      jEdit 4.3pre17
    • bufferAdded

      public void bufferAdded(Buffer buffer, int index)
      A buffer was added in the bufferSet.
      Specified by:
      bufferAdded in interface BufferSetListener
      Parameters:
      buffer - the added buffer
      index - the position where it was added
      Since:
      jEdit 4.3pre15
    • bufferRemoved

      public void bufferRemoved(Buffer buffer, int index)
      A buffer was removed from the bufferSet.
      Specified by:
      bufferRemoved in interface BufferSetListener
      Parameters:
      buffer - the removed buffer
      index - the position where it was before being removed
      Since:
      jEdit 4.3pre15
    • bufferMoved

      public void bufferMoved(Buffer buffer, int oldIndex, int newIndex)
      A buffer was moved in the BufferSet.
      Specified by:
      bufferMoved in interface BufferSetListener
      Parameters:
      buffer - the moved buffer
      oldIndex - the position it was before
      newIndex - the new position
      Since:
      jEdit 4.3pre15
    • bufferSetSorted

      public void bufferSetSorted()
      The bufferSet was sorted
      Specified by:
      bufferSetSorted in interface BufferSetListener
      Since:
      jEdit 4.3pre16
    • toString

      public String toString()
      Overrides:
      toString in class Component
    • initPainter

      public static void initPainter(TextAreaPainter painter)
      Init the painter of a textarea.
      Parameters:
      painter - the painter of a textarea
      Since:
      jEdit 4.3pre12
    • handleBufferUpdate

      public void handleBufferUpdate(BufferUpdate msg)