Community
Participate
Working Groups
Created attachment 262283 [details] Tree on generated editor I have used the method described in the book "EMF Eclipse Modeling Framework" at ยง 19.2.3. "Adding Non-Model Intermediary View Objects" in order to define some "virtual node" in my content tree. In the generated editor it seems to work properly however in the content tree of the model explorer view the children of my virtual nodes are not displayed. See screenshots in attachment
Created attachment 262284 [details] Tree in the model explorer view
org.eclipse.sirius.ui.tools.internal.views.common.SessionWrapperContentProvider.doGetChildren() handles IResource, Sirius items and EObject, it can return "virtual node" ie non EObject children but will not return children for them. The wrapped content provider is an AdapterFactoryContentProvider, created from a ComposedAdapterFactory (with ComposedAdapterFactory.Descriptor.Registry.INSTANCE, DialectUIManager.createAdapterFactory(), ReflectiveItemProviderAdatpterFactory). This might not be optimized, see Bug 454388. You can try to use ViewHelper.INSTANCE which will be a ViewHelperImpl and call addExtensions to provide a ISessionViewExtension with your content provider to handle your virtual nodes. Your extension will be called on getChildren() and getParent(). This is not API but might allow you to wait for a correction of this bugzilla. The concrete correction will be to modify SessionWrapperContentProvider/SiriusCommonContentProvider to avoid to stop on non EObject elements.
Yes I agree. But since I am using my own view I have copied SessionWrapperContentProvider and added the following correction. In SessionWrapperContentProvider.doGetChildren I have added the following case and it works just fine. else if (parentElement instanceof IStructuredItemContentProvider) { result.addAll(((IStructuredItemContentProvider) parentElement).getElements(parentElement)); } Thanks for your help. Should I close the bug or do you plan to integrate such change in the Sirius Content provider?
New Gerrit change created: https://git.eclipse.org/r/88339