MagicDraw 18.3 Documentation
You need to extend the Eclipse main menu with a Plugin command. Conventionally you do not need to write any additional code so that the main menu of a program was extended with some specific commands brought by a plugin after the plugin is installed. However, this is necessary when the same plugin is installed on a modeling tool which is integrated with Eclipse.
If an additional command should appear on the main menu or an additional button should be placed on the main toolbar in a modeling tool after the plugin installation, you need to create an Eclipse bundle that tells Eclipse where the command or the button should be placed.
Example: Extending the Eclipse main menu with an additional command brought by a program plugin
Let's say you have already created a plugin for your modeling tool, that is MagicDraw in this example, that extends the main menu of a program with a command whose id, for example, is "CUSTOM_ACTION_ID".
To extend the Eclipse main menu with this command
- Create a class for an Eclipse bundle to extend the com.nomagic.magicdraw.integrations.eclipse.rcp.actions.MDEclipseActionWrapper class.
This is an example of an Eclipse bundle class that connects to a MagicDraw command by its id "CUSTOM_ACTION_ID":
This is a general way of connecting to an Eclipse the command org.eclipse.ui.actions.ActionDelegate that should be placed on the Eclipse main menu.
2. Create a descriptor (a plugin.xml file) for the Eclipse bundle to place the command on the Eclipse main menu.
This is an example of a descriptor that should place the command with id "CUSTOM_ACTION_ID" under the Diagrams > Diagram Wizards menu:
This is a general way of adding a command to the Eclipse main menu.
3. Pack the command class with the Eclipse bundle descriptor to an Eclipse bundle (a .jar file) and save the file in <MagicDraw installation directory>\plugins\eclipse\plugins.
4. Integrate your modeling tool with Eclipse.
5. Start Eclipse. The new command appears on the Eclipse main menu.
<MagicDraw installation directory>\plugins\eclipse\plugins contains MagicDraw plugins that have commands to appear on the Eclipse main menu. Their plugin.xml files can be used as examples too. Accordingly it is the same with other modeling tools developed by No Magic Inc.