mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug # 219950 : TemplateEngine: Changes made to wizard fields are lost if Advanced Settings is first pressed
This commit is contained in:
parent
364c506b26
commit
69f1f56382
4 changed files with 62 additions and 14 deletions
|
@ -535,11 +535,11 @@ public class MBSWizardHandler extends CWizardHandler {
|
|||
cfgFirst = cfgDes;
|
||||
}
|
||||
mngr.setProjectDescription(project, des);
|
||||
doPostProcess(project);
|
||||
doCustom();
|
||||
doTemplatesPostProcess(project);
|
||||
doCustom(project);
|
||||
}
|
||||
|
||||
protected void doPostProcess(IProject prj) {
|
||||
protected void doTemplatesPostProcess(IProject prj) {
|
||||
if(entryInfo == null)
|
||||
return;
|
||||
|
||||
|
@ -648,7 +648,7 @@ public class MBSWizardHandler extends CWizardHandler {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected void doCustom() {
|
||||
protected void doCustom(IProject newProject) {
|
||||
IRunnableWithProgress[] operations = MBSCustomPageManager.getOperations();
|
||||
if(operations != null)
|
||||
for(int k = 0; k < operations.length; k++)
|
||||
|
@ -661,11 +661,21 @@ public class MBSWizardHandler extends CWizardHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public void postProcess(IProject newProject) {
|
||||
public void postProcess(IProject newProject, boolean created) {
|
||||
deleteExtraConfigs(newProject);
|
||||
doCustom();
|
||||
// calls are required only if the project was
|
||||
// created before for <Advanced Settings> feature.
|
||||
if (created) {
|
||||
doTemplatesPostProcess(newProject);
|
||||
doCustom(newProject);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes configurations
|
||||
*
|
||||
* @param newProject - affected project
|
||||
*/
|
||||
private void deleteExtraConfigs(IProject newProject) {
|
||||
if (isChanged()) return; // no need to delete
|
||||
if (listener != null && listener.isCurrent()) return; // nothing to delete
|
||||
|
|
|
@ -80,9 +80,8 @@ public class STDWizardHandler extends MBSWizardHandler {
|
|||
}
|
||||
mngr.setProjectDescription(project, des);
|
||||
|
||||
doPostProcess(project);
|
||||
// process custom pages
|
||||
doCustom();
|
||||
doTemplatesPostProcess(project);
|
||||
doCustom(project);
|
||||
}
|
||||
public boolean canCreateWithoutToolchain() { return true; }
|
||||
|
||||
|
|
|
@ -181,13 +181,14 @@ implements IExecutableExtension, IWizardWithMemory
|
|||
}
|
||||
|
||||
public boolean performFinish() {
|
||||
boolean needsPost = (newProject != null && !isChanged());
|
||||
// create project if it is not created yet
|
||||
if (getProject(fMainPage.isCurrent(), true) == null) return false;
|
||||
fMainPage.h_selected.postProcess(newProject);
|
||||
if (getProject(fMainPage.isCurrent(), true) == null)
|
||||
return false;
|
||||
fMainPage.h_selected.postProcess(newProject, needsPost);
|
||||
try {
|
||||
setCreated();
|
||||
} catch (CoreException e) {
|
||||
// TODO log or display a message
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -171,9 +171,14 @@ public class CWizardHandler implements Cloneable {
|
|||
/**
|
||||
* Called when Finish button pressed,
|
||||
* even if project was created before.
|
||||
* @param proj
|
||||
*
|
||||
* @param prj - affected project
|
||||
* @param created - true if the project was created before
|
||||
*/
|
||||
public void postProcess(IProject proj) {}
|
||||
public void postProcess(IProject prj, boolean created) {
|
||||
doTemplatesPostProcess(prj);
|
||||
doCustom(prj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this item can be added to Wizard tree
|
||||
|
@ -214,4 +219,37 @@ public class CWizardHandler implements Cloneable {
|
|||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after project creation in order to apply
|
||||
* template-specific settings.
|
||||
*
|
||||
* Can be called 2 or more times:
|
||||
* - each time when user presses <Advanced Settings> button
|
||||
* - when user presses <Finish> button.
|
||||
* If <Adv. settings> were not invoked, called once.
|
||||
*
|
||||
* Since the project is cleared before each method call,
|
||||
* no need to check whether it has been called before.
|
||||
*
|
||||
* @param prj - affected project.
|
||||
*/
|
||||
protected void doTemplatesPostProcess(IProject prj) {}
|
||||
|
||||
/**
|
||||
* Called after project creation in order to apply
|
||||
* settings from custom pages.
|
||||
*
|
||||
* Can be called 2 or more times:
|
||||
* - each time when user presses <Advanced Settings> button
|
||||
* - when user presses <Finish> button.
|
||||
* If <Adv. settings> were not invoked, called once.
|
||||
*
|
||||
* Since the project is cleared before each doCustom() call,
|
||||
* no need to check whether it has been called before.
|
||||
* @param prj - affected project.
|
||||
*/
|
||||
|
||||
protected void doCustom(IProject prj) {}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue