Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkraev2010-06-22 08:04:20 +0000
committerkraev2010-06-22 08:04:20 +0000
commitf14c0fe6aeb55cc174632896c9183a00da964e53 (patch)
treef316cf026967aefd15ed351b21911b0e11c3ff72 /plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst
parent99ad471116601bd2e8d3dec5ab44ff34fb945e10 (diff)
downloadwebtools.javaee-f14c0fe6aeb55cc174632896c9183a00da964e53.tar.gz
webtools.javaee-f14c0fe6aeb55cc174632896c9183a00da964e53.tar.xz
webtools.javaee-f14c0fe6aeb55cc174632896c9183a00da964e53.zip
[312449] 2 NPEs on new Servlet Wizard -> Browse for existing class
Diffstat (limited to 'plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst')
-rw-r--r--plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewServletClassWizardPage.java75
1 files changed, 42 insertions, 33 deletions
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewServletClassWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewServletClassWizardPage.java
index daca4542d..d6b3809ff 100644
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewServletClassWizardPage.java
+++ b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewServletClassWizardPage.java
@@ -73,43 +73,52 @@ public class NewServletClassWizardPage extends NewWebClassWizardPage {
@Override
protected void handleClassButtonSelected() {
getControl().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_WAIT));
- IProject project = (IProject) model.getProperty(PROJECT);
- IVirtualComponent component = ComponentCore.createComponent(project);
- MultiSelectFilteredFileSelectionDialog ms = new MultiSelectFilteredFileSelectionDialog(
- getShell(),
- NEW_SERVLET_WIZARD_WINDOW_TITLE,
- CHOOSE_SERVLET_CLASS,
- JSPEXTENSIONS,
- false,
- project);
- IContainer root = component.getRootFolder().getUnderlyingFolder();
- ms.setInput(root);
- ms.open();
- if (ms.getReturnCode() == Window.OK) {
- String qualifiedClassName = ""; //$NON-NLS-1$
- if (ms.getSelectedItem() == MultiSelectFilteredFileSelectionDialog.JSP) {
- Object obj = ms.getFirstResult();
- if (obj != null) {
- if (obj instanceof IFile) {
- IFile file = (IFile) obj;
- IPath pFull = file.getFullPath();
- IPath pBase = root.getFullPath();
- IPath path = pFull.removeFirstSegments(pBase.segmentCount());
- qualifiedClassName = path.makeAbsolute().toString();
- model.setProperty(IS_SERVLET_TYPE, new Boolean(false));
+ try {
+ IProject project = (IProject) model.getProperty(PROJECT);
+
+ if (project == null) {
+ // show info message
+ return;
+ }
+
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ MultiSelectFilteredFileSelectionDialog ms = new MultiSelectFilteredFileSelectionDialog(
+ getShell(),
+ NEW_SERVLET_WIZARD_WINDOW_TITLE,
+ CHOOSE_SERVLET_CLASS,
+ JSPEXTENSIONS,
+ false,
+ project);
+ IContainer root = component.getRootFolder().getUnderlyingFolder();
+ ms.setInput(root);
+ ms.open();
+ if (ms.getReturnCode() == Window.OK) {
+ String qualifiedClassName = ""; //$NON-NLS-1$
+ if (ms.getSelectedItem() == MultiSelectFilteredFileSelectionDialog.JSP) {
+ Object obj = ms.getFirstResult();
+ if (obj != null) {
+ if (obj instanceof IFile) {
+ IFile file = (IFile) obj;
+ IPath pFull = file.getFullPath();
+ IPath pBase = root.getFullPath();
+ IPath path = pFull.removeFirstSegments(pBase.segmentCount());
+ qualifiedClassName = path.makeAbsolute().toString();
+ model.setProperty(IS_SERVLET_TYPE, new Boolean(false));
+ }
+ }
+ }
+ else {
+ IType type = (IType) ms.getFirstResult();
+ if (type != null) {
+ qualifiedClassName = type.getFullyQualifiedName();
+ model.setProperty(IS_SERVLET_TYPE, new Boolean(true));
}
}
- }
- else {
- IType type = (IType) ms.getFirstResult();
- if (type != null) {
- qualifiedClassName = type.getFullyQualifiedName();
- model.setProperty(IS_SERVLET_TYPE, new Boolean(true));
- }
+ existingClassText.setText(qualifiedClassName);
}
- existingClassText.setText(qualifiedClassName);
+ } finally {
+ getControl().setCursor(null);
}
- getControl().setCursor(null);
}
@Override

Back to the top