1
|
package eu.etaxonomy.taxeditor.navigation;
|
2
|
|
3
|
import org.eclipse.jface.action.IMenuManager;
|
4
|
import org.eclipse.jface.action.MenuManager;
|
5
|
import org.eclipse.ui.IWorkbenchActionConstants;
|
6
|
import org.eclipse.ui.IWorkbenchWindow;
|
7
|
import org.eclipse.ui.actions.ActionFactory;
|
8
|
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
|
9
|
import org.eclipse.ui.application.ActionBarAdvisor;
|
10
|
import org.eclipse.ui.application.IActionBarConfigurer;
|
11
|
|
12
|
/**
|
13
|
* An action bar advisor is responsible for creating, adding, and disposing of
|
14
|
* the actions added to a workbench window. Each window will be populated with
|
15
|
* new actions.
|
16
|
*/
|
17
|
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
|
18
|
|
19
|
// Actions - important to allocate these only in makeActions, and then use
|
20
|
// them
|
21
|
// in the fill methods. This ensures that the actions aren't recreated
|
22
|
// when fillActionBars is called with FILL_PROXY.
|
23
|
private IWorkbenchAction exitAction;
|
24
|
|
25
|
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
|
26
|
super(configurer);
|
27
|
}
|
28
|
|
29
|
@Override
|
30
|
protected void makeActions(final IWorkbenchWindow window) {
|
31
|
// Creates the actions and registers them.
|
32
|
// Registering is needed to ensure that key bindings work.
|
33
|
// The corresponding commands keybindings are defined in the plugin.xml
|
34
|
// file.
|
35
|
// Registering also provides automatic disposal of the actions when
|
36
|
// the window is closed.
|
37
|
|
38
|
|
39
|
//FIXME E4 migrate/ delete statusLineManager
|
40
|
// StoreUtil.setStatusLineManager(getActionBarConfigurer().getStatusLineManager());
|
41
|
|
42
|
exitAction = ActionFactory.QUIT.create(window);
|
43
|
register(exitAction);
|
44
|
}
|
45
|
|
46
|
@Override
|
47
|
protected void fillMenuBar(IMenuManager menuBar) {
|
48
|
MenuManager fileMenu = new MenuManager("&File",
|
49
|
IWorkbenchActionConstants.M_FILE);
|
50
|
menuBar.add(fileMenu);
|
51
|
fileMenu.add(exitAction);
|
52
|
}
|
53
|
|
54
|
}
|