Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to drive Project Template Engine from custom wizard?


hi Mark,

> I'm trying to create a custom import wizard which will create some C++
> projects. And I'd like to run the project creation routines
> (ProcessRunner) we've setup for the Project Template Engine (template.xml).
>
> Is there a way to drive the Project Template Engine outside of the New
> Project Wizard?

Yes, the sequence is more or less the same as in:
        MBSWizardHandler.doTemplatesPostProcess(IProject)
The MBS Wizard is special as it performs project creation itself and only
uses the template engine for additional actions.

The high level sequence is:

        // get a fresh template by the id appearing in the header in the corresponding template.xml
        TemplateCore tcore= TemplateEngine.getDefault().getTemplateById("ExampleProject");

        // configure it (the keys are macros appearing argument /values/ in template.xml)
        Map<String,String> values= tcore.getValueStore();
        values.put("location", "C:/temp/workspace");
        values.put("projectName", "exampleTemplateProject");

        // execute it
        IStatus[] status= tcore.executeTemplateProcesses(new NullProgressMonitor(), false);

There is only a template process for creating a managed project as far as I can see, so if you want
a different project type, you might need to code and register a template process for that.

thanks,
Andrew


**********************************************************************
Symbian Software Ltd is a company registered in England and Wales with registered number 4190020 and registered office at 2-6 Boundary Row, Southwark, London, SE1 8HP, UK. This message is intended only for use by the named addressee and may contain privileged and/or confidential information. If you are not the named addressee you should not disseminate, copy or take any action in reliance on it. If you have received this message in error please notify postmaster@xxxxxxxxxxx and delete the message and any attachments accompanying it immediately. Neither Symbian nor any of its Affiliates accepts liability for any corruption, interception, amendment, tampering or viruses occurring to this message in transit or for any message sent by its employees which is not in compliance with Symbian corporate policy.
**********************************************************************


Back to the top