diff options
author | Yana Stamcheva <yana@jitsi.org> | 2008-03-18 15:21:41 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2008-03-18 15:21:41 +0000 |
commit | a58a2d587ea8e8c54aaf8fd629c368fab1ac9844 (patch) | |
tree | 9c0f0b86a588d4c0aba003489e5ed69540eb7337 /src/net/java/sip/communicator/plugin/whiteboard | |
parent | 9f61ba8d4339278ee2f7a3ab065593da9153dc68 (diff) | |
download | jitsi-a58a2d587ea8e8c54aaf8fd629c368fab1ac9844.zip jitsi-a58a2d587ea8e8c54aaf8fd629c368fab1ac9844.tar.gz jitsi-a58a2d587ea8e8c54aaf8fd629c368fab1ac9844.tar.bz2 |
Change GUI plugin architecture to fit OSGI.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/whiteboard')
-rw-r--r-- | src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java | 24 | ||||
-rw-r--r-- | src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java | 33 |
2 files changed, 38 insertions, 19 deletions
diff --git a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java index 18f3aa3..1bd01ad 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java @@ -39,23 +39,21 @@ public class WhiteboardActivator implements BundleActivator { bundleContext = bc; - ServiceReference uiServiceRef - = bc.getServiceReference (UIService.class.getName ()); + session = new WhiteboardSessionManager (); - uiService = (UIService) bc.getService (uiServiceRef); + WhiteboardMenuItem whiteboardPlugin = new WhiteboardMenuItem (session); - session = new WhiteboardSessionManager (); + Hashtable<String, String> containerFilter + = new Hashtable<String, String>(); + containerFilter.put( + Container.CONTAINER_ID, + Container.CONTAINER_CONTACT_RIGHT_BUTTON_MENU.getID()); - if(uiService.isContainerSupported ( - UIService.CONTAINER_CONTACT_RIGHT_BUTTON_MENU)) - { - WhiteboardMenuItem whiteboardPlugin = - new WhiteboardMenuItem (session); + bundleContext.registerService( PluginComponent.class.getName(), + whiteboardPlugin, + containerFilter); - uiService.addComponent ( - UIService.CONTAINER_CONTACT_RIGHT_BUTTON_MENU, - whiteboardPlugin); - } + logger.info("WHITEBOARD... [REGISTERED]"); } /** diff --git a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java index b2d06d3..ebd0d02 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java @@ -21,10 +21,12 @@ import net.java.sip.communicator.service.protocol.*; * @author Julien Waechter */ public class WhiteboardMenuItem - extends JMenu - implements ContactAwareComponent, + implements PluginComponent, ActionListener { + private JMenu whiteboardMenu + = new JMenu(Resources.getString("whiteboardMenuItemText")); + /** * The current meta contact */ @@ -42,9 +44,8 @@ public class WhiteboardMenuItem */ public WhiteboardMenuItem (WhiteboardSessionManager session) { - super (Resources.getString("whiteboardMenuItemText")); this.session = session; - this.setIcon (Resources.getImage ("mpenIcon")); + this.whiteboardMenu.setIcon (Resources.getImage ("mpenIcon")); } /** @@ -56,7 +57,7 @@ public class WhiteboardMenuItem { this.metaContact = metaContact; - this.removeAll(); + this.whiteboardMenu.removeAll(); Iterator iter = metaContact.getContacts(); while (iter.hasNext()) @@ -83,7 +84,7 @@ public class WhiteboardMenuItem Resources.getString("whiteboardMenuItemNotSupportedTooltip")); } - this.add(contactItem); + this.whiteboardMenu.add(contactItem); } } @@ -117,4 +118,24 @@ public class WhiteboardMenuItem session.initWhiteboard (contact); } } + + public String getConstraints() + { + return null; + } + + public Container getContainer() + { + return Container.CONTAINER_CONTACT_RIGHT_BUTTON_MENU; + } + + public Object getComponent() + { + return whiteboardMenu; + } + + public String getName() + { + return whiteboardMenu.getText(); + } }
\ No newline at end of file |