Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » masterdetails update treeviewer
masterdetails update treeviewer [message #657598] Thu, 03 March 2011 12:38 Go to next message
j.dufour  is currently offline j.dufour Friend
Messages: 2
Registered: March 2011
Junior Member
Good morning,

I used the following plugin (http://www.conceptualprocessengineering.com/library/) to see my EMF model with the master details pattern.
It's OK.

But I want to create a RCP command whose modify the selected element in the treeviewer.

I tried this testcode:
Object[] newSegments = new Object[3];
EditingDomain domain = editor.getEditingDomain();
// Segment 0
newSegments[0] = root;
// segment 1
Collection c = domain.getChildren(root);
Object[] ac = c.toArray();
newSegments[1] = ac[ac.length - 1];
// segment 2
c = domain.getChildren(ac[ac.length - 1]);
ac = c.toArray();
newSegments[2] = ac[ac.length - 1];
TreePath newTreePath = new TreePath(newSegments);
TreeSelection newSelection = new TreeSelection(newTreePath);
// raise event
contributor.selectionChanged(new SelectionChangedEvent(editor.getContentOutlineViewer(), newSelection));


There is no runtime error. But the treeviewer don't change state.

Thanks.
Re: masterdetails update treeviewer [message #657690 is a reply to message #657598] Thu, 03 March 2011 16:05 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Don't you have to actually set the selection, not just notify that
you've done it when you really haven't?

j.dufour wrote:
> Good morning,
> I used the following plugin
> (http://www.conceptualprocessengineering.com/library/) to see my EMF
> model with the master details pattern.
> It's OK.
>
> But I want to create a RCP command whose modify the selected element
> in the treeviewer.
>
> I tried this testcode:
> Object[] newSegments = new Object[3];
> EditingDomain domain = editor.getEditingDomain();
> // Segment 0
> newSegments[0] = root;
> // segment 1
> Collection c = domain.getChildren(root);
> Object[] ac = c.toArray();
> newSegments[1] = ac[ac.length - 1];
> // segment 2
> c = domain.getChildren(ac[ac.length - 1]);
> ac = c.toArray();
> newSegments[2] = ac[ac.length - 1];
> TreePath newTreePath = new TreePath(newSegments);
> TreeSelection newSelection = new TreeSelection(newTreePath);
> // raise event
> contributor.selectionChanged(new
> SelectionChangedEvent(editor.getContentOutlineViewer(), newSelection));
>
>
> There is no runtime error. But the treeviewer don't change state.
>
> Thanks.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: masterdetails update treeviewer [message #657905 is a reply to message #657690] Fri, 04 March 2011 14:57 Go to previous messageGo to next message
j.dufour  is currently offline j.dufour Friend
Messages: 2
Registered: March 2011
Junior Member
Hi,

Sorry, I must not understand your answer correctly.

With the work about treepath, I think I set a new item to see it in the treeview, and when I raised the event, I think it must be refresh the treeview to see my new choice, but it doen't work ==> the selection is again the old selection.
Re: masterdetails update treeviewer [message #657917 is a reply to message #657905] Fri, 04 March 2011 15:20 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Where to you set the selection? I see you creating a TreeSelection, and
see you notifying that the selection has changed, but I don't see you
actually setting this to be the selection of an actual tree view. Have
you used the debugger to see what happens when you call
"selectionChanged"?


j.dufour wrote:
> Hi,
>
> Sorry, I must not understand your answer correctly.
>
> With the work about treepath, I think I set a new item to see it in
> the treeview, and when I raised the event, I think it must be refresh
> the treeview to see my new choice, but it doen't work ==> the
> selection is again the old selection.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF instance
Next Topic:Where to Start
Goto Forum:
  


Current Time: Thu Mar 28 12:52:41 GMT 2024

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

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

Back to the top