Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Activator never gets called?
Activator never gets called? [message #444950] Sat, 25 February 2006 12:25 Go to next message
Andreas Heinecke is currently offline Andreas HeineckeFriend
Messages: 21
Registered: July 2009
Junior Member
Hi Group,

I've taken the RCP mail example and developed my own RCP application, like
many other here I suppose.
Now I'm trying to write a Plugin Test, with JUnit of course. The first thing
I did in this test was to get the Workbench from my PluginClass, called
Activator.

IWorkbench workbench = Activator.getDefault().getWorkbench();

But I was very astonished as I get an NullPointerException. The
Activator.getDefault() call returns NULL, this means the Activator wasn't
initialized. I thought the Activator is called during the startup like the
PluginClass of a "normal" plugin. Am I wrong, or did I something wrong?

Please help me.

Kind regards,

Andreas
Re: Activator never gets called? [message #444996 is a reply to message #444950] Sat, 25 February 2006 18:45 Go to previous messageGo to next message
Karsten Panier is currently offline Karsten PanierFriend
Messages: 57
Registered: July 2009
Member
Hi Andreas,
do you use Junit PDE Test? If I run a similar test with junit for
plugins the eclipse runtime is launched to execute the junit test and
the plugin is initialized. with normal junit getDefult returns null.
kp

Andreas Heinecke schrieb:
> Hi Group,
>
> I've taken the RCP mail example and developed my own RCP application, like
> many other here I suppose.
> Now I'm trying to write a Plugin Test, with JUnit of course. The first thing
> I did in this test was to get the Workbench from my PluginClass, called
> Activator.
>
> IWorkbench workbench = Activator.getDefault().getWorkbench();
>
> But I was very astonished as I get an NullPointerException. The
> Activator.getDefault() call returns NULL, this means the Activator wasn't
> initialized. I thought the Activator is called during the startup like the
> PluginClass of a "normal" plugin. Am I wrong, or did I something wrong?
>
> Please help me.
>
> Kind regards,
>
> Andreas
Re: Activator never gets called? [message #445007 is a reply to message #444996] Sat, 25 February 2006 21:51 Go to previous messageGo to next message
Andreas Heinecke is currently offline Andreas HeineckeFriend
Messages: 21
Registered: July 2009
Junior Member
Hi Karsten,

first of all thank you for your answer. I run my tests as JUnit plugin Test
not as "normal" JUnit Test. In my oppinion thats all whats need to be done
since Eclipse 3.0, because since this time PDE JUnit is integrated in
Eclipse.
Normally this would work, because as I tested a older plugin project which
is not a RCP plugin, the test run fine. Just my RCP plugin tests won't
work. Maybe there are some differences with RCP plugins?

This seems very strange to me.

Andreas

Karsten Panier wrote:

> Hi Andreas,
> do you use Junit PDE Test? If I run a similar test with junit for
> plugins the eclipse runtime is launched to execute the junit test and
> the plugin is initialized. with normal junit getDefult returns null.
> kp
>
> Andreas Heinecke schrieb:
>> Hi Group,
>>
>> I've taken the RCP mail example and developed my own RCP application,
>> like many other here I suppose.
>> Now I'm trying to write a Plugin Test, with JUnit of course. The first
>> thing I did in this test was to get the Workbench from my PluginClass,
>> called Activator.
>>
>> IWorkbench workbench = Activator.getDefault().getWorkbench();
>>
>> But I was very astonished as I get an NullPointerException. The
>> Activator.getDefault() call returns NULL, this means the Activator wasn't
>> initialized. I thought the Activator is called during the startup like
>> the PluginClass of a "normal" plugin. Am I wrong, or did I something
>> wrong?
>>
>> Please help me.
>>
>> Kind regards,
>>
>> Andreas
Re: Activator never gets called? [message #445018 is a reply to message #445007] Sun, 26 February 2006 12:49 Go to previous messageGo to next message
Karsten Panier is currently offline Karsten PanierFriend
Messages: 57
Registered: July 2009
Member
Hi Andreas,
looks stange.
Is there maybe a Problem with the launch configuration? RCP Plugins are
normal Plugins like the others.
kp

Andreas Heinecke schrieb:
> Hi Karsten,
>
> first of all thank you for your answer. I run my tests as JUnit plugin Test
> not as "normal" JUnit Test. In my oppinion thats all whats need to be done
> since Eclipse 3.0, because since this time PDE JUnit is integrated in
> Eclipse.
> Normally this would work, because as I tested a older plugin project which
> is not a RCP plugin, the test run fine. Just my RCP plugin tests won't
> work. Maybe there are some differences with RCP plugins?
>
> This seems very strange to me.
>
> Andreas
>
> Karsten Panier wrote:
>
>> Hi Andreas,
>> do you use Junit PDE Test? If I run a similar test with junit for
>> plugins the eclipse runtime is launched to execute the junit test and
>> the plugin is initialized. with normal junit getDefult returns null.
>> kp
>>
>> Andreas Heinecke schrieb:
>>> Hi Group,
>>>
>>> I've taken the RCP mail example and developed my own RCP application,
>>> like many other here I suppose.
>>> Now I'm trying to write a Plugin Test, with JUnit of course. The first
>>> thing I did in this test was to get the Workbench from my PluginClass,
>>> called Activator.
>>>
>>> IWorkbench workbench = Activator.getDefault().getWorkbench();
>>>
>>> But I was very astonished as I get an NullPointerException. The
>>> Activator.getDefault() call returns NULL, this means the Activator wasn't
>>> initialized. I thought the Activator is called during the startup like
>>> the PluginClass of a "normal" plugin. Am I wrong, or did I something
>>> wrong?
>>>
>>> Please help me.
>>>
>>> Kind regards,
>>>
>>> Andreas
>
Re: Activator never gets called? [message #445020 is a reply to message #445018] Sun, 26 February 2006 14:30 Go to previous messageGo to next message
Andreas Heinecke is currently offline Andreas HeineckeFriend
Messages: 21
Registered: July 2009
Junior Member
Yes this is really weird. I know that they are plugins like the others but
they differ from them because make use of the
org.eclipse.core.runtime.application extension point. With the word
"normal" I wanted to make a difference between the two, because the other
plugin tests work fine.

I found out that the Activator class which is the Plugin class (inherits
from AbstractUIPlugin) never gets called. I placed a trace to the console
in the constructor, the text was never displayed, although the plugin works
fine if I start it.
Do you know when and by which class the AbstractUIPlugin (Activator in this
case) will get called?

Kind regards,

Andreas

Karsten Panier wrote:

> Hi Andreas,
> looks stange.
> Is there maybe a Problem with the launch configuration? RCP Plugins are
> normal Plugins like the others.
> kp
>
> Andreas Heinecke schrieb:
>> Hi Karsten,
>>
>> first of all thank you for your answer. I run my tests as JUnit plugin
>> Test not as "normal" JUnit Test. In my oppinion thats all whats need to
>> be done since Eclipse 3.0, because since this time PDE JUnit is
>> integrated in Eclipse.
>> Normally this would work, because as I tested a older plugin project
>> which is not a RCP plugin, the test run fine. Just my RCP plugin tests
>> won't work. Maybe there are some differences with RCP plugins?
>>
>> This seems very strange to me.
>>
>> Andreas
>>
>> Karsten Panier wrote:
>>
>>> Hi Andreas,
>>> do you use Junit PDE Test? If I run a similar test with junit for
>>> plugins the eclipse runtime is launched to execute the junit test and
>>> the plugin is initialized. with normal junit getDefult returns null.
>>> kp
>>>
>>> Andreas Heinecke schrieb:
>>>> Hi Group,
>>>>
>>>> I've taken the RCP mail example and developed my own RCP application,
>>>> like many other here I suppose.
>>>> Now I'm trying to write a Plugin Test, with JUnit of course. The first
>>>> thing I did in this test was to get the Workbench from my PluginClass,
>>>> called Activator.
>>>>
>>>> IWorkbench workbench = Activator.getDefault().getWorkbench();
>>>>
>>>> But I was very astonished as I get an NullPointerException. The
>>>> Activator.getDefault() call returns NULL, this means the Activator
>>>> wasn't initialized. I thought the Activator is called during the
>>>> startup like the PluginClass of a "normal" plugin. Am I wrong, or did I
>>>> something wrong?
>>>>
>>>> Please help me.
>>>>
>>>> Kind regards,
>>>>
>>>> Andreas
>>
Re: Activator never gets called? [message #445023 is a reply to message #445020] Sun, 26 February 2006 23:03 Go to previous message
Pascal Rapicault is currently offline Pascal RapicaultFriend
Messages: 440
Registered: July 2009
Senior Member
If you are using 3.1 Make sure you have the Eclipse-AutoStart: true line
in your manifest. If you are using 3.2, you may see Eclipse-LazyStart: true.
You can also see the value I'm talking about by looking at the
manifest.mf of a plug-in generated by the pde wizards.

Andreas Heinecke wrote:
> Yes this is really weird. I know that they are plugins like the others but
> they differ from them because make use of the
> org.eclipse.core.runtime.application extension point. With the word
> "normal" I wanted to make a difference between the two, because the other
> plugin tests work fine.
>
> I found out that the Activator class which is the Plugin class (inherits
> from AbstractUIPlugin) never gets called. I placed a trace to the console
> in the constructor, the text was never displayed, although the plugin works
> fine if I start it.
> Do you know when and by which class the AbstractUIPlugin (Activator in this
> case) will get called?
>
> Kind regards,
>
> Andreas
>
> Karsten Panier wrote:
>
>> Hi Andreas,
>> looks stange.
>> Is there maybe a Problem with the launch configuration? RCP Plugins are
>> normal Plugins like the others.
>> kp
>>
>> Andreas Heinecke schrieb:
>>> Hi Karsten,
>>>
>>> first of all thank you for your answer. I run my tests as JUnit plugin
>>> Test not as "normal" JUnit Test. In my oppinion thats all whats need to
>>> be done since Eclipse 3.0, because since this time PDE JUnit is
>>> integrated in Eclipse.
>>> Normally this would work, because as I tested a older plugin project
>>> which is not a RCP plugin, the test run fine. Just my RCP plugin tests
>>> won't work. Maybe there are some differences with RCP plugins?
>>>
>>> This seems very strange to me.
>>>
>>> Andreas
>>>
>>> Karsten Panier wrote:
>>>
>>>> Hi Andreas,
>>>> do you use Junit PDE Test? If I run a similar test with junit for
>>>> plugins the eclipse runtime is launched to execute the junit test and
>>>> the plugin is initialized. with normal junit getDefult returns null.
>>>> kp
>>>>
>>>> Andreas Heinecke schrieb:
>>>>> Hi Group,
>>>>>
>>>>> I've taken the RCP mail example and developed my own RCP application,
>>>>> like many other here I suppose.
>>>>> Now I'm trying to write a Plugin Test, with JUnit of course. The first
>>>>> thing I did in this test was to get the Workbench from my PluginClass,
>>>>> called Activator.
>>>>>
>>>>> IWorkbench workbench = Activator.getDefault().getWorkbench();
>>>>>
>>>>> But I was very astonished as I get an NullPointerException. The
>>>>> Activator.getDefault() call returns NULL, this means the Activator
>>>>> wasn't initialized. I thought the Activator is called during the
>>>>> startup like the PluginClass of a "normal" plugin. Am I wrong, or did I
>>>>> something wrong?
>>>>>
>>>>> Please help me.
>>>>>
>>>>> Kind regards,
>>>>>
>>>>> Andreas
>
Previous Topic:ViewPart toolbar extensions
Next Topic:RCP App without workspace
Goto Forum:
  


Current Time: Thu Nov 07 16:58:32 GMT 2024

Powered by FUDForum. Page generated in 0.05295 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top