Merge commit '42b2e5ca519766e37ce6941ba4faecc9691cc403' into upstream
[debian/openrocket] / core / src / net / sf / openrocket / gui / plugin / SwingMenuPlugin.java
1 package net.sf.openrocket.gui.plugin;
2
3 import javax.swing.Action;
4
5 import net.sf.openrocket.document.OpenRocketDocument;
6 import net.sf.openrocket.gui.main.BasicFrame;
7
8 /**
9  * A plugin that provides a menu item to the Swing GUI menus.
10  * This may open a dialog window or perform some other action on
11  * the current document.
12  * <p>
13  * During plugin discovery, the BasicFrame and OpenRocketDocument
14  * objects are passed to the plugin.
15  * 
16  * @author Sampo Niskanen <sampo.niskanen@iki.fi>
17  */
18 public interface SwingMenuPlugin {
19         
20         /**
21          * Return the menu position where the action is placed.
22          * The first string in the array indicates the menu to place
23          * the item in, the second is the sub-menu, the third is the
24          * sub-sub-menu etc.
25          * <p>
26          * The strings are translated menu names.
27          * 
28          * @return      the menu position for the action
29          */
30         public String[] getMenuPosition();
31         
32         /**
33          * Return the Action that the menu item performs.  This contains
34          * the menu item text and may contain an icon.
35          * 
36          * @return      the action to perform on the menu item.
37          */
38         public Action getAction(BasicFrame frame, OpenRocketDocument document);
39         
40 }