Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » e4 programmatic part show/hide
e4 programmatic part show/hide [message #1398882] Fri, 11 July 2014 18:48 Go to next message
Jonathan Wright is currently offline Jonathan WrightFriend
Messages: 2
Registered: July 2014
Junior Member
I'm having difficulty getting programmatic show/hide to work for parts within an MPartStack. I've created a simple e4 application project (github.com/hibouhome/rcp-spikes/tree/master/com.hibouhome.rcp.spikes.partvisibility) containing three parts within a single partstack. I have a Combo ToolControl that selects the part to display. Showing a part is done via the following method:

private void showPart(final String id) {
	final MPartStack partstack = (MPartStack) modelService.find("simplepartstack", application);
	final MPart part = partService.showPart(id, PartState.ACTIVATE);
	part.setVisible(true);
	partstack.setSelectedElement(part);
}


This only works insofar as the part's tab is display. The content of the tab is not rendered, neither is the part's tab selected. If I click the part's tab it's then rendered as expected - however, this only works when I include 'part.setVisible(true);' which I wouldn't have thought was necessary seeing as I've already called 'partService.showPart(id, PartState.ACTIVATE);'.

Within Application.e4xmi each part has 'to be rendered' = true, 'visible' = false

I've tried tried debugging the code to see what the problem is but haven't made any progress. Any help / advice would be greatly appreciated.
Re: e4 programmatic part show/hide [message #1398914 is a reply to message #1398882] Fri, 11 July 2014 19:48 Go to previous messageGo to next message
Eclipse UserFriend
EPartService#showPart and hidePart may be what you need. You can have your EPartService injected.
Re: e4 programmatic part show/hide [message #1398919 is a reply to message #1398914] Fri, 11 July 2014 19:58 Go to previous message
Jonathan Wright is currently offline Jonathan WrightFriend
Messages: 2
Registered: July 2014
Junior Member
Thanks for the reply. I managed to get it working as follows:

private void showPart(final String id) {
	final MPartStack partstack = (MPartStack) modelService.find("simplepartstack", application);
	final MPart part = partService.findPart(id);
	part.setVisible(true);
	partstack.setSelectedElement(part);
}


I was trying showPart() because of the lazy rendering. However, simply selecting the part in the stack seems to trigger this so problem solved. Thanks!
Previous Topic:Building feature with tycho and bundle importing javafx packages
Next Topic:E4 modal Dialog
Goto Forum:
  


Current Time: Sat Apr 20 00:15:34 GMT 2024

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

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

Back to the top