Adding extra nodes to the Content Merge Viewer [message #1751655] |
Thu, 12 January 2017 04:56  |
Eclipse User |
|
|
|
Hi all,
By following the PapyrusTreeContentMergeViewer implementation we were able to filter out some elements from the viewer, by applying a filter in the getChildren() method in our extension of TreeContentMergeViewerItemContentProvider (Thanks Philip - see https://www.eclipse.org/forums/index.php/t/1082766/ ).
Now we are wondering about the following, or if anyone has any pointers on doing this - how would it be possible to add in some extra children into the Content Viewer, that are not part of the original models (and resulting comparison)?
The case in our application is as follows -
We have an EMF model for a "Block", which has a "input" feature (a list of "Input" objects)
The EMF comparison compares 2 Blocks, and correctly detects the differences between the Inputs that are contained on the block.
But we have further "static" Block Inputs that are not persisted to the Block model (these are derived elsewhere), and we want to add these to our Content Merge Viewer - they are not different between blocks but form part of the "Content" of each block from the user's perspective.
e.g - something like the following:
Static Input list: Input0
Block_A contains Input1
Block_B contains Input2
Result of comparison - e.g., Input1 is added, Input2 is deleted
But Content Merge Viewer should show
Left
+ Block_A
+ Input0
+ Input1
Right
+ Block_B
+ Input0
+ Input2
|
|
|
|
Re: Adding extra nodes to the Content Merge Viewer [message #1751742 is a reply to message #1751732] |
Fri, 13 January 2017 06:42  |
Eclipse User |
|
|
|
Hi Laurent,
Thanks for the reply.
I did develop further the changes I was making yesterday - a problem I had then was when I was adding an "Input" object directly to the array in the getChildren() method in the content provider - this was causing exceptions in the TreeContentMergeViewer, as it assumes that any items are IMergeViewerItems.
By wrapping the Input objects in my own implementation of "IMergeViewerItem", they now appear in the tree.
The thing that isn't working now is selection in the merge content viewer, e.g. selecting "Input0" on the LHS viewer does not select the corresponding "Input0" on the RHS - but I will look further at this.
|
|
|
Powered by
FUDForum. Page generated in 0.03157 seconds