KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > importer > rose > taskdefs > RoseGeneratorTask


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2004-2005 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: RoseGeneratorTask.java,v 1.2 2005/06/08 06:20:36 nickb Exp $
16  */

17 package org.eclipse.emf.importer.rose.taskdefs;
18
19 import org.eclipse.emf.ant.taskdefs.codegen.ecore.GeneratorTask;
20 import org.eclipse.emf.importer.rose.RoseImporterApplication;
21
22
23 /**
24  * <p>
25  * Generates source code from models specifed in <b>Rose</b> files. Exposes some
26  * functionalities available on the {@link org.eclipse.emf.importer.rose.RoseImporterApplication}
27  * class - check its <tt>printUsage()</tt> method for detailed information on the arguments
28  * you can use with this task.
29  * </p>
30  * <p>
31  * This task is supposed to be executed by a Eclipse driver with the
32  * <b>org.eclipse.emf.ant</b> plugin. It is neither necessary to use Ant's task
33  * <tt>TaskDef</tt> to declare this task in a script nor to change the Ant's runtime
34  * classpath.
35  * </p>
36  * <p>
37  * The following command line will start a headless Eclipse instance and run the specified
38  * Ant script.
39  * </p>
40  * <p>
41  * java -classpath <i>eclipseDir</i>/startup.jar org.eclipse.core.launcher.Main
42  * -data <i>worspaceDir</i>
43  * -application org.eclipse.ant.core.antRunner
44  * -buildfile <i>antScript</i>
45  * </p>
46  * <p>
47  * Usage example:
48  * </p>
49  * <pre>
50  * &lt;emf.Rose2Java model=&quot;c:/lib/model/lib.mdl&quot;
51  * genModel=&quot;c:/lib/emf/lib.genmodel&quot;
52  * modelProject=&quot;c:/lib&quot;
53  * modelProjectFragmentPath=&quot;src&quot;&gt;
54  * &lt;arg line=&quot;-package library library library.xmi org.examples Library&quot;/&gt;
55  * &lt;arg line=&quot;-pathMap VABASE_PLUGINS_PATH d:/eclipse/plugins&quot/&gt;
56  * &lt;/emf.Rose2Java&gt;
57  * </pre>
58  *
59  * @since 2.1.0
60  */

61 public class RoseGeneratorTask extends GeneratorTask
62 {
63   protected void addGenModelArguments()
64   {
65     super.addGenModelArguments();
66     getCommandline().createArgument().setValue("-noQualify");
67   }
68
69   protected void createGenModel(String JavaDoc[] arguments) throws Exception JavaDoc
70   {
71     new RoseImporterApplication().run(getProgressMonitor(), arguments);
72   }
73 }
Popular Tags