Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic TAU (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 23-Jan-2007 22:39
User is offline View Users Profile Print this message


Ramandeep Ahuja

Posts: 10
Joined: 25-Sep-2006

Hello ,

I would like to accomplish the following: Reference an element in the Tau model in Tau via a GUID such that Tau browses (shows) that element when I provide the GUID.

Is there an API function to do this ?  What is std::Locate used for ?

Thanks.

Raman



-------------------------
Raman
Report this to a Moderator Report this to a Moderator
 24-Jan-2007 09:49
User is offline View Users Profile Print this message


Ian Barnard

Posts: 91
Joined: 4-Jul-2002

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
Report this to a Moderator Report this to a Moderator
 24-Jan-2007 10:16
User is offline View Users Profile Print this message


Ian Barnard

Posts: 91
Joined: 4-Jul-2002

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
Report this to a Moderator Report this to a Moderator
 25-Jan-2007 16:56
User is offline View Users Profile Print this message


Ramandeep Ahuja

Posts: 10
Joined: 25-Sep-2006

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 ) ?

I tried the DiagramOverview Add -in but I get the following error message no matter what level entity I select. I selected a package with diagrams below it (CD, CSD, ...) :

Please select an entity to collect diagrams from
0: ill formed object id0 : Cannot interpret this as a ITtdEntity.

Also I could not get Locate to work:

 set myObj [u2::FindByGuid $model "bQjFlIrRn2ALYleaLE1gZisI"]
 std::Locate myObj


Thanks.
Regards,
Raman



-------------------------
Raman

Edited: 25-Jan-2007 at 17:01 by Ramandeep Ahuja
Report this to a Moderator Report this to a Moderator
 25-Jan-2007 17:12
User is offline View Users Profile Print this message


Ian Barnard

Posts: 91
Joined: 4-Jul-2002

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
Report this to a Moderator Report this to a Moderator
 25-Jan-2007 17:24
User is offline View Users Profile Print this message


Ramandeep Ahuja

Posts: 10
Joined: 25-Sep-2006

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 :).

2. Ok I tried this but Tau didn't seem to automatically browse to that element:

  set curProject [std::GetActiveProject]
  set model [std::GetModels -kind U2 -project $curProject] 
  set myObj [u2::FindByGuid $model "bQjFlIrRn2ALYleaLE1gZisI"]
  std::Locate $myObj

Thanks again for your quick response!



-------------------------
Raman
Report this to a Moderator Report this to a Moderator
 25-Jan-2007 18:07
User is offline View Users Profile Print this message


Ian Barnard

Posts: 91
Joined: 4-Jul-2002

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic TAU forum.
There are currently 0 users logged in.
The most users ever online was 15 on 31-Mar-2008 at 16:22.
There are currently 0 guests browsing this forum, which makes a total of 0 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.