Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Plugin auto-start
Plugin auto-start [message #664738] Mon, 11 April 2011 18:44 Go to next message
Marco Maccaferri is currently offline Marco MaccaferriFriend
Messages: 138
Registered: July 2009
Senior Member
Hi.

I'm trying to set a plugin to start automatically at startup regardless
of it being accessed from other plugins. To do so, I have set the
auto-start flag on the Run configuration's Plugins page to true and the
start level to default, however I think I haven't fully understood the
meaning of these parameters.

When I launch the run configuration the plugin is not started, from the
osgi console I see that it is resolved, so it seems that the auto-start
flag is not used. Is that true ? It is a bug or something I don't
understand ?

Now comes the funny thing, from the osgi console, I start my plugin, it
starts well, no errors. Now whenever I start the same launch
configuration the plugin is started automatically, like the command I
typed on the osgi console was recorded somewhere. I don't think this is
an expected behaviour, or not ? Sometimes however the plugin is not
started, I think when I change something in the run configuration
settings, not sure what however, but after starting it again from the
osgi console it keeps to auto-start.

I'm using Eclipse 3.6.2 with a 3.5.2 target platform.

Regards,
Marco.
Re: Plugin auto-start [message #664878 is a reply to message #664738] Tue, 12 April 2011 11:17 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

That doesn't do what you want. Auto start simply means the first access
to a class contained in that bundle with start the bundle. It's been
more correctly renamed to:

Bundle-ActivationPolicy: lazy

re: bundle started after a restart. If you start your bundle, it will
be remain in that state until it is stopped. Within eclipse we call
bundle.start(Bundle.START_TRANSIENT) instead of bundle.start(), as
START_TRANSIENT leaves the bundle in the lazy-starting state in the next
session.

Are you talking about OSGi bundles here, or eclipse plugins with
extensions and a plugin.xml? Anything that depends on the workbench
starting up (IDE or RCP app) should not be started via OSGi unless you
have no workbench dependencies and no extensions.

There is an extension point called org.eclipse.ui.startup that can be
used to start a plugin immediately after the workbench is created but
before the first window is shown. The caveat is that an plugin started
early should have almost no extensions and certainly not contribute to
the UI (actionSets, popupMenus, handlers, views, editors, etc).

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Plugin auto-start [message #664931 is a reply to message #664878] Tue, 12 April 2011 14:10 Go to previous messageGo to next message
Marco Maccaferri is currently offline Marco MaccaferriFriend
Messages: 138
Registered: July 2009
Senior Member
On 12/04/2011 13:17 Paul Webster ha scritto:

> That doesn't do what you want. Auto start simply means the first access
> to a class contained in that bundle with start the bundle. It's been
> more correctly renamed to:
>
> Bundle-ActivationPolicy: lazy

Ah, that's a bit confusing.

> re: bundle started after a restart. If you start your bundle, it will
> be remain in that state until it is stopped. Within eclipse we call
> bundle.start(Bundle.START_TRANSIENT) instead of bundle.start(), as
> START_TRANSIENT leaves the bundle in the lazy-starting state in the next
> session.

Ok, I didn't know that difference, so it is an expected behaviour.

> Are you talking about OSGi bundles here, or eclipse plugins with
> extensions and a plugin.xml? Anything that depends on the workbench
> starting up (IDE or RCP app) should not be started via OSGi unless you
> have no workbench dependencies and no extensions.

It is a plugin but doesn't have a plugin.xml so it doesn't implement
extensions. It provides some core services that needs to be available to
other plugins. I want to auto-start it because I would like to
initialize the core services during the application startup. Is there a
better method to do that ?


Regards,
Marco.
Re: Plugin auto-start [message #664939 is a reply to message #664931] Tue, 12 April 2011 14:32 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/12/2011 10:10 AM, Marco Maccaferri wrote:
> It is a plugin but doesn't have a plugin.xml so it doesn't implement
> extensions. It provides some core services that needs to be available to
> other plugins. I want to auto-start it because I would like to
> initialize the core services during the application startup. Is there a
> better method to do that ?

In your own RCP app? You can do that by starting the bundle yourself in
one of the workbench/workbench window Advisors.

In the eclipse IDE, you shouldn't start any services until they're
requested.

The preferred method in that case would be to leave it's activation
policy as lazy, and use Declarative Services to provide your core
services as OSGi services.

The first requests to the service would cause the core service bundle to
activate.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Previous Topic:Custom Java Exception Breakpoint
Next Topic:View with a grid
Goto Forum:
  


Current Time: Sat Aug 08 15:57:50 GMT 2020

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

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

Back to the top