Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java4
-rw-r--r--plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewServletClassWizardPage.java75
2 files changed, 44 insertions, 35 deletions
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java
index 189ca3605..54e84c0bd 100644
--- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java
@@ -92,8 +92,8 @@ public abstract class NewWebClassDataModelProvider extends NewJavaClassDataModel
*/
protected List interfaceList;
- private String classNameCache;
- private String existingClassNameCache;
+ private String classNameCache = ""; //$NON-NLS-1$
+ private String existingClassNameCache = ""; //$NON-NLS-1$
private static boolean useAnnotations = false;
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