Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » getDefault() returns null
getDefault() returns null [message #234147] Sun, 25 April 2004 13:38 Go to next message
Eclipse UserFriend
Originally posted by: dwojtas.myrealbox.com

Hi,

I havewritten a simple plugin with single preference page.
It is based on some samples found in the net.
This preference page makes use of the plugin.
Eg.
MyPlugin.getDefault().getPreferenceStore()

My preference page shows in the Window/Preferences menu,
but when I click in the pages tree to see my preference page I gen NPE
from getDefault()

What is the lifecycle of the plugin, when does it start?
How to make sure that my plugin started when I eter it's preference
page in configuration?

Darek
Re: getDefault() returns null [message #234217 is a reply to message #234147] Sun, 25 April 2004 17:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Bill.Blalock.certegy.com

The RCP Tutorial Part 2 describes the lifecycle of a plugin and digs into
the WorkbenchAdvisor class. That might help you. The url is

http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/platform -ui-home/rcp-proposal/rcp_tutorial/tutorial2.html

Bill

Darek wrote:

> Hi,

> I havewritten a simple plugin with single preference page.
> It is based on some samples found in the net.
> This preference page makes use of the plugin.
> Eg.
> MyPlugin.getDefault().getPreferenceStore()

> My preference page shows in the Window/Preferences menu,
> but when I click in the pages tree to see my preference page I gen NPE
> from getDefault()

> What is the lifecycle of the plugin, when does it start?
> How to make sure that my plugin started when I eter it's preference
> page in configuration?

> Darek
Re: getDefault() returns null [message #234338 is a reply to message #234147] Mon, 26 April 2004 04:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ....test.com

I recently had the same effect while porting my plugins to Eclipse 3.0. With
this release, a plugin needs a default constructor under the condintions
listed in the 3.0 porting guide:
"Note also that if you mark you plug-in as 3.0 (using <?eclipse...?>) and
your plug-in defines a Plugin class, you must either explicitly <import
plugin="org.eclipse.core.runtime.compatibility"/> in the plug-in manifest or
ensure that the Plugin class defines the default constructor."
Disregarding this hint could cause the mentioned effect as the plugin
doesn't get instantiated.

Christian

"Darek" <dwojtas@myrealbox.com> wrote in message
news:rstn801hkpv54jp9fijotoag2rbkhn2tve@4ax.com...
> Hi,
>
> I havewritten a simple plugin with single preference page.
> It is based on some samples found in the net.
> This preference page makes use of the plugin.
> Eg.
> MyPlugin.getDefault().getPreferenceStore()
>
> My preference page shows in the Window/Preferences menu,
> but when I click in the pages tree to see my preference page I gen NPE
> from getDefault()
>
> What is the lifecycle of the plugin, when does it start?
> How to make sure that my plugin started when I eter it's preference
> page in configuration?
>
> Darek
Re: getDefault() returns null [message #234766 is a reply to message #234338] Mon, 26 April 2004 16:02 Go to previous message
Eclipse UserFriend
Originally posted by: dwojtas.myrealbox.com

Thanks Christian!

That was it. Now it seems to work.
I added default, no arg constructor.

Do you know when exactly a call to
MyPlugin.getDefault().getPreferenceStore()
causes instantiation of the plugin?
What if at some point (but from some class within the plugin)
I call MyPlugin.getDefault() for the 1st time?
How does it know that it should initialize it before the 1st call?
Or maybe it can happen that it will not initialize before?

Darek


On Mon, 26 Apr 2004 10:33:07 +0200, "Christian Georgi" <...@test.com>
wrote:

>I recently had the same effect while porting my plugins to Eclipse 3.0. With
>this release, a plugin needs a default constructor under the condintions
>listed in the 3.0 porting guide:
>"Note also that if you mark you plug-in as 3.0 (using <?eclipse...?>) and
>your plug-in defines a Plugin class, you must either explicitly <import
>plugin="org.eclipse.core.runtime.compatibility"/> in the plug-in manifest or
>ensure that the Plugin class defines the default constructor."
>Disregarding this hint could cause the mentioned effect as the plugin
>doesn't get instantiated.
>
>Christian
>
>"Darek" <dwojtas@myrealbox.com> wrote in message
>news:rstn801hkpv54jp9fijotoag2rbkhn2tve@4ax.com...
>> Hi,
>>
>> I havewritten a simple plugin with single preference page.
>> It is based on some samples found in the net.
>> This preference page makes use of the plugin.
>> Eg.
>> MyPlugin.getDefault().getPreferenceStore()
>>
>> My preference page shows in the Window/Preferences menu,
>> but when I click in the pages tree to see my preference page I gen NPE
>> from getDefault()
>>
>> What is the lifecycle of the plugin, when does it start?
>> How to make sure that my plugin started when I eter it's preference
>> page in configuration?
>>
>> Darek
Previous Topic:Update Manager through proxy with authentication
Next Topic:Updating the column headers of a view on change of selection
Goto Forum:
  


Current Time: Thu May 08 11:43:43 EDT 2025

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

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

Back to the top