com.raelity.jvi
Class ViManager

java.lang.Object
  extended by com.raelity.jvi.ViManager

public class ViManager
extends Object

This class coordinates things. The platform (main application) notifies jVi about new editors that are opened and switches between open editors.

Here are several static methods used to inform jVi of major changes. The appHandle is opaque to jVi; it means something to the platform. It may be a logical container which tracks the editor. There is one of these for each open editor, if the same document is editted in two windows, then there are two of these. appHandle may be nulll; this signifies that the editor is a "nomad" and is not associated directly with top level file data, for example if the editor is in a dialog and is used to edit some app configuration data. When appHandle is null, the editor is not added to the MRU list, and so it does not show up in the ":ls" command. NEEDSWORK:


Nested Class Summary
static class ViManager.jViVersion
          version is of the form #.#.# or #.#.#.[x|alpha|beta|rc]#, examples 0.9.1, 0.9.1.beta1 also, 0.9.1.beta1.3 for tweaking between exposed releases
static class ViManager.OsVersion
           
 
Field Summary
static Map HackMap
           
static String PREFS_KEYS
           
static String PREFS_ROOT
           
static ViManager.jViVersion version
           
static String VIM_CLIPBOARD
           
static String VIM_CLIPBOARD_RAW
           
static String VIM_CLIPBOARD2
           
static DataFlavor VimClipboard2
           
 
Constructor Summary
ViManager()
           
 
Method Summary
static void activateFile(JEditorPane ep, Object fileObject, String tag)
          The application invokes this whenever a file becomes selected in the specified container.
static boolean addStartupListener(ActionListener l)
          Add listener to invoke when editor is starting up.
static void caretUpdate(ViTextView tv, int lastDot, int dot, int mark)
           
static void closeFile(JEditorPane ep, Object fileObject)
          The applications invokes this method when a file is completely removed from a container or should be forgotten by jVi.
static void copyPreferences(Preferences dst, Preferences src, boolean clearDst)
          Copy preferences tree.
static ViOutputStream createOutputStream(ViTextView tv, Object type, Object info)
           
static ViOutputStream createOutputStream(ViTextView tv, Object type, Object info, int priority)
           
static void deactivateCurrentFile(Object parent)
           
static void detached(JEditorPane ep)
          The arg JEditorPane is detached from its text view, forget about it.
static void dump(PrintStream ps)
           
static void dumpStack()
           
static void dumpStack(String msg)
           
static void exitInputMode()
           
static ViTextView getAlternateTextView(ViTextView tv, Buffer buf)
          get any text view, other than tv, which has buf KLUDGE HACK
static Buffer getBuffer(JEditorPane editorPane)
           
static JEditorPane getCurrentEditorPaneXXX()
           
static ViTextView getCurrentTextView()
           
static ViFS getFS()
           
static Keymap getInsertModeKeymap()
           
static Object getMruBuffer(int i)
          Fetch the Nth buffer, 0 to N-1, from the Mru list.
static Keymap getNormalModeKeymap()
           
static ViManager.OsVersion getOsVersion()
           
static boolean getPlatformFindMatch()
           
static String getReleaseString()
           
static Object getTextBuffer(int i)
          Fetch the text buffer indicated by the argument.
static ViFactory getViFactory()
           
static ViTextView getViTextView(JEditorPane editorPane)
           
static void ignoreActivation(Object fileObject)
          Request that the next activation does not re-order the mru list if the activated object is the argment.
static void installKeymap(JEditorPane editorPane)
           
static boolean isBuffer(Object fileObject)
           
static boolean isJdk15()
           
static boolean isJdk16()
           
static boolean jViBusy()
           
static void keyStroke(JEditorPane target, char key, int modifier)
          A key was typed.
static void log(Object... a)
           
static int mouseMoveDot(int pos, JTextComponent c, MouseEvent mev)
           
static void mouseRelease(MouseEvent mev)
           
static int mouseSetDot(int pos, JTextComponent c, MouseEvent mev)
          A mouse click; switch to the activated editor.
static void registerEditorPane(JEditorPane editorPane)
          Deprecated. use activateFile
static Object relativeMruBuffer(int i)
           
static Object relativeMruBuffer(Object fileObject, int i)
          Return the Ith next/previous fileObject relative to the argument fileObject.
static void removeStartupListener(ActionListener l)
           
static void requestSwitch(JEditorPane ep)
          requestSwitch can be used from IDE code for situation where an editor is activated.
static int setDot(int pos, JTextComponent c)
          not mouse involved, keep caret off of new line; see window.mouseClickedPosition(pos)
static void setInsertModeKeymap(Keymap newInsertModeKeymap)
           
static void setNormalModeKeymap(Keymap newNormalModeKeymap)
           
static void setPlatformFindMatch(boolean f)
          Specify if the platform can be used for brace matching.
static void setViFactory(ViFactory factory)
           
static void startCommandEntry(ViCmdEntry commandEntry, String mode, ViTextView tv, StringBuffer initialString)
          Pass control to indicated ViCmdEntry widget.
static void stopCommandEntry()
           
static void unexpectedCaretChange(int dot)
          A mouse click may have moved the caret.
static void updateHighlightSearchState()
          update visible textviews
static void viewMoveChange(ViTextView textView)
          The viewport has changed or scrolled, clear messages
static void viewSizeChange(ViTextView textView)
          The viewport has changed, so number of screen lines have changed
static ActionListener xlateKeymapAction(ActionListener act)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFS_ROOT

public static final String PREFS_ROOT
See Also:
Constant Field Values

PREFS_KEYS

public static final String PREFS_KEYS
See Also:
Constant Field Values

VIM_CLIPBOARD

public static final String VIM_CLIPBOARD
See Also:
Constant Field Values

VIM_CLIPBOARD2

public static final String VIM_CLIPBOARD2
See Also:
Constant Field Values

VIM_CLIPBOARD_RAW

public static final String VIM_CLIPBOARD_RAW
See Also:
Constant Field Values

HackMap

public static Map HackMap

version

public static final ViManager.jViVersion version

VimClipboard2

public static final DataFlavor VimClipboard2
Constructor Detail

ViManager

public ViManager()
Method Detail

setViFactory

public static void setViFactory(ViFactory factory)

isJdk15

public static boolean isJdk15()

isJdk16

public static boolean isJdk16()

jViBusy

public static boolean jViBusy()

getOsVersion

public static ViManager.OsVersion getOsVersion()

getReleaseString

public static String getReleaseString()

getViFactory

public static ViFactory getViFactory()

getFS

public static ViFS getFS()

getCurrentEditorPaneXXX

public static JEditorPane getCurrentEditorPaneXXX()

getViTextView

public static ViTextView getViTextView(JEditorPane editorPane)

getAlternateTextView

public static ViTextView getAlternateTextView(ViTextView tv,
                                              Buffer buf)
get any text view, other than tv, which has buf KLUDGE HACK


getBuffer

public static Buffer getBuffer(JEditorPane editorPane)

createOutputStream

public static ViOutputStream createOutputStream(ViTextView tv,
                                                Object type,
                                                Object info)

createOutputStream

public static ViOutputStream createOutputStream(ViTextView tv,
                                                Object type,
                                                Object info,
                                                int priority)

installKeymap

public static void installKeymap(JEditorPane editorPane)

startCommandEntry

public static void startCommandEntry(ViCmdEntry commandEntry,
                                     String mode,
                                     ViTextView tv,
                                     StringBuffer initialString)
Pass control to indicated ViCmdEntry widget. If there are readahead or typeahead characters available, then collect them up to a <CR> and append them to initialString. If there was a CR, then signal the widget to immeadiately fire its actionPerformed without displaying any UI element.


stopCommandEntry

public static void stopCommandEntry()

updateHighlightSearchState

public static void updateHighlightSearchState()
update visible textviews


setPlatformFindMatch

public static void setPlatformFindMatch(boolean f)
Specify if the platform can be used for brace matching.

Parameters:
f - true if platform can perform all find match functions.

getPlatformFindMatch

public static boolean getPlatformFindMatch()

getTextBuffer

public static Object getTextBuffer(int i)
Fetch the text buffer indicated by the argument. If the argument is positive, then fetch the Nth buffer, numbered 1 to N, according to the order they were activated. If the argument is negative then use the MRU list to get the buffer, where -1 means the previous buffer. An argument of 0 will return null. Usage for n < 0 is deprecated, consider -0 is not the top of the MRU list, see getMruBuffer(int).


getMruBuffer

public static Object getMruBuffer(int i)
Fetch the Nth buffer, 0 to N-1, from the Mru list.

Returns:
the buffer, else null if i is out of bounds.

relativeMruBuffer

public static Object relativeMruBuffer(Object fileObject,
                                       int i)
Return the Ith next/previous fileObject relative to the argument fileObject. If i < 0 then look in previously used direction.


relativeMruBuffer

public static Object relativeMruBuffer(int i)

ignoreActivation

public static void ignoreActivation(Object fileObject)
Request that the next activation does not re-order the mru list if the activated object is the argment.


activateFile

public static void activateFile(JEditorPane ep,
                                Object fileObject,
                                String tag)
The application invokes this whenever a file becomes selected in the specified container. This also serves as an open.

Parameters:
ep - May be null, otherwise the associated editor pane
parent - Usually, but not necessarily, a container that hold the editor.

deactivateCurrentFile

public static void deactivateCurrentFile(Object parent)

isBuffer

public static boolean isBuffer(Object fileObject)

closeFile

public static void closeFile(JEditorPane ep,
                             Object fileObject)
The applications invokes this method when a file is completely removed from a container or should be forgotten by jVi.


registerEditorPane

public static void registerEditorPane(JEditorPane editorPane)
Deprecated. use activateFile

Set up an editor pane for use with vi.


log

public static void log(Object... a)

keyStroke

public static void keyStroke(JEditorPane target,
                             char key,
                             int modifier)
A key was typed. Handle the event.
NEEDSWORK: catch all exceptions comming out of here?


requestSwitch

public static void requestSwitch(JEditorPane ep)
requestSwitch can be used from IDE code for situation where an editor is activated. It allows things to be initialized, some with visual implications, before a key is entered.


getCurrentTextView

public static ViTextView getCurrentTextView()

addStartupListener

public static boolean addStartupListener(ActionListener l)
Add listener to invoke when editor is starting up. A null argument can be used to test if startup has already occured.

Returns:
true if listener add, otherwise false indicates that startup has already occured.

removeStartupListener

public static void removeStartupListener(ActionListener l)

detached

public static void detached(JEditorPane ep)
The arg JEditorPane is detached from its text view, forget about it.


exitInputMode

public static void exitInputMode()

setDot

public static int setDot(int pos,
                         JTextComponent c)
not mouse involved, keep caret off of new line; see window.mouseClickedPosition(pos)


mouseSetDot

public static int mouseSetDot(int pos,
                              JTextComponent c,
                              MouseEvent mev)
A mouse click; switch to the activated editor. Pass the click on to the window and give it a chance to adjust the position and whatever.


mouseRelease

public static void mouseRelease(MouseEvent mev)

mouseMoveDot

public static int mouseMoveDot(int pos,
                               JTextComponent c,
                               MouseEvent mev)

caretUpdate

public static void caretUpdate(ViTextView tv,
                               int lastDot,
                               int dot,
                               int mark)

unexpectedCaretChange

public static void unexpectedCaretChange(int dot)
A mouse click may have moved the caret.


viewSizeChange

public static void viewSizeChange(ViTextView textView)
The viewport has changed, so number of screen lines have changed


viewMoveChange

public static void viewMoveChange(ViTextView textView)
The viewport has changed or scrolled, clear messages


dumpStack

public static void dumpStack(String msg)

dumpStack

public static void dumpStack()

setInsertModeKeymap

public static void setInsertModeKeymap(Keymap newInsertModeKeymap)

getInsertModeKeymap

public static Keymap getInsertModeKeymap()

setNormalModeKeymap

public static void setNormalModeKeymap(Keymap newNormalModeKeymap)

getNormalModeKeymap

public static Keymap getNormalModeKeymap()

xlateKeymapAction

public static ActionListener xlateKeymapAction(ActionListener act)

dump

public static void dump(PrintStream ps)

copyPreferences

public static void copyPreferences(Preferences dst,
                                   Preferences src,
                                   boolean clearDst)
Copy preferences tree.