public class Registers
extends java.lang.Object
A Registers.Register
is string of text indexed by a
single character. Typically the text is taken from selected buffer text
and the index character is a keyboard character selected by the user.
This class defines a number of static methods that give each register the properties of a virtual clipboard.
Two classes implement the Registers.Register
interface. A
Registers.ClipboardRegister
is tied to the contents of the
system clipboard. jEdit assigns a
Registers.ClipboardRegister
to the register indexed under
the character $
. A
Registers.DefaultRegister
is created for registers assigned
by the user. In addition, jEdit assigns %
to
the last text segment selected in the text area. On Windows this is a
Registers.DefaultRegister
, on Unix under Java 2 version 1.4, a
Registers.ClipboardRegister
.
Modifier and Type | Class and Description |
---|---|
static class |
Registers.ClipboardRegister
A clipboard register.
|
static interface |
Registers.Register
A register.
|
Modifier and Type | Method and Description |
---|---|
static void |
append(TextArea textArea,
char register)
Appends the text selected in the text area to the specified register,
with a newline between the old and new text.
|
static void |
append(TextArea textArea,
char register,
java.lang.String separator)
Appends the text selected in the text area to the specified register.
|
static void |
append(TextArea textArea,
char register,
java.lang.String separator,
boolean cut)
Appends the text selected in the text area to the specified register.
|
static void |
clearRegister(char name)
Sets the value of the specified register to
null . |
static void |
copy(TextArea textArea,
char register)
Copies the text selected in the text area into the specified register.
|
static void |
cut(TextArea textArea,
char register)
Copies the text selected in the text area into the specified
register, and then removes it from the buffer.
|
protected static void |
debugListDataFlavors(java.awt.datatransfer.Transferable transferable) |
static Registers.Register |
getRegister(char name)
Returns the specified register.
|
static java.lang.String |
getRegisterNameString()
Returns a string of all defined registers, used by the status bar
(eg, "a b $ % ^").
|
static Registers.Register[] |
getRegisters()
Returns an array of all available registers.
|
static boolean |
isLoading() |
static void |
paste(TextArea textArea,
char register)
Insets the contents of the specified register into the text area.
|
static void |
paste(TextArea textArea,
char register,
boolean vertical)
Inserts the contents of the specified register into the text area.
|
static void |
paste(TextArea textArea,
char register,
boolean vertical,
java.awt.datatransfer.DataFlavor preferredDataFlavor)
Inserts the contents of the specified register into the text area.
|
static void |
paste(TextArea textArea,
char register,
java.awt.datatransfer.DataFlavor preferredDataFlavor)
Insets the contents of the specified register into the text area.
|
static void |
saveRegisters() |
static void |
setListener(RegistersListener listener) |
static void |
setLoading(boolean loading) |
static void |
setRegister(char name,
Registers.Register newRegister)
Sets the specified register.
|
static void |
setRegister(char name,
java.lang.String value)
Sets the specified register.
|
static void |
setRegister(char name,
java.awt.datatransfer.Transferable transferable)
Sets the specified register.
|
static void |
setSaver(RegisterSaver saver) |
public static void copy(TextArea textArea, char register)
textArea
- The text arearegister
- The registerpublic static void cut(TextArea textArea, char register)
textArea
- The text arearegister
- The registerpublic static void append(TextArea textArea, char register)
textArea
- The text arearegister
- The registerpublic static void append(TextArea textArea, char register, java.lang.String separator)
textArea
- The text arearegister
- The registerseparator
- The separator to insert between the old and new textpublic static void append(TextArea textArea, char register, java.lang.String separator, boolean cut)
textArea
- The text arearegister
- The registerseparator
- The text to insert between the old and new textcut
- Should the current selection be removed?public static void paste(TextArea textArea, char register)
textArea
- The text arearegister
- The registerpublic static void paste(TextArea textArea, char register, java.awt.datatransfer.DataFlavor preferredDataFlavor)
textArea
- The text arearegister
- The registerpreferredDataFlavor
- the preferred dataflavor. If not available
DataFlavor.stringFlavor will be usedpublic static void paste(TextArea textArea, char register, boolean vertical)
textArea
- The text arearegister
- The registervertical
- Vertical (columnar) pastepublic static void paste(TextArea textArea, char register, boolean vertical, java.awt.datatransfer.DataFlavor preferredDataFlavor)
textArea
- The text arearegister
- The registervertical
- Vertical (columnar) pastepreferredDataFlavor
- the preferred dataflavor. If not available
DataFlavor.stringFlavor will be usedpublic static Registers.Register getRegister(char name)
name
- The namepublic static void setRegister(char name, Registers.Register newRegister)
name
- The namenewRegister
- The new valuepublic static void setRegister(char name, java.lang.String value)
name
- The namevalue
- The new valuepublic static void setRegister(char name, java.awt.datatransfer.Transferable transferable)
name
- The nametransferable
- the transferablepublic static void clearRegister(char name)
null
.name
- The register namepublic static Registers.Register[] getRegisters()
null
.public static java.lang.String getRegisterNameString()
public static void saveRegisters()
public static void setListener(RegistersListener listener)
public static void setSaver(RegisterSaver saver)
public static boolean isLoading()
public static void setLoading(boolean loading)
protected static void debugListDataFlavors(java.awt.datatransfer.Transferable transferable)