[sip-comm-dev] Adding a plugin under main menu bar


#1

Hi guys,

One very simple and short question: I want to add a plugin under "Tool" menu
in the main window. I think it's only related to my bundle's
*Activator*class and
I got the idea from *extendedCallHistorySearchActivator* class. But
unfortunately,
it didn't added where I wanted. The tutorial in sip-communicator.org didn't
really
help me since the *bundleContext* in Apache Felix does not contain
addComponent
method anymore. I'm very sure that I modified build.xml,
felix.client.run.properties,
and the manifest file correctly. Here's my code for my *Activator* class:

/***********************************************************************
package net.java.sip.communicator.plugin.eventgenerator;
import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import org.osgi.framework.*;
public class EventGeneratorActivator implements BundleActivator
{
    public void start(BundleContext bc) throws Exception
    {
        ServiceReference uiServiceRef =
            bc.getServiceReference(UIService.class.getName());
        UIService uiService = (UIService) bc.getService(uiServiceRef);
        EventGeneratorWindow plugin = new EventGeneratorWindow();
        Hashtable<String, String> containerFilter
            = new Hashtable<String, String>();
        containerFilter.put(
                Container.CONTAINER_ID,
                Container.CONTAINER_TOOLS_MENU.getID());
        bc.registerService(
            PluginComponent.class.getName(),
            plugin, containerFilter);
    }
    public void stop(BundleContext bc) throws Exception
    {
    }
}
***********************************************************************/

Thank you for taking a look at it. Have a nice day!

James H. LEE


#2

Hi,

I have the same problem when I write my own plugin. If you find any solution of this problem please let me know .

Thanks

Lubo

···

--- James H Lee &lt;drpandol@gmail.com&gt; schrieb am Mi, 11.6.2008: Von: James H Lee &lt;drpandol@gmail.com&gt;
Betreff: [sip-comm-dev] Adding a plugin under main menu bar
An: dev@sip-communicator.dev.java.net
Datum: Mittwoch, 11. Juni 2008, 19:23

Hi guys,
&nbsp;
One very simple and short question: I want to add a plugin under "Tool" menu
in the main window. I think it's only related to my bundle's Activator class and
I got the idea from extendedCallHistorySearchActivator class. But unfortunately,
it&nbsp;didn't added where I wanted. The tutorial in sip-communicator.org didn't really
help me since the bundleContext in Apache Felix does not contain addComponent
method anymore. I'm very sure that I modified build.xml, felix.client.run.properties,
and the manifest file correctly. Here's my code for&nbsp;my Activator&nbsp;class:
&nbsp;
&nbsp;
/***********************************************************************
package net.java.sip.communicator.plugin.eventgenerator;
import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import org.osgi.framework.*;
public class EventGeneratorActivator implements BundleActivator
{
&nbsp;&nbsp;&nbsp; public void start(BundleContext bc) throws Exception
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ServiceReference uiServiceRef =

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bc.getServiceReference(UIService.class.getName());
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UIService uiService = (UIService) bc.getService(uiServiceRef);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EventGeneratorWindow plugin = new EventGeneratorWindow();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hashtable&lt;String, String&gt; containerFilter
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = new Hashtable&lt;String, String&gt;();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; containerFilter.put(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Container.CONTAINER_ID,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Container.CONTAINER_TOOLS_MENU.getID());
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bc.registerService(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PluginComponent.class.getName(),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; plugin, containerFilter);
&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; public void stop(BundleContext bc) throws Exception
&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;
}
***********************************************************************/
&nbsp;
Thank you for taking a look at it. Have a nice day!
&nbsp;
James H. LEE

      __________________________________________________________
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com


#3

Hello James,

Search for your plugin name in Plugin manager in settings option of sip
communicator. If you see that your plugin is deactivated, then search in the
logs for the reason for the same. Probably, there may be some files missing
in the jar or so. Some of the problem that I have encountered while adding
plugin are: 1. Forget to include some package name in manifest file.
2. Forget to include directory structure in build.xml.

These errors can be detected using logs.
If your plugin name does not appear in pluginmanager, the reason can be some
error in felix.run.property file.

In summary, seach your plugin name in pluginmanager and looks for logs for
more info.

Hope this will work.
Atul

···

On Wed, Jun 11, 2008 at 10:53 PM, James H Lee <drpandol@gmail.com> wrote:

Hi guys,

One very simple and short question: I want to add a plugin under "Tool"
menu
in the main window. I think it's only related to my bundle's *Activator*class and
I got the idea from *extendedCallHistorySearchActivator* class. But
unfortunately,
it didn't added where I wanted. The tutorial in sip-communicator.orgdidn't really
help me since the *bundleContext* in Apache Felix does not contain
addComponent
method anymore. I'm very sure that I modified build.xml,
felix.client.run.properties,
and the manifest file correctly. Here's my code for my *Activator* class:

/***********************************************************************
package net.java.sip.communicator.plugin.eventgenerator;
import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import org.osgi.framework.*;
public class EventGeneratorActivator implements BundleActivator
{
    public void start(BundleContext bc) throws Exception
    {
        ServiceReference uiServiceRef =
            bc.getServiceReference(UIService.class.getName());
        UIService uiService = (UIService) bc.getService(uiServiceRef);
        EventGeneratorWindow plugin = new EventGeneratorWindow();
        Hashtable<String, String> containerFilter
            = new Hashtable<String, String>();
        containerFilter.put(
                Container.CONTAINER_ID,
                Container.CONTAINER_TOOLS_MENU.getID());
        bc.registerService(
            PluginComponent.class.getName(),
            plugin, containerFilter);
    }
    public void stop(BundleContext bc) throws Exception
    {
    }
}
***********************************************************************/

Thank you for taking a look at it. Have a nice day!

James H. LEE

--
Henny Youngman - "When I told my doctor I couldn't afford an operation, he
offered to touch-up my X-rays."


#4

Hello Lyubomir and James,

I, earlier had the same problem but Damian helped me to solve it. Actually,
it should be addConfigurationForm instead of addComponent.

I am including some code that I have written for global proxy settings
plugin.

public void start(BundleContext bc) throws Exception
    {
        bundleContext = bc;

        ServiceReference uiServiceRef
            = bc.getServiceReference(UIService.class.getName());

        uiService = (UIService) bundleContext.getService(uiServiceRef);

        configWindow = uiService.getConfigurationWindow();

        if(configWindow != null)
        {
            GlobalProxyConfigForm globalProxyConfigForm
                    = new GlobalProxyConfigForm();
            configWindow.addConfigurationForm(globalProxyConfigForm);
        }

    }

Hope this will help you.

Atul

···

On Thu, Jun 12, 2008 at 12:57 PM, Lyubomir Lyubenov <progcc@yahoo.de> wrote:

Hi,

I have the same problem when I write my own plugin. If you find any
solution of this problem please let me know .

Thanks

Lubo

--- James H Lee *<drpandol@gmail.com>* schrieb am *Mi, 11.6.2008: > * > > *Von: James H Lee <drpandol@gmail.com>
Betreff: [sip-comm-dev] Adding a plugin under main menu bar
An: dev@sip-communicator.dev.java.net
Datum: Mittwoch, 11. Juni 2008, 19:23

*
*Hi guys,*
* *
*One very simple and short question: I want to add a plugin under "Tool"
menu*
*in the main window. I think it's only related to my bundle's Activatorclass and
*
*I got the idea from extendedCallHistorySearchActivator class. But
unfortunately,*
*it didn't added where I wanted. The tutorial in sip-communicator.orgdidn't really
*
*help me since the bundleContext in Apache Felix does not contain
addComponent*
*method anymore. I'm very sure that I modified build.xml,
felix.client.run.properties,*
*and the manifest file correctly. Here's my code for my Activator class:*
* *
* *
*/************************************************************************
*package net.java.sip.communicator.plugin.eventgenerator;*
*import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import org.osgi.framework.*;*
*public class EventGeneratorActivator implements BundleActivator
{
    public void start(BundleContext bc) throws Exception
    {
        ServiceReference uiServiceRef =
            bc.getServiceReference(UIService.class.getName());*
* UIService uiService = (UIService) bc.getService(uiServiceRef);*
* EventGeneratorWindow plugin = new EventGeneratorWindow();*
* Hashtable<String, String> containerFilter
            = new Hashtable<String, String>();*
* containerFilter.put(
                Container.CONTAINER_ID,
                Container.CONTAINER_TOOLS_MENU.getID());*
* bc.registerService(
            PluginComponent.class.getName(),
            plugin, containerFilter);*
* }*
* public void stop(BundleContext bc) throws Exception
    {
    }
}*
************************************************************************/*
* *
*Thank you for taking a look at it. Have a nice day!*
* *
*James H. LEE*

------------------------------
Gesendet von Yahoo! Mail<http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52427/*http://de.overview.mail.yahoo.com>.

Dem pfiffigeren Posteingang.

--
Emo Philips - "I was the kid next door's imaginary friend."