View Javadoc
1 package org.argosfields.action.server; 2 3 import org.argosfields.ArgosFields; 4 import org.argosfields.action.BaseAction; 5 import org.argosfields.multi.server.GameServer; 6 import org.argosfields.multi.server.IGameServer; 7 import org.argosfields.multi.server.IServerStatusListener; 8 import org.argosfields.resource.ResourceManager; 9 import org.argosfields.util.ExceptionHandler; 10 import org.eclipse.swt.widgets.Event; 11 12 /*** 13 * StopServerAction.java 14 * 15 * @author Xavier Cho 16 * @version $Revision: 1.3 $ $Date: 2004/04/15 05:42:44 $ 17 */ 18 public class StopServerAction extends BaseAction { 19 20 private IGameServer server; 21 22 public StopServerAction(final ArgosFields application) { 23 super(application); 24 25 this.server = GameServer.getInstance(); 26 27 setEnabled(server.isRunning()); 28 29 server.addServerStatusListener(new IServerStatusListener() { 30 31 public void serverStarted(final GameServer server) { 32 setEnabled(true); 33 } 34 35 public void serverStopped(final GameServer server) { 36 setEnabled(false); 37 } 38 }); 39 } 40 41 /*** 42 * @see org.eclipse.jface.action.IAction#runWithEvent(org.eclipse.swt.widgets.Event) 43 */ 44 public void runWithEvent(final Event event) { 45 try { 46 server.stop(); 47 } catch (Exception e) { 48 ResourceManager resources = ResourceManager.getInstance(); 49 50 String msg = resources.getString("error.server.stop"); 51 ExceptionHandler.handleException(msg, e); 52 } 53 } 54 }

This page was automatically generated by Maven