Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » using ECommandService and Preferences in LifecycleManager
using ECommandService and Preferences in LifecycleManager [message #1384905] Tue, 03 June 2014 00:21 Go to next message
Ralf Heydenreich is currently offline Ralf HeydenreichFriend
Messages: 235
Registered: July 2009
Senior Member
Hi all,
I've an RCP application which should check some points at startup.
Therefore, I created a LifecycleManager and added a method public void
checkOnStartup() (annotated with @PostContextCreate). Now I have to
check if some preferences are set. But somehow I can't get the
IEclipsePreferences object from context. The checkOnStartup() method
gets an IEclipseContext injected, but this didn't help me.

Additionally, I want to start a command with ECommandService. But this
service isn't available, too. If I try to inject these services into my
LifecycleManager the methods were not called, anyway (this looked very
strange to me... no error message appeared!).

How can I access these services in LifecycleManager?

Thanks in advance,
Ralf.
Re: using ECommandService and Preferences in LifecycleManager [message #1385892 is a reply to message #1384905] Thu, 12 June 2014 06:43 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I think you can't because the command service is created through an addon. And that is called after @PostContextCreate is executed. At least that is my understanding.

And getting IEclipsePreferences from the context sound wrong to me. Preference values are not stored directly in the IEclipseContext but contributed by an ExtendedObjectSupplier. Therefore you need to use the @Preference annotation as explained here: http://www.vogella.com/tutorials/EclipsePreferences/article.html

Would be the usage of a Model Addon better suit your needs?
Re: using ECommandService and Preferences in LifecycleManager [message #1386196 is a reply to message #1385892] Sat, 14 June 2014 18:06 Go to previous message
Ralf Heydenreich is currently offline Ralf HeydenreichFriend
Messages: 235
Registered: July 2009
Senior Member
Am 12.06.2014 08:43, schrieb Dirk Fauth:
> I think you can't because the command service is created through an
> addon. And that is called after @PostContextCreate is executed. At least
> that is my understanding.
>
> And getting IEclipsePreferences from the context sound wrong to me.
> Preference values are not stored directly in the IEclipseContext but
> contributed by an ExtendedObjectSupplier. Therefore you need to use the
> @Preference annotation as explained here:
> http://www.vogella.com/tutorials/EclipsePreferences/article.html
>
> Would be the usage of a Model Addon better suit your needs?

Hi Dirk,
Thanks for your answer. I think I will omit the using of these services.
The only reason why I wanted to use them was that I thought it would be
easier to launch a dialog via a Command. I have to check some things
before the application is launched. Now, I will implement it as a simple
dialog, which is easier at this point.

For the Preferences I'll use the OSGi Preferences Service, which is
available at this point. Im a little confused about the different
preferences (one from Eclipse and one from OSGi context).

Regards,
Ralf.
Previous Topic:Dependencies for imported plug-ins (maven)
Next Topic:@Inject calls context function but ContextInjectionFactory.make does not. Why?
Goto Forum:
  


Current Time: Tue Mar 19 11:35:17 GMT 2024

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

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

Back to the top