Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to add SessionWrapper/ViewHelper extensions to handle custom tree elements(Children of a custom ItemProviderAdapter are not displayed in the tree)
How to add SessionWrapper/ViewHelper extensions to handle custom tree elements [message #1817981] Tue, 03 December 2019 20:35 Go to next message
Pavel Vlasov is currently offline Pavel VlasovFriend
Messages: 3
Registered: April 2013
Junior Member
I have an ereference item provider for grouping children by containing references - https://github.com/Nasdanika/core/blob/develop/emf.edit/src/org/nasdanika/emf/edit/EReferenceItemProvider.java. This provider was inspired by the EMF book. It works well in the generated EMF tree editor, but in the project navigator children of this provider are not shown.

I stepped through the Sirius code and found that children are collected by two methods in the SessionWrapperContentProvider - getChildren() and getChildrenFromExtensions(). The getChildren method does not handle the case when the object is an instance of some tree content provider. The getChildrenFromExtensions() seems to be the method which I need, but I couldn't find how to contribute such extensions in the correct way. There is ViewHelperImpl class with addExtension() method. However, the method is not API, the class is internal, and the method parameter type is also internal.

I searched the web, integrated help, and this forum, but couldn't find a solution. Any advice? Is it possible without introducing dependency on Sirius API such as CommonSessionItem (handled by getChildren())?
Re: How to add SessionWrapper/ViewHelper extensions to handle custom tree elements [message #1818028 is a reply to message #1817981] Wed, 04 December 2019 12:56 Go to previous messageGo to next message
Pavel Vlasov is currently offline Pavel VlasovFriend
Messages: 3
Registered: April 2013
Junior Member
Here is my working solution - https://github.com/Nasdanika/vinci/blob/develop/design/src/org/nasdanika/vinci/design/Activator.java#L53. It's drawback is that is uses restricted API's. I'm wondering if there is the "official" way to contribute extensions - my search of the Sirius codebase yielded nothing of the kind.
Re: How to add SessionWrapper/ViewHelper extensions to handle custom tree elements [message #1818094 is a reply to message #1818028] Thu, 05 December 2019 16:41 Go to previous message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 499
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Pavel,

It seems that your use of ViewHelperImpl.addExtension() is correct.

If you want to avoid the use of restricted APIs, I think you might need to do some attempts with your own CNF extensions in your plugin.xml : org.eclipse.ui.navigator.navigatorContent / navigatorContent and org.eclipse.ui.navigator.viewer / viewerContentBinding. You will have the possibility to register
you content provider and its trigger points and then to bind it to the Model Explorer viewer.

You can find how Sirius declares it navigator content and viewer bindings in https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tree/plugins/org.eclipse.sirius.ui/plugin.xml

Regards


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius

[Updated on: Thu, 05 December 2019 16:41]

Report message to a moderator

Previous Topic:How to unit test diagram related operations ?
Next Topic:How to set Values of attributes programmatically
Goto Forum:
  


Current Time: Sat Dec 05 03:30:57 GMT 2020

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

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

Back to the top