|
Papyrus Tutorial:
How to contribute to the code
generation menu
Editor |
Saadia DHOUIB - CEA LIST |
Status |
Production |
Version number |
0.1 |
Date of preparation |
07/11/11 |
Authors name (first/last name) |
Company |
E-mail |
Initial |
|
|
|
|
Saadia Dhouib |
CEA LIST |
SD |
Version |
Date |
Reasons |
0.1 |
19/10/11 |
Initial contribution. |
|
|
|
|
|
|
|
|
|
|
|
|
This tutorial explains how to contribute to the RobotML code generation menu in the papyrus model explorer view, as shown in the following figure:
It is very important that your Eclipse projects use the J2SE-1.5, this is the java version used by papyrus. To do this, follow the steps in the table:
Step 1 click on project properties |
|
|||
Step 2 Edit the JRE system library and set it to J2SE-1.5 |
|
|||
Step 3 Set the minimum execution environment in the plug-in manifest
editor |
|
Go to the user interface project, org.eclipse.proteus.generators.acceleo.yourplatform.ui:
Then open the plug-in manifest editor.
In the Extensions corner, you are going to add a new extension that will contribute to the RobotML code generation menu.
To do this, follow the steps described in the table:
Step1 Go to the extension corner |
|
||||||||||||
Step 2 Add org.eclipse.ui.menus extension |
|
||||||||||||
Step 3 Add a new menu contribution |
|
||||||||||||
Step 4 Add a command to the menucontribution |
<extension point="org.eclipse.ui.menus"> <menuContribution allPopups="true" LocationURI= "popup:org.eclipse.papyrus.robotML.modelexplorer.popupmenu.generate"> <command commandId="org.eclipse.robotML.generateRTMapsCommand" icon="icons/default.gif" id="org.eclipse.robotML.generateRTMaps" label="Generate to RTMaps" style="push" tooltip="Generate code to RTMaps middleware"> <visibleWhen> <reference DefinitionId= "org.eclipse.papyrus.proteus.diagram.common.IsPapyrusActiveWithProteus"> </reference> </visibleWhen> </command> </menuContribution> </extension> The extension details (plugin.xml corner) |
Then add an extension point to define the code generation command called by the previously defined menu. A command is is a declarative description of a component and is independent from the implementation details. Commands are defined via the extension point "org.eclipse.ui.commands". A command can be categorized, assigned to the user interface and a key binding can be defined for the command. The behavior of a command can be defined via a handler.
Step Add a command extension point |
|
Add an extension point to define the handler of the command. The handler is used to define the command behavior.
Step Add the handler extension point |
|
You can find an example of a generation
command handler class in “org.eclipse.proteus.generators.acceleo.rtmaps.ui.handler.AcceleoGenerateRTMapsCommandHandler”
package. [Proteus wp2 svn repository: https://dassault3.ddo.net/svn/proteus-wp2/trunk/S2.2.8-RTMaps-connectors/rtmaps-generator/org.eclipse.proteus.generators.acceleo.rtmaps.ui]