Module jEdit

Class JEditTextArea

All Implemented Interfaces:
AutoCompletableTextArea, ImageObserver, MenuContainer, Serializable, Accessible

public class JEditTextArea extends TextArea implements AutoCompletableTextArea
jEdit's text component.

Unlike most other text editors, the selection API permits selection and concurrent manipulation of multiple, non-contiguous regions of text. Methods in this class that deal with selecting text rely upon classes derived the Selection class.

Version:
$Id: JEditTextArea.java 25032 2020-03-25 23:17:29Z kpouer $
Author:
Slava Pestov, John Gellene (API documentation)
See Also:
  • Field Details

  • Constructor Details

    • JEditTextArea

      public JEditTextArea(View view)
      Creates a new JEditTextArea.
  • Method Details

    • dispose

      public void dispose()
      Description copied from class: TextArea
      Plugins and macros should not call this method.
      Overrides:
      dispose in class TextArea
    • getFoldPainter

      public FoldPainter getFoldPainter()
      Overrides:
      getFoldPainter in class TextArea
    • home

      public void home(boolean select)
      An override to record the acutual action taken for home().
      Overrides:
      home in class TextArea
      Parameters:
      select - true if we also want to select from the cursor
    • end

      public void end(boolean select)
      An override to record the acutual action taken for end().
      Overrides:
      end in class TextArea
      Parameters:
      select - true if we also want to select from the cursor
    • smartHome

      public void smartHome(boolean select)
      An override to record the acutual action taken for smartHome().
      Overrides:
      smartHome in class TextArea
      Parameters:
      select - true if you want to extend selection
    • smartEnd

      public void smartEnd(boolean select)
      An override to record the acutual action taken for smartHome().
      Overrides:
      smartEnd in class TextArea
      Parameters:
      select - true if you want to extend selection
    • goToBufferEnd

      public void goToBufferEnd(boolean select)
      Description copied from class: TextArea
      Moves the caret to the end of the buffer.
      Overrides:
      goToBufferEnd in class TextArea
      Parameters:
      select - true if you want to extend selection
    • goToMatchingBracket

      public void goToMatchingBracket()
      Moves the caret to the bracket matching the one before the caret. Also sends PositionChanging if it goes somewhere.
      Overrides:
      goToMatchingBracket in class TextArea
      Since:
      jEdit 4.3pre18
    • goToBufferStart

      public void goToBufferStart(boolean select)
      Description copied from class: TextArea
      Moves the caret to the beginning of the buffer.
      Overrides:
      goToBufferStart in class TextArea
      Parameters:
      select - true if you want to extend selection
    • replaceSelection0

      public int replaceSelection0(String selectedText)
      Description copied from class: TextArea
      Set the selection, but does not deactivate it, and does not move the caret. Please use TextArea.setSelectedText(String) instead.
      Overrides:
      replaceSelection0 in class TextArea
      Parameters:
      selectedText - The new selection
      Returns:
      The new caret position
    • showGoToLineDialog

      public void showGoToLineDialog()
      Displays the 'go to line' dialog box, and moves the caret to the specified line number, or moves the caret back or forward by the offset provided.
      Since:
      jEdit 2.7pre2
    • userInput

      public void userInput(char ch)
      Handles the insertion of the specified character. It performs the following operations in addition to TextArea#userInput(char):
      • Inserting a space with automatic abbrev expansion enabled will try to expand the abbrev
      Overrides:
      userInput in class TextArea
      Parameters:
      ch - The character
      Since:
      jEdit 2.7pre3
      See Also:
    • addExplicitFold

      public void addExplicitFold()
      Surrounds the selection with explicit fold markers.
      Overrides:
      addExplicitFold in class TextArea
      Since:
      jEdit 4.0pre3
    • formatParagraph

      public void formatParagraph()
      Formats the paragraph containing the caret.
      Overrides:
      formatParagraph in class TextArea
      Since:
      jEdit 2.7pre2
    • doWordCount

      protected static void doWordCount(View view, String text)
    • showWordCountDialog

      public void showWordCountDialog()
      Displays the 'word count' dialog box.
      Since:
      jEdit 2.7pre2
    • getView

      public View getView()
      Returns this text area's view.
      Since:
      jEdit 4.2pre5
    • getFoldPainterName

      public static String getFoldPainterName()
    • handlePopupTrigger

      public void handlePopupTrigger(MouseEvent evt)
      Do the same thing as right-clicking on the text area. The Gestures plugin uses this API.
      Overrides:
      handlePopupTrigger in class TextArea
      Since:
      jEdit 4.2pre13
    • createPopupMenu

      public void createPopupMenu(MouseEvent evt)
      Creates the popup menu.
      Overrides:
      createPopupMenu in class TextArea
      Since:
      4.3pre15
    • handlePropertiesChanged

      public void handlePropertiesChanged(PropertiesChanged msg)
    • getAlreadyEnteredText

      public String getAlreadyEnteredText(CompletionProvider provider)
      Description copied from interface: AutoCompletableTextArea
      Returns the text just before the current caret position that could be the start of something auto-completable.

      Specified by:
      getAlreadyEnteredText in interface AutoCompletableTextArea
    • findWordStart

      public static int findWordStart(CharSequence line, int pos, CompletionProvider p)
      Locates the start of the word at the specified position.
    • init

      public void init()
      Description copied from interface: AutoCompletableTextArea
      Initializes this completion provider.
      Specified by:
      init in interface AutoCompletableTextArea
    • getXYCaretPosition

      public Point getXYCaretPosition()
      Description copied from interface: AutoCompletableTextArea
      Get the XY position of the caret in pixels
      Specified by:
      getXYCaretPosition in interface AutoCompletableTextArea
    • getLineOfCaret

      public int getLineOfCaret()
      Description copied from interface: AutoCompletableTextArea
      Return the line of the caret.
      Specified by:
      getLineOfCaret in interface AutoCompletableTextArea
    • replaceSelection

      public void replaceSelection(String content)
      Description copied from interface: AutoCompletableTextArea
      Replace the current selection by the String content
      Specified by:
      replaceSelection in interface AutoCompletableTextArea
    • selectText

      public void selectText(int start, int end)
      Description copied from interface: AutoCompletableTextArea
      Select the text between the two position.
      Specified by:
      selectText in interface AutoCompletableTextArea
    • getHighlighter

      public Highlighter getHighlighter()
      Description copied from interface: AutoCompletableTextArea
      Return the Highlighter object of the text area
      Specified by:
      getHighlighter in interface AutoCompletableTextArea
    • getSelectionEnd

      public int getSelectionEnd()
      Description copied from interface: AutoCompletableTextArea
      Return the end offset of the current selection
      Specified by:
      getSelectionEnd in interface AutoCompletableTextArea
    • getSelectionStart

      public int getSelectionStart()
      Description copied from interface: AutoCompletableTextArea
      Return the start offset of the current selection
      Specified by:
      getSelectionStart in interface AutoCompletableTextArea
    • getDocumentLength

      public int getDocumentLength()
      Description copied from interface: AutoCompletableTextArea
      Return the buffer size of the text area
      Specified by:
      getDocumentLength in interface AutoCompletableTextArea
    • createPosition

      public Position createPosition(int length) throws BadLocationException
      Description copied from interface: AutoCompletableTextArea
      Create the position at the position lenght. If length is bigger than the buffer size it will throw an error.
      Specified by:
      createPosition in interface AutoCompletableTextArea
      Throws:
      BadLocationException
    • getEmptyStringOfSize

      protected String getEmptyStringOfSize(int length)
    • getBeginLineText

      public String getBeginLineText(int line)
      Description copied from interface: AutoCompletableTextArea
      Return the Text contains between the begining of the given line and the caret position. It suppose that the caret position is after the start of the line
      Specified by:
      getBeginLineText in interface AutoCompletableTextArea
      Returns: