View Javadoc
1 package org.argosfields; 2 3 import org.argosfields.action.ActionMap; 4 import org.argosfields.action.game.QuitAction; 5 import org.argosfields.action.game.SettingsAction; 6 import org.argosfields.action.server.ConnectAction; 7 import org.argosfields.action.server.DisconnectAction; 8 import org.argosfields.action.server.StartServerAction; 9 import org.argosfields.action.server.StopServerAction; 10 import org.argosfields.action.view.ToggleInfoPanelAction; 11 import org.argosfields.action.view.ToggleMessagePanelAction; 12 import org.argosfields.resource.ResourceManager; 13 import org.eclipse.jface.action.MenuManager; 14 import org.eclipse.jface.action.Separator; 15 import org.eclipse.swt.SWT; 16 17 /*** 18 * DefaultMenuManager.java 19 * @author Xavier Cho 20 * @version $Revision: 1.1 $ $Date: 2004/04/15 05:43:55 $ 21 */ 22 public class DefaultMenuManager extends MenuManager { 23 private ActionMap actions; 24 25 private ArgosFields application; 26 private ResourceManager resources; 27 28 public DefaultMenuManager(final ArgosFields application) { 29 if (application == null) { 30 SWT.error(SWT.ERROR_NULL_ARGUMENT); 31 } 32 33 this.application = application; 34 this.actions = application.getActionMap(); 35 this.resources = ResourceManager.getInstance(); 36 37 initialize(); 38 } 39 40 protected void initialize() { 41 add(createGameMenu()); 42 add(createServerMenu()); 43 add(createViewMenu()); 44 add(createHelpMenu()); 45 } 46 47 protected MenuManager createGameMenu() { 48 String name = resources.getString("menu.game"); 49 MenuManager manager = new MenuManager(name); 50 51 manager.add(actions.get(SettingsAction.class.getName())); 52 manager.add(new Separator()); 53 manager.add(actions.get(QuitAction.class.getName())); 54 55 return manager; 56 } 57 58 protected MenuManager createViewMenu() { 59 String name = resources.getString("menu.view"); 60 MenuManager manager = new MenuManager(name); 61 62 manager.add(actions.get(ToggleMessagePanelAction.class.getName())); 63 manager.add(actions.get(ToggleInfoPanelAction.class.getName())); 64 65 return manager; 66 } 67 68 protected MenuManager createServerMenu() { 69 String name = resources.getString("menu.server"); 70 MenuManager manager = new MenuManager(name); 71 72 manager.add(actions.get(ConnectAction.class.getName())); 73 manager.add(actions.get(DisconnectAction.class.getName())); 74 manager.add(new Separator()); 75 manager.add(actions.get(StartServerAction.class.getName())); 76 manager.add(actions.get(StopServerAction.class.getName())); 77 78 return manager; 79 } 80 81 protected MenuManager createHelpMenu() { 82 String name = resources.getString("menu.help"); 83 MenuManager manager = new MenuManager(name); 84 85 return manager; 86 } 87 }

This page was automatically generated by Maven