![]() |
Telelogic TAU (steve huntington) | ![]() |
profile :
search :
help :
dashboard :
calendar :
home
|
||
|
Topic Title: COM API Topic Summary: Created On: 28-Apr-2006 13:32 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hello,ffice We are developing an Add-in using COM API. Our idea is use Visual Studio 2003 and C# adding the references of Telelogic TAU: using U2ModelAccessTypeLib; using TauG2IntegrationAddinLib;>We have been testing with a short program and we obtain the next error: Meta feature Session is derived. The code is show below: U2ModelAccessTypeLib.ITtdModel pITtdModel=ma.LoadProject("adp_adp.ttp"); U2ModelAccessTypeLib.ITtdEntity pSession=(U2ModelAccessTypeLib.ITtdEntity)pITtdModel; try { ITtdEntity pPackage; pPackage = pITtdModel.New("Package"); pPackage.SetEntity("Session", pSession, 3); } catch(Exception excep){ System.Windows.Forms.MessageBox.Show(excep.Message); } >Thanks in advance. Best Regards. |
|
![]() |
|
![]() |
|
Javier
Nice smilies ![]() In the metamodel, the Session metafeature is what UML calls 'derived' which usually means it is worked out from some other metafeatures and not stored as a value itself, so you can't modify it. In this case, the Session is effectively the model instance you are using so it has a different value each time TAU runs, and modifying it wouldn't be sensible so TAU doesn't allow it. I guess you are trying to create a package: to do this, use the Create api function, which will create an element below the thing you specify to the Create call (give it the Model to create a top-level package); then all you have to do is set its name using SetValue on the metafeature Name. Use the Create call passing it your new package to create elements in the package. The example 504 (for TAU 2.6) in the help for Create (under Customizing TAU->COM API->ITtdEntity) shows how to create a top-level package, a sequence diagram and an assignment expression. To better understand the TAU metamodel which you are accessing using COM, if you haven't already you should download and use the SDK; when I start an addin which creates or reads model I always create an example model in TAU just like what I want the addin to create/read, and then use the debugger to explore the model and understand the relationships between elements and how to navigate between them. I remember one thing which confused me at first when using the API (using tcl) was the difference between Get/SetEntity and Get/SetValue; use Get/SetEntity when you need a reference to a model element for example when you might then want to use Get/SetEntity or Get/SetValue on its metafeatures, but use Get/SetValue when you need to read/write the actual value of a metafeature, for example the Name of an element. HTH Ian ------------------------- ============= Ian Barnard Principal Consultant Telelogic UK, an IBM company Edited: 28-Apr-2006 at 16:57 by Ian Barnard |
|
![]() |
|
![]() |
|
Ok.
Many thanks Ian. |
|
![]() |
Telelogic TAU
» TAU/Developer
»
COM API
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.