Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Geert Bellekens

Pages: 1 ... 478 479 [480] 481 482 ... 525
7186
Hi,

It's definitely possible to do what you need using the API, but I don't think there is a readily available tool that already does something like that.
I suggest you start reading here:http://www.sparxsystems.com/enterprise_architect_user_guide/8.0/automation_and_scripts/automation_interface.html
Then look at the examples in the C:\Program Files\Sparx Systems\EA\Code Samples\C#_Sample directory
And have a look at the addins available from the community site

Geert

7187
Jeronimo,

Could you post an update of your code?
We might be able to spot the error.

Geert

7188
Jeronimo,

I think you'll need to user Repository.ReloadDiagram (long DiagramID)
to refresh the contents of the diagram.

Geert

PS. I don't think diagramObjects.Refresh() is usefull in your context.

7189
Automation Interface, Add-Ins and Tools / Re: Change diagram type (icon)
« on: December 23, 2010, 01:51:52 am »
There's always the solution with  Repository.Execute(SQLString)  ;)

Geert

7190
Mariusz,

The multiplicity information is stored in the t_xref table.
The description column from my example has following info:
Code: [Select]
@PROP=@NAME=lower@ENDNAME;@TYPE=Integer@ENDTYPE;@VALU=1@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;@PROP=@NAME=upper@ENDNAME;@TYPE=UnlimitedNatural@ENDTYPE;@VALU=*@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;
I think the only solution right now (before sparx exposes this property in the API, you better send them a feature request) is to use Repository.SQLQuery and then parse the description column to get the info you need.

Geert

7191
Automation Interface, Add-Ins and Tools / Re: scripting
« on: December 16, 2010, 05:10:40 pm »
George,

I'm in no way a specialist, but isn't vbscript weakly typed?
If I'm correct that would mean that you have to declare variables and functions without a type.
So iso
Code: [Select]
Dim myVariable as integer you type
Code: [Select]
Dim myVariable
Geert

7192
This is how I do it:

Code: [Select]
/// locks the element by the current user
/// </summary>
/// <returns>true if successful</returns>
public override bool enableWrite()
{
      //because of some nasty bug in EA the application will crash if the element is already locked
      // by another user.
      // therefore we check first if this element is locked before even trying.
      string SQLQuery = "select s.entityID from t_seclocks s where s.entityID = '" + this.wrappedElement.ElementGUID + "'";
      XmlDocument result = ((EAModel)this.model).SQLQuery(SQLQuery);
      XmlNode lockNode = result.SelectSingleNode("//entityID");
      if (lockNode == null)
      {
            //no lock found, go ahead and try to lock the element
            try
            {
                  return this.wrappedElement.ApplyUserLock();
            }
            catch (Exception)
            {
                  return false;
            }
      }
      else  
      {
            //lock found, don't even try it.
            return false;
      }
}

Geert

7193
Alright then :)

Geert

7194
So its solved?

Geert

7195
Automation Interface, Add-Ins and Tools / Re: Controlling package order
« on: December 16, 2010, 03:32:08 pm »
Jason,

You mad the classical mistake of thinking that EA.Collection.Refresh something else then it actually does.
In fact, in most cases you won't need EA.Collection, I think I've never needed it in any of my addins.
The Refresh operation will only go back to the database and reload the collection into memory. This is only necessary if you add or remove something from the Collection, and you want to iterate the collection later. If you don't refresh the collection it will not reflect the added or removed elements.
So Refresh should maybe be better named ReloadContentsFromDatabase.

Geert

7196
Automation Interface, Add-Ins and Tools / Re: Controlling package order
« on: December 15, 2010, 07:48:41 pm »
Jason,

First thing to do is figure out if the treepos value has been saved after you set it. You can check in the database if the t_object.Tpos column contains the value you've set.
If that is the case, try to reload the model. The GUI often isn't aware of changes like that, so it might need to repaint before you see the correct order.

Geert

7197
Automation Interface, Add-Ins and Tools / Re: Controlling package order
« on: December 14, 2010, 07:55:29 pm »
Jason,

There's a setting somewhere in the options to allow/disallow free ordering.
If it is allowed (and EA takes the treepos into account) you should see the green up/down arrays enabled in your project browser.

Geert

7198
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

7199
Then I suggest you ask Sparx, I'm all out of ideas.

Geert

7200
Which version are you using?
Have you tried it with the latest version?
I think I remember a fix for a similar issue.

Geert

Pages: 1 ... 478 479 [480] 481 482 ... 525