1 package org.columba.chat.command; 19 20 import javax.swing.JOptionPane ; 21 22 import org.columba.api.command.ICommandReference; 23 import org.columba.api.command.IWorkerStatusController; 24 import org.columba.chat.Connection; 25 import org.columba.chat.ui.frame.api.IChatFrameMediator; 26 import org.columba.core.command.Command; 27 import org.columba.core.gui.frame.FrameManager; 28 import org.jivesoftware.smack.XMPPException; 29 30 public class AddContactCommand extends Command { 31 32 private PopulateRoasterCommand populateCommand; 33 34 public AddContactCommand(IChatFrameMediator mediator, 35 ICommandReference reference) { 36 super(reference); 37 38 39 populateCommand = new PopulateRoasterCommand(mediator, reference); 40 41 } 42 43 46 @Override  47 public void updateGUI() throws Exception { 48 populateCommand.updateGUI(); 49 } 50 51 @Override  52 public void execute(IWorkerStatusController worker) throws Exception { 53 ChatCommandReference ref = (ChatCommandReference) getReference(); 54 55 try { 56 String jabberId = ref.getJabberId(); 57 58 Connection.XMPPConnection.getRoster().createEntry(jabberId, 60 "", null); 61 62 populateCommand.execute(worker); 63 64 } catch (XMPPException e) { 65 JOptionPane.showMessageDialog(FrameManager.getInstance() 66 .getActiveFrame(), e.getMessage()); 67 e.printStackTrace(); 68 } 69 } 70 71 } 72 | Popular Tags |