New test script generation algorithm
Create new plug-in project.
Lets start by adding a new entry in the context menu that will allow the algorithm execution. To do this, in the plugin.xml file it is neccessary to add 3 extensions. The first is a command to be executed and shall be similar to:
<extension point="org.eclipse.ui.commands"> <category name="Paradigm" description="Commands related to Paradigm diagrams." id="org.eclipse.gmf.category.Paradigm"/> <command categoryId="org.eclipse.gmf.category.Paradigm" description="Generate Test Script" id="paradigm.GenerateTestScript" name="Generate Test Script"> </command> </extension>
The second is an handler of the command and it will be similar to:
<extension point="org.eclipse.ui.handlers"> <handler class="paradigm.diagram.scriptGenerator.GenerateTestScript" commandId="paradigm.GenerateTestScript"> </handler> </extension>
Note the class attribute that identifies the class to be executed when the command is executed.
Finally the third extension is the menu entry:
<extension id="generate.paths" point="org.eclipse.ui.menus"> <menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions"> <command commandId="paradigm.GenerateTestScript" label="Generate Test Script"> <visibleWhen> <with variable="activeMenuSelection"> <iterate> <instanceof value="Paradigm.diagram.edit.parts.ModelEditPart"/> </iterate> </with> </visibleWhen> </command> </menuContribution> </extension>
Next create the class referenced in the handler.
This class extends AbstractHandler and implements the execute method. In this method you may implement the new test script generation algorithm.