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 - TheTwo

Pages: [1] 2 3
1
Automation Interface, Add-Ins and Tools / Re: Generating Custom XML
« on: May 25, 2010, 09:51:05 pm »
Hi,

I think it is not possible in EA to customize the generation of XMI directly. For my XMI format, I had first realized an XSLT transformation to from EA XMI 2.1 to my XMI format, but mine was extremely different. So I needed too many templates and after every change in the EA XMI format, I needed to change my transformation.

So I have written an  own export in my addin. Using the EA API I extract the information from the Repository and write it to an DOM tree.

This isn't the best way, but it works.

2
Hi everybody,

im currently implementing an AddIn for EA and need to know which elements are selected in the current diagram.
For that I use the EA_OnContextItemChanged() method to read the context items everytime they have changed. The Problem occures when one Element in an diagram is allready selected and I select another which pushed Ctrl key. In this case the event is not fired, and I can't save the additionaly selected element.

I need these two selected elements to deside if I add an element from the Toolbox or not. If I select an Element in the Toolbox, the collection returned from the method selectedObjects() is empty.  

Is this an error in EA and is there an work around?

Thanks
TheTwo

3
Thanks to all,

today I've found the solution to my problem. The reason has been, that I've used the EA.Element supplied as prameter of the method EA_OnRunElementRule(..).

Now I use the element, like in the other EA_OnRun...Rules. There is only an ID delivered.

Code: [Select]
       
public void EA_OnRunElementRule(EA.Repository Repository, string RuleID, EA.Element Element)
{
      EA.Element element = Repository.GetElementByGuid(Element.ElementGUID);

By using my own "element" recieved out of the repository, no exceptions occure.

Why is an EA.Element in the API defined, that should not be used? All other methods have only an ID as parameter and everything works fine.

Maybe this is a bug (but definitly an inconsitency in the API) that should be changed in the next versions of EA.

The Two

4
Hi,

I've tried to call the garbage collector in the event code (OnEndValidation) after nearly release every COM object by ReleaseComObject(...) I have used. This only causes the exeption to happen in the OnEndValidation()-part of the code instead of other event methods like EA_OnRunConnectorRule(...).

Is it possible that EA runs concurrent operations on the repository, while the validation is executed. May this cause these exceptions?

Thanks
TheTwo  

5
Hi,

I've tried to use my workaround in my Add-In and realized, that it is nearly impossible to release all references by hand. The code gets really ugly.

Has someone an other - maybe more usable than mine - idea to solve my problem?

Thanks
TheTwo

6
Thanks for your help.

After half a day try and error, I found a solution.

I'm using the Method
System.Runtime.InteropServices.Marshal.ReleaseComObject(attributes);


The parameters EA calls are handeled by EA self. So I have not to release the parameter Element. But I have to release the EA.Collection attribs and every attribute (from this collection) I work on. So I can't use a foreach. Its possible to use foreach.

This solution is not nice but it works.
               EA.Attribute attr = null;
                for (short i = 0; i < attribs.Count; i++)
                {
                    attr = (EA.Attribute)attribs.GetAt(i);
                    
                    //check type of enumeration
                    if (!(attr.Stereotype.Equals("enum") && attr.Type.Equals("")))
                    {
                        //release com object
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(attribs);
                        return false;
                    }
                    //release com object
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(attr);
                }
                //release com object
                System.Runtime.InteropServices.Marshal.ReleaseComObject(attr);


Is there a possibility to extend the EA.Collection with an destructor or automate something like this?

I have read about the "extension methods" in C# 3.5 but I use 2.0 and VS2005.

7
I am using EA 7.1 Build 833 but also tested my addin with the newest Version of 7.5. In both cases the Exeption is thrown.

To reference the API I use the Interop.EA.dll.

How can I release the resource (here the Attribute-Collection) explicitly in C#?

And I have not send a bug report to Sparx Systems, yet, because I am not sure if I do something wrong.

Thanks
TheTwo

8
Hi,

I've a problem with an self implemented rule check.

1. It is started by the EA_OnStartValidation. There I do nothing.
2. EA_OnRunElementRule is called.
3. then I take the EA.Element and call
     if (Element.Attributes.Count == 0)
                return true;


At the end EA_OnEndValidation(EA.Repository Repository, Object Args) is called from EA.
There I call
GC.Collect();
GC.WaitForPendingFinalizers();


When this method is finished, then an TargetInvocationExeption occures in my Addin.

What could be the reason?

Thanks
TheTwo

9
Automation Interface, Add-Ins and Tools / Use Function macro in addin
« on: January 28, 2009, 10:06:34 pm »
Hi,

I'm trying to realize an Add-In (C#) that writes an special xml-file. In this file also a javadoc should be inserted.

Is it possible to use the fuction macro JAVADOC_COMMENT to receive e.g. a string with the javadoc of a class in my Add-In?

Thanks for reply
TheTwo  

10
Hi,

I've written my own XML-Export for EA as AddIn in C#. Now I cannot find the information about a subsetted or redefined association in the repository. I've defined this Property over

context menu->Advanced->Specilize associations ...

Thanks
TheTwo

11
The Element is not created through my Addin but simply with the Toolbox by drag and drop.

Then the the Method EA_OnNotifyContext.. is called by EA. and there I call an Repository.ValidateElement(GUID) on the EAElement.

Must be done some update between these two steps? Shouldn't EA do the update and refreshs by it self?

Thanks
TheTwo

12
Hi,

Is it maybe possible that after creating an EAElement the Reository is not completely updated before the method EA_OnNotifyContextItemChanged()?

Thanks
TheTwo

13
Has someone an idea what could cause this exception or how I can find the reason for it?

Thanks
TheTwo

14
I'm only use Visual Studio to write the Add-In in C#. In EA I use the DLL I have created.

I've added a new ToolBox, a new element type and a new diagram type with my own MDG Technology file (XML) added by the Addin.

I've updated to Build 831 but without success.

Now I get the following error message in EA:

An error occurred while attampting to communicate with an Addin:
EA_Addin_Rulechecker(EA_Addin_Rulechecker.Main)
"EA_OnRunElementRule: External component has thrown an exception."
Please contact ...

And after this:

An error occurred while attampting to communicate with an Addin:
EA_Addin_Rulechecker(EA_Addin_Rulechecker.Main)
"EA_onPostNewConnector: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Please contact ...


15
I'm using
MS Visual Studio 2005 v. 8.0.50727.762
Programing in C# .Net-Framework v. 2.0.50727
Enterprise Architect v. 7.0.818
Windows XP SP3

Thanks
TheTwo

Pages: [1] 2 3