java.lang.Object | +----LpexCommand
LpexCommand
class provides access to the LPEX JPI (the LPEX
editor Java Programming Interface). It is the base class for lpexlets -
LPEX external commands written in Java.
It consists of entry points for LPEX to call the lpexlet, which the lpexlet
will override as necessary, but never itself call:
and of methods to access the LPEX editor, such as:lpexEntry(), lpexNotify(), lpexDocExit(), lpexExit(),
The lpexlet class will subclasslpexCall(), lpexGetParm(), lpexGetText().
LpexCommand
, and provide any
overriding methods for the LPEX calls into the lpexlet.
This is a preliminary, "as is" release, subject to change.
lpexGetElementState()
- the element is protected.
lpexGetElementState()
- the element is a SHOW element.
lpexGetElementState()
- the element is visible.
lpexNotify()
- ask for document-exit notifications.
lpexNotify()
- ask for LPEX-exit notification.
lpexNotify()
- ask LPEX to send no notifications.
QUERY CLASS
.
QUERY FONTS
.
QUERY MODES
.
QUERY CONTENT
.
NEXT
.
PREV
.
SET CLASS
.
SET FONTS
.
SET CONTENT
.
public static final int LPEX_NOTIFY_NONE
lpexNotify()
- ask LPEX to send no notifications.
public static final int LPEX_NOTIFY_DOCEXIT
lpexNotify()
- ask for document-exit notifications.
public static final int LPEX_NOTIFY_EXIT
lpexNotify()
- ask for LPEX-exit notification.
public static final int LPEX_ELE_VISIBLE
lpexGetElementState()
- the element is visible.
This flag indicates that the current element will show in the
current edit view when given a chance (e.g., scrolled to).
public static final int LPEX_ELE_SHOW
lpexGetElementState()
- the element is a SHOW element.
SHOW elements are not part of the document, and will not normally be saved
in the document file. For example, error messages from a compilation will
usually be imbedded in the edit view as SHOW elements.
public static final int LPEX_ELE_PROTECTED
lpexGetElementState()
- the element is protected.
This flag indicates the current element is protected from overtype
changes.
public LpexCommand()
public static int lpexEntry(String arg)
The implementation of this method provided by the
LpexCommand
class does nothing, except return 0.
Example: If the user enters this on the LPEX command line:
java Test info
lpexEntry()
in Test.class will be called,
with arg
set to "info"
.
lpexNotify()
from being called.
public static int lpexNotify()
LPEX_NOTIFY_DOCEXIT
), and
the lpexlet is being unloaded and the Java Virtual Machine (JVM) destroyed
(LPEX_NOTIFY_EXIT
).
The JVM will be terminated when the editor is exited, or when the user
runs the command UNLINK JAVA
.
LPEX_NOTIFY_NONE
may be sent to register no notifications.
LPEX calls this method once, after the first call to
lpexEntry()
which doesn't return a negative result.
LPEX notifies the lpexlet of the registered events through
lpexDocExit()
and lpexExit()
.
The implementation of this method provided by the
LpexCommand
class returns LPEX_NOTIFY_NONE
.
C/C++ API: LpexDocExit() / lxdocexit()
,
and LpexExit() / lxexit()
;
either is called for any external command DLL that EXPORTs these entry
points.
LPEX_NOTIFY_NONE
(default), or any combination of
LPEX_NOTIFY_DOCEXIT
and
LPEX_NOTIFY_EXIT
.
public static int lpexDocExit(int docnum)
LpexCommand
should override this method
if it has any operation that it wants to perform when a (particular) LPEX
document is exited.
The implementation of this method provided by the
LpexCommand
class does nothing, except return 0.
public static int lpexExit(String arg)
LpexCommand
should override this method if
it has any operation that it wants to perform before it is destroyed.
The implementation of this method provided by the
LpexCommand
class does nothing, except return 0.
public static native int lpexCommand(String cmdargs)
C/C++ API: LpexCommand("cmdargs") / lxcmd("cmdargs")
.
Examples:
lpexCommand("NEXT"); lpexCommand("MSG Hello, world!"); lpexCommand("SET DISPWIDTH 90");
public static native int lpexCall(String cmd, String args)
C/C++ API: LpexCall("cmd","args") / lxcall("cmd","args")
.
Examples:
lpexCall("NEXT", ""); lpexCall("MSG", "Hello, world!");
public static native String lpexGetParm(String parm)
QUERY parm
.
This lets the lpexlet query any of the LPEX parameters.
See the Editor reference.
C/C++ API: LpexQuery("parm") / lxquery("parm")
.
A major difference is that lpexGetParm()
only returns the
value of the queried parameter.
Example:
will returnString q = lpexGetParm("ELEMENTS");
"25"
in q
for a current document
that has 25 elements.
public static native int lpexGetElementState()
LPEX_ELE_VISIBLE, LPEX_ELE_SHOW, LPEX_ELE_PROTECTED
).
C/C++ API: LpexQueryElementState() / lxqelestate()
.
Similar editor commands: QUERY SHOW, QUERY PROTECT +
QUERY CLASS
.
public static native void lpexDialogUp(boolean up)
true
before
the dialog is brought up, and false
after the dialog was
dismissed. This will ensure LPEX is not exited while the dialog is up.
C/C++ API: LpexDialogUp(up)
.
public static native String lpexProfile()
C/C++ API: LpexProfile()
.
public static native int lpexNext()
NEXT
.
Move the current position to the next element.
C/C++ API: LpexNext("") / lxnext()
.
Equivalent editor command: NEXT ELEMENT
.
public static native int lpexPrev()
PREV
.
Move the current position to the previous element.
C/C++ API: LpexPrev("") / lxprev()
.
Equivalent editor command: PREV ELEMENT
.
public static native int lpexGetIntParm(String parm)
C/C++ API: LpexQuery("parm") / lxquery("parm")
,
followed by atoi()
on the parameter value returned.
Similar editor command: QUERY parm
.
Example:
will returnint e = lpexGetIntParm("ELEMENTS");
25
in e
for a current document that
consists of 25 elements.
public static native int lpexSetIntParm(String parm, int value)
C/C++ API: LpexCall("SET parm value") /
lxcall("SET parm value")
, after
conversion of the parameter value to a string.
Similar editor command: SET parm value
.
Example:
int rc = lpexSetIntParm("DISPDEPTH", 25);
public static native String lpexGetText()
QUERY CONTENT
.
C/C++ API: LpexQueryText() / lxqtext()
.
Equivalent editor command: QUERY CONTENT
.
public static native int lpexSetText(String text)
SET CONTENT
.
C/C++ API: LpexSetText("text") / lxstext("text")
.
Equivalent editor command: SET CONTENT text
.
public static native String lpexGetFonts()
QUERY FONTS
.
C/C++ API: LpexQueryFonts() / lxqfont()
.
Equivalent editor command: QUERY FONTS
.
public static native int lpexSetFonts(String fonts)
SET FONTS
.
C/C++ API: LpexSetFonts("fonts") / lxsfont("fonts")
.
Equivalent editor command: SET FONTS fonts
.
public static native String lpexGetModes()
QUERY MODES
.
C/C++ API: LpexQueryCharModes() / lxqmode()
.
Equivalent editor command: QUERY MODES
.
public static native int lpexGetClass()
QUERY CLASS
.
C/C++ API: LpexQueryClass() / lxqclass()
.
Similar editor command: QUERY CLASS
,
but lpexGetClass()
returns the class bits set for the
element, rather than the class names.
public static native int lpexSetClass(int lpexclass)
SET CLASS
.
C/C++ API: LpexSetClass(lpexclass) / lxsclass(lpexclass)
.
Similar editor command: SET CLASS lpexclass
, but
lpexSetClass()
passes in the class-bits aggregate to be set
for the element, rather than the class names.