1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package sk.uniba.euromath.editor.actions;
17
18 import java.util.Map;
19
20 import org.eclipse.gef.ui.actions.ActionRegistry;
21 import org.eclipse.jface.action.IAction;
22 import org.eclipse.jface.action.ICoolBarManager;
23 import org.eclipse.jface.action.IMenuManager;
24 import org.eclipse.jface.action.IStatusLineManager;
25 import org.eclipse.jface.action.IToolBarManager;
26
27 import sk.uniba.euromath.editor.IEditor;
28
29 /***
30 * <h2> Contributor to global bars like menu, status line, tool bar, cool bar
31 * and to local bars like context menu. </h2>
32 *
33 * There are two possibilities to contribute to global bar:
34 * <ul>
35 * <li>contribute to bar with not shareable contribution item - in such case
36 * when {@link IEditor} is activated, its associated {@link IActionContributor}
37 * is asked to contribute and when is deactivated its contributions are removed.</li>
38 * <li>contribute to bar with shareable action NOT WORKING</li>
39 * </ul>
40 * <b>Contribution to local context menu<b> is done by creation of context menu
41 * and contributing to it by method contributeToContextMenu. In method init
42 * acquires global action registry for all open IEditors in all open
43 * EditorSites.
44 *
45 * @author Tomáš Studva Sep 19, 2005
46 */
47
48 public interface IActionContributor {
49
50 /***
51 * Contribute to global tool bar by modifying passed manager.
52 *
53 * @param manager
54 */
55 public void contributeToToolBar(IToolBarManager manager);
56
57 /***
58 * Contribute to status line by modifying passed manager.
59 *
60 * @param manager
61 */
62 public void contributeToStatusLine(IStatusLineManager manager);
63
64 /***
65 * Contribute to global cool bar by modifying passed manager.
66 *
67 * @param manager
68 */
69 public void contributeCoolBar(ICoolBarManager manager);
70
71 /***
72 * Contribute to global menu by modifying passed manager.
73 *
74 * @param manager
75 */
76 public void contributeToMenu(IMenuManager manager);
77
78 /***
79 * Return global action handlers, which are registred when associated
80 * IEditor is gains focus and removed when losts focus;
81 *
82 * @return Map <global action id, action handler>
83 */
84 public Map<String, IAction> getGlobalActionHandlers();
85
86 /***
87 * Initialization this contributor with access to global registry. After
88 * this call contributor can create actions and contribute using global
89 * registry. Created actions are stored globally for all open IEditors.
90 * When focus changes, actions are automatically moved to active
91 * EditorPart.
92 *
93 * @param actionRegistry
94 * global action registry
95 *
96 */
97 public void init(ActionRegistry actionRegistry);
98
99 /***
100 * Returns global action registry passed in init.
101 *
102 * @see #init(ActionRegistry)
103 *
104 * @return global action registry
105 */
106 public ActionRegistry getGlobalActionRegistry();
107
108 }