Link a part to another part in "e4 way" [message #1314166] |
Fri, 25 April 2014 07:50 |
István Mészáros Messages: 51 Registered: October 2009 |
Member |
|
|
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 #1833275 is a reply to message #1314166] |
Thu, 08 October 2020 10:09 |
Christian Eugster Messages: 203 Registered: July 2009 Location: St. Gallen Switzerland |
Senior Member |
|
|
Hi
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
"org/eclipse/e4/ui/model/ui/ElementContainer/selectedElement/SET"
"org/eclipse/e4/ui/model/ui/ElementContainer/children/REMOVE"
"org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD"
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!
Christian
|
|
|
|
Powered by
FUDForum. Page generated in 0.03211 seconds