Package org.fife.ui.rtextarea
Class ClipboardHistory
java.lang.Object
org.fife.ui.rtextarea.ClipboardHistory
Listens for cuts and copies from instances of
RTextArea
. This is
used for the "clipboard history" shortcut (Ctrl+Shift+V by default).Note that this class does not listen for all events on the system clipboard, because that functionality is pretty fragile. See https://stackoverflow.com/questions/5484927/listen-to-clipboard-changes-check-ownership for more information.
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static ClipboardHistory
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an entry to the clipboard history.static ClipboardHistory
get()
Returns the singleton instance of this class, lazily creating it if necessary.Returns the clipboard history, in most-recently-used order.int
Returns the maximum number of clipboard values remembered.void
setMaxSize
(int maxSize) Sets the maximum number of clipboard values remembered.private void
trim()
Ensures the remembered set of strings is not larger than the maximum allowed size.
-
Field Details
-
instance
-
history
-
maxSize
private int maxSize -
DEFAULT_MAX_SIZE
private static final int DEFAULT_MAX_SIZE- See Also:
-
-
Constructor Details
-
ClipboardHistory
private ClipboardHistory()
-
-
Method Details
-
add
Adds an entry to the clipboard history.- Parameters:
str
- The text to add.- See Also:
-
get
Returns the singleton instance of this class, lazily creating it if necessary.This method should only be called on the EDT.
- Returns:
- The singleton instance of this class.
-
getHistory
Returns the clipboard history, in most-recently-used order.- Returns:
- The clipboard history.
-
getMaxSize
public int getMaxSize()Returns the maximum number of clipboard values remembered.- Returns:
- The maximum number of clipboard values remembered.
- See Also:
-
setMaxSize
public void setMaxSize(int maxSize) Sets the maximum number of clipboard values remembered.- Parameters:
maxSize
- The maximum number of clipboard values to remember.- Throws:
IllegalArgumentException
- IfmaxSize
is not greater than zero.- See Also:
-
trim
private void trim()Ensures the remembered set of strings is not larger than the maximum allowed size.
-