Functionality depends on loaded template

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

Functionality depends on loaded template

Postby Petar Blagoev » Mon May 21, 2007 7:57 am

Hallo,
I've created my own template and I want to write some more
functionalities, that are only possible if the template is loaded.
How is the best way to find out, that the template (or module) is in
the current project loaded?
best regards,
Petar Blagoev
--
Composed with Newz Crawler 1.8 http://www.newzcrawler.com/
Petar Blagoev
 
Posts Rating:

Re: Functionality depends on loaded template

Postby Martynas Lelevicius » Tue May 22, 2007 3:53 am

Hi,

If you want to know if your template is used:
1) you can try to search the template specific element in project or
2) edit the template file - change the root model id to some specific id,
and later check if the project root model has your id.

To know if the module is loaded you should search for the module descriptor
in the project mount table:

boolean loaded = false;
Collection modules = project.getMountTable().getModules();
for (Iterator it = modules.iterator(); it.hasNext() && !loaded;)
{
ModuleDescriptor moduleDescriptor = (ModuleDescriptor) it.next();
URI uri = moduleDescriptor.getURI();
if ("moduleFileName".equals(new File(uri).getName()))
{
loaded = moduleDescriptor.isLoaded();
}
}


Regards,
--
Martynas Lelevicius
Programmer
No Magic Lithuanian Development Center
Savanoriu pr. 363, LT-49425, Kaunas
P.O. box 2166, LT-44011, Kaunas
Phone: +370 37 324032 Fax: +370 37 320670
E-mail : marte
WWW: http://www.magicdraw.com

----- Original Message -----
From: "nntp://news.nomagic.com/nomagic.products.magicdrawuml.openapi"
<blagoev>
To: "Martynas Lelevicius" <marlel>
Sent: Tuesday, May 22, 2007 2:27 PM
Subject: Functionality depends on loaded template


> Hallo,
> I've created my own template and I want to write some more
> functionalities, that are only possible if the template is loaded.
> How is the best way to find out, that the template (or module) is in
> the current project loaded?
> best regards,
> Petar Blagoev
> --
> Composed with Newz Crawler 1.8 http://www.newzcrawler.com/
>

Martynas Lelevicius
 
Posts Rating:


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 1 guest