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

yanas at dev.java.net yanas at dev.java.net
Thu Apr 26 23:43:51 CEST 2007


User: yanas   
Date: 2007-04-26 21:43:51+0000
Modified:
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/ToolsMenu.java

Log:
 add plugin component listeners for containers that accept plugin components

File Changes:

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

File [changed]: ContactRightButtonMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java?r1=1.48&r2=1.49
Delta lines:  +2 -0
-------------------
--- ContactRightButtonMenu.java	2007-04-12 15:33:46+0000	1.48
+++ ContactRightButtonMenu.java	2007-04-26 21:43:48+0000	1.49
@@ -343,6 +343,8 @@
             if (o instanceof ContactAwareComponent)
                 ((ContactAwareComponent)o).setCurrentContact(contactItem);
         }
+        
+        GuiActivator.getUIService().addPluginComponentListener(this);
     }
     
     private void initMnemonics()

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

File [changed]: ToolsMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/ToolsMenu.java?r1=1.8&r2=1.9
Delta lines:  +46 -5
--------------------
--- ToolsMenu.java	2007-04-11 14:15:53+0000	1.8
+++ ToolsMenu.java	2007-04-26 21:43:49+0000	1.9
@@ -9,17 +9,16 @@
 
 import java.awt.*;
 import java.awt.event.*;
+import java.util.*;
 
 import javax.swing.*;
 
-import org.osgi.framework.*;
-
 import net.java.sip.communicator.impl.gui.*;
 import net.java.sip.communicator.impl.gui.customcontrols.*;
 import net.java.sip.communicator.impl.gui.i18n.*;
 import net.java.sip.communicator.impl.gui.main.*;
-import net.java.sip.communicator.impl.gui.main.account.*;
 import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.gui.event.*;
 import net.java.sip.communicator.util.*;
 /**
  * The <tt>FileMenu</tt> is a menu in the main application menu bar that
@@ -29,7 +28,8 @@
  */
 public class ToolsMenu
     extends SIPCommMenu 
-    implements ActionListener
+    implements  ActionListener,
+                PluginComponentListener
 {
 
     private Logger logger = Logger.getLogger(ToolsMenu.class.getName());
@@ -60,6 +60,30 @@
         
         this.setMnemonic(Messages.getI18NString("tools").getMnemonic());
         this.configMenuItem.setMnemonic(settingsString.getMnemonic());
+        
+        this.initPluginComponents();
+    }
+
+    /**
+     * Initialize plugin components already registered for this container.
+     */
+    private void initPluginComponents()
+    {   
+        Iterator pluginComponents = GuiActivator.getUIService()
+            .getComponentsForContainer(
+                UIService.CONTAINER_TOOLS_MENU);
+        
+        if(pluginComponents.hasNext())
+            this.addSeparator();
+        
+        while (pluginComponents.hasNext())
+        {
+            Component o = (Component)pluginComponents.next();
+            
+            this.add(o);
+        }
+        
+        GuiActivator.getUIService().addPluginComponentListener(this);
     }
 
     /**
@@ -76,4 +100,21 @@
             configDialog.setVisible(true);
         }
     }
+
+    public void pluginComponentAdded(PluginComponentEvent event)
+    {
+        Component c = (Component) event.getSource();
+        
+        this.add(c);
+        
+        this.revalidate();
+        this.repaint();
+    }
+
+    public void pluginComponentRemoved(PluginComponentEvent event)
+    {
+        Component c = (Component) event.getSource();
+        
+        this.remove(c);
+    }
 }




---------------------------------------------------------------------
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