Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

javax.ide.editor
Class TextEditor

java.lang.Object
  extended by javax.ide.view.DefaultViewable
      extended by javax.ide.view.View
          extended by javax.ide.editor.Editor
              extended by javax.ide.editor.TextEditor
All Implemented Interfaces:
Identifiable, Viewable

public abstract class TextEditor
extends Editor

Base class for text based editors. Provides utilities for querying and changing the caret position and selection.


Field Summary
 
Fields inherited from interface javax.ide.view.Viewable
PROP_ICON_PATH, PROP_LABEL, PROP_VISIBLE
 
Constructor Summary
TextEditor()
           
 
Method Summary
abstract  int getCaretColumn()
          Get the current column position of the caret.
abstract  int getCaretLine()
          Get the current line position of the caret.
abstract  int getCaretPosition()
          Get the current caret position as a character offset from the start of the document.
abstract  int getSelectionLength()
          Get the length of the current selection in characters.
abstract  int getSelectionStart()
          Get the character offset of the start of the current selection.
abstract  void setCaretPosition(int position)
          Set the caret position.
abstract  void setCaretPosition(int line, int column)
          Set the caret position using a line and column number.
abstract  void setSelection(int start, int length)
          Set the current selection.
 
Methods inherited from class javax.ide.editor.Editor
close, getContext, getLabel, open, restore, save
 
Methods inherited from class javax.ide.view.View
activate, deactivate, getController, getGUI, isVisible, parent, setVisible
 
Methods inherited from class javax.ide.view.DefaultViewable
addPropertyChangeListener, firePropertyChange, getIcon, getToolTip, removePropertyChangeListener, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.ide.Identifiable
getID
 

Constructor Detail

TextEditor

public TextEditor()
Method Detail

getCaretPosition

public abstract int getCaretPosition()
Get the current caret position as a character offset from the start of the document.

Returns:
the position of the caret as an offset from the start of the document.

setCaretPosition

public abstract void setCaretPosition(int position)
Set the caret position. Any current selection will be cleared. If possible, the editor is scrolled so that the caret is in view.

Parameters:
position - the character offset from the start of the document at which to position the caret.
Throws:
java.lang.IndexOutOfBoundsException - if the specified position is invalid.

setCaretPosition

public abstract void setCaretPosition(int line,
                                      int column)
Set the caret position using a line and column number. Any current selection will be cleared. If possible, the editor is scrolled so that the caret is in view.

Parameters:
line - the line number on which to position the caret. The first line in the document is 0.
column - the column number at which to position the caret. The first column in the document is 0.
Throws:
java.lang.IndexOutOfBoundsException - if the specified position is invalid.

getCaretColumn

public abstract int getCaretColumn()
Get the current column position of the caret.

Returns:
the column position of the caret. If the caret is in the first column of the document, the return value will be 0.

getCaretLine

public abstract int getCaretLine()
Get the current line position of the caret.

Returns:
the line position of the caret. This is zero-based; if the caret is on the first line in the document, the return value will be 0 not 1.

getSelectionStart

public abstract int getSelectionStart()
Get the character offset of the start of the current selection. If there is no current selection, this returns the same value as getCaretPosition().

Returns:
the character offset of the start of the current selection.

getSelectionLength

public abstract int getSelectionLength()
Get the length of the current selection in characters. If there is no current selection, this returns 0.

Returns:
the number of characters currently selected.

setSelection

public abstract void setSelection(int start,
                                  int length)
Set the current selection. If possible, the selection is scrolled into view.

Parameters:
start - the start offset of the selection. This must be greater than 0 and less than the length of the document-1.
length - the length of the selection. This must not cause the selection to extend past the end of the document.
Throws:
java.lang.IndexOutOfBoundsException - if the specified selection position is invalid.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

Copyright © 1997, 2010, Oracle. All rights reserved.