Java 类org.eclipse.emf.common.util.BasicMonitor 实例源码

项目:OCCI-Studio    文件:DesignerGeneratorAction.java   
private IProject generateDesignProject(String occieLocation, String designName, String designProjectName,
        final IProgressMonitor monitor) throws CoreException, IOException {

    // Load the ecore file.
    String ecoreLocation = occieLocation.replace(".occie", ".ecore");
    URI ecoreURI = URI.createFileURI(ecoreLocation);
    // Create a new resource set.
    ResourceSet resourceSet = new ResourceSetImpl();
    // Load the OCCI resource.
    org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(ecoreURI, true);
    // Return the first element.
    EPackage ePackage = (EPackage) resource.getContents().get(0);

    String extensionScheme = Occi2Ecore.convertEcoreNamespace2OcciScheme(ePackage.getNsURI());

    // Register the ePackage to avoid an error when trying to open the generated
    // .odesign file,
    EPackage.Registry.INSTANCE.put(ePackage.getNsURI(), ePackage);


    URI occieURI = URI.createFileURI(occieLocation);

    /*
     * Create design project
     */
    IProject project = DesignerGeneratorUtils.genDesignProject(designProjectName, designName, extensionScheme,
            new ProgressMonitorDialog(shell));

    /*
     * Create design model
     */
    org.eclipse.cmf.occi.core.gen.design.main.Generate generator = new org.eclipse.cmf.occi.core.gen.design.main.Generate(
            occieURI, project.getFolder("description").getLocation().toFile(), new ArrayList<String>());
    generator.doGenerate(BasicMonitor.toMonitor(monitor));
    project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
    return project;
}
项目:M2Doc    文件:AbstractTemplatesTestSuite.java   
/**
 * Prepare the output with the given user content and generate to the given output.
 * 
 * @param userContentURI
 *            existing user content {@link URI}
 * @param outputURI
 *            the output {@link URI}
 * @return the {@link GenerationResult}
 * @throws Exception
 *             if the generation fails
 */
private GenerationResult prepareoutputAndGenerate(final URI userContentURI, URI outputURI) throws Exception {
    if (resourceSetForModels.getURIConverter().exists(userContentURI, Collections.EMPTY_MAP)) {
        copy(userContentURI, outputURI);
    }
    for (URI userContentLostURI : getUserContentLostURI(new File(testFolderPath))) {
        final URI destURI = URI.createURI(
                outputURI.toString() + userContentLostURI.lastSegment().substring(
                        userContentLostURI.lastSegment().indexOf(USER_CONTENT_TAG) + USER_CONTENT_TAG.length()),
                false);
        copy(userContentLostURI, destURI);
    }
    final GenerationResult generationResult = M2DocUtils.generate(documentTemplate, queryEnvironment, variables,
            resourceSetForModels.getURIConverter(), outputURI, new BasicMonitor());
    return generationResult;
}
项目:coordination    文件:GenerateAll.java   
/**
 * Launches the generation.
 *
 * @param monitor
 *            This will be used to display progress information to the user.
 * @throws IOException
 *             Thrown when the output cannot be saved.
 * @generated
 */
public void doGenerate(IProgressMonitor monitor) throws IOException {
    if (!targetFolder.getLocation().toFile().exists()) {
        targetFolder.getLocation().toFile().mkdirs();
    }

    // final URI template0 = getTemplateURI("org.eclipse.gemoc.bcool.transformation.bcool2qvto", new Path("/org/eclipse/gemoc/bcool/transformation/bcool2qvto/common/generate.emtl"));
    // org.eclipse.gemoc.bcool.transformation.bcool2qvto.common.Generate gen0 = new org.eclipse.gemoc.bcool.transformation.bcool2qvto.common.Generate(modelURI, targetFolder.getLocation().toFile(), arguments) {
    //  protected URI createTemplateURI(String entry) {
    //      return template0;
    //  }
    //};
    //gen0.doGenerate(BasicMonitor.toMonitor(monitor));
    monitor.subTask("Loading...");
    org.eclipse.gemoc.bcool.transformation.bcool2qvto.common.Generate gen0 = new org.eclipse.gemoc.bcool.transformation.bcool2qvto.common.Generate(modelURI, targetFolder.getLocation().toFile(), arguments);
    monitor.worked(1);
    String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.gemoc.bcool.transformation.bcool2qvto", "org.eclipse.gemoc.bcool.transformation.bcool2qvto.common.Generate", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
    gen0.setGenerationID(generationID);
    gen0.doGenerate(BasicMonitor.toMonitor(monitor));


}
项目:eip-designer    文件:GenerateAll.java   
/**
 * Launches the generation.
 *
 * @param monitor
 *            This will be used to display progress information to the user.
 * @throws IOException
 *             Thrown when the output cannot be saved.
 * @generated
 */
public void doGenerate(IProgressMonitor monitor) throws IOException {
    if (!targetFolder.getLocation().toFile().exists()) {
        targetFolder.getLocation().toFile().mkdirs();
    }

    // final URI template0 = getTemplateURI("com.github.lbroudoux.dsl.eip.gen.spring", new Path("/com/github/lbroudoux/dsl/eip/gen/spring/main/generateRoutes.emtl"));
    // com.github.lbroudoux.dsl.eip.gen.spring.main.GenerateRoutes gen0 = new com.github.lbroudoux.dsl.eip.gen.spring.main.GenerateRoutes(modelURI, targetFolder.getLocation().toFile(), arguments) {
    //  protected URI createTemplateURI(String entry) {
    //      return template0;
    //  }
    //};
    //gen0.doGenerate(BasicMonitor.toMonitor(monitor));
    monitor.subTask("Loading...");
    com.github.lbroudoux.dsl.eip.gen.spring.main.GenerateRoutes gen0 = new com.github.lbroudoux.dsl.eip.gen.spring.main.GenerateRoutes(modelURI, targetFolder.getLocation().toFile(), arguments);
    monitor.worked(1);
    String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("com.github.lbroudoux.dsl.eip.gen.spring", "com.github.lbroudoux.dsl.eip.gen.spring.main.GenerateRoutes", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
    gen0.setGenerationID(generationID);
    gen0.doGenerate(BasicMonitor.toMonitor(monitor));


}
项目:eip-designer    文件:GenerateAll.java   
/**
 * Launches the generation.
 *
 * @param monitor
 *            This will be used to display progress information to the user.
 * @throws IOException
 *             Thrown when the output cannot be saved.
 * @generated
 */
public void doGenerate(IProgressMonitor monitor) throws IOException {
    if (!targetFolder.getLocation().toFile().exists()) {
        targetFolder.getLocation().toFile().mkdirs();
    }

    // final URI template0 = getTemplateURI("com.github.lbroudoux.dsl.eip.gen.switchyard", new Path("/com/github/lbroudoux/dsl/eip/gen/switchyard/main/generateSwitchyard.emtl"));
    // com.github.lbroudoux.dsl.eip.gen.switchyard.main.GenerateSwitchyard gen0 = new com.github.lbroudoux.dsl.eip.gen.switchyard.main.GenerateSwitchyard(modelURI, targetFolder.getLocation().toFile(), arguments) {
    //  protected URI createTemplateURI(String entry) {
    //      return template0;
    //  }
    //};
    //gen0.doGenerate(BasicMonitor.toMonitor(monitor));
    monitor.subTask("Loading...");
    com.github.lbroudoux.dsl.eip.gen.switchyard.main.GenerateSwitchyard gen0 = new com.github.lbroudoux.dsl.eip.gen.switchyard.main.GenerateSwitchyard(modelURI, targetFolder.getLocation().toFile(), arguments);
    monitor.worked(1);
    String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("com.github.lbroudoux.dsl.eip.gen.switchyard", "com.github.lbroudoux.dsl.eip.gen.switchyard.main.GenerateSwitchyard", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
    gen0.setGenerationID(generationID);
    gen0.doGenerate(BasicMonitor.toMonitor(monitor));


}
项目:eclipse-avro    文件:TestAvroSchemaGen.java   
@Test
public void testLibraryExample() throws IOException {
    URI modelURI;
    File locationFile;
    Bundle bundle = Platform.getBundle("org.eclipse.emf.examples.library");
    URL bundleURL = bundle.getEntry("model/extlibrary.ecore");
    URL fileURL = FileLocator.toFileURL(bundleURL);
    modelURI = URI.createFileURI(fileURL.toString());
    locationFile = new File("library-schemas");
    clearDir(locationFile);
    AcceleoPreferences.switchQueryCache(false);
    GenerateAvroSchema generator;
    try {
        generator = new GenerateAvroSchema(
                modelURI, locationFile, new ArrayList<Object>());
        generator.doGenerate(new BasicMonitor());
    } catch (IOException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
项目:eclipse-avro    文件:TestAvroSchemaGen.java   
@Test
public void testEMFEcore() throws IOException {
    URI modelURI;
    File locationFile;
    Bundle bundle = Platform.getBundle("org.eclipse.emf.ecore");
    URL bundleURL = bundle.getEntry("model/Ecore.ecore");
    URL fileURL = FileLocator.toFileURL(bundleURL);
    modelURI = URI.createFileURI(fileURL.toString());
    locationFile = new File("ecore-schemas");
    clearDir(locationFile);
    AcceleoPreferences.switchQueryCache(false);
    GenerateAvroSchema generator;
    try {
        generator = new GenerateAvroSchema(
                modelURI, locationFile, new ArrayList<Object>());
        generator.doGenerate(new BasicMonitor());
    } catch (IOException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
项目:eclipse-avro    文件:TestAvroSchemaGen.java   
@Test
public void testXMLNamespace() throws IOException {
    URI modelURI;
    File locationFile;
    Bundle bundle = Platform.getBundle("org.eclipse.emf.ecore");
    URL bundleURL = bundle.getEntry("model/XMLNamespace.ecore");
    URL fileURL = FileLocator.toFileURL(bundleURL);
    modelURI = URI.createFileURI(fileURL.toString());
    locationFile = new File("xml-namespace-schemas");
    clearDir(locationFile);
    AcceleoPreferences.switchQueryCache(false);
    GenerateAvroSchema generator;
    try {
        generator = new GenerateAvroSchema(
                modelURI, locationFile, new ArrayList<Object>());
        generator.doGenerate(new BasicMonitor());
    } catch (IOException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
项目:eclipse-avro    文件:TestAvroSchemaGen.java   
@Test
public void testXMLType() throws IOException {
    URI modelURI;
    File locationFile;
    Bundle bundle = Platform.getBundle("org.eclipse.emf.ecore");
    URL bundleURL = bundle.getEntry("model/XMLType.ecore");
    URL fileURL = FileLocator.toFileURL(bundleURL);
    modelURI = URI.createFileURI(fileURL.toString());
    locationFile = new File("xml-type-schemas");
    clearDir(locationFile);
    AcceleoPreferences.switchQueryCache(false);
    GenerateAvroSchema generator;
    try {
        generator = new GenerateAvroSchema(
                modelURI, locationFile, new ArrayList<Object>());
        generator.doGenerate(new BasicMonitor());
    } catch (IOException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
项目:k3    文件:GenerateGenModelCode.java   
public void generate(GenModel genModel) {
    // Generate Code

    genModel.setCanGenerate(true);
    GeneratorAdapterFactory.Descriptor.Registry.INSTANCE.addDescriptor(
            GenModelPackage.eNS_URI,
            GenModelGeneratorAdapterFactory.DESCRIPTOR);

    // Create the generator and set the model-level input object.
    Generator generator = new Generator();
    generator.setInput(genModel);

    // Generator model code.
    Diagnostic d = generator.generate(genModel,
            GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE,
            new BasicMonitor.Printing(System.out));
    System.out.println(d.getMessage());

}
项目:emf-rest    文件:EMFGenerator.java   
public void executeTransformation(IExecutionInformation executionInformation) throws Exception {
    ResourceSet resourceSet = new ResourceSetImpl();
    Resource resource = resourceSet.createResource(locator.getEMFURI(inputModels.get(0).getModel()));
    resource.load(null);
    EcoreUtil.resolveAll(resourceSet);
    GenModel genModel = (GenModel) resource.getContents().get(0);
    genModel.setDynamicTemplates(true);
    genModel.setTemplateDirectory("platform:/plugin/emf-rest/templates");
    genModel.setCanGenerate(true);
    genModel.setModelDirectory(genModel.getModelDirectory()+"/main/java");
    System.out.println("test");
    // generate the code
    Generator generator = new Generator();
    generator.setInput(genModel);
    generator.generate(genModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, new BasicMonitor.Printing(System.err));
    for (OutputFile outFile : outputFiles) {
        executionEnvironment.fileReady(outFile.getFile(), transformation);
    }
}
项目:MMINT    文件:Java2File.java   
private @NonNull Model print(@NonNull Model javaModel, @NonNull MID instanceMID) throws Exception {

        // run acceleo
        String fileModelPath = FileUtils.getUniquePath(
            FileUtils.replaceFileExtensionInPath(javaModel.getUri(), JAVA_FILE_SUFFIX),
            true,
            false);
        List<Object> m2tArgs = new ArrayList<>();
        m2tArgs.add(FileUtils.getFileNameFromPath(fileModelPath));
        File folder = (new File(FileUtils.prependWorkspacePath(javaModel.getUri()))).getParentFile();
        AcceleoPreferences.switchForceDeactivationNotifications(true);
        AcceleoPreferences.switchNotifications(false);
        Java2File_M2T m2t = new Java2File_M2T(javaModel.getEMFInstanceRoot(), folder, m2tArgs);
        m2t.doGenerate(new BasicMonitor());

        // create file model
        Model fileModelType = MIDTypeRegistry.getType(FilePackage.eNS_URI);
        Model fileModel = fileModelType.createInstance(null, fileModelPath, instanceMID);

        return fileModel;
    }
项目:MMINT    文件:EcoreMAVOToSMTLIB.java   
@Override
public Map<String, Model> run(
        Map<String, Model> inputsByName, Map<String, GenericElement> genericsByName,
        Map<String, MID> outputMIDsByName) throws Exception {

    //TODO MMINT[REASONING] generalize for non-mavo too
    //TODO MMINT[REASONING] improve create formula vars 1) use other strings if name not present 2) check uniqueness 3) use names of src/tgt for edges

    // input
    Model mavoModel = inputsByName.get(IN_MODEL);
    init(mavoModel);

    List<Object> m2tArgs = createAcceleoArguments(mavoModel);
    File folder = createAcceleoFolder(mavoModel);
    AbstractAcceleoGenerator m2t = createAcceleoGenerator((MAVORoot) mavoModel.getEMFInstanceRoot(), folder, m2tArgs);
    m2t.doGenerate(new BasicMonitor());

    return new HashMap<>();
}
项目:neoscada    文件:GenerateAll.java   
/**
 * Launches the generation.
 * 
 * @param monitor
 *            This will be used to display progress information to the user.
 * @generated NOT
 */
@SuppressWarnings ( "unchecked" )
public void doGenerate ( final IProgressMonitor monitor ) throws Exception
{
    if ( !this.targetFolder.getLocation ().toFile ().exists () )
    {
        this.targetFolder.getLocation ().toFile ().mkdirs ();
    }

    // final URI template0 = getTemplateURI("org.eclipse.scada.protocol.ngp.generator", new Path("/org/eclipse/scada/protocol/ngp/generator/main/generate.emtl"));
    // org.eclipse.scada.protocol.ngp.generator.main.Generate gen0 = new org.eclipse.scada.protocol.ngp.generator.main.Generate(modelURI, targetFolder.getLocation().toFile(), arguments) {
    //  protected URI createTemplateURI(String entry) {
    //      return template0;
    //  }
    //};
    //gen0.doGenerate(BasicMonitor.toMonitor(monitor));
    monitor.subTask ( "Loading..." );

    final Class<? extends AbstractAcceleoGenerator> clazz = (Class<? extends AbstractAcceleoGenerator>)Activator.getDefault ().getBundle ().loadClass ( this.main );
    final Constructor<? extends AbstractAcceleoGenerator> ctor = clazz.getConstructor ( URI.class, File.class, List.class );
    final AbstractAcceleoGenerator gen0 = ctor.newInstance ( this.modelURI, this.targetFolder.getLocation ().toFile (), this.arguments );

    // final AbstractAcceleoGenerator gen0 = new org.eclipse.scada.protocol.ngp.generator.main.Generate ( this.modelURI, this.targetFolder.getLocation ().toFile (), this.arguments );
    monitor.worked ( 1 );

    final String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID ( "org.eclipse.scada.protocol.ngp.generator", this.main, this.modelURI.toString (), this.targetFolder.getFullPath ().toString (), new ArrayList<String> () );
    gen0.setGenerationID ( generationID );
    gen0.doGenerate ( BasicMonitor.toMonitor ( monitor ) );
}
项目:OCCI-Studio    文件:GenerateAll.java   
/**
 * Launches the generation.
 *
 * @param monitor
 *            This will be used to display progress information to the user.
 * @throws IOException
 *             Thrown when the output cannot be saved.
 * @generated
 */
public void doGenerate(IProgressMonitor monitor) throws IOException {
    if (!targetFolder.getLocation().toFile().exists()) {
        targetFolder.getLocation().toFile().mkdirs();
    }

    monitor.subTask("Loading...");
    org.eclipse.cmf.occi.core.gen.latex.main.Generate gen0 = new org.eclipse.cmf.occi.core.gen.latex.main.Generate(modelURI, targetFolder.getLocation().toFile(), arguments);
    monitor.worked(1);
    String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.cmf.occi.core.gen.latex", "org.eclipse.cmf.occi.core.gen.latex.main.Generate", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
    gen0.setGenerationID(generationID);
    gen0.doGenerate(BasicMonitor.toMonitor(monitor));


}
项目:OCCI-Studio    文件:GenerateAll.java   
/**
 * Launches the generation.
 *
 * @param monitor
 *            This will be used to display progress information to the user.
 * @throws IOException
 *             Thrown when the output cannot be saved.
 * @generated
 */
public void doGenerate(IProgressMonitor monitor) throws IOException {
    if (!targetFolder.getLocation().toFile().exists()) {
        targetFolder.getLocation().toFile().mkdirs();
    }

    monitor.subTask("Loading...");
    org.eclipse.cmf.occi.core.gen.uris.main.Generate gen0 = new org.eclipse.cmf.occi.core.gen.uris.main.Generate(modelURI, targetFolder.getLocation().toFile(), arguments);
    monitor.worked(1);
    String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.cmf.occi.core.gen.uris", "org.eclipse.cmf.occi.core.gen.uris.main.Generate", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
    gen0.setGenerationID(generationID);
    gen0.doGenerate(BasicMonitor.toMonitor(monitor));


}
项目:OCCI-Studio    文件:GenerateAll.java   
/**
 * Launches the generation.
 *
 * @param monitor
 *            This will be used to display progress information to the user.
 * @throws IOException
 *             Thrown when the output cannot be saved.
 * @generated
 */
public void doGenerate(IProgressMonitor monitor) throws IOException {
    if (!targetFolder.getLocation().toFile().exists()) {
        targetFolder.getLocation().toFile().mkdirs();
    }

    monitor.subTask("Loading...");
    org.eclipse.cmf.occi.core.gen.textile.main.Generate gen0 = new org.eclipse.cmf.occi.core.gen.textile.main.Generate(modelURI, targetFolder.getLocation().toFile(), arguments);
    monitor.worked(1);
    String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.cmf.occi.core.gen.textile", "org.eclipse.cmf.occi.core.gen.textile.main.Generate", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
    gen0.setGenerationID(generationID);
    gen0.doGenerate(BasicMonitor.toMonitor(monitor));


}
项目:OCCI-Studio    文件:GenerateAll.java   
/**
 * Launches the generation.
 *
 * @param monitor
 *            This will be used to display progress information to the user.
 * @throws IOException
 *             Thrown when the output cannot be saved.
 * @generated
 */
public void doGenerate(IProgressMonitor monitor) throws IOException {
    if (!targetFolder.getLocation().toFile().exists()) {
        targetFolder.getLocation().toFile().mkdirs();
    }

    monitor.subTask("Loading...");
    org.eclipse.cmf.occi.core.gen.alloy.main.Generate gen0 = new org.eclipse.cmf.occi.core.gen.alloy.main.Generate(modelURI, targetFolder.getLocation().toFile(), arguments);
    monitor.worked(1);
    String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.cmf.occi.core.gen.alloy", "org.eclipse.cmf.occi.core.gen.alloy.main.Generate", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
    gen0.setGenerationID(generationID);
    gen0.doGenerate(BasicMonitor.toMonitor(monitor));


}
项目:OCCI-Studio    文件:GenerateAll.java   
/**
 * Launches the generation.
 *
 * @param monitor
 *            This will be used to display progress information to the user.
 * @throws IOException
 *             Thrown when the output cannot be saved.
 * @generated
 */
public void doGenerate(IProgressMonitor monitor) throws IOException {
    if (!targetFolder.getLocation().toFile().exists()) {
        targetFolder.getLocation().toFile().mkdirs();
    }

    monitor.subTask("Loading...");
    org.eclipse.cmf.occi.core.gen.xml.main.Generate gen0 = new org.eclipse.cmf.occi.core.gen.xml.main.Generate(modelURI, targetFolder.getLocation().toFile(), arguments);
    monitor.worked(1);
    String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.cmf.occi.core.gen.xml", "org.eclipse.cmf.occi.core.gen.xml.main.Generate", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
    gen0.setGenerationID(generationID);
    gen0.doGenerate(BasicMonitor.toMonitor(monitor));


}
项目:OCCI-Studio    文件:DesignerGeneratorAction.java   
private IProject generateDesignProject(String occieLocation, String designName, String designProjectName,
        final IProgressMonitor monitor) throws CoreException, IOException {

    // Load the ecore file.
    String ecoreLocation = occieLocation.replace(".occie", ".ecore");
    URI ecoreURI = URI.createFileURI(ecoreLocation);
    // Create a new resource set.
    ResourceSet resourceSet = new ResourceSetImpl();
    // Load the OCCI resource.
    org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(ecoreURI, true);
    // Return the first element.
    EPackage ePackage = (EPackage) resource.getContents().get(0);

    String extensionScheme = Occi2Ecore.convertEcoreNamespace2OcciScheme(ePackage.getNsURI());

    // Register the ePackage to avoid an error when trying to open the generated
    // .odesign file,
    EPackage.Registry.INSTANCE.put(ePackage.getNsURI(), ePackage);


    URI occieURI = URI.createFileURI(occieLocation);

    /*
     * Create design project
     */
    IProject project = DesignerGeneratorUtils.genDesignProject(designProjectName, designName, extensionScheme,
            new ProgressMonitorDialog(shell));

    /*
     * Create design model
     */
    org.eclipse.cmf.occi.core.gen.design.extended.main.Generate generator = new org.eclipse.cmf.occi.core.gen.design.extended.main.Generate(
            occieURI, project.getFolder("description").getLocation().toFile(), new ArrayList<String>());
    generator.doGenerate(BasicMonitor.toMonitor(monitor));
    project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
    return project;
}
项目:OCCI-Studio    文件:GenerateAll.java   
/**
 * Launches the generation.
 *
 * @param monitor
 *            This will be used to display progress information to the user.
 * @throws IOException
 *             Thrown when the output cannot be saved.
 * @generated
 */
public void doGenerate(IProgressMonitor monitor) throws IOException {
    if (!targetFolder.getLocation().toFile().exists()) {
        targetFolder.getLocation().toFile().mkdirs();
    }

    monitor.subTask("Loading...");
    org.eclipse.cmf.occi.core.gen.connector.main.Main gen0 = new org.eclipse.cmf.occi.core.gen.connector.main.Main(modelURI, targetFolder.getLocation().toFile(), arguments);
    monitor.worked(1);
    String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.cmf.occi.core.gen.connector", "org.eclipse.cmf.occi.core.gen.connector.main.Main", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
    gen0.setGenerationID(generationID);
    gen0.doGenerate(BasicMonitor.toMonitor(monitor));
}
项目:OCCI-Studio    文件:GenerateAll.java   
/**
 * Launches the generation.
 *
 * @param monitor
 *            This will be used to display progress information to the user.
 * @throws IOException
 *             Thrown when the output cannot be saved.
 * @generated
 */
public void doGenerate(IProgressMonitor monitor) throws IOException {
    if (!targetFolder.getLocation().toFile().exists()) {
        targetFolder.getLocation().toFile().mkdirs();
    }

    monitor.subTask("Loading...");
    org.eclipse.cmf.occi.core.gen.curl.main.Generate gen0 = new org.eclipse.cmf.occi.core.gen.curl.main.Generate(modelURI, targetFolder.getLocation().toFile(), arguments);
    monitor.worked(1);
    String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.cmf.occi.core.gen.curl", "org.eclipse.cmf.occi.core.gen.curl.main.Generate", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
    gen0.setGenerationID(generationID);
    gen0.doGenerate(BasicMonitor.toMonitor(monitor));


}
项目:xtext-gef    文件:GenericModelMerger.java   
@Override
public void merge(final EObject source, final EObject destination) {
  final DefaultComparisonScope scope = new DefaultComparisonScope(destination, source, null);
  EMFCompare.Builder _builder = EMFCompare.builder();
  EMFCompare _build = _builder.build();
  final Comparison comparison = _build.compare(scope);
  EMFCompareRCPPlugin _default = EMFCompareRCPPlugin.getDefault();
  IMerger.Registry _mergerRegistry = _default.getMergerRegistry();
  final BatchMerger merger = new BatchMerger(_mergerRegistry);
  EList<Diff> _differences = comparison.getDifferences();
  BasicMonitor _basicMonitor = new BasicMonitor();
  merger.copyAllRightToLeft(_differences, _basicMonitor);
}
项目:tug_qt_unit_testing_fw    文件:MyGenerator.java   
/**
 * This is an adapted copy of main method in Generate class.
 * 
 * @param args
 *            Arguments of the generation.
 * @throws IOException 
 */
public static void main(URI modelURI, File folder, ArrayList<String> arguments) throws IOException {
    //try {

    /*
     * If you want to change the content of this method, do NOT forget to change the "@generated"
     * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
     * of the Acceleo module with the main template that has caused the creation of this class will
     * revert your modifications.
     */

    /*
     * Add in this list all the arguments used by the starting point of the generation
     * If your main template is called on an element of your model and a String, you can
     * add in "arguments" this "String" attribute.
     */

    Generate generator = new MyGenerator(modelURI, folder, arguments);

    /*
     * Add the properties from the launch arguments.
     * If you want to programmatically add new properties, add them in "propertiesFiles"
     * You can add the absolute path of a properties files, or even a project relative path.
     * If you want to add another "protocol" for your properties files, please override 
     * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
     * The behavior of the properties loader service is explained in the Acceleo documentation
     * (Help -> Help Contents).
     */

    //for (int i = 2; i < args.length; i++) {
    //    generator.addPropertiesFile(args[i]);
    //}

    generator.doGenerate(new BasicMonitor());

    //} catch (IOException e) {
    //  e.printStackTrace();
    //}
}
项目:tool    文件:SIDDAction.java   
protected void modelToTextMasterDocument(Model root,File targetFolder) throws IOException{
    // startup transformation, passing in params 
        List<String> args=new Vector<String>();
        //Model root = getCurrentModelRoot();//project.getModel(); 
        if(root==null)return;
        //log.log("start master document provisioning");
        SIDD masterDocument=new  SIDD(root,  targetFolder,args);
        masterDocument.doGenerate(new BasicMonitor());
        //log.log("completed master document provisioning");


}
项目:tool    文件:SDDAction.java   
protected void modelToTextMasterDocument(Model root,File targetFolder) throws IOException{
    // startup transformation, passing in params 
        List<String> args=new Vector<String>();
        //Model root = getCurrentModelRoot();//project.getModel(); 
        if(root==null)return;
        //log.log("start master document provisioning");
        SDD masterDocument=new  SDD(root,  targetFolder,args);
        masterDocument.doGenerate(new BasicMonitor());
        //log.log("completed master document provisioning");


}
项目:eclipse-avro    文件:TestResourceFactoryGen.java   
@Test
public void test() throws IOException {
    File locationFile;
    Bundle bundle = Platform.getBundle("org.eclipse.emf.examples.library");
    URL bundleURL = bundle.getEntry("model/extlibrary.genmodel");
    URL fileURL = FileLocator.toFileURL(bundleURL);

    URI locationURI = URI.createFileURI(fileURL.getPath());

    ResourceSet resourceSet = new ResourceSetImpl();
    Resource resource = resourceSet.getResource(locationURI, true);
    GenModel genModel = (GenModel) resource.getContents().get(0);

    locationFile = new File("src-gen");
    clearDir(locationFile);
    AcceleoPreferences.switchQueryCache(false);

    for (GenPackage genPackage : genModel.getGenPackages()) {
        String basePackage = genPackage.getBasePackage() + "."
                + genPackage.getEcorePackage().getName();
        Utility.setBasePackage(basePackage);
        Utility.setFactory(genPackage.getPrefix() + "Factory");
        Utility.setPackage(genPackage.getPrefix() + "Package");

        String avroDir = locationFile.toString() + File.separator
                + basePackage.replace('.', '/') + File.separator + "avro";
        File avroLocation = new File(avroDir);
        GenerateResourceFactory factoryGenerator;
        try {
            factoryGenerator = new GenerateResourceFactory(
                    genPackage.getEcorePackage(), avroLocation,
                    new ArrayList<Object>());
            factoryGenerator.generate(new BasicMonitor());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
项目:eclipse-avro    文件:GenerateAvroHandler.java   
@Execute
public void execute() {

    ContainerSelectionDialog dialog = new ContainerSelectionDialog(Display
            .getCurrent().getActiveShell(), null, true,
            "Select a folder to contain the generated schemas");
    if (dialog.open() == ContainerSelectionDialog.OK) {
        Object[] results = dialog.getResult();
        if (results != null && results.length > 0) {
            Object first = results[0];
            if (first instanceof IPath) {
                IPath path = (IPath) first;
                IWorkspace workspace = ResourcesPlugin.getWorkspace();
                IWorkspaceRoot workspaceRoot = workspace.getRoot();
                IResource ifile = workspaceRoot.findMember(path);
                if (ifile != null) {
                    java.net.URI fileURI = ifile.getLocationURI();
                    File locationFile = new File(fileURI);
                    URI modelURI = URI.createFileURI(selectedResource
                            .getFullPath().toFile().toString());
                    try {
                        AcceleoPreferences.switchQueryCache(false);
                        GenerateAvroSchema generator = new GenerateAvroSchema(
                                modelURI, locationFile, new ArrayList<Object>());
                        generator.generate(new BasicMonitor());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
}
项目:BIMserver    文件:DataObjectGenerator.java   
public VirtualFile generate(VirtualFile basedir) throws DatabaseException {
        GenModel genModel = GenModelFactory.eINSTANCE.createGenModel();
        genModel.setRuntimeVersion(GenRuntimeVersion.EMF25);
        genModel.setComplianceLevel(GenJDKLevel.JDK60_LITERAL);
        genModel.setFeatureDelegation(GenDelegationKind.REFLECTIVE_LITERAL);
        genModel.setRootExtendsClass("org.bimserver.emf.IdEObjectImpl");
        genModel.setRootExtendsInterface("org.bimserver.emf.IdEObject");
        genModel.setSuppressContainment(true);
        genModel.setCodeFormatting(true);
        genModel.setCopyrightText(StringUtils.readFromFile(new File("copyright.txt")));
        genModel.setCanGenerate(true);
        genModel.setModelDirectory("test");
        genModel.setModelName("model name");
        genModel.setForceOverwrite(true);
        genModel.setSuppressNotification(false);
        genModel.setContainmentProxies(false);
        genModel.setBinaryCompatibleReflectiveMethods(false);
        genModel.setPublicConstructors(false);
        genModel.setMinimalReflectiveMethods(true); // More code, but faster
        genModel.setUpdateClasspath(false);

        genModel.initialize(schema.getEPackages());

        GeneratorAdapterFactory.Descriptor.Registry.INSTANCE.addDescriptor(GenModelPackage.eNS_URI, GenModelGeneratorAdapterFactory.DESCRIPTOR);
        Generator generator = new Generator();
        generator.setInput(genModel);
        generator.generate(genModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, new BasicMonitor.Printing(System.out));


//      List<GenPackage> genPackages = createGenPackages(genModel, basedir);
//      generatePackages(genModel, genPackages, basedir);

        return basedir;
    }
项目:eclipse-optimus    文件:JavaGenerator.java   
public IStatus generate(Model input, IPath output, Object... arguments) {

        try {
            this.initialize(input, new File(output.toString()), Arrays.asList(arguments));
            BasicMonitor monitor2 = new BasicMonitor();
            this.doGenerate(monitor2);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return Status.OK_STATUS;
    }
项目:neoscada    文件:GenerateData.java   
/**
 * This can be used to launch the generation from a standalone application.
 * 
 * @param args
 *            Arguments of the generation.
 * @generated
 */
public static void main ( String[] args )
{
    try {
        if (args.length < 2) {
            System.out.println("Arguments not valid : {model, folder}.");
        } else {
            URI modelURI = URI.createFileURI(args[0]);
            File folder = new File(args[1]);

            List<String> arguments = new ArrayList<String>();

            /*
             * If you want to change the content of this method, do NOT forget to change the "@generated"
             * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
             * of the Acceleo module with the main template that has caused the creation of this class will
             * revert your modifications.
             */

            /*
             * Add in this list all the arguments used by the starting point of the generation
             * If your main template is called on an element of your model and a String, you can
             * add in "arguments" this "String" attribute.
             */

            GenerateData generator = new GenerateData(modelURI, folder, arguments);

            /*
             * Add the properties from the launch arguments.
             * If you want to programmatically add new properties, add them in "propertiesFiles"
             * You can add the absolute path of a properties files, or even a project relative path.
             * If you want to add another "protocol" for your properties files, please override 
             * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
             * The behavior of the properties loader service is explained in the Acceleo documentation
             * (Help -> Help Contents).
             */

            for (int i = 2; i < args.length; i++) {
                generator.addPropertiesFile(args[i]);
            }

            generator.doGenerate(new BasicMonitor());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:neoscada    文件:GenerateCodec.java   
/**
 * This can be used to launch the generation from a standalone application.
 * 
 * @param args
 *            Arguments of the generation.
 * @generated
 */
public static void main ( String[] args )
{
    try {
        if (args.length < 2) {
            System.out.println("Arguments not valid : {model, folder}.");
        } else {
            URI modelURI = URI.createFileURI(args[0]);
            File folder = new File(args[1]);

            List<String> arguments = new ArrayList<String>();

            /*
             * If you want to change the content of this method, do NOT forget to change the "@generated"
             * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
             * of the Acceleo module with the main template that has caused the creation of this class will
             * revert your modifications.
             */

            /*
             * Add in this list all the arguments used by the starting point of the generation
             * If your main template is called on an element of your model and a String, you can
             * add in "arguments" this "String" attribute.
             */

            GenerateCodec generator = new GenerateCodec(modelURI, folder, arguments);

            /*
             * Add the properties from the launch arguments.
             * If you want to programmatically add new properties, add them in "propertiesFiles"
             * You can add the absolute path of a properties files, or even a project relative path.
             * If you want to add another "protocol" for your properties files, please override 
             * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
             * The behavior of the properties loader service is explained in the Acceleo documentation
             * (Help -> Help Contents).
             */

            for (int i = 2; i < args.length; i++) {
                generator.addPropertiesFile(args[i]);
            }

            generator.doGenerate(new BasicMonitor());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:neoscada    文件:Generate.java   
/**
 * This can be used to launch the generation from a standalone application.
 * 
 * @param args
 *            Arguments of the generation.
 * @generated
 */
public static void main ( String[] args )
{
    try {
        if (args.length < 2) {
            System.out.println("Arguments not valid : {model, folder}.");
        } else {
            URI modelURI = URI.createFileURI(args[0]);
            File folder = new File(args[1]);

            List<String> arguments = new ArrayList<String>();

            /*
             * If you want to change the content of this method, do NOT forget to change the "@generated"
             * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
             * of the Acceleo module with the main template that has caused the creation of this class will
             * revert your modifications.
             */

            /*
             * Add in this list all the arguments used by the starting point of the generation
             * If your main template is called on an element of your model and a String, you can
             * add in "arguments" this "String" attribute.
             */

            Generate generator = new Generate(modelURI, folder, arguments);

            /*
             * Add the properties from the launch arguments.
             * If you want to programmatically add new properties, add them in "propertiesFiles"
             * You can add the absolute path of a properties files, or even a project relative path.
             * If you want to add another "protocol" for your properties files, please override 
             * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
             * The behavior of the properties loader service is explained in the Acceleo documentation
             * (Help -> Help Contents).
             */

            for (int i = 2; i < args.length; i++) {
                generator.addPropertiesFile(args[i]);
            }

            generator.doGenerate(new BasicMonitor());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:neoscada    文件:Generate.java   
/**
 * This can be used to launch the generation from a standalone application.
 * 
 * @param args
 *            Arguments of the generation.
 * @generated
 */
public static void main(String[] args) {
    try {
        if (args.length < 2) {
            System.out.println("Arguments not valid : {model, folder}.");
        } else {
            URI modelURI = URI.createFileURI(args[0]);
            File folder = new File(args[1]);

            List<String> arguments = new ArrayList<String>();

            /*
             * If you want to change the content of this method, do NOT forget to change the "@generated"
             * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
             * of the Acceleo module with the main template that has caused the creation of this class will
             * revert your modifications.
             */

            /*
             * Add in this list all the arguments used by the starting point of the generation
             * If your main template is called on an element of your model and a String, you can
             * add in "arguments" this "String" attribute.
             */

            Generate generator = new Generate(modelURI, folder, arguments);

            /*
             * Add the properties from the launch arguments.
             * If you want to programmatically add new properties, add them in "propertiesFiles"
             * You can add the absolute path of a properties files, or even a project relative path.
             * If you want to add another "protocol" for your properties files, please override 
             * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
             * The behavior of the properties loader service is explained in the Acceleo documentation
             * (Help -> Help Contents).
             */

            for (int i = 2; i < args.length; i++) {
                generator.addPropertiesFile(args[i]);
            }

            generator.doGenerate(new BasicMonitor());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:neoscada    文件:Content.java   
/**
 * This can be used to launch the generation from a standalone application.
 * 
 * @param args
 *            Arguments of the generation.
 * @generated
 */
public static void main(String[] args) {
    try {
        if (args.length < 2) {
            System.out.println("Arguments not valid : {model, folder}.");
        } else {
            URI modelURI = URI.createFileURI(args[0]);
            File folder = new File(args[1]);

            List<String> arguments = new ArrayList<String>();

            /*
             * If you want to change the content of this method, do NOT forget to change the "@generated"
             * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
             * of the Acceleo module with the main template that has caused the creation of this class will
             * revert your modifications.
             */

            /*
             * Add in this list all the arguments used by the starting point of the generation
             * If your main template is called on an element of your model and a String, you can
             * add in "arguments" this "String" attribute.
             */

            Content generator = new Content(modelURI, folder, arguments);

            /*
             * Add the properties from the launch arguments.
             * If you want to programmatically add new properties, add them in "propertiesFiles"
             * You can add the absolute path of a properties files, or even a project relative path.
             * If you want to add another "protocol" for your properties files, please override 
             * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
             * The behavior of the properties loader service is explained in the Acceleo documentation
             * (Help -> Help Contents).
             */

            for (int i = 2; i < args.length; i++) {
                generator.addPropertiesFile(args[i]);
            }

            generator.doGenerate(new BasicMonitor());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:time4sys    文件:Generate.java   
/**
 * This can be used to launch the generation from a standalone application.
 * 
 * @param args
 *            Arguments of the generation.
 * @generated
 */
public static void main(String[] args) {
    try {
        if (args.length < 2) {
            System.out.println("Arguments not valid : {model, folder}.");
        } else {
            URI modelURI = URI.createFileURI(args[0]);
            File folder = new File(args[1]);

            List<String> arguments = new ArrayList<String>();

            /*
             * If you want to change the content of this method, do NOT forget to change the "@generated"
             * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
             * of the Acceleo module with the main template that has caused the creation of this class will
             * revert your modifications.
             */

            /*
             * Add in this list all the arguments used by the starting point of the generation
             * If your main template is called on an element of your model and a String, you can
             * add in "arguments" this "String" attribute.
             */

            Generate generator = new Generate(modelURI, folder, arguments);

            /*
             * Add the properties from the launch arguments.
             * If you want to programmatically add new properties, add them in "propertiesFiles"
             * You can add the absolute path of a properties files, or even a project relative path.
             * If you want to add another "protocol" for your properties files, please override 
             * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
             * The behavior of the properties loader service is explained in the Acceleo documentation
             * (Help -> Help Contents).
             */

            for (int i = 2; i < args.length; i++) {
                generator.addPropertiesFile(args[i]);
            }

            generator.doGenerate(new BasicMonitor());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:OCCI-Studio    文件:Generate.java   
/**
 * This can be used to launch the generation from a standalone application.
 * 
 * @param args
 *            Arguments of the generation.
 * @generated
 */
public static void main(String[] args) {
    try {
        if (args.length < 2) {
            System.out.println("Arguments not valid : {model, folder}.");
        } else {
            URI modelURI = URI.createFileURI(args[0]);
            File folder = new File(args[1]);

            List<String> arguments = new ArrayList<String>();

            /*
             * If you want to change the content of this method, do NOT forget to change the "@generated"
             * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
             * of the Acceleo module with the main template that has caused the creation of this class will
             * revert your modifications.
             */

            /*
             * Add in this list all the arguments used by the starting point of the generation
             * If your main template is called on an element of your model and a String, you can
             * add in "arguments" this "String" attribute.
             */

            Generate generator = new Generate(modelURI, folder, arguments);

            /*
             * Add the properties from the launch arguments.
             * If you want to programmatically add new properties, add them in "propertiesFiles"
             * You can add the absolute path of a properties files, or even a project relative path.
             * If you want to add another "protocol" for your properties files, please override 
             * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
             * The behavior of the properties loader service is explained in the Acceleo documentation
             * (Help -> Help Contents).
             */

            for (int i = 2; i < args.length; i++) {
                generator.addPropertiesFile(args[i]);
            }

            generator.doGenerate(new BasicMonitor());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:OCCI-Studio    文件:Generate.java   
/**
 * This can be used to launch the generation from a standalone application.
 * 
 * @param args
 *            Arguments of the generation.
 * @generated
 */
public static void main(String[] args) {
    try {
        if (args.length < 2) {
            System.out.println("Arguments not valid : {model, folder}.");
        } else {
            URI modelURI = URI.createFileURI(args[0]);
            File folder = new File(args[1]);

            List<String> arguments = new ArrayList<String>();

            /*
             * If you want to change the content of this method, do NOT forget to change the "@generated"
             * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
             * of the Acceleo module with the main template that has caused the creation of this class will
             * revert your modifications.
             */

            /*
             * Add in this list all the arguments used by the starting point of the generation
             * If your main template is called on an element of your model and a String, you can
             * add in "arguments" this "String" attribute.
             */

            Generate generator = new Generate(modelURI, folder, arguments);

            /*
             * Add the properties from the launch arguments.
             * If you want to programmatically add new properties, add them in "propertiesFiles"
             * You can add the absolute path of a properties files, or even a project relative path.
             * If you want to add another "protocol" for your properties files, please override 
             * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
             * The behavior of the properties loader service is explained in the Acceleo documentation
             * (Help -> Help Contents).
             */

            for (int i = 2; i < args.length; i++) {
                generator.addPropertiesFile(args[i]);
            }

            generator.doGenerate(new BasicMonitor());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:OCCI-Studio    文件:Generate.java   
/**
 * This can be used to launch the generation from a standalone application.
 * 
 * @param args
 *            Arguments of the generation.
 * @generated
 */
public static void main(String[] args) {
    try {
        if (args.length < 2) {
            System.out.println("Arguments not valid : {model, folder}.");
        } else {
            URI modelURI = URI.createFileURI(args[0]);
            File folder = new File(args[1]);

            List<String> arguments = new ArrayList<String>();

            /*
             * If you want to change the content of this method, do NOT forget to change the "@generated"
             * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
             * of the Acceleo module with the main template that has caused the creation of this class will
             * revert your modifications.
             */

            /*
             * Add in this list all the arguments used by the starting point of the generation
             * If your main template is called on an element of your model and a String, you can
             * add in "arguments" this "String" attribute.
             */

            Generate generator = new Generate(modelURI, folder, arguments);

            /*
             * Add the properties from the launch arguments.
             * If you want to programmatically add new properties, add them in "propertiesFiles"
             * You can add the absolute path of a properties files, or even a project relative path.
             * If you want to add another "protocol" for your properties files, please override 
             * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
             * The behavior of the properties loader service is explained in the Acceleo documentation
             * (Help -> Help Contents).
             */

            for (int i = 2; i < args.length; i++) {
                generator.addPropertiesFile(args[i]);
            }

            generator.doGenerate(new BasicMonitor());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:OCCI-Studio    文件:Generate.java   
/**
 * This can be used to launch the generation from a standalone application.
 * 
 * @param args
 *            Arguments of the generation.
 * @generated
 */
public static void main(String[] args) {
    try {
        if (args.length < 2) {
            System.out.println("Arguments not valid : {model, folder}.");
        } else {
            URI modelURI = URI.createFileURI(args[0]);
            File folder = new File(args[1]);

            List<String> arguments = new ArrayList<String>();

            /*
             * If you want to change the content of this method, do NOT forget to change the "@generated"
             * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
             * of the Acceleo module with the main template that has caused the creation of this class will
             * revert your modifications.
             */

            /*
             * Add in this list all the arguments used by the starting point of the generation
             * If your main template is called on an element of your model and a String, you can
             * add in "arguments" this "String" attribute.
             */

            Generate generator = new Generate(modelURI, folder, arguments);

            /*
             * Add the properties from the launch arguments.
             * If you want to programmatically add new properties, add them in "propertiesFiles"
             * You can add the absolute path of a properties files, or even a project relative path.
             * If you want to add another "protocol" for your properties files, please override 
             * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
             * The behavior of the properties loader service is explained in the Acceleo documentation
             * (Help -> Help Contents).
             */

            for (int i = 2; i < args.length; i++) {
                generator.addPropertiesFile(args[i]);
            }

            generator.doGenerate(new BasicMonitor());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}