|Re: Creating files based on templates [message #1173625 is a reply to message #1172137]
||Wed, 06 November 2013 16:53
|| Mickael Istria
Registered: July 2009
Location: Grenoble, France
On 11/05/2013 07:29 PM, Ilya B wrote:|
> Where do I store this 10 lines of code?
Where you want: as a static string, as a resource file in the bundle, as
a preference value, somewhere over HTTP... It really depends on your
> I'd imagine that it should go in some kind of separate template file,
> say dslHelloWorld.template. But, how do I bundle this with my plug-in so
> that the custom new project wizard knows about it and can put this
> template file in with the new project?
Anyway, you'll need to write the code that create the IFile with the
given content in the performFinish method. There is no automatic
behaviour to create a file at the end of a wizard.
When it comes to getting content, assuming you've created this file as a
resource in your bundle, the right way to do it is to use
getClass().getResourceAsStream("/myTemplateFile") if the resource is
available in your classloader.
My job: http://www.jboss.org/tools
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Powered by FUDForum
. Page generated in 0.14243 seconds