|Re: How do I programmatically select an EMF element in the Project Explorer? [message #1504501 is a reply to message #1497128]
||Tue, 09 December 2014 10:03
| Ed Merks
Registered: July 2009
I don't have significant experience with the common navigator
framework. Is the tree for your model actually shown in the Project
explorer? More comments below.
On 03/12/2014 4:09 PM, Paul C. Brown wrote:
> Given an element selected in the EMF editor, I want to select the
> corresponding element in the Project Explorer. I have tried two
> approaches so far, neither of which has worked.
Keep in mind that it may well be the case that the explorer is showing
different objects (from a different resource set) than is the editor
itself (depending on whether your using the transaction framework to
share editing domains.
> Approach 1: Extend the Navigate->Show In->Project Explorer
> functionality. Here I have modified the EMF Editor's IShowInSource.
> getShowInContext() to return the model element, but the Project
> Explorer does not understand that selection nor can I figure out how
> to configure it to map that selection into an actual element of the tree.
The issue with the editor and the explore using different objects could
well be a problem here, but as I said, I don't understand the details of
how the project explorer works. That's why I ask if your model is
actually showing children in the explorer. If so you must have done
something to make that work....
> Approach 2: Create a new operation (pop-up menu) to perform this
> action. Here I am struggling with the implementation of the handler.
> Given the model element, how do I locate the corresponding tree node
> in the Project Explorer?
Also a good question, but it's similar to approach 1 where you've
returned the selection in the editor, but the outline in the explorer is
likely using different object instances than in the editor...
> Can anyone help me with either of these approaches (or offer a third
I have no deep experience. Hopefully someone else will suggest something...
Powered by FUDForum
. Page generated in 0.01954 seconds