Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » E4 way to react on part hide / show(How to execute code when a part is hidden and then shown again ?)
E4 way to react on part hide / show [message #1709423] Mon, 28 September 2015 11:07 Go to next message
Patrik Suzzi is currently offline Patrik SuzziFriend
Messages: 91
Registered: June 2010
Location: Urdorf, Switzerland


I am an Eclipse E4 user, and I would like to know if there is a Best Practices for Eclipse4 on how to react to part hide & show.

This is my example:

I have two parts:
PartMaster : allows the user to select one element.
PartDetail : displays details of the element selected in Master.

Both these two parts are contained, in a container that can be hidden or displayed, depending on user interaction.

My scope is to react to part hide / show.
As example: when the user makes the two parts visible again, I want to re-select an element in PartMaster, and update the visualization in PartDetail.

To achieve this, need to execute a "selection" code, when PartMaster is displayed again.

So, my question is: what are the best practices on hook the display / hide events on an E4 Part ?

Kind Regards

[Updated on: Tue, 29 September 2015 09:01]

Report message to a moderator

Re: E4 way to react on part hide / show [message #1713194 is a reply to message #1709423] Mon, 02 November 2015 09:09 Go to previous message
Alexander Bunkowski is currently offline Alexander BunkowskiFriend
Messages: 29
Registered: February 2014
Junior Member
Hey Patrik.

here I had some problems with the part visible mechanism reacting to UIEvents.UILifeCycle.BRINGTOTOP
Maybe this is sufficient for your case.

If you need to get notified on perspective switch as well (like me) the only reliable way I found is:

				ePartService.addPartListener(new PartListenerAdapter() {
					public void partBroughtToTop(MPart part) {
						if (part == targetMPart) {
							//react here

I did a lot of part visibility stuff, let me now if this helped you or if you need more details.

[Updated on: Mon, 02 November 2015 09:10]

Report message to a moderator

Previous Topic:E4 DI: Accessing the MPart from an EventObjectSupplier
Next Topic:RCP Launcher name issue
Goto Forum:

Current Time: Mon Sep 28 06:45:14 GMT 2020

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

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

Back to the top