WebSphere Commerce EnterpriseWebSphere Commerce Professional

Adding a dialog

Dialogs are a common user interface element in the IBM Sales Center. Dialogs are used when the user chooses to perform an action and needs to provide additional information. This section explains how to add a dialog.

Procedure

  1. Define a new dialog using the dialogs extension point. Using this extension point will allow others to replace or extend your dialog and it will allow you to reuse the same mechanism for launching and managing the dialog that the IBM Sales Center uses. Create a new plugin.xml (or add to your plugin.xml) as follows:
    
    <?xml version="1.0" encoding="UTF-8"?>
    <?eclipse version="3.0"?>
    <plugin>
       <extension
    point="com.ibm.commerce.telesales.configurator">
          <configurator path="config"/>
       </extension>
       <extension point="com.ibm.commerce.telesales.ui.dialogs">
    <!-- custom dialog -->
          <dialog
                
                id="extensions.customDialog">
          </dialog>
       </extension>
    </plugin>
    
  2. Create a new Java class extending org.eclipse.jface.dialogs.Dialog:
    
    package extensions;
    
    import org.eclipse.jface.dialogs.Dialog;
    
    import com.ibm.commerce.telesales.ui.TelesalesUIPlugin;
    
    public class CustomDialog extends Dialog {
            public CustomDialog() {
            super(TelesalesUIPlugin.getTopMostShell());
        }
    }
    

    Note: The IBM Sales Center provides the following dialog base classes in the com.ibm.commerce.telesales.ui.dialogs package:

    Dialog
    A base class for dialogs.
    ConfiguredDialog
    A subclass of Dialog that provides support for managed composites.
    ConfiguredMessageLineDialog
    A subclass of Dialog that provides support for managed composites and a message line area.
    TitleAreaDialog
    A base class for dialogs with a title area.
    ConfiguredTitleAreaDialog
    A subclass of TitleAreaDialog that provides support for managed composites.
  3. Provide a way to open your new dialog. You can open it programmatically or add a menu action or button.

    Dialogs are instantiated using the getDialog method on the com.ibm.commerce.telesales.ui.dialogs.DialogFactory class. For example:

    
    IDialog myDialog =
    DialogFactory.getDialog("extension.customDialog");
    
    
    myDialog.open(); //show the dialog