E4 EPartService findPart () throws java.lang.Null Pointer Exception

New to Eclipse RCP (e4), I am trying to get a handler to update the user interface widget inside the Part.

I tried to enter EPartServicefor the first access to the part using an identifier, for example:

public class Example {

    public static final String PART_ID = "au.org.example.app.part";

    @Inject
    private EPartService partService;

    public void eventOccured()
    {
        MPart part = partService.findPart(PART_ID); // exception thrown here    
    }

} 

But it throws NPE.

findPart()should at least safely return nullif the identifier was incorrect? So what am I missing?

Am is also open to suggesting related tutorials (worked through some of Lars Vogella 's excellent lessons , but to no avail for this problem).

Any further information please let me know.

EDIT: Looks like it is EPartServicen't being entered? I did not add it correctly?

0
1

, - , .

, , ContextInjectionFactory. :

@Inject
IEclipseContext context;

...

MyClass myClass = ContextInjectionFactory.make(MyClass.class, context);

:

ContextInjectionFactory.inject(myClass, context);

.

make inject, , , .

+2

All Articles