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 - Rick Meng

Pages: [1]
1
Automation Interface, Add-Ins and Tools / API function to get EA version
« on: August 30, 2011, 03:19:36 pm »
My plugin needs to know which EA version is used. Is there an API function can return the current EA version?

Thanks.

2
Thank you everyone. :D

3
I am using EA API to import model library from a registry server. I want to set imported libraries to be read only. Which EA API function should I use?

Thank you very much.

4
The final workable code:

 string packageGUID = de.Key.ToString();
                    EA.Package pack = m_eaResp.GetPackageByGuid(packageGUID);
                    EA.Connector con = (EA.Connector)m_eaResp.GetElementByID(m_package.Element.ElementID).Connectors.AddNew("", "Dependency");
                    con.Stereotype = "Import";
                    con.SupplierID = pack.Element.ElementID;
                    con.Update();

5
I did more testing. I have tried to use the following connector type. None of them work.
1. Aggregation
2. Association
3. Collaboration
4. Generalization

The only acceptable type is : Dependency.

Do you mean the above COMException was raised because the package object does not accept any other connector type except "Dependency"

Any way, "Dependency" works.

Thank you very much!

6
I do not know which type should I use. I want to show that a package import another one.

7
I am trying to create "A Package Dependencies" Diagram using C#.

 EA.Package pack = m_eaResp.GetPackageByGuid(packageGUID);
 EA.Connector con = (EA.Connector)m_package.Connectors.AddNew("Test Import", "");
 con.SupplierID = pack.Element.ElementID;
 con.Update();

The Update() function raises a COMException:

A COMException was raised after the con.Update() was executed.
Exception detail:

 

      COMException was unhandled

 

      The server threw an exception.( Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))

 

 

StackTrace:

 

      "   at EA.IDualConnector.Update()\r\n   at EADemo.Form1.ConnectorTest() in C:\\Program Files\\Sparx Systems\\EA\\Code Samples\\C#_Sample\\Form1.cs:line 274\r\n   at EADemo.Form1.btnDoIt_Click(Object sender, EventArgs e) in C:\\Program Files\\Sparx Systems\\EA\\Code Samples\\C#_Sample\\Form1.cs:line 200\r\n   at System.Windows.Forms.Control.OnClick(EventArgs e)\r\n   at System.Windows.Forms.Button.OnClick(EventArgs e)\r\n   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)\r\n   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\r\n   at System.Windows.Forms.Control.WndProc(Message& m)\r\n   at System.Windows.Forms.ButtonBase.WndProc(Message& m)\r\n   at System.Windows.Forms.Button.WndProc(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.Run(Form mainForm)\r\n   at EADemo.Form1.Main() in C:\\Program Files\\Sparx Systems\\EA\\Code Samples\\C#_Sample\\Form1.cs:line 151\r\n   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at System.Threading.ThreadHelper.ThreadStart()"

 
Is this the correct way to create a connector for a package? Are there some other way to create it?

Thank you very much!

Pages: [1]