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
The editor or protocol extensions that are needed to manipulate
the test, and the test add, remove, insert specific model elements,
must use the
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 Editor class expects to find an instance of the com.ibm.rational.common.test.editor.framework.extensions.ExtActionHandler class and some com.ibm.rational.common.test.editor.framework.kernel.actions.NewModelElementActions registered in com.ibm.rational.common.test.editor.framework.
TestEditorplug-in’s com.ibm.rational.common.test.editor.framework.RptMenuManager.
- The ActionHandlers are declared in the
plugin.xml file, while the com.ibm.rational.common.test.editor.framework.kernel.actions.NewModelElementAction class 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
. The com.ibm.rational.common.test.editor.framework.extensions.ExtActionHandler examines 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 TestEditor class passes the selection to each of the registered com.ibm.rational.common.test.editor.framework.kernel.actions.NewModelElementAction instances. 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.NewModelElementAction or 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 the modelObjectDescriptor extension point.
The com.ibm.rational.common.test.editor.framework.Test Editor class 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.RptMenuManager class, 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 the AddObject action 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 ActionHandler to create a new model object. At this point,
the ActionHandler class 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
parent ContentProvider returns a list of the children
that have EList type, the native model list. For
a composite list of children, for example the ArrayList assembled by provider, the ActionHandler is 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.