Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Link a part to another part in "e4 way"
Link a part to another part in "e4 way" [message #1314166] Fri, 25 April 2014 07:50 Go to next message
István Mészáros is currently offline István MészárosFriend
Messages: 51
Registered: October 2009
Hello all,

i would like to implement something like the concept know as "editor linked view" in 3.x world.

Basically, i have a fixed Part that is always visible throughout the lifetime of the application. In another PartStack multiple editor like Parts can be opened or closed.

I would like the fixed Part to be linked to the active editor part and show information about the editor's content. If no editor is open, fields of the fixed part should be empty/disabled/hidden, etc. To put it simple, i would like the fixed Part to behave much like the "Outline" view in Eclipse.

My problem is that i don't know how to notify the fixed part properly about the "active" part or editor, or content object.

At first i thought i'd use the selection service. The editor parts would be selection providers and the fixed part would be a selection listener.

The hard thing is determining the "active" editor, and catching the right event when to determine it.

@UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) looks confusing to me, it's called a lot even if i click on the currently active CTabItem, so no "real" part activation happens. Also, there is no similar event for part closing.

I think i need the following events:

- an editor Part is activated (by this i mean opened, or selected in the parent PartStack)
- an editor Part is closed

The order of these events is important. If two or more editor Parts are open, and one of them gets closed, the close event for that Part must come before the activation event of another part, because the "close" event would clear the selection in the selection service, and the "activate" event would set it again.

Do you have any ideas how to implement this behavior?

[Updated on: Fri, 25 April 2014 08:05]

Report message to a moderator

Re: Link a part to another part in "e4 way" [message #1334414 is a reply to message #1314166] Mon, 05 May 2014 15:10 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric MoffattFriend
Messages: 118
Registered: July 2009
Senior Member

The most likely candidate fdr what you want to do is to subscribe to the UIEvents.TOPIC_SELECTEDELEMENT topic. This will fire whenever *any* stack changes which tab is selected. Check the changed element to see if it's your 'editor' stack and take appropriate action. This has the advantage that it'll also tell you when the stack goes empty (all editors closed) so no need for special cases...
Re: Link a part to another part in "e4 way" [message #1833275 is a reply to message #1314166] Thu, 08 October 2020 10:09 Go to previous messageGo to next message
Christian Eugster is currently offline Christian EugsterFriend
Messages: 197
Registered: July 2009
Location: St. Gallen Switzerland
Senior Member
thanks to the answer of Eric Moffatt, I found a way to connect editors to "outline views". I did not find the mentioned UIEvents.TOPIC_SELECTEDELEMENT topic, but diving any deeper in the e4 code, I see that there are topics like:

"org/eclipse/e4/ui/model/ui/ElementContainer/*" as


this works so far. But I have some problems with the refreshing of the "outline views" when closing the last editor: I seems, that the gui is not properly updated, the content of the viewers is empty but the view shows still the content. I can click in it, but it is clear, that it is only a ghost.

I tried with different methods as layout, refresh, redraw but nothing helps.

Has anyone an idea how I can achieve that the views are emptied out, properly?

Thank you!

Re: Link a part to another part in "e4 way" [message #1833732 is a reply to message #1833275] Thu, 22 October 2020 18:47 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 463
Registered: July 2009
Senior Member

Loos like you are missing an event. Do you know that you can listen for "org/eclipse/e4/ui/model/ui/ElementContainer/*"to receive all events with that parent?
Previous Topic:Maximizing MPlaceholder with MArea
Next Topic:Set Weight of UIElements
Goto Forum:

Current Time: Sun Apr 18 20:45:51 GMT 2021

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

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

Back to the top