EMF Element Binding to TreeViewer [message #1806175] |
Sun, 05 May 2019 00:14 |
Parsa Pourali Messages: 210 Registered: February 2014 |
Senior Member |
|
|
Hello,
I am using the below code snippet to show the model contents in a treeviewer. This works fine as I give the whole eResource as the input! However, I need to show only some part of the model, so I don't wanna start from the root of the model! I tried to give the element as the input but it doesn't work when I input an element in treeviewer's setinput (). Any idea would be appreciated.
Thanks,
Parsa
composedAdapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
composedAdapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
composedAdapterFactory.addAdapterFactory(new FormlItemProviderAdapterFactory());
composedAdapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
Tree tree = new Tree(this, SWT.SINGLE);
TreeViewer tv = new TreeViewer(tree);
tv.setContentProvider(new AdapterFactoryContentProvider(composedAdapterFactory));
tv.setLabelProvider(new AdapterFactoryLabelProvider(composedAdapterFactory));
//HOW TO GIVE AN ELEMENT AND NOT THE RESOURCE HERE ?
tv.setInput(FPC_SingletonData.getCurrentRoleable().eResource());
[Updated on: Sun, 05 May 2019 00:15] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02888 seconds