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.

Topics - fwoolz

Pages: 1 ... 5 6 [7]
Another one for Sparx:

The AI provides an undocumented Repository method "Execute," which allows an automation client to execute a non-query SQL command (such as "INSERT INTO..." I know this works as of 8.0.857, because I just tried it with the table t_xrefuser). Would Sparx consider changing this from 'undocumented' to 'documented', as it provides add-ins with additional flexibility in accessing the EA database?

Fred W

Automation Interface, Add-Ins and Tools / Undocumented features - AI
« on: February 12, 2010, 09:34:37 am »
As a result of responses to forum posts and some poking around in the object model (importing the EA AI into EA is truly a wonderful thing...), I've run across a few undocumented features, to wit:

    CustomCommand(String, String, String) : String (I already know this can be used to sync stererotypes... thanks Neil!)
    Execute(String) : Void
    CreateModelWatcher() : ModelWatcher (the ModelWatcher is described in the help, but the factory method isn't described)
    SuppressSecurityDialog : Boolean
    EnableEventFlags : Boolean

    GetCodeProject(string*, string*) : Void
    SetCodeProject(string, string) : Void
    GetClassCodeObjects(String) : CodeObject
    GetCodeObject(string) : CodeObject
    ShallowGetClassCodeObjects(String) : CodeObject
    GenerateSourceCode() : Void

There may be more...

Would Sparx be so kind as to indicate which of these methods may be used without risking model implosion, how they are used, and, eventually, document these things in Help?

Fred W

Automation Interface, Add-Ins and Tools / Use of _profile_data tag
« on: February 05, 2010, 02:21:04 pm »
Does anyone know the significance/use of the _profile_data tag applied to a profile package? Its value is stored in the tag Notes field (as a <memo>* value) and appears to be XML associated with the profile (<ProfileData/> by default).

Fred W

I have the following scenario:
  • I create a new Element using the AI.
  • I assign the Element just created a stereotype from a profile created previously.
  • I now want to synchronize the Element with the profile to ensure that all tagged values, shape scripts, etc. are applied to the new Element.
How would one accomplish this using the AI?


I'm working on a .NET requirements management add-in for EA that integrates viewing of linked documents together with the normal requirement attributes (and then some). To allow advanced editing of the linked documents (beyond the editing capability offered by a .NET RichTextBox), I fire up Wordpad and load the linked document into it (after saving the linked doc to a temp file); this allows the user to remain within the add-in environment to do fancy editing without having to open EA's document editor. The add-in then "waits" for Wordpad to close, reads the modified file back into the linked document, then updates the display. The problem is the "wait" doesn't wait at all... the add-in blows right through the wait statement and updates the linked document with the original temp file - in other words, without the changes made in Wordpad. Adding a message box to the code, however, forces a wait (until it's closed at least); this "fixes" the wait problem and the update to the linked doc is now successful.

Here's the (C#) code:

Code: [Select]
private void editToolStripMenuItem_Click(object sender, EventArgs e)
            bool res;

            if (this.processEditor == null)
                this.processEditor = new System.Diagnostics.Process();
                this.processEditor.EnableRaisingEvents = true;

            tempdoc = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\EA_" + Guid.NewGuid().ToString().Replace("{", "").Replace("}", "") + ".rtf";

            processEditor.StartInfo.FileName = Strings.AdvancedEditor; // C:\Windows\write.exe in this case
            processEditor.StartInfo.Arguments = tempdoc;

            processEditor.WaitForExit(); // This happens immediately; it doen't wait for the process to exit...

            MessageBox.Show(processEditor.HasExited.ToString()); // This provides the required wait to allow the process to exit!

            res = theRequirement.LoadLinkedDocument(tempdoc);
            res &= theRequirement.Update(); // Unsure whether this is needed, but what the heck.

            this.rtfEditor1.TheRichTextBox.Rtf = theRequirement.GetLinkedDocument();

            processEditor = null;

This seems to be a Windows problem rather than an EA problem, but I'm hoping that the Sparxians or one of our crackerjack EA gurus (and there are quite a few of them on this forum) can offer some advice. It's as if the wait call, viewed metaphorically as a yodeler waiting to hear his/her echo return from across a wide valley (!), has his/her yodel bounced back immediately by an invisible wall (non-metaphorically, the COM barrier of the add-in model or the EA process itself?). I'm no Win32 expert, so this is just a wild guess (a yodel in the dark?)

Fred W

PS: I know, I need to add code to clean up the temp file...

Automation Interface, Add-Ins and Tools / MDG Add-Ins and Automation
« on: June 02, 2009, 02:08:22 pm »
There appear to be some arcane aspects to the implementation of certain MDG technologies, e.g. SysML, that are opaque to the Automation interface. For example, after finally getting an array copy (multiple copies) feature in an add-in to work (thanks to an assist from Aaron B), I discovered that SysML flowProperty elements copy as plain-old Parts. Checking the related entries in t_object (via Access) revealed that PDATA1 contains what appears to be an Xref to the property type, which apparently carries with it the fact that the element is no mere part but is in fact a SysML flow property. Such undocumented features make it difficult to extend the MDG technologies. Can we expect a write-up from Sparx explaining the use of custom properties and Xrefs, particularly as they apply to MDG add ins?


I recall encountering this problem a long time ago when I was more active in tinkering with add ins, and I seem to remember getting around it, but...

Here is the offending code (C#):

EA.Element nelem = (EA.Element)(currdiag.DiagramObjects.AddNew(currelem.Name + i.ToString(), currelem.Type));

The error:

System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'EA.Element'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{20073882-CCA7-4E64-BE9C-D381216A4225}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

In the above, currelem is an EA element passed to the method in which the offending line appears, currdiag is the current diagram, and i is an index appended to the name of the current element.

Further info:
EA: 7.5 build 845
VS 2008
.NET 3.5 SP1


Automation Interface, Add-Ins and Tools / Add-Ins using .NET 2.0
« on: September 04, 2006, 10:57:55 am »

Are there any known problems implementing EA add-ins using v 2.0 of the .NET framework?


Automation Interface, Add-Ins and Tools / Profile Woes
« on: August 16, 2006, 03:54:05 pm »
Hello All,

The behavior of <<redefines>> and <<extends>> in UML profiles is inconsistent. In some cases (e.g. connectors), EA 6.1 wouldn't carry attributes over as tagged values once the saved profile was imported into EA unless the connector metaclass was redefined (extend didn't work). In EA 6.5 Beta 1, it seems even redefinition doesn't work--attributes defined in the profile don't show up as tags when the imported profile element is placed in a diagram. Similar behavior was noted in 6.1 with events.


Automation Interface, Add-Ins and Tools / Merge Nodes and Regions
« on: August 15, 2006, 04:04:45 pm »

This isn't specifically an automation interface issue, but it arose while working on an add-in to process activity diagrams into code, simulations, scenario text, etc. For some regions, Merge Nodes (and possibly Decision Nodes) in Regions don't take the Region ElementID as their ParentID (other elements do, e.g. Actions). In addition, attempting to move a Merge Node under a Region yields an error message. Why is this?


Hello All,

It seems that, while casting Element.TaggedValues.GetAt(x) to TaggedValue works fine, trying the same with Connector.TaggedValues throws a COM invalid cast exception. In addition, Connector.TaggedValues.GetByName(name) always seems to throw an OLE exception, yet GetByName() works fine for an Element.



Can anyone clarify the usage for the Repository.ShowInProjectView(Object) method? I didn't see anything in the help file, but snooping in EA.tlb shows a help string stating "Show an object in the tree view." I've tried calling it, passing an element as the parameter, but it seems to do nothing (at least it doesn't crash my .NET add-in).

Fred Woolsey

Hello All,

I've been trying out MDG link for VS and encountered a minor glitch. It's minor because it can be overcome using EA's built-in code engineering feature. It's a glitch, however, because it seems the add-in is less tightly integrated with VS than vanilla EA at this point!

Here's the scenario: I have a project connection between VS (C#) and EA. Adding classes in either tool, then synchronizing works just fine. However, when I add a method to an already synchronized class, MDG Link doesn't recognize the need to re-synchronize, so Merge doesn't bring in the new method. However, right-clicking on the class in EA and clicking "Synchronize model" pulls the new method in.


Hi All,

Is there an automatic way to access and manipulate the current element via the Automation Interface in an Add-In?


Hello All,

I'm working on an "EA Toolkit" add-in and am interested in hearing what kinds of utility features the EA community is interested in. So, any and all suggestions are most welcome!

Fred Woolsey

Pages: 1 ... 5 6 [7]