Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: fferm on December 14, 2010, 08:05:45 pm

Title: Element in focus in menu click
Post by: fferm on December 14, 2010, 08:05:45 pm
I'm creating a function that will run as a result of a menu click through the EA_MenuClick event.

When the user clicks this menu item, I want updates to happen to all elements in the model in focus, i e not the full set of models but only the one that the user previously worked in.

How can I find out what the element in focus is from the menu click.  I only get a reference to the full repository and I did not find any way to find the focus from there.

Title: Re: Element in focus in menu click
Post by: Geert Bellekens on December 14, 2010, 09:37:41 pm
Repository.GetTreeSelectedItem (object SelectedItem) gives you the selected item in the project tree.
From there you should be able to figure out which model is being used.
(go up until package.Element is NULL or check Package.IsModel, but I'm not sure about the latter)

Geert