Creating actions
You can use the com.ibm.rational.common.test.editor.framework.extensions.ExtActionHandler class to remove, move up, and move down menu buttons
About this task
NewModelElementAction class as described
in the following conditions:Procedure
- For every model element displayed in the tree, the
com.ibm.rational.common.test.editor.framework.Test Editorclass expects to find an instance of thecom.ibm.rational.common.test.editor.framework.extensions.ExtActionHandlerclass and somecom.ibm.rational.common.test.editor.framework.kernel.actions.NewModelElementActions registered incom.ibm.rational.common.test.editor.framework. TestEditorplug-in’scom.ibm.rational.common.test.editor.framework.RptMenuManager. - The
ActionHandlers are declared in the plugin.xml file, while thecom.ibm.rational.common.test.editor.framework.kernel.actions.NewModelElementActionclass must be created and registered programmatically through the protocol plug-in class. Only one set of actions is needed for multiple editors, because this class is context sensitive. - The
ActionHandlers of the selected elements are asked whether to enable the Remove, Move up and Move down buttons . Thecom.ibm.rational.common.test.editor.framework.extensions.ExtActionHandlerexamines the selection, looks for the objects of the recognized types, and then returns a value of true or false. - To enable or disable Add and Insert buttons and menus, the
TestEditorclass passes the selection to each of the registeredcom.ibm.rational.common.test.editor.framework.kernel.actions.NewModelElementActioninstances. The action is expected to examine the selection, and enable or disable its state, based on whether this action can add its model object to the selected item. - The ID of each
com.ibm.rational.common.test.editor.framework.kernel.actions.NewModelElementActionor the derived type must match the type of the model object that this action represents. The ID must have the same value as the one used in themodelObjectDescriptorextension point. Thecom.ibm.rational.common.test.editor.framework.Test Editorclass uses this value to locate various providers for the specific model element. - There are two separate sets of actions maintained by the
com.ibm.rational.common.test.editor.framework.RptMenuManagerclass, the Add and the Insert actions. While objects of the same type can be registered for both, the same instances of the same class cannot. This means that two instances of theAddObjectaction must be created and registered. If the object cannot be inserted, the insert action is not required. The same is true for the add action. - If an action is selected, the action calls its correspondent
ActionHandlerto create a new model object. At this point, theActionHandlerclass must create and initialize a new model object, including any required children. The action will add the new model object to the selected parent, but only if the selected parentContentProviderreturns a list of the children that haveEListtype, the native model list. For a composite list of children, for example theArrayListassembled by provider, theActionHandleris expected to add a new child to the parent. - The protocol writers must use the LoadTestNewModelElementAction class as the base class for creating actions. The class supports filtering by feature.