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

E13403-04

oracle.javatools.editor
Class EditorSelectionColumns

java.lang.Object
  extended by oracle.javatools.editor.EditorSelectionColumns
All Implemented Interfaces:
ActionHookInvoker, EditorSelection

public final class EditorSelectionColumns
extends java.lang.Object
implements EditorSelection, ActionHookInvoker

A EditorSelection that selects by column blocks. i.e. The selection rectangle has the same gap on the left and right on every selected line. Selection begins on the line and column of the selection start, and spans every line to selection end, but only those characters in the columns between selection start and selection end (inclusive).


Constructor Summary
EditorSelectionColumns()
           
 
Method Summary
 boolean canSupportEditor(BasicEditorPane editorPane)
          Column selection can only support editors containing fixed width fonts
 void clearSelectionHighlights(HighlightLayer selectionLayer)
          Clear the selection by removing any selection highlighting and permorming any other internal clear operations.
 void copy()
           
 void cut()
           
 void deinstall()
          Disassociate the editor selection from an editor
 void delete()
           
 void deleteSelection()
          Remove the currently selected text (if any) from the document
 java.lang.String getSelectedText()
           
 int getSelectionEnd()
           
 int getSelectionStart()
           
 void insertText(int offset, java.lang.String text)
          Insert the given text at the given offset (Different selections will handle things like newline characters differently).
 void install(BasicEditorPane editor)
          Associate the editor selection with an editor
 boolean invokeAction(java.lang.String actionKey)
          Invokes the Action corresponding to the given actionKey.
static boolean isEditorFixedWidthFont(BasicEditorPane editorPane)
           
 boolean isInSelection(int offset)
          Returns whether the given offset lies within the current selection bounds
 void paste()
          Paste in column select will delete the current selection, then beginning at the selection start row - will insert clip board contents, one line at a time, into the lines below the selection start row.
 void selectAll()
          Selects all characters in the document
 void setEndSelectionPoint(java.awt.Point p)
          Let the selection know the point (in editor coordinates) where the selection end is designated.
 void setStartSelectionPoint(java.awt.Point p)
          Let the selection know the point (in editor coordinates) where the selection start is designated.
 void updateSelectionHighlight(HighlightLayer layer, HighlightStyle caretStyle)
          Update the Editors selection highlight layer in response to a possible change in selection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditorSelectionColumns

public EditorSelectionColumns()
Method Detail

getSelectionStart

public int getSelectionStart()
Specified by:
getSelectionStart in interface EditorSelection
Returns:
The offset of selection start (usually the caret position)

getSelectionEnd

public int getSelectionEnd()
Specified by:
getSelectionEnd in interface EditorSelection
Returns:
The offset of selection end. May be identical to selection start which may indicate no selection.

getSelectedText

public java.lang.String getSelectedText()
Specified by:
getSelectedText in interface EditorSelection
Returns:
The text currently covered by selection

copy

public void copy()

cut

public void cut()

delete

public void delete()
            throws javax.swing.text.BadLocationException
Throws:
javax.swing.text.BadLocationException

paste

public void paste()
Paste in column select will delete the current selection, then beginning at the selection start row - will insert clip board contents, one line at a time, into the lines below the selection start row. The insertion point in each line is the same column index as the selection start column. If, before insertion, a row isn't wide enough to meet the column insertion point, then spaces will be inserted to pad the row up to the insertion column.


updateSelectionHighlight

public void updateSelectionHighlight(HighlightLayer layer,
                                     HighlightStyle caretStyle)
Description copied from interface: EditorSelection
Update the Editors selection highlight layer in response to a possible change in selection

Specified by:
updateSelectionHighlight in interface EditorSelection
Parameters:
layer - The selection highlight layer

install

public void install(BasicEditorPane editor)
Description copied from interface: EditorSelection
Associate the editor selection with an editor

Specified by:
install in interface EditorSelection

deinstall

public void deinstall()
Description copied from interface: EditorSelection
Disassociate the editor selection from an editor

Specified by:
deinstall in interface EditorSelection

invokeAction

public boolean invokeAction(java.lang.String actionKey)
Description copied from interface: ActionHookInvoker
Invokes the Action corresponding to the given actionKey.

Specified by:
invokeAction in interface ActionHookInvoker
Parameters:
actionKey - the published key for the action
Returns:
true if the action is handled, false otherwise

setStartSelectionPoint

public void setStartSelectionPoint(java.awt.Point p)
Description copied from interface: EditorSelection
Let the selection know the point (in editor coordinates) where the selection start is designated. We can't just rely on editor.getCaret() as this will return an offset, sometimes the selection start point will be past the end of the row and not specifically identified by an offset

Specified by:
setStartSelectionPoint in interface EditorSelection
Parameters:
p - the Point where the selection begin

setEndSelectionPoint

public void setEndSelectionPoint(java.awt.Point p)
Description copied from interface: EditorSelection
Let the selection know the point (in editor coordinates) where the selection end is designated. We can't just rely on editor.getCaret() as this will return an offset, sometimes the selection end point will be past the end of the row and not specifically identified by an offset

Specified by:
setEndSelectionPoint in interface EditorSelection
Parameters:
p - the Point where the selection bounds ends

clearSelectionHighlights

public void clearSelectionHighlights(HighlightLayer selectionLayer)
Description copied from interface: EditorSelection
Clear the selection by removing any selection highlighting and permorming any other internal clear operations.

Specified by:
clearSelectionHighlights in interface EditorSelection

deleteSelection

public void deleteSelection()
                     throws javax.swing.text.BadLocationException
Description copied from interface: EditorSelection
Remove the currently selected text (if any) from the document

Specified by:
deleteSelection in interface EditorSelection
Throws:
javax.swing.text.BadLocationException

insertText

public void insertText(int offset,
                       java.lang.String text)
                throws javax.swing.text.BadLocationException
Description copied from interface: EditorSelection
Insert the given text at the given offset (Different selections will handle things like newline characters differently).

Specified by:
insertText in interface EditorSelection
Throws:
javax.swing.text.BadLocationException

isInSelection

public boolean isInSelection(int offset)
Description copied from interface: EditorSelection
Returns whether the given offset lies within the current selection bounds

Specified by:
isInSelection in interface EditorSelection
Returns:

selectAll

public void selectAll()
Description copied from interface: EditorSelection
Selects all characters in the document

Specified by:
selectAll in interface EditorSelection

canSupportEditor

public boolean canSupportEditor(BasicEditorPane editorPane)
Column selection can only support editors containing fixed width fonts

Specified by:
canSupportEditor in interface EditorSelection
Parameters:
editorPane -
Returns:
true

isEditorFixedWidthFont

public static boolean isEditorFixedWidthFont(BasicEditorPane editorPane)
Parameters:
editorPane -
Returns:
true if the editor is using a fixed width font

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.