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
Istvan Meszaros is currently offline Istvan MeszarosFriend
Messages: 49
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 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...
Previous Topic:Cannot create a part at APP_STARTUP_COMPLETE in Luna M6
Next Topic:Injecting selected project into view
Goto Forum:

Current Time: Thu Jun 21 18:24:48 GMT 2018

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

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

Back to the top