EMF Element Binding to TreeViewer [message #1806175] |
Sat, 04 May 2019 20:14  |
Eclipse User |
|
|
|
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: Sat, 04 May 2019 20:15] by Moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04407 seconds