Hi,

that might be "just luck" depending on the dependencies between this second 
plugin & the plugin registering the factory.

If the second plugin declares a dependency on the first plugin in its 
pluginspec, a check in extensionsInitialized is exactly the right thing to do, 
see 
http://doc.qt.nokia.com/qtcreator-extending/extensionsystem-iplugin.html#extensionsInitialized

If the second plugin does *not* declare a dependency on the first plugin, then 
the check in extensionsInitialized can arbitrarily work or not, since there are 
no guarantees whatsoever about the loading+initialization order of plugins that 
have no dependency (direct or indirect). If the check is supposed to just find 
out if the second plugin is "present in principle" you can just get the list of 
plugins from the PluginManager and check for its presence, and if it has no 
errors (PluginSpec::name() and PluginSpec::error(); if you do that in your 
first plugin's extensionsInitialized method you'll at least get informed by 
some loading errors).

Br,
--
Eike Ziller
Principal Software Engineer

Nokia, Qt Development Frameworks

Nokia gate5 GmbH
Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B
Umsatzsteueridentifikationsnummer: DE 812 845 193
Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori

________________________________________
From: [email protected] 
[[email protected]] On Behalf Of ext Thomas 
Ehrnhoefer [[email protected]]
Sent: Wednesday, September 07, 2011 20:54
To: [email protected]
Subject: Re: [Qt-creator] delayed sidebar widget contribution

Actually,

I just moved this to
extensionsInitialized()
and it seems this makes sure that my prerequisite (which is a second plugin 
registering something at my first plugin) is met, thus I wont need the timer 
(loop for waiting for that prerequisite).

If anybody thinks that's wrong though, speak up

Thomas


On Wed, Sep 7, 2011 at 11:32 AM, Thomas Ehrnhoefer 
<[email protected]<mailto:[email protected]>> wrote:
Hi

I have a plugin contributing a sidebar widget. It extends IPlugin, and in the 
initialize method it calls
addAutoReleasedObject(new MyWidgetFactory);

So far so good. All works well.
But now I have an additional requirement that would make that contribution only 
available if certain prerequisites are given. Simply put, I will have a loop 
constantly checking whether a condition is true, and if finally yes, the 
sidebar widget should get contributed.

Problem is, that when I call
addAutoReleasedObject(new MyWidgetFactory);
outside the initialize method scope, the sidebar does not show (the 
"createWidget" of MyWidgetFactory never gets called).

Is there a way to do this?

Hope I made myself somewhat clear :)

Thanks
Thomas

--
Thomas Ehrnhoefer
Software Developer, http://tasktop.com



--
Thomas Ehrnhoefer
Software Developer, http://tasktop.com
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-creator

Reply via email to