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


Extend a context 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. This section explains how to extend a context menu action.


Procedure

  1. Extend the context menu action's implementation class using the API documentation for that class. These sample classes add two new actions to the stores view popup menu and overrides the behavior of the open store action:

    package extensions; 
    import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; 
    public class ExtendedCustomerActionDelegate implements
    IObjectActionDelegate {
    
            public void setActivePart(IAction arg0, IWorkbenchPart
    arg1) {
            }
    
            public void run(IAction arg0) {
                   
    System.out.println("ExtendedCustomerActionDelegate");         }
    
            public void selectionChanged(IAction arg0, ISelection arg1)
    {
            }
    
    }
    

    package extensions; 
    import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IViewActionDelegate; import org.eclipse.ui.IViewPart; 
    
    public class ExtendedStoresViewActionDelegate implements
    IViewActionDelegate {
    
            public void init(IViewPart arg0) {
            }
    
            public void run(IAction arg0) {
                    System.out.println("Extended stores view action
    delelgate");         }
    
            public void selectionChanged(IAction arg0, ISelection arg1)
    {
            }
    
    }
    

    This class overrides the behavior of the open store action:

    package extensions; 
    import com.ibm.commerce.telesales.ui.impl.actions.OpenStoreAction; 
    public class ExtendedOpenStoreAction extends OpenStoreAction {
            public void run() {
                    System.out.println("Extended open store action");                 super.run();         }
    }
    

  2. Define an extension definition of the com.ibm.commerce.telesales.ui.actions extension point. The extension is defined in a new plug-in called extensions:

    Plug-in manifest file: 
    <?xml version="1.0" encoding="UTF-8"?>
    <?eclipse version="3.0"?>
    <plugin> 
      
    <extension
    point="com.ibm.commerce.telesales.configurator">      
    <configurator path="config"/>   
    </extension>
    <!-- add some new entries to the stores view popup menu -->   
    <extension point="org.eclipse.ui.popupMenus">      
    <objectContribution
                objectClass="com.ibm.commerce.telesales.model.Customer"
                adaptable="true">         
    <action
                   label="Extended Customer Action"
                   
                   menubarPath="customer.ext"
                   enablesFor="1"
                   id="extensions.ExtendedCustomerActionDelegate">         
    </action>      
    </objectContribution>      
    <viewerContribution
            targetID="com.ibm.commerce.telesales.storesView">            
    <action
    id="extensions.ExtendedStoresViewActionDelegate"
                   label="Extended Stores View Action"
                   menubarPath="additions"
                  
    class="extensions.ExtendedStoresViewActionDelegate">        
               
    </action>      
    </viewerContribution>   
    </extension>
    <!-- Register extended open store action -->   
    <extension point="com.ibm.commerce.telesales.ui.actions">      
    <action id="extensions.ExtendedOpenStoreAction"
                  />   
    </extension>    
    </plugin>
    

  3. Use the com.ibm.commerce.telesales.configurator extension point to indicate that the definition will be used instead of the default one:

    com.ibm.commerce.telesales.action.OpenStoreAction=extensions.ExtendedOpenStoreAction
    


Related concepts

System configurator


Related tasks

Add a context menu action

Remove a context menu action

Replace a context menu action


+

Search Tips   |   Advanced Search