Class Registers
- java.lang.Object
-
- org.gjt.sp.jedit.Registers
-
public class Registers extends java.lang.ObjectjEdit's registers are an extension of the clipboard metaphor.A
Registers.Registeris 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.Registerinterface. ARegisters.ClipboardRegisteris tied to the contents of the system clipboard. jEdit assigns aRegisters.ClipboardRegisterto the register indexed under the character$. ARegisters.DefaultRegisteris 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 aRegisters.DefaultRegister, on Unix under Java 2 version 1.4, aRegisters.ClipboardRegister.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRegisters.ClipboardRegisterA clipboard register.static interfaceRegisters.RegisterA register.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidappend(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 voidappend(TextArea textArea, char register, java.lang.String separator)Appends the text selected in the text area to the specified register.static voidappend(TextArea textArea, char register, java.lang.String separator, boolean cut)Appends the text selected in the text area to the specified register.static voidclearRegister(char name)Sets the value of the specified register tonull.static voidcopy(TextArea textArea, char register)Copies the text selected in the text area into the specified register.static voidcut(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 voiddebugListDataFlavors(java.awt.datatransfer.Transferable transferable)static Registers.RegistergetRegister(char name)Returns the specified register.static java.lang.StringgetRegisterNameString()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 booleanisLoading()static voidpaste(TextArea textArea, char register)Insets the contents of the specified register into the text area.static voidpaste(TextArea textArea, char register, boolean vertical)Inserts the contents of the specified register into the text area.static voidpaste(TextArea textArea, char register, boolean vertical, java.awt.datatransfer.DataFlavor preferredDataFlavor)Inserts the contents of the specified register into the text area.static voidpaste(TextArea textArea, char register, java.awt.datatransfer.DataFlavor preferredDataFlavor)Insets the contents of the specified register into the text area.static voidsaveRegisters()static voidsetListener(RegistersListener listener)static voidsetLoading(boolean loading)static voidsetRegister(char name, java.awt.datatransfer.Transferable transferable)Sets the specified register.static voidsetRegister(char name, java.lang.String value)Sets the specified register.static voidsetRegister(char name, Registers.Register newRegister)Sets the specified register.static voidsetSaver(RegisterSaver saver)
-
-
-
Method Detail
-
copy
public static void copy(TextArea textArea, char register)
Copies the text selected in the text area into the specified register. This will replace the existing contents of the designated register.- Parameters:
textArea- The text arearegister- The register- Since:
- jEdit 2.7pre2
-
cut
public 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.- Parameters:
textArea- The text arearegister- The register- Since:
- jEdit 2.7pre2
-
append
public 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.- Parameters:
textArea- The text arearegister- The register
-
append
public static void append(TextArea textArea, char register, java.lang.String separator)
Appends the text selected in the text area to the specified register.- Parameters:
textArea- The text arearegister- The registerseparator- The separator to insert between the old and new text
-
append
public 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.- Parameters:
textArea- The text arearegister- The registerseparator- The text to insert between the old and new textcut- Should the current selection be removed?- Since:
- jEdit 3.2pre1
-
paste
public static void paste(TextArea textArea, char register)
Insets the contents of the specified register into the text area.- Parameters:
textArea- The text arearegister- The register- Since:
- jEdit 2.7pre2
-
paste
public static void paste(TextArea textArea, char register, java.awt.datatransfer.DataFlavor preferredDataFlavor)
Insets the contents of the specified register into the text area.- Parameters:
textArea- The text arearegister- The registerpreferredDataFlavor- the preferred dataflavor. If not availableDataFlavor.stringFlavorwill be used- Since:
- jEdit 4.4pre1
-
paste
public static void paste(TextArea textArea, char register, boolean vertical)
Inserts the contents of the specified register into the text area.- Parameters:
textArea- The text arearegister- The registervertical- Vertical (columnar) paste- Since:
- jEdit 4.1pre1
-
paste
public 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.- Parameters:
textArea- The text arearegister- The registervertical- Vertical (columnar) pastepreferredDataFlavor- the preferred dataflavor. If not availableDataFlavor.stringFlavorwill be used- Since:
- jEdit 4.4pre1
-
getRegister
public static Registers.Register getRegister(char name)
Returns the specified register.- Parameters:
name- The name
-
setRegister
public static void setRegister(char name, Registers.Register newRegister)Sets the specified register.- Parameters:
name- The namenewRegister- The new value
-
setRegister
public static void setRegister(char name, java.lang.String value)Sets the specified register.- Parameters:
name- The namevalue- The new value
-
setRegister
public static void setRegister(char name, java.awt.datatransfer.Transferable transferable)Sets the specified register.- Parameters:
name- The nametransferable- the transferable
-
clearRegister
public static void clearRegister(char name)
Sets the value of the specified register tonull.- Parameters:
name- The register name
-
getRegisters
public static Registers.Register[] getRegisters()
Returns an array of all available registers. Some of the elements of this array might benull.
-
getRegisterNameString
@Nullable public static java.lang.String getRegisterNameString()
Returns a string of all defined registers, used by the status bar (eg, "a b $ % ^").- Since:
- jEdit 4.2pre2
-
saveRegisters
public static void saveRegisters()
-
setListener
public static void setListener(RegistersListener listener)
-
setSaver
public static void setSaver(RegisterSaver saver)
-
isLoading
public static boolean isLoading()
-
setLoading
public static void setLoading(boolean loading)
-
debugListDataFlavors
protected static void debugListDataFlavors(java.awt.datatransfer.Transferable transferable)
-
-