[sip-comm-dev] Lions and Tigers and BundleExceptions OH MY!

Yana Stamcheva yana at sip-communicator.org
Tue Jul 28 11:41:28 CEST 2009


Hi Brett,

On Jul 28, 2009, at 10:35 AM, Geren, Brett wrote:

>
>> One quick question, why do you exactly need the current Contact? In
>> UIService we have a method called getCurrentChat(), would you think
>> that it could give you what you need?
>
> This would work quite well, I just didn't know how to get access to  
> the UIService, although
> it looks like you know :).

The UIService is "exported" from the swing-ui bundle (have a look at  
swing.ui.manifest.mf export section). This means that any plugin (any  
bundle in general) could  "import" it by simply adding the  
net.java.sip.communicator.service.gui package in the import section of  
its manifest.

>
>
>> By the way, what do you exactly mean, when you're talking about a
>> "group of Contacts that are selected in the ChatWindow"? Currently
>> we're not able to select more than one Contact tab.
>
> Sorry, I think I didn't explain this well. I meant the MetaContact  
> which as I understand it can represent multiple Contacts.

Now, I think I know what you need:) You want your user agent icon  
plugin to "know", which is the currently selected MetaContact in order  
to show the correct user agent information, right? In order to show  
the user agent icon in the chat window, you should have already  
implemented the net.java.sip.communicator.service.gui.PluginComponent  
interface. In there, you have a method called  
setCurrentContact(MetaContact metaContact), where actually you should  
receive the meta contact that is currently selected. The plugin  
container you're using (which in your case is CONTAINER_CHAT_TOOL_BAR)  
should set this for you.

Now, this is how it SHOULD work, but actually I see that this is not  
implemented yet and won't work right now. What you could do is to have  
a look at the MainToolBar  
(net.java.sip.communicator.impl.gui.main.chat.toolBars.MainToolBar)  
and ChatWindow  
(net.java.sip.communicator.impl.gui.main.chat.ChatWindow) classes and  
figure out how to notify your plugin of a chat selection change. Have  
a look at the setCurrentChatPanel(ChatPanel chatPanel) in the  
ChatWindow. This is where we update all interested components that a  
new chat was selected. I think that you could simply add a method in  
the MainToolBar like: setCurrentContact(MetaContact contact), where  
you go through the registered plugins and set the MetaContact. Then  
you should just call this method in the  
ChatWindow.setCurrentChatPanel. There you could obtain the MetaContact  
by calling chatPanel.getChatSession().getDescriptor(). We have two  
types of descriptors right now: MetaContact and ChatRoom, so you  
should check which of them you get.

Hope this helps. If you need any help or it turns to be harder than I  
thought, don't hesitate to ask help:)

Cheers,
Yana

> ________________________________________
> From: Yana Stamcheva [yana at sip-communicator.org]
> Sent: Tuesday, July 28, 2009 3:14 AM
> To: dev at sip-communicator.dev.java.net
> Subject: Re: [sip-comm-dev] Lions and Tigers and BundleExceptions OH  
> MY!
>
> Hi Brett,
>
> One quick question, why do you exactly need the current Contact? In
> UIService we have a method called getCurrentChat(), would you think
> that it could give you what you need?
>
> Otherwise, yes we can move the ChatChangeListener to the service and
> we don't even need a new interface, we could just add add/
> removeChatSelectionListener() methods to the UIService. I see in the
> code that at the moment this listener is not fired anywhere, so you
> should also implement the fire part. Pay attention to the multi window
> chat mode, where each Chat correspond to an window. If you decide that
> this is really what you need and you go with this implementation we
> could look together through the details.
>
> By the way, what do you exactly mean, when you're talking about a
> "group of Contacts that are selected in the ChatWindow"? Currently
> we're not able to select more than one Contact tab.
>
> Cheers,
> Yana
>
> On Jul 28, 2009, at 5:56 AM, Geren, Brett wrote:
>
>> I was afraid that was the answer :P.
>>
>> I need to get the current Contact or group of Contacts that are
>> selected in the ChatWindow. My idea was to add my plugin as a
>> ChatChangeListener to the ChatWindow it is in since this listeners
>> is designed for exactly this purpose. To solve the "inter-bundle"
>> problem I could simply move the ChatChangeListener and write another
>> interface that ChatWindow implements that describes adding and
>> removing ChatChangeListeners.
>>
>> So all-in-all I would have to move one listener and create another
>> which describes functionality that ChatWindow already has.  Is this
>> reasonable?
>>
>> Cheers!
>>
>> -Brett
>>
>> P.S. I like that no one minded my "playful" e-mail subject.
>> ________________________________________
>> From: Emil Ivov [emil at sip-communicator.org] On Behalf Of Emil Ivov [emcho at sip-communicator.org
>> ]
>> Sent: Monday, July 27, 2009 9:27 PM
>> To: dev at sip-communicator.dev.java.net
>> Subject: Re: [sip-comm-dev] Lions and Tigers and BundleExceptions OH
>> MY!
>>
>> Hey Brett,
>>
>> Geren, Brett wrote:
>>> I need to import net.java.sip.communicator.impl.gui.main.chat.* into
>>> a plugin
>>
>> Oh, no you don't! ;)
>>
>> Service implementations are not meant for inter-bundle use (a basic
>> rule
>> of thumb is to never import anything that has "impl" in the package
>> name). If you need to import anything from the GUI then that has to  
>> be
>> in net.java.sip.communicator.service.ui.
>>
>> If the UI service doesn't have what you need then you should consider
>> adding it in the service interfaces, but again, you shouldn't be
>> importing it from its impl package.
>>
>>> so I did and then I edited the plugin's manifest. After the
>>> I rebuilt and ran the project I get the following exception:
>>>
>>> [java] org.osgi.framework.BundleException: Unresolved constraint in
>>> bundle 78: package;
>>> (&(package=net.java.sip.communicator.impl.gui.main.chat)
>>> (version>=0.0.0))
>>> [java]       at
>>> org.apache.felix.framework.Felix._resolveBundle(Felix.java:1775)
>>> [java]        at
>>> org.apache.felix.framework.Felix._startBundle(Felix.java:1635)  
>>> [java]
>>> at org.apache.felix.framework.Felix.startBundle(Felix.java:1578)
>>> [java]        at
>>> org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:
>>> 1172)
>>> [java]       at
>>> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:
>>> 265)
>>> [java]       at java.lang.Thread.run(Unknown Source)
>>
>> That's because the impl.gui package is not "Exported" by anyone  
>> (given
>> that impl packages are not meant for.... :) )
>>
>> Drop us a note telling us exactly what it is you need and we'll  
>> figure
>> out a way to get there together.
>>
>> Cheers
>> Emil
>>
>>> I've checked my manifest file for errors and such but I didn't find
>>> any. I did a few Google searches for some Felix related help, but
>>> they didn't help either.
>>>
>>> Attached is my manifest file.  Cheers!
>>>
>>> -Brett
>>>
>>> P.S. as soon as this problem is fixed I send some pictures of my
>>> current progress to this mailling list (as requested).
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:
>>> dev-unsubscribe at sip-communicator.dev.java.net For additional
>>> commands, e-mail: dev-help at sip-communicator.dev.java.net
>>
>> --
>> Emil Ivov, Ph.D.                               67000 Strasbourg,
>> Project Lead                                   France
>> SIP Communicator
>> emcho at sip-communicator.org                     PHONE:
>> +33.1.77.62.43.30
>> http://sip-communicator.org                    FAX:
>> +33.1.77.62.47.31
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe at sip-communicator.dev.java.net
>> For additional commands, e-mail: dev-help at sip-
>> communicator.dev.java.net
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe at sip-communicator.dev.java.net
>> For additional commands, e-mail: dev-help at sip-
>> communicator.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe at sip-communicator.dev.java.net
> For additional commands, e-mail: dev-help at sip- 
> communicator.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe at sip-communicator.dev.java.net
> For additional commands, e-mail: dev-help at sip- 
> communicator.dev.java.net
>


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





More information about the dev mailing list