The available action bar configuration options documentation lists all possible configuration options you can use with the default Lucy actions.

The TLcyActionBarManager allows you to re-use this mechanism for your own actions and active settables:

  1. Create your own ILcdAction or ILcyActiveSettable implementation.

  2. Add an identifier key-value pair to the action or active settable using the putValue method.

    ILcdAction action = createAction();
    //add identifier
    String identifier = "MyOpenAction";
    action.putValue(TLcyActionBarUtil.ID_KEY, identifier);
  3. Add the necessary configuration options for that action. In this example, we stick to the required item property which defines the location.

    # Configure the location of the action, using the same identifier

    In this example, the action is inserted into an action bar with the name "toolBar".

  4. Use the TLcyActionBarUtil.insertInConfiguredActionBars method to register the action.

    TLcyActionBarManager actionBarManager = aLucyEnv.getUserInterfaceManager().getActionBarManager();
    //Obtain a parsed version of the configuration file, e.g. by using a TLcyStringPropertiesCodec
    //If using an ALcyPreferencesAddOn, you can use ALcyPreferencesAddOn#getPreferences()
    ALcyProperties configuration = parseConfigurationFile();
    //When inserting an action, you need to specify the context. Typically this is:
    //null for global action like for example an action to exit the application
    //the map component for an action which works on a specific map, like an action to open data
    Object context = mapComponent;
    //Insert the action in all configured locations
    //In case the configuration file contains other settings (shortDescription, smallIcon, ...),
    //these will be also set on the action

    The TLcyActionBarUtil.insertInConfiguredActionBars method uses the identifier stored in the action (step 2) to find the relevant settings from the configuration. In this example, it will detect that the action must be registered for an action bar with the name "toolBar" (step 3).

    As explained in The action bar API, the action bar manager uses both a name and a context to identify an action bar. The name is retrieved from the configuration file. The context is passed to the TLcyActionBarUtil.insertInConfiguredActionBars method as a parameter. In this example, the context is the mapComponent variable.

    This means that only the name part of the action bar identifier is configurable, and not the context. This makes sense as the action is written for a specific context.

If you want to insert your action in a specific, hard-coded location, there is no need to use the configuration file and the TLcyActionBarUtil utility method. You can use the API of the action bar manager ,TLcyActionBarUtil.getActionBar, and call ILcyActionBar.insertAction, to insert the action directly. However, if you want to be able to change the location at a later time, through a configuration file modification, this option is not recommended.