Sometimes, you want to have programmatic access to an existing action in one of the available action bars, for example to
trigger the action through your own code.
Because all actions are registered with the
TLcyActionBarManager, you can retrieve it from there.
The following example shows how to get a reference to the File→ Exit action:
TLcyActionBarManager actionBarManager = lucy.getUserInterfaceManager().getActionBarManager(); String actionID = "TLcyMain.exitAction"; String actionBarName = "menuBar"; // Typical contexts are null for global (=application wide) action bars, // and a map component for action bars associated with a map Object actionBarContext = null; ILcdAction exitAction = TLcyActionBarUtil.findAction(actionID, actionBarName, actionBarContext, actionBarManager);
See How to find the IDs of the available actions, tool bars, menu bars and pop-up menus for more information on retrieving the IDs of the action and the action bar.
Note that the same approach can be used to retrieve an