1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
private IWorkbenchAction undo;
private IWorkbenchAction redo;
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
super(configurer);
}
/**
* Instanciation des actions à ajouter aux menus
* et à la barre de boutons
* Utilisation de ActionFactory pour récupérer
* les actions prédéfinies..
*/
protected void makeActions(IWorkbenchWindow window) {
undo = ActionFactory.UNDO.create(window);
redo = ActionFactory.REDO.create(window);
}
protected void fillMenuBar(IMenuManager menuBar) {
IWorkbenchWindow window = getActionBarConfigurer().getWindowConfigurer().getWindow();
menuBar.add(createEditMenu(window));
}
private MenuManager createEditMenu(IWorkbenchWindow window) {
MenuManager menuEdit = new MenuManager("Edition",IWorkbenchActionConstants.M_EDIT);
menuEdit.add(undo);
menuEdit.add(redo);
return menuEdit;
}
} |
Partager