How to change a project name between the steps of the New Project Wizard ?



I'm developing a plugin in which I add a new type of project that the user can create. In the first step of the wizard, the plugin asks the user for some information and with them, I want to automatically and programmatically change the name of the project in the final step of the wizard.

I know of the existence of WizardContext and setProjectName() method but for some reason I don't understand the project name doesn't change between steps. I can only change the project name before the wizard opens but in this case I don't have the information I wanted and the name change is not useful.

Here my code in MyModuleWizardStep :

//The method is called just before the wizard opens
public void updateStep(){
wizardContext.setProjectName("First Name"); //The name is changed but not when I want it

//The method is called just when the 'Next' button is clicked
public void updateDataModel() {
wizardContext.setProjectName("Second Name"); //The method is called when I want but the name doesn't change

How can I change the project name if the WizardContext.setProjectName() doesn't work in the context of updateDataModel ? Is this normal ? If yes then is it possible to have access to the 'Name' TextField of the last step of the Wizard ?

评论操作 固定链接

Thank you very much, I solved my problem.
For anyone in the future who found this post, my solution is to implement the overriden method "ModuleWizardStep modifySettingsStep(SettingsStep settingsStep)" in MyModuleBuilder. Inside the method, I get the ModuleNameLocationSettings thanks to the getter "settingsStep.getModuleNameLocationSettings()" and with it, I was able to set and get the module name and the module root path.