1 19 package org.lucane.applications.shutdown; 20 21 import org.lucane.client.*; 22 import org.lucane.client.widgets.DialogBox; 23 import org.lucane.common.*; 24 import org.lucane.common.net.ObjectConnection; 25 26 public class ShutdownPlugin 27 extends StandalonePlugin 28 { 29 public ShutdownPlugin() 30 { 31 } 32 33 public Plugin newInstance(ConnectInfo[] friends) 34 { 35 return new ShutdownPlugin(); 36 } 37 38 39 public void start() 40 { 41 boolean isStartupPlugin = Client.getInstance().getStartupPlugin().equals(getName()); 42 43 if(!isStartupPlugin) 45 { 46 String msg = tr("msg.reallyShutdown"); 47 if(!DialogBox.question(getTitle(), msg)) 48 { 49 exit(); 50 return; 51 } 52 } 53 54 try { 56 ConnectInfo service = Communicator.getInstance().getConnectInfo(getName()); 57 ObjectConnection oc = Communicator.getInstance().sendMessageTo(service, getName(), ""); 58 oc.close(); 59 } catch (Exception e) { 60 Logging.getLogger().warning("Unable to send shutdown"); 61 e.printStackTrace(); 62 } 63 64 exit(); 65 } 66 } 67 | Popular Tags |