Skip to main content


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 22:48 Go to next message
Cristiano Gavião is currently offline Cristiano GaviãoFriend
Messages: 279
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 22:55 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
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] Tue, 27 September 2011 00:19 Go to previous message
Cristiano Gavião is currently offline Cristiano GaviãoFriend
Messages: 279
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: Tue, 27 September 2011 00: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 Apr 26 18:32:00 GMT 2024

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

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

Back to the top