Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.gjt.sp.jedit
Class Registers  view Registers download Registers.java

java.lang.Object
  extended byorg.gjt.sp.jedit.Registers

public class Registers
extends java.lang.Object

jEdit's registers are an extension of the clipboard metaphor.

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.StringRegister 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.StringRegister, on Unix under Java 2 version 1.4, a Registers.ClipboardRegister.

Version:
$Id: Registers.java,v 1.19 2003/07/23 06:08:54 spestov Exp $

Nested Class Summary
static class Registers.ClipboardRegister
          A clipboard register.
static interface Registers.Register
          A register.
(package private) static class Registers.RegistersHandler
           
static class Registers.StringRegister
          Register that stores a string.
 
Field Summary
private static boolean loaded
           
private static boolean loading
           
private static boolean modified
           
private static Registers.Register[] registers
           
private static long registersModTime
           
 
Constructor Summary
private Registers()
           
 
Method Summary
static void append(org.gjt.sp.jedit.textarea.JEditTextArea 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(org.gjt.sp.jedit.textarea.JEditTextArea textArea, char register, java.lang.String separator)
          Appends the text selected in the text area to the specified register.
static void append(org.gjt.sp.jedit.textarea.JEditTextArea 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(org.gjt.sp.jedit.textarea.JEditTextArea textArea, char register)
          Copies the text selected in the text area into the specified register.
static void cut(org.gjt.sp.jedit.textarea.JEditTextArea textArea, char register)
          Copies the text selected in the text area into the specified register, and then removes it from the buffer.
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 java.lang.String getRegisterStatusPrompt(java.lang.String action)
          Returns the status prompt for the given register action.
private static void loadRegisters()
           
static void paste(org.gjt.sp.jedit.textarea.JEditTextArea textArea, char register)
          Insets the contents of the specified register into the text area.
static void paste(org.gjt.sp.jedit.textarea.JEditTextArea textArea, char register, boolean vertical)
          Inserts the contents of the specified register into the text area.
static void saveRegisters()
           
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

registers

private static Registers.Register[] registers

registersModTime

private static long registersModTime

loaded

private static boolean loaded

loading

private static boolean loading

modified

private static boolean modified
Constructor Detail

Registers

private Registers()
Method Detail

copy

public static void copy(org.gjt.sp.jedit.textarea.JEditTextArea 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.

Since:
jEdit 2.7pre2

cut

public static void cut(org.gjt.sp.jedit.textarea.JEditTextArea textArea,
                       char register)
Copies the text selected in the text area into the specified register, and then removes it from the buffer.

Since:
jEdit 2.7pre2

append

public static void append(org.gjt.sp.jedit.textarea.JEditTextArea textArea,
                          char register)
Appends the text selected in the text area to the specified register, with a newline between the old and new text.


append

public static void append(org.gjt.sp.jedit.textarea.JEditTextArea textArea,
                          char register,
                          java.lang.String separator)
Appends the text selected in the text area to the specified register.


append

public static void append(org.gjt.sp.jedit.textarea.JEditTextArea textArea,
                          char register,
                          java.lang.String separator,
                          boolean cut)
Appends the text selected in the text area to the specified register.

Since:
jEdit 3.2pre1

paste

public static void paste(org.gjt.sp.jedit.textarea.JEditTextArea textArea,
                         char register)
Insets the contents of the specified register into the text area.

Since:
jEdit 2.7pre2

paste

public static void paste(org.gjt.sp.jedit.textarea.JEditTextArea textArea,
                         char register,
                         boolean vertical)
Inserts the contents of the specified register into the text area.

Since:
jEdit 4.1pre1

getRegister

public static Registers.Register getRegister(char name)
Returns the specified register.


setRegister

public static void setRegister(char name,
                               Registers.Register newRegister)
Sets the specified register.


setRegister

public static void setRegister(char name,
                               java.lang.String value)
Sets the specified register.


clearRegister

public static void clearRegister(char name)
Sets the value of the specified register to null.


getRegisters

public static Registers.Register[] getRegisters()
Returns an array of all available registers. Some of the elements of this array might be null.


getRegisterStatusPrompt

public static java.lang.String getRegisterStatusPrompt(java.lang.String action)
Returns the status prompt for the given register action. Only intended to be called from actions.xml.

Since:
jEdit 4.2pre2

getRegisterNameString

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()

loadRegisters

private static void loadRegisters()