[126090,179715] Should only be able to add an XDoclet EJB to a project if EJBDoclet facet is enabled
diff --git a/plugins/org.eclipse.jst.j2ee.navigator.ui/plugin.xml b/plugins/org.eclipse.jst.j2ee.navigator.ui/plugin.xml
index 1a6ec26..3d5d5f8 100644
--- a/plugins/org.eclipse.jst.j2ee.navigator.ui/plugin.xml
+++ b/plugins/org.eclipse.jst.j2ee.navigator.ui/plugin.xml
@@ -829,7 +829,7 @@
type="org.eclipse.core.resources.IProject">
<test forcePluginActivation="true"
property="org.eclipse.wst.common.project.facet.core.projectFacet"
- value="jst.ejb" />
+ value="jst.ejb.xdoclet" />
</adapt>
</and>
<instanceof value="org.eclipse.jst.j2ee.ejb.EJBJar" />
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassWizardPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassWizardPage.java
index 5ce5572..259938e 100644
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassWizardPage.java
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassWizardPage.java
@@ -201,6 +201,30 @@
}
return null;
}
+
+ /**
+ * This method is used by the project list initializer. The method checks
+ * if the specified project is valid to include it in the project list.
+ *
+ * <p>Subclasses of this wizard page should override this method to
+ * adjust filtering of the projects to their needs. </p>
+ *
+ * @param project reference to the project to be checked
+ *
+ * @return <code>true</code> if the project is valid to be included in
+ * the project list, <code>false</code> - otherwise.
+ */
+ protected boolean isProjectValid(IProject project) {
+ boolean result;
+ try {
+ result = project.isAccessible() &&
+ project.hasNature(IModuleConstants.MODULE_NATURE_ID) &&
+ J2EEProjectUtilities.getJ2EEProjectType(project).equals(projectType);
+ } catch (CoreException ce) {
+ result = false;
+ }
+ return result;
+ }
/**
*
@@ -210,14 +234,8 @@
List items = new ArrayList();
for (int i = 0; i < workspaceProjects.length; i++) {
IProject project = workspaceProjects[i];
- try {
- if (project.isAccessible() && project.hasNature(IModuleConstants.MODULE_NATURE_ID)) {
- if (J2EEProjectUtilities.getJ2EEProjectType(project).equals(projectType))
- items.add(project.getName());
- }
- } catch (CoreException ce) {
- // Ignore
- }
+ if (isProjectValid(project))
+ items.add(project.getName());
}
if (items.isEmpty()) return;
String[] names = new String[items.size()];