1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Catch when fMainPage is null.

This commit is contained in:
Alain Magloire 2002-11-23 04:34:01 +00:00
parent 9b07d58245
commit ea8306b084

View file

@ -123,7 +123,9 @@ public abstract class CProjectWizard extends BasicNewResourceWizard implements I
* Gets the project location path from the main page * Gets the project location path from the main page
* Overwrite this method if you do not have a main page * Overwrite this method if you do not have a main page
*/ */
protected IPath getLocationPath() { protected IPath getLocationPath() throws UnsupportedOperationException {
if (null == fMainPage)
throw new UnsupportedOperationException();
return fMainPage.getLocationPath(); return fMainPage.getLocationPath();
} }
@ -132,7 +134,9 @@ public abstract class CProjectWizard extends BasicNewResourceWizard implements I
* Overwrite this method if you do not have a main page * Overwrite this method if you do not have a main page
*/ */
protected IProject getProjectHandle() { protected IProject getProjectHandle() throws UnsupportedOperationException {
if (null == fMainPage)
throw new UnsupportedOperationException();
return fMainPage.getProjectHandle(); return fMainPage.getProjectHandle();
} }
@ -254,8 +258,8 @@ public abstract class CProjectWizard extends BasicNewResourceWizard implements I
CUIPlugin.log(th); CUIPlugin.log(th);
try { try {
getProjectHandle().delete(false, false, null); getProjectHandle().delete(false, false, null);
} } catch (CoreException ignore) {
catch (CoreException ignore) { } catch (UnsupportedOperationException ignore) {
} }
return false; return false;
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -290,7 +294,12 @@ public abstract class CProjectWizard extends BasicNewResourceWizard implements I
return newProject; return newProject;
// get a project handle // get a project handle
IProject newProjectHandle = getProjectHandle(); IProject newProjectHandle = null;
try {
newProjectHandle = getProjectHandle();
} catch (UnsupportedOperationException e) {
throw new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, 0, e.getMessage(), null));
}
// get a project descriptor // get a project descriptor
IPath defaultPath = Platform.getLocation(); IPath defaultPath = Platform.getLocation();