Overview

 
Package  Use  Tree  Serialized  Deprecated  Index  Help 
SWT LPEX
v3.0.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD


 

com.ibm.lpex.core
Interface LpexAction

All Known Implementing Classes:
BlockTransferAction, ComposeAction, CopyLineAction, LpexBaseAction, SetDateAction, TestAction


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.

See Also:
LpexView.defineAction(java.lang.String, com.ibm.lpex.core.LpexAction), TestAction, CopyLineAction, TestUserProfile, LpexBaseAction


Method Summary
 boolean available(LpexView lpexView)
          This method in the defined action will be called to query the availability of the action.
 void doAction(LpexView lpexView)
          This method in the defined action will be called to run the action.
 

Method Detail

 

 

doAction

public void doAction(LpexView lpexView)

This method in the defined action will be called to run the action.

An action may be run (e.g., 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.

Parameters:
lpexView - the document view in which the action is issued


 

 

available

public boolean available(LpexView lpexView)

This method in the defined action will be called to query the availability of the action.

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.

Parameters:
lpexView - the document view for which the action availability is queried


 

Overview

 
Package  Use  Tree  Serialized  Deprecated  Index  Help 
SWT LPEX
v3.0.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD