Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open another Part in Eclipse e4

Tags:

eclipse

e4

rcp

I am developing a e4 application. Initially I have part A. I m displaying A part on start up of application and B part is not visible. In the Part A, I will be displaying HTML Pages with Links. When the user clicks any of the links, I need to open it another Part, B. Both parts will be visible simultaneously like the Tile Windows Vertically of Windows. How to do this ?

like image 796
John Avatar asked Dec 26 '22 04:12

John


1 Answers

If you have a part definition in your application model you can just use EPartService:

@Inject EPartService partService;

partService.showPart("part id", PartState.ACTIVATE);

which will open the part wherever you placed it in the application model. If you don't want the part shown initially turn off the 'To Be Rendered' flag in the application model entry for the part.

Alternatively you can create a part from a 'Part Descriptor'

MPart part = partService.createPart("part descriptor id");

In this case you need to add the part to one of your part stacks and then show it:

@Inject EModelService modelService;

@Inject MApplication app;

MPartStack partStack = (MPartStack)modelService.find("part stack id", app);

partStack.getChildren().add(part);

partService.showPart(part, PartState.ACTIVATE);
like image 128
greg-449 Avatar answered Dec 27 '22 18:12

greg-449