import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import eu.etaxonomy.cdm.io.common.ImportWrapper;
+import eu.etaxonomy.taxeditor.actions.TaxEditorActionFactory;
import eu.etaxonomy.taxeditor.actions.io.ExportAction;
import eu.etaxonomy.taxeditor.actions.io.ImportAction;
-import eu.etaxonomy.taxeditor.actions.ui.OpenNewTaxonEditorAction;
import eu.etaxonomy.taxeditor.controller.GlobalController;
/**
private static final Logger logger = Logger
.getLogger(ApplicationActionBarAdvisor.class);
+ protected void makeActions(final IWorkbenchWindow window) {
+ GlobalController.setStatusLineManager(getActionBarConfigurer().getStatusLineManager());
+ }
+
+ protected void fillMenuBar(IMenuManager menuBar) {
+ }
+
// Actions - important to allocate these only in makeActions, and then use
// them in the fill methods. This ensures that the actions aren't recreated
// when fillActionBars is called with FILL_PROXY.
- private IWorkbenchAction exitAction;
- private IWorkbenchAction saveAction;
- private IWorkbenchAction preferencesAction;
- private IWorkbenchAction undoAction;
- private IWorkbenchAction redoAction;
-
- private IAction newNameAction;
+// private IWorkbenchAction exitAction;
+// private IWorkbenchAction saveAction;
+// private IWorkbenchAction preferencesAction;
+// private IWorkbenchAction undoAction;
+// private IWorkbenchAction redoAction;
+//
+// private IAction newNameAction;
private List<IAction> importActionList;
super(configurer);
}
- protected void makeActions(final IWorkbenchWindow window) {
+ protected void _makeActions(final IWorkbenchWindow window) {
// Creates the actions and registers them.
// Registering is needed to ensure that key bindings work.
// The corresponding commands keybindings are defined in the plugin.xml
// file.
// Registering also provides automatic disposal of the actions when
// the window is closed.
-
+
GlobalController.setStatusLineManager(getActionBarConfigurer().getStatusLineManager());
- saveAction = ActionFactory.SAVE.create(window);
- register(saveAction);
+ // File menu actions
+ register(TaxEditorActionFactory.NEW.create(window));
+ register(TaxEditorActionFactory.SAVE.create(window));
+ register(TaxEditorActionFactory.QUIT.create(window));
- undoAction = ActionFactory.UNDO.create(window);
- register(undoAction);
+ // Edit menu actions
+ register(TaxEditorActionFactory.UNDO.create(window));
+ register(TaxEditorActionFactory.REDO.create(window));
+ register(TaxEditorActionFactory.CUT.create(window));
+ register(TaxEditorActionFactory.COPY.create(window));
+ register(TaxEditorActionFactory.PASTE.create(window));
+ register(TaxEditorActionFactory.DELETE.create(window));
- redoAction = ActionFactory.REDO.create(window);
- register(redoAction);
+ // Window menu actions
+ register(TaxEditorActionFactory.PREFERENCES.create(window));
- exitAction = ActionFactory.QUIT.create(window);
- register(exitAction);
+ // Help menu actions
+ register(TaxEditorActionFactory.ABOUT.create(window));
- newNameAction = new OpenNewTaxonEditorAction();
- register(newNameAction);
- preferencesAction = ActionFactory.PREFERENCES.create(window);
makeImportActions();
register(exportJaxbAction);
}
+
private void makeImportActions() {
importActionList = new ArrayList<IAction>();
importActionList.add(importAction);
}
}
-
- protected void fillMenuBar(IMenuManager menuBar) {
-
- // Note: to hook into Eclipse File Menu, to use open File for instance,
- // replace NULL with IWorkbenchActionConstants.M_FILE);
+
+ private MenuManager FILE_MENU(){
MenuManager fileMenu = new MenuManager("&File",
- null);
-
- MenuManager editMenu = new MenuManager("&Edit", null);
+ IWorkbenchActionConstants.M_FILE);
// Create submenu for imports
MenuManager importMenu = new MenuManager("Import ...", null);
// Create submenu for exports
MenuManager exportMenu = new MenuManager("Export as ...", null);
-
+
// Populate file menu
- menuBar.add(fileMenu);
- fileMenu.add(newNameAction);
- fileMenu.add(saveAction);
+ fileMenu.add(getAction(TaxEditorActionFactory.NEW.getId()));
+ fileMenu.add(getAction(TaxEditorActionFactory.SAVE.getId()));
fileMenu.add(new Separator());
fileMenu.add(importMenu);
fileMenu.add(exportMenu);
fileMenu.add(new Separator());
- fileMenu.add(exitAction);
-
- menuBar.add(editMenu);
- editMenu.add(undoAction);
- editMenu.add(redoAction);
+ fileMenu.add(getAction(TaxEditorActionFactory.QUIT.getId()));
// Populate submenu for imports
for (IAction importAction : importActionList) {
// Populate submenu for exports
exportMenu.add(exportJaxbAction);
- // Populate preferences
- MenuManager preferencesMenu = new MenuManager("&Preferences",
- null);
- menuBar.add(preferencesMenu);
- preferencesMenu.add(preferencesAction);
+ return fileMenu;
+ }
+
+
+ private MenuManager EDIT_MENU() {
+
+ MenuManager editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
+
+ editMenu.add(getAction(TaxEditorActionFactory.UNDO.getId()));
+ editMenu.add(getAction(TaxEditorActionFactory.REDO.getId()));
+ editMenu.add(new Separator());
+ editMenu.add(getAction(TaxEditorActionFactory.CUT.getId()));
+ editMenu.add(getAction(TaxEditorActionFactory.COPY.getId()));
+ editMenu.add(getAction(TaxEditorActionFactory.PASTE.getId()));
+ editMenu.add(new Separator());
+ editMenu.add(getAction(TaxEditorActionFactory.DELETE.getId()));
+
+ return editMenu;
+ }
+
+ private MenuManager WINDOW_MENU() {
+ MenuManager windowMenu = new MenuManager("&Window",
+ IWorkbenchActionConstants.M_WINDOW);
+
+ windowMenu.add(getAction(TaxEditorActionFactory.PREFERENCES.getId()));
+
+ return windowMenu;
+ }
+
+ private MenuManager HELP_MENU(){
+ MenuManager helpMenu = new MenuManager("&Help",
+ IWorkbenchActionConstants.M_HELP);
+
+ helpMenu.add(getAction(TaxEditorActionFactory.ABOUT.getId()));
+
+ return helpMenu;
+ }
+
+ protected void _fillMenuBar(IMenuManager menuBar) {
+
+ menuBar.add(FILE_MENU());
+
+ menuBar.add(EDIT_MENU());
+
+ menuBar.add(WINDOW_MENU());
+
+ menuBar.add(HELP_MENU());
}
}
\ No newline at end of file