Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[e4-dev] MPart.getContext() is null


For my demo app I want clicking a button on part 'a' to set part 'b' to visible (it is initially invisible).
My part b relies on a domain object com.acme.SalesOrder so i have
  @Inject public PartB(SalesOrder salesOrder) ...

I wondered how I should provide this domain object dependency. In the code responsible for making part 'b' visible, I did:

MPart partB= partService.findPart("com.acme.partb");
        partB.getContext().set(SalesOrder.class, salesOrder);
partService.showPart(checkoutPart, PartState.ACTIVATE);

--> java.lang.NullPointerException
    at org.acme.Part1.checkoutRequested(

So, IEclipseContext was null for an MPart obtained thru the part service. On the other hand, I noticed the following idiom in most of the other MPart getters:

if(stuff==null) {
return stuff;

So I was wondering whether this was a bug, or I am not using the platform correctly?
Thanks in advance!

Regards, Dimitar


Back to the top