01: /*--------------------------------------------------------------------------*
02: | Copyright (C) 2006 Christopher Kohlhaas, Bettina Lademann |
03: | |
04: | This program is free software; you can redistribute it and/or modify |
05: | it under the terms of the GNU General Public License as published by the |
06: | Free Software Foundation. A copy of the license has been included with |
07: | these distribution in the COPYING file, if not go to www.fsf.org |
08: | |
09: | As a special exception, you are granted the permissions to link this |
10: | program with every library, which license fulfills the Open Source |
11: | Definition as published by the Open Source Initiative (OSI). |
12: *--------------------------------------------------------------------------*/
13: package org.rapla.gui.internal.action;
14:
15: import java.awt.event.ActionEvent;
16:
17: import javax.swing.SwingUtilities;
18:
19: import org.rapla.framework.RaplaContext;
20: import org.rapla.framework.RaplaException;
21: import org.rapla.gui.RaplaAction;
22: import org.rapla.server.RestartServer;
23:
24: public class RestartServerAction extends RaplaAction {
25: /**
26: * @param sm
27: * @throws RaplaException
28: */
29: public RestartServerAction(RaplaContext sm) throws RaplaException {
30: super (sm);
31: putValue(NAME, getString("restart_server"));
32: putValue(SMALL_ICON, getIcon("icon.restart"));
33: }
34:
35: public void actionPerformed(ActionEvent arg0) {
36: SwingUtilities.invokeLater(new Runnable() {
37: public void run() {
38: try {
39: ((RestartServer) getService(RestartServer.class
40: .getName())).restartServer();
41: } catch (RaplaException ex) {
42: getLogger().error("Error restarting ", ex);
43: }
44: }
45: });
46: }
47:
48: }
|