Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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
Cristiano Gaviao is currently offline Cristiano Gaviao
Messages: 253
Registered: July 2009
Senior Member
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
Thomas Schindl is currently offline Thomas Schindl
Messages: 5284
Registered: July 2009
Senior Member
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
Cristiano Gaviao is currently offline Cristiano Gaviao
Messages: 253
Registered: July 2009
Senior Member
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]

Report message to a moderator

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


Current Time: Fri Aug 22 09:59:20 EDT 2014

Powered by FUDForum. Page generated in 0.01603 seconds