How to create file on a location

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

How to create file on a location

Postby Tanvir Hussain » Fri Mar 16, 2007 3:09 am

1.I want create a new project using Openapi at a fixed location. How to
do that.

2. How to save a file with a chosen name (through filechooser) and
location? (I tried with the examples given at openapi directory it does
not work either)

It needs to be mentioned that I am using 12.0 and 12.1

Tanvir Hussain
 
Posts Rating:

Re: How to create file on a location

Postby Martynas Lelevicius » Fri Mar 16, 2007 4:48 am

Hi,

> 1.I want create a new project using Openapi at a fixed location. How to do
> that.

Create project and save it to the required location:

Application application = Application.getInstance();
application.start(false, true, false, args, null);

ProjectsManager projectsManager = application.getProjectsManager();

Project project = projectsManager.createProject();

String projectFile = "d:\test.mdzip";

ProjectDescriptor projectDescriptor =
ProjectDescriptorsFactory.createLocalProjectDescriptor(project,
new File(projectFile));

projectsManager.saveProject(projectDescriptor, true);

application.shutdown();

> 2. How to save a file with a chosen name (through filechooser) and
> location? (I tried with the examples given at openapi directory it does
> not work either)

Create local project descriptor and save the project. See sample above.

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"
<hussain>
To: "Martynas Lelevicius" <marlel>
Sent: Friday, March 16, 2007 11:53 AM
Subject: How to create file on a location


> 1.I want create a new project using Openapi at a fixed location. How to do
> that.
>
> 2. How to save a file with a chosen name (through filechooser) and
> location? (I tried with the examples given at openapi directory it does
> not work either)
>
> It needs to be mentioned that I am using 12.0 and 12.1
>

Martynas Lelevicius
 
Posts Rating:


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 0 guests