In Lucy, you can add and remove actions to and from the menu bars, tool bars and pop-up menus. It is also possible to change the location in the UI of existing actions, or even add existing actions to your own tool bar.

All of those Lucy UI components are conceived as configured action bars, allowing for a high degree of customization by means of configuration files. To configure an action in an action bar, you need to identify both the action and the action bar. That means that you need to find:

  • The action bar ID: the unique identifier associated with each menu bar, tool bar or pop-up menu.

  • The action ID: the unique identifier associated with each action.

For some use cases, you also need to find:

  • The configuration file that determines whether the action is inserted, and in which location. This is required when you want to remove an action from the UI, for example.

  • The context of the action: you need to identify the context if you want to insert your own actions programmatically in one of the available tool bars, pop-up menus or menu bars. Some actions affect a specific map. For example, the Open action loads data on a specific map. Such actions have the map as context. Other actions, such as the Exit action, have an effect across the whole application. Those actions have null as context.

Steps to take

  1. You need to make use of the Lucy debug addon. Make sure that your addons.xml file includes the entry for the TLcyDebugAddOn:

    <addon>
      <priority>early</priority>
      <name/>
      <!-- No name, to avoid that it shows up in the UI -->
      <class>com.luciad.lucy.addons.debug.TLcyDebugAddOn</class>
      <configFile>lucy/debug/TLcyDebugAddOn.cfg</configFile>
    </addon>

    Or, if you want to use Lucy MapCentric:

    <addon>
      <priority>early</priority>
      <name/>
      <!-- No name, to avoid that it shows up in the UI -->
      <class>com.luciad.lucy.addons.debug.TLcyDebugAddOn</class>
      <configFile>samples/frontend/mapcentric/map_centric_TLcyDebugAddOn.cfg</configFile>
    </addon>

    Each addon XML file that comes with the release includes this add-on.

    See How to customize the add-ons used by your application for more information about adding add-ons to your application.

  2. Add the -Dlucy.debug=true JVM argument: the TLcyDebugAddOn will only be activated if this argument is set.

    • For regular Lucy and Lucy GXY, we included debug start-up scripts alongside the regular start-up scripts that do just that. Simply run LucyDebug.sh or LucyDebug.bat.

    • For Lucy MapCentric: the LucyMapCentric.sh or LucyMapCentric.bat file contain instructions for modifying JVM arguments.

  3. Start Lucy, and activate the Debug | Debug actions menu item. If it was not active yet, you need to restart Lucy after activating the menu item.

    Lucy now displays blue borders around all the menu bars, tool bars and pop-up menus.

    This might not work if you are using a custom logging framework. If that is the case, make sure that TRACE logging is enabled for the ILcdLogger of the ALcyActionBar class if you want to see the blue borders. Consult the Logging documentation for more information about logging in LuciadLightspeed.

  4. Retrieve the action ID and context through the tool tip of the action. In addition to the blue borders, Lucy Debug also displays custom tool tips with ID and context information. Hover over an action item to see the custom tool tip:

    debug tooltip menu item
  5. The action ID also suggests in which configuration file you can find the action. For example, in the previous tool tip screenshot, the ID is TLcyMapAddOn.openFileAction. Therefore, the configuration file that contains the definition for this action is the TLcyMapAddOn configuration file.

  6. Retrieve the ID of the action bar through the tool tip of the menu bar, tool bar or pop-up menu:

    debug tooltip action bar