[sip-comm-cvs] CVS update: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java

yanas at dev.java.net yanas at dev.java.net
Tue Apr 17 17:34:22 CEST 2007


User: yanas   
Date: 2007-04-17 15:34:22+0000
Log:
 In the accounts menu, instead of storing the accountID, we store the ProtocolProviderService.

File Changes:

Directory: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/
=====================================================================================

File [changed]: GroupRightButtonMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java?r1=1.19&r2=1.20
Delta lines:  +29 -7
--------------------
--- GroupRightButtonMenu.java	2007-03-12 17:40:55+0000	1.19
+++ GroupRightButtonMenu.java	2007-04-17 15:34:20+0000	1.20
@@ -83,8 +83,7 @@
             
             String protocolName = pps.getProtocolName();
             
-            JMenuItem menuItem = new JMenuItem(pps.getAccountID()
-                    .getUserID(),
+            AccountMenuItem menuItem = new AccountMenuItem(pps,
                     new ImageIcon(createAccountStatusImage(pps)));
             
             menuItem.setName(protocolName);
@@ -146,12 +145,13 @@
         String itemText = item.getText();
         String itemName = item.getName();
         
-        if(itemName.equals("removeGroup")) {
-            
+        if(itemName.equals("removeGroup"))
+        {   
             if(group != null) 
                 new RemoveGroupThread(group).start();                
         }
-        else if(itemName.equals("renameGroup")) {
+        else if(itemName.equals("renameGroup"))
+        {
             
             RenameGroupDialog dialog = new RenameGroupDialog(
                     mainFrame, group);
@@ -167,9 +167,10 @@
             
             dialog.requestFocusInFiled();
         }
-        else if(mainFrame.getProtocolProviderForAccount(itemText) != null) {
+        else if(item instanceof AccountMenuItem)
+        {
             ProtocolProviderService pps 
-                = mainFrame.getProtocolProviderForAccount(itemText);
+                = ((AccountMenuItem)item).getProtocolProvider();
             
             AddContactDialog dialog = new AddContactDialog(
                     mainFrame, group, pps);
@@ -303,4 +304,25 @@
         }
         return img;
     }
+ 
+    /**
+     * The <tt>AccountMenuItem</tt> is a <tt>JMenuItem</tt> that stores a
+     * <tt>ProtocolProviderService</tt> in it.
+     */
+    private class AccountMenuItem extends JMenuItem
+    {
+        private ProtocolProviderService pps;
+        
+        public AccountMenuItem(ProtocolProviderService pps, Icon icon)
+        {
+            super(pps.getAccountID().getUserID(), icon);
+            
+            this.pps = pps;
+        }
+        
+        public ProtocolProviderService getProtocolProvider()
+        {
+            return pps;
+        }
+    }
 }




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe at sip-communicator.dev.java.net
For additional commands, e-mail: cvs-help at sip-communicator.dev.java.net





More information about the commits mailing list