Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


oracle.javatools.editor
Class EmacsAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by javax.swing.text.TextAction
          extended by oracle.javatools.editor.BasicAction
              extended by oracle.javatools.editor.EmacsAction

All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
Direct Known Subclasses:
BasicEditorKit.EmacsBeginAction, BasicEditorKit.EmacsEndAction, BasicEditorKit.EmacsExchangePointMarkAction, BasicEditorKit.EmacsMarkBufferAction, BasicEditorKit.EmacsSetMarkAction, EmacsWriteAction

public abstract class EmacsAction
extends BasicAction

The EmacsAction is an abstract class that all Emacs actions should extend from. This provides utility routines for supporting a kill-ring and for setting a mark in the editor.

See Also:
Serialized Form

Nested Class Summary
protected static class EmacsAction.Tracker
          Protected class for tracking an editor and offset to determine whether to merge possibly consecutive kill actions, or for determining whether previous action was a yank or yank pop.

 

Field Summary

 

Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled

 

Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON

 

Constructor Summary
EmacsAction(java.lang.String actionName)
          Constructs this object with the appropriate action name.

 

Method Summary
abstract  void actionPerformed(java.awt.event.ActionEvent event, BasicEditorPane editor, BasicDocument document)
          The operation to perform when this action is triggered in a BasicEditorPane.
protected static void addKillRing(java.lang.String text)
          Utility routine to add the given text as the last (top-most) entry in the kill ring.
protected static void appendKillRing(java.lang.String text)
          Utility routine to append the given text to the last (top-most) entry in the kill ring.
protected static java.lang.String getClipboardText()
          Utility routine to fetch the contents of the system clipboard as a String.
protected static int getMark(BasicEditorPane editor)
          Utility routine to fetch the Emacs mark set for the given editor.
protected static java.awt.datatransfer.Clipboard getSystemClipboard()
          Utility routine to fetch the system clipboard.
protected static java.lang.String popKillRing()
          Utility routine to "pop" the last yank text from the kill ring, and retrieve the text before it from the kill ring.
protected static void prependKillRing(java.lang.String text)
          Utility routine to prepend the given text to the last (top-most) entry in the kill ring.
protected static void removeMark(BasicEditorPane editor)
          Utility routine to remove the Emacs mark from a given editor (i.e., when it is being closed.
protected static void setClipboardText(java.lang.String text)
          Utility routine to set the contents of the system clipboard to the given String text.
protected static void setMark(BasicEditorPane editor, int offset)
          Utility routine to set the Emacs mark for the given editor to the specified offset.
static void setSystemClipboard(java.awt.datatransfer.Clipboard clip)
          Sets the clipboard used by EmacsAction.
protected static void showEndBufferMessage(BasicEditorPane editor)
          Utility routine to show the message that we are at the end of the buffer
protected static void showMarkNotSetMessage(BasicEditorPane editor)
          Utility routine to show the message that the mark has not yet been set.
protected static void showMarkSetMessage(BasicEditorPane editor)
          Utility routine to show the message that the mark has been set.
protected static void showNextKillAppendMessage(BasicEditorPane editor)
          Utility routine to show the message that if the next command is a kill, it will append
protected static void showPreviousNotYankMessage(BasicEditorPane editor)
          Utility routine to show the message that the previous command was not a yank.
protected static void showReadOnlyMessage(BasicEditorPane editor)
          Utility routine to show the message that the buffer is read-only.
protected static java.lang.String yankKillRing()
          Utility routine to yank text from the last yank index of the kill ring, or from the clipboard if the text in the clipboard doesn't match the kill ring (which is generally the case if the user did a cut/copy elsewhere.)

 

Methods inherited from class oracle.javatools.editor.BasicAction
actionPerformed, beep, buildIndent, getFontHeight, getIndentSizeProperty, getLastAction, getMagicCaretPosition, getName, getSmartIndentProvider, getSpaces, getTab, getTabs, getTabSizeProperty, getUseAutoIndentProperty, getUseTabsProperty, getVisibleRect, isEditable, lock, setMagicCaretPosition, showMessage, skipLeadingIndent, unlock

 

Methods inherited from class javax.swing.text.TextAction
augmentList, getFocusedComponent, getTextComponent

 

Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled

 

Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

EmacsAction

public EmacsAction(java.lang.String actionName)
Constructs this object with the appropriate action name.

Method Detail

actionPerformed

public abstract void actionPerformed(java.awt.event.ActionEvent event,
                                     BasicEditorPane editor,
                                     BasicDocument document)
The operation to perform when this action is triggered in a BasicEditorPane. Implementations should override this method. Implementations are guaranteed that the document read lock is held for the duration of this call.
Specified by:
actionPerformed in class BasicAction
Parameters:
event - the action event
editor - the editor this action was invoked in
document - the document associated with the editor

addKillRing

protected static void addKillRing(java.lang.String text)
Utility routine to add the given text as the last (top-most) entry in the kill ring. This is the entry retrieved by the next yank command. This will also add the text to the clipboard.
Parameters:
text - the text to add to the kill ring

appendKillRing

protected static void appendKillRing(java.lang.String text)
Utility routine to append the given text to the last (top-most) entry in the kill ring. This newly constructed entry will be the entry retrieved by the next yank command. This entry will also be added to the clipboard.
Parameters:
text - the text to append to the top-most entry of the clipboard

prependKillRing

protected static void prependKillRing(java.lang.String text)
Utility routine to prepend the given text to the last (top-most) entry in the kill ring. This newly constructed entry will be the entry retrieved by the next yank command. This entry will also be added to the clipboard.
Parameters:
text - the text to prepend to the top-most entry of the clipboard

yankKillRing

protected static java.lang.String yankKillRing()
Utility routine to yank text from the last yank index of the kill ring, or from the clipboard if the text in the clipboard doesn't match the kill ring (which is generally the case if the user did a cut/copy elsewhere.)
Returns:
the last yank text from the kill ring

popKillRing

protected static java.lang.String popKillRing()
Utility routine to "pop" the last yank text from the kill ring, and retrieve the text before it from the kill ring.
Returns:
the yank text before the current one in the kill ring

getClipboardText

protected static java.lang.String getClipboardText()
Utility routine to fetch the contents of the system clipboard as a String.
Returns:
the contents of the system clipboard as a String

setClipboardText

protected static void setClipboardText(java.lang.String text)
Utility routine to set the contents of the system clipboard to the given String text.
Parameters:
text - the STring text to put into the system clipboard

getSystemClipboard

protected static java.awt.datatransfer.Clipboard getSystemClipboard()
Utility routine to fetch the system clipboard.
Returns:
the system clipboard object

setSystemClipboard

public static void setSystemClipboard(java.awt.datatransfer.Clipboard clip)
Sets the clipboard used by EmacsAction.
Parameters:
clip - clipboard that should be used.

getMark

protected static int getMark(BasicEditorPane editor)
Utility routine to fetch the Emacs mark set for the given editor.
Parameters:
editor - the editor to retrieve the mark for
Returns:
the mark offset last set, or -1 if there is no mark currently set

setMark

protected static void setMark(BasicEditorPane editor,
                              int offset)
Utility routine to set the Emacs mark for the given editor to the specified offset. If the offset is invalid, it is silently moved to the closest valid offset.
Parameters:
editor - the editor to set the mark for
offset - the offset to set the mark to

removeMark

protected static void removeMark(BasicEditorPane editor)
Utility routine to remove the Emacs mark from a given editor (i.e., when it is being closed.
Parameters:
editor - the editor to remove the mark for.

showMarkSetMessage

protected static void showMarkSetMessage(BasicEditorPane editor)
Utility routine to show the message that the mark has been set.
Parameters:
editor - the editor to show the message for

showMarkNotSetMessage

protected static void showMarkNotSetMessage(BasicEditorPane editor)
Utility routine to show the message that the mark has not yet been set.
Parameters:
editor - the editor to show the message for

showEndBufferMessage

protected static void showEndBufferMessage(BasicEditorPane editor)
Utility routine to show the message that we are at the end of the buffer
Parameters:
editor - the editor to show the message for

showReadOnlyMessage

protected static void showReadOnlyMessage(BasicEditorPane editor)
Utility routine to show the message that the buffer is read-only.
Parameters:
editor - the editor to show the message for

showNextKillAppendMessage

protected static void showNextKillAppendMessage(BasicEditorPane editor)
Utility routine to show the message that if the next command is a kill, it will append
Parameters:
editor - the editor to show the message for

showPreviousNotYankMessage

protected static void showPreviousNotYankMessage(BasicEditorPane editor)
Utility routine to show the message that the previous command was not a yank.
Parameters:
editor - the editor to show the message for

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


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