![]() |
Telelogic TAU (steve huntington) | ![]() |
Topic Title: Link into Tau model Topic Summary: Reference an element in the Tau model in Tau via a GUID such that Tau browses (shows) that element Created On: 23-Jan-2007 22:39 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hello , ------------------------- Raman |
|
![]() |
|
![]() |
|
Ahuja
One wouldn't normally navigate into a model using Guids. They aren't required to be very human-friendly. However, here are a couple of ways of doing what you outline: 1. To do this without programming: use the query editor (menu Edit->Query) to write a query like: GetAllEntities().select(IsKindOf("Element") and HasPropertyWithValue("Guid", "xvHZXL36kU0LuClYMIEuhNYI")) and then double-click the matching item in the list in the Output window. This works on my model which has an Artifact with the above Guid. 2. Write an addin in tcl/C++/c# which gets the required guid from the user, finds the model element (using u2::FindByGuid), and then uses std:Locate to display it. HTH Ian ------------------------- ============= Ian Barnard Principal Consultant Telelogic UK, an IBM company |
|
![]() |
|
![]() |
|
FYI There's an example of FindByGuid/Locate in action in the DiagramOverview addin downloadable from the Tau SDK site here. To get it go the Tau SDK site and select the SDK category. It was posted 22 Dec 2006. It requires Tau 3.0.
On Windows, to install the addin unzip it into your profile in a directory like: C:\Documents and Settings\<yourusername>\Application Data\Telelogic\TAU 3.0\addins, replacing <yourusername> with your login. Restart Tau if it was already running and once you've opened a project enable the addin through Tools->Customize->Addins and put a checkmark against DiagramOverview which will be right at the end of the list of addins. To use the addin, select something which has diagrams below it, e.g. a Package, then click Tools->Diagram Overview. What this addin does is provides a web page with an overview of all the diagrams below the context you selected. On the web page the diagram thumbnails have javascript actions which tell tau to find the model element for the diagram using FindByGuid, and to display it using std::Locate. Look in DiagramOverview.tcl for the agent tcl script which generates the web page with these actions embedded in them. This example is a lot more complicated than the minimum needed to do what you want, but may give you some pointers. HTH Ian ------------------------- ============= Ian Barnard Principal Consultant Telelogic UK, an IBM company |
|
![]() |
|
![]() |
|
Hi Ian, Thanks for the reply. I actually want to accomplish #2. Additionally is there a better way (user friendly) to access an element in Tau uniquely ( without specifying what the element type is and exact name ) ? ------------------------- Raman Edited: 25-Jan-2007 at 17:01 by Ramandeep Ahuja |
|
![]() |
|
![]() |
|
Ahuja
1. A guid is certainly a unique way of identifying a model element, but isn't designed to be human-friendly. In UML you can identify a model element by name precisely using e.g ::Package1::Package2::Thing1, which references an element call Thing1, in package Package2, in Package1 (which is at the root of the model). 2. Concerning the DiagramOverview error message: I got that error when I installed the addin below Tau's installation directory (which is why I was very specific in my earlier post about installing it in the profile addins directory ;-) Concerning your tcl: 3. Is $model a valid reference to the model? 4. You should use: std::Locate $myObj HTH Ian ------------------------- ============= Ian Barnard Principal Consultant Telelogic UK, an IBM company Edited: 25-Jan-2007 at 17:20 by Ian Barnard |
|
![]() |
|
![]() |
|
Hi Ian, 1. I agree Package1:Thing1 is ok id you know it is in Package 1. A user might not know about the model but want to find Thing1 without getting 5 references (other packages). That is why I like the GUID :). ------------------------- Raman |
|
![]() |
|
![]() |
|
I've add a tcl file to my project and run a very similar script.
set sel [std::GetSelection] Output "sel=$sel guid=[u2::GetValue $sel Guid]\n" set guid [u2::GetValue $sel Guid] set model [u2::GetModel $sel] set found [u2::FindByGuid $model $guid] Output "found=$found\n" std::Locate $found which if a diagram is selected (in the Model View) when you run it should open the diagram. Strange; I can't get std::Locate to work from the tcl file but I'm afraid I haven't got time to look more into this now. Another UML-y way of marking something as interesting is to put a stereotype on it. For example you could mark a class as <<critical>>. Then by finding all things marked <<critical>> (using e.g. a query expression) you can show the user the relevant things to navigate to. What the DiagramOverview addin does is embed the guid in the web page it generates, and when the user clicks a thumbnail the javascript writes the guid into some tcl which uses FindByGuid and Locate to activate the diagram. If you look in the Documentation section of the SDK site on support.telelogic.com, there is a bundle of papers including one on stereotypes and profiles, which are very easy to use. DiagramOverview definitely works using std::Locate, so maybe there's a limitation that std::Locate doesn't work from a tcl script file? If you can't get std::Locate to work from an addin or agent (like DiagramOverview), please report this to support. Regards Ian ------------------------- ============= Ian Barnard Principal Consultant Telelogic UK, an IBM company |
|
![]() |
Telelogic TAU
» TAU/Developer
»
Link into Tau model
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.