mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Fix from Andrew Ferguson to the project creation with small updates
This commit is contained in:
parent
c5603e5a0e
commit
279868fade
2 changed files with 16 additions and 3 deletions
|
@ -54,7 +54,8 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
private String wz_title;
|
private String wz_title;
|
||||||
private String wz_desc;
|
private String wz_desc;
|
||||||
|
|
||||||
public String lastProjectName = null;
|
private String lastProjectName = null;
|
||||||
|
private IPath lastProjectLocation = null;
|
||||||
private ICWizardHandler savedHandler = null;
|
private ICWizardHandler savedHandler = null;
|
||||||
|
|
||||||
protected List localPages = new ArrayList(); // replacing Wizard.pages since we have to delete them
|
protected List localPages = new ArrayList(); // replacing Wizard.pages since we have to delete them
|
||||||
|
@ -83,7 +84,9 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
* @return true if user has changed settings since project creation
|
* @return true if user has changed settings since project creation
|
||||||
*/
|
*/
|
||||||
private boolean isChanged() {
|
private boolean isChanged() {
|
||||||
if (savedHandler != fMainPage.h_selected || !fMainPage.getProjectName().equals(lastProjectName))
|
if (savedHandler != fMainPage.h_selected
|
||||||
|
|| !fMainPage.getProjectName().equals(lastProjectName)
|
||||||
|
|| !fMainPage.getProjectLocation().equals(lastProjectLocation))
|
||||||
return true;
|
return true;
|
||||||
return savedHandler.isChanged();
|
return savedHandler.isChanged();
|
||||||
}
|
}
|
||||||
|
@ -95,6 +98,7 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
savedHandler = fMainPage.h_selected;
|
savedHandler = fMainPage.h_selected;
|
||||||
savedHandler.saveState();
|
savedHandler.saveState();
|
||||||
lastProjectName = fMainPage.getProjectName();
|
lastProjectName = fMainPage.getProjectName();
|
||||||
|
lastProjectLocation = fMainPage.getProjectLocation();
|
||||||
// start creation process
|
// start creation process
|
||||||
invokeRunnable(getRunnable(defaults));
|
invokeRunnable(getRunnable(defaults));
|
||||||
}
|
}
|
||||||
|
@ -112,6 +116,7 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
} catch (CoreException ignore) {}
|
} catch (CoreException ignore) {}
|
||||||
newProject = null;
|
newProject = null;
|
||||||
lastProjectName = null;
|
lastProjectName = null;
|
||||||
|
lastProjectLocation = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean invokeRunnable(IRunnableWithProgress runnable) {
|
private boolean invokeRunnable(IRunnableWithProgress runnable) {
|
||||||
|
@ -154,7 +159,7 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
getShell().getDisplay().syncExec(new Runnable() {
|
getShell().getDisplay().syncExec(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
newProject = createIProject(lastProjectName, fMainPage.getProjectLocation());
|
newProject = createIProject(lastProjectName, lastProjectLocation);
|
||||||
if (newProject != null)
|
if (newProject != null)
|
||||||
fMainPage.h_selected.createProject(newProject, defaults);
|
fMainPage.h_selected.createProject(newProject, defaults);
|
||||||
} catch (CoreException e) { CUIPlugin.getDefault().log(e); }
|
} catch (CoreException e) { CUIPlugin.getDefault().log(e); }
|
||||||
|
@ -222,4 +227,8 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
public String getLastProjectName() {
|
public String getLastProjectName() {
|
||||||
return lastProjectName;
|
return lastProjectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IPath getLastProjectLocation() {
|
||||||
|
return lastProjectLocation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,14 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.jface.wizard.IWizard;
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
|
|
||||||
public interface IWizardWithMemory extends IWizard {
|
public interface IWizardWithMemory extends IWizard {
|
||||||
// returns name of last-created project
|
// returns name of last-created project
|
||||||
// or null if no projects were created
|
// or null if no projects were created
|
||||||
public String getLastProjectName();
|
public String getLastProjectName();
|
||||||
|
|
||||||
|
public IPath getLastProjectLocation();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue