Develop > Presentation layer > Customize IBM Sales Center > Menu actions


Add a menu action

The default IBM Sales Center actions are defined by the com.ibm.commerce.telesales.ui.actionSetGroups extension-point. This extension point allows you to specify a list of actionSet IDs and an ID for the whole group. When a IBM Sales Center perspective is loaded, it will use a predefined ID to determine which action set group to use. You can use the system configurator plug-in to override an entire action set group, or a specific action set that already defined as part of the action set.

To define a new menu action:


Procedure

  1. Define the actions using the base eclipse extension point org.eclipse.ui.actionSets. The following sample defines a single action in an action set:

    <extension
             point="org.eclipse.ui.actionSets">   
    <actionSet
             label="Sample Action Set"
             id="extensions.extendedActionSet">      
    <action
                   label=""
                   
                   menubarPath="store/additions"
                   id="extensions.ExtendedAction">      
    </action>   
    </actionSet>
    </extension>
    

  2. When writing a new workbench action delegate class, make sure to extend from the com.ibm.commerce.telesales.ui.actions.TelesalesWorkbenchActionDelegate class. The real work for a IBM Sales Center workbench action is done in an action registered with the com.ibm.commerce.telesales.ui.actions extension point.

    package extensions; 
    import org.eclipse.jface.action.Action; 
    public class ExtendedAction extends Action {
            public void run() {
                    System.out.println("running extended action");         }
    }
    

    ExtendedWorkbenchActionDelegate.java
    
    package extensions; 
    import org.eclipse.jface.action.IAction; 
    import
    com.ibm.commerce.telesales.ui.actions.TelesalesWorkbenchActionDelegate; 
    public class ExtendedWorkbenchActionDelegate extends
    TelesalesWorkbenchActionDelegate {
            public void init(IAction action) {
                    super.init(action);                 
                action.setEnabled(true);                 action.setText("my action");                 action.setToolTipText("my action tool tip text");                 action.setDescription("my action description");         }
    
            /**
             * Indicate that the real work is to be delegated to the
    action 
             * registered under "extensions.ExtendedAction".
             * 
             * @see
    com.ibm.commerce.telesales.ui.actions.TelesalesWorkbenchActionDelegate#getDelegateActionId()
             */
            public String getDelegateActionId() {
                    return "extensions.ExtendedAction";         }
    }
    

  3. Indicate the ID of the delegate action in the getDelegateActionId method (see preceding example).

  4. (Optional) Set the action attributes in the init(IAction action) method. For example:

       public void init(IAction action) {
                    super.init(action);                 
                    action.setText("my action");                 action.setToolTipText("my action tool tip text");                 action.setDescription("my action description");         }
    

  5. (Optional) Extend the following methods:

    • public String getActionDefinitionId()
      

    • public String getHelpContextId()
      

  6. To include the new action in the action set group for a perspective:

    1. Define a new action set group

    2. Use the system configurator to indicate that the action set group will be used instead of the default one. In normal circumstances you will include all of the default action sets as well as the new one. This can be done by referencing the default action set group in the action set group definition. The following sample is a new action set group definition for the Orders perspective that includes the test.actionSet action set.

      
    <extension
             name="Extended Orders Perspective ActionSet Group"
             point="com.ibm.commerce.telesales.ui.actionSetGroups">      
    <actionSetGroup id="extensions.actionSetGroup.orders">         
    <actionSetGroupContribution
    actionSetGroupId="com.ibm.commerce.telesales.actionSetGroup.orders"/>         
    <actionSetContribution
    actionSetId="extensions.extendedActionSet"/>      
    </actionSetGroup>   
    </extension>
    

    This sample also requires that you add the following entry to your system configurator file:

    com.ibm.commerce.telesales.actionSetGroup.orders=extensions.actionSetGroup.orders
    


Results


Related concepts

Menu actions

System configurator


Related tasks

Add a dialog

Remove a menu action

Replace a context menu action

Extend a menu action

Extend roles and activity sets

Replace a menu action

Related reference

IBM Sales Center samples: Actions, dialogs, editors and requests


+

Search Tips   |   Advanced Search