[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] CProjectWizard patch
|
The problem appears in ConversionWizard that inherits to CProjectWizard. The
first one does not initialize fmainPage which causes NullpiinterException.
Actually, ConversionWizard doesn't have this page, so it is unsupported
operation for it.
Index: CProjectWizard.java
===================================================================
RCS file:
/home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CProjectWizard
.java,v
retrieving revision 1.6
diff -u -r1.6 CProjectWizard.java
--- CProjectWizard.java 13 Nov 2002 16:44:11 -0000 1.6
+++ CProjectWizard.java 22 Nov 2002 16:36:13 -0000
@@ -123,7 +123,10 @@
* Gets the project location path from the main page
* Overwrite this method if you do not have a main page
*/
- protected IPath getLocationPath() {
+ protected IPath getLocationPath() throws UnsupportedOperationException {
+ // In case of conversion wizard fMainPage == null
+ if(null == fMainPage)
+ throw new UnsupportedOperationException();
return fMainPage.getLocationPath();
}
@@ -132,7 +135,10 @@
* Overwrite this method if you do not have a main page
*/
- protected IProject getProjectHandle() {
+ protected IProject getProjectHandle() throws UnsupportedOperationException
{
+ // In case of conversion wizard fMainPage == null
+ if(null == fMainPage)
+ throw new UnsupportedOperationException();
return fMainPage.getProjectHandle();
}
@@ -252,11 +258,15 @@
}
MessageDialog.openError(shell, title, message);
CUIPlugin.log(th);
- try {
- getProjectHandle().delete(false, false, null);
+ try {
+ IProject project = getProjectHandle();
+ if(null != project) // In case of conversion wizard we shouldn't delete
project
+ project.delete(false, false, null);
}
catch (CoreException ignore) {
}
+ catch (UnsupportedOperationException ignore) {
+ }
return false;
} catch (InterruptedException e) {
return false;
@@ -286,11 +296,15 @@
*/
protected IProject createNewProject(IProgressMonitor monitor) throws
CoreException {
+ IProject newProjectHandle;
if (newProject != null)
return newProject;
-
// get a project handle
- IProject newProjectHandle = getProjectHandle();
+ try {
+ newProjectHandle = getProjectHandle();
+ } catch (UnsupportedOperationException e) {
+ throw new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID,
0, e.getMessage(), null));
+ }
// get a project descriptor
IPath defaultPath = Platform.getLocation();
===================================================================
Alex Chapiro