Skip to main content



      Home
Home » Eclipse Projects » Eclipse 4 » How to get an E4 service inside PropertyTester class ?
How to get an E4 service inside PropertyTester class ? [message #729756] Mon, 26 September 2011 18:48 Go to next message
Eclipse UserFriend
Hi,

I'm trying to create a Expression Definition class and use it in .e3xmi menu's core expression to handle if it is visible or not.

I need to looking for some data in the e4 model, so I need EModelService.

I've tried to inject the EModelService in the tester class, but it not worked...

public class MyPropertyTester extends PropertyTester {
	
	@Inject
	private EModelService modelService;



How could I get a reference of EModelService inside a PropertyTester class?

thanks for any tip

cheers

Cristiano
Re: How to get an E4 service inside PropertyTester class ? [message #729760 is a reply to message #729756] Mon, 26 September 2011 18:55 Go to previous messageGo to next message
Eclipse UserFriend
PropertyTesters are not created through DI so you can't use injection
for them.

Why do you use PropertyTesters anyways. This is not needed anymore in
Eclipse 4 because you can simply annotate a handler method with
@CanExecute or am I missing something?

Tom

Am 27.09.11 00:48, schrieb Cristiano avi:
> Hi,
>
> I'm trying to create a Expression Definition class and use it in .e3xmi
> menu's core expression to handle if it is visible or not.
>
> I need to looking for some data in the e4 model, so I need EModelService.
>
> I've tried to inject the EModelService in the tester class, but it not
> worked...
>
>
> public class MyPropertyTester extends PropertyTester {
>
> @Inject
> private EModelService modelService;
>
>
>
> How could I get a reference of EModelService inside a PropertyTester class?
>
> thanks for any tip
>
> cheers
>
> Cristiano
Re: How to get an E4 service inside PropertyTester class ? [message #729778 is a reply to message #729760] Mon, 26 September 2011 20:19 Go to previous message
Eclipse UserFriend
Hi Tom,

What I'm trying to achieve is to get some Menu contributions visible only when a determined perspective is activated (selected by user).

Can I do that using @CanExecute ?

Searching for this subject on the Web points me to use Core Expressions and PropertyTesters / Test Variables... but I couldn't find nothing related to E4 yet.

So, could you please point me to right direction ?

thanks a lot

Cristiano

[Updated on: Mon, 26 September 2011 20:20] by Moderator

Previous Topic:[E4] Preference annotation and the e4 dependency injection architecture
Next Topic:How to use shared elements?
Goto Forum:
  


Current Time: Wed Jul 02 01:52:38 EDT 2025

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

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

Back to the top