Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Separating New Wizards and File Templates
Separating New Wizards and File Templates [message #1833375] Sun, 11 October 2020 21:18 Go to next message
Alexander Rhodes is currently offline Alexander RhodesFriend
Messages: 2
Registered: October 2020
Junior Member
For my plugin, I'm trying to create two separate New File Wizards. One will create the base file in the created language, and then the other will do file generation based on what the user wrote in the previous file.

In other words, I need two separate New File Wizards that do drastically different things. I was able to create two wizards by just adding a second one to the UI plugin.xml, but it's not able to distinguish which File Template Provider I want to use. I created two different File Template Providers, but when I add them to the plugin.xml, they're both used by both wizards. I want each wizard to use a different File Template Provider, but I'm not sure how to distinguish this. Below is a snippet of the UI plugin.xml, but I'm not sure that will help at all.

        <extension
		point="org.eclipse.ui.newWizards">
		<wizard
			category="org.eclipse.jdt.ui.java/org.eclipse.jdt.junit"
			class="org.cnu.probinst.ui.ProbInstExecutableExtensionFactory:org.eclipse.xtext.ui.wizard.template.TemplateNewFileWizard"
			id="org.cnu.probinst.ui.wizard.AsgNewFileWizard"
			name="Asg File"
			icon="icons/new_ProbInst_file.png">
		</wizard>
	</extension>
	<extension
		point="org.eclipse.xtext.ui.fileTemplate">
		<fileTemplateProvider
			class="org.cnu.probinst.ui.ProbInstExecutableExtensionFactory:org.cnu.probinst.ui.wizard.AsgFileTemplateProvider"
			grammarName="org.cnu.probinst.ProbInst">
		</fileTemplateProvider>
	</extension>
	<extension
		point="org.eclipse.ui.newWizards">
		<wizard
			category="org.eclipse.jdt.ui.java/org.eclipse.jdt.junit"
			class="org.cnu.probinst.ui.ProbInstExecutableExtensionFactory:org.eclipse.xtext.ui.wizard.template.TemplateNewFileWizard"
			id="org.cnu.probinst.ui.wizard.AsgJUnitWizard"
			name="Asg JUnit"
			icon="icons/new_ProbInst_file.png">
		</wizard>
	</extension>
	<extension
		point="org.eclipse.xtext.ui.fileTemplate">
		<fileTemplateProvider
			class="org.cnu.probinst.ui.ProbInstExecutableExtensionFactory:org.cnu.probinst.ui.wizard.AsgJUnitTemplateProvider"
			grammarName="org.cnu.probinst.ProbInst">
		</fileTemplateProvider>
	</extension>
Re: Separating New Wizards and File Templates [message #1833380 is a reply to message #1833375] Mon, 12 October 2020 06:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi,

this is not part of the functionality so you would have to copy & paste & adapt e.g. TemplateNewFileWizard


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Separating New Wizards and File Templates [message #1833413 is a reply to message #1833380] Mon, 12 October 2020 14:21 Go to previous message
Alexander Rhodes is currently offline Alexander RhodesFriend
Messages: 2
Registered: October 2020
Junior Member
Thanks for your reply! I was looking into adapting the various Eclipse-created classes and at least wanted to check I wasn't missing an obvious solution before diving into that. I will give that a shot!

Thanks again!
Previous Topic:java.io.FileNotFoundException
Next Topic:Path Expression Issue
Goto Forum:
  


Current Time: Tue Apr 16 15:56:33 GMT 2024

Powered by FUDForum. Page generated in 0.02666 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top