|
LPEX 3.6.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface LpexAction
Interface LpexAction can be implemented to define a user action.
The code sample below is used inside a document parser to define the insertAmp editor action (which inserts the string "&" at the cursor), and associate it with the Ctrl+& key in the text area:
lpexView.defineAction("insertAmp", new LpexAction() { public void doAction(LpexView view) { view.doDefaultCommand("insertText &"); } public boolean available(LpexView view) { return !view.queryOn("readonly") && view.currentElement() != 0; } }); if (!lpexView.keyAssigned("c-ampersand.t")) { lpexView.doCommand("set keyAction.c-ampersand.t insertAmp"); } |
The user action may be a new editor action, or it may redefine or extend a default editor action.
An action can be assigned to a key or series of keys with the set keyAction editor command, or to a mouse event with the set mouseAction editor command.
LpexView.defineAction(java.lang.String, com.ibm.lpex.core.LpexAction)
,
LpexBaseAction
,
Samples
Method Summary | |
---|---|
boolean |
available(LpexView lpexView)
This method in the defined action will be called to query its availability. |
void |
doAction(LpexView lpexView)
This method in the defined action will be called to run it. |
Method Detail |
---|
void doAction(LpexView lpexView)
An action may be run (for example, from the LPEX command line) with the action editor command, by selecting an associated menu item, or by activating the key or the mouse event to which the action is assigned.
lpexView
- the document view in which the action is issuedboolean available(LpexView lpexView)
When this method returns false
, menu items associated
with this user action will be disabled, the key or mouse event to which
this action is assigned will not run it, and neither will the
action command.
lpexView
- the document view for which the action availability is
queried
|
LPEX 3.6.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |