Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: alext on February 12, 2009, 12:45:25 am
-
Does someone know what the Java equivalent is for the follwing code:
using System.Runtime.InteropServices;
...
object obj = Marshal.GetActiveObject("EA.App");
EA.App app = obj as EA.App;
EA.Repository rep = app.Repository;
This is supposed to get a reference to the running instance of EA.
Thanks! :exclamation
-
From a quick glance at my code:
org.sparx.EARepository eaRepository = new org.sparx.Repository();
if (eaRepository == null)
{
//error handling here...
return false;
}
if (!eaRepository.OpenFile(CONNECTION))
{
//error handling here...
return false;
}
Note that this will not give you access to a running instance but opens a new instance (defined in the connection string). AFAIK there is no way to access the running instance from JAVA via the DCOM bridge.
Oliver
-
Thanks for your reply Oliver, but this seems to throw me an error when I do a Repository.GetModels().
I get an "Internal application error".
If I open a Repository through openFile...I have no Issues (not always at least), but I would like to get the Models for the open instance of EA.
My plan is to open a network repository and then use it as if it where sitting on my local machine...for this I need a current running EA instance
reference.
Thanks!
-
If I open a Repository through openFile...I have no Issues (not always at least), but I would like to get the Models for the open instance of EA.
As I said above- afaik you can not access an already open instance from the JAVA API.
I'd be glad if someone can prove me wrong here as I need that functionality, too.
Oliver
-
Sorry, it's not currently possible.