Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Link with Editor in IViewPart
Link with Editor in IViewPart [message #879474] Thu, 31 May 2012 09:39 Go to next message
Lorand Lorincz is currently offline Lorand LorinczFriend
Messages: 35
Registered: April 2011
Member
Hello everybody,

I want to add the Link with Editor functionality from eclipse to a ViewPart.
Is that possible or do I have to migrate mi Views into Common Navigator Framework?
I know that in CNF it's just a matter of adding an extension point an linking it to an implementation of ILinkHelper, but migrating my custom TreeViews to CNF is way to much work.

Is that possible, or do you have any suggestions to how I should handle this?

Thanks in advance.
Lori
Re: Link with Editor in IViewPart [message #880419 is a reply to message #879474] Sat, 02 June 2012 00:38 Go to previous messageGo to next message
John Steele is currently offline John SteeleFriend
Messages: 50
Registered: January 2010
Member
So you are trying to link the selection from one view to another?

You have a few options, but I personally wouldn't go with CNF because where's the fun in that;)

Option - 1) The most obvious option would be to use the SelectionService. You can register the viewer from your navigation view as the selection provider, and the other views/editors that wish to listen to selection events can register a selection listener with the selection service.

See this article about selection service: eclipse.org/articles/Article-WorkbenchSelections/article.html

Option - 2) Maintain a Singleton object which contains a list of listeners to be notified on selection events. It would also maintain a flag indicating if views are currently linked. When the link command is executed, call the Singleton object LinkingUtil.INSTANCE.enableLinking(), which will then iterate through all the listeners that linking has been enabled. You could also store other information in the Singleton object like the selection object, so that listeners can retrieve it from there instead of having to maintain a reference to the navigational view.

See this article about Singleton: vogella.com/articles/DesignPatternSingleton/article.html

Option - 3) Use PropertyChangeSupport and/or databinding to allow other views to listen to property changes. Of course, when linking is disabled, you would not notify(...).

See this article on databinding:
vogella.com/articles/EclipseDataBinding/article.html


Option - 4) My favorite way to implement this is to use the EventAdmin OSGi service. You can post events to the EventAdmin service when a selection is made, and then register handlers to be notified when an event occurs.

See this article on view communication: tomsondev.bestsolution.at/2011/01/03/enhanced-rcp-how-views-can-communicate/

Hopefully these ideas can help you derive a solution.

John


There are a lot more other ways as well.

[Updated on: Sat, 02 June 2012 00:39]

Report message to a moderator

Re: Link with Editor in IViewPart [message #883270 is a reply to message #880419] Fri, 08 June 2012 07:21 Go to previous message
Lorand Lorincz is currently offline Lorand LorinczFriend
Messages: 35
Registered: April 2011
Member
Hello John,

Thank you for your response and your solutions. We already have a rudimentary "manual" implementation of the link with editor feature but our client want's to use specifically the out of the box solution from Eclipse.
So what I'm really interested in is knowing if I can use this out-of-the-box feature without having to migrate my custom TreeView's to CNF.

Your sugestions are welcome and I'm certainly going to use them as inspiration if using Link with Editor Eclipse feature in non CNF TreeViews is not possible.
Previous Topic:Deleting Temp Directories While IRunnableProgress is Running
Next Topic:Mark modified files
Goto Forum:
  


Current Time: Tue Mar 19 09:55:58 GMT 2024

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

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

Back to the top