[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.ejb.annotations.ui/src/org/eclipse/jst/j2ee/ejb/annotation/ui/internal/wizards/NewEjbClassWizardPage.java b/plugins/org.eclipse.jst.j2ee.ejb.annotations.ui/src/org/eclipse/jst/j2ee/ejb/annotation/ui/internal/wizards/NewEjbClassWizardPage.java
index 0a275b1..a98c20b 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb.annotations.ui/src/org/eclipse/jst/j2ee/ejb/annotation/ui/internal/wizards/NewEjbClassWizardPage.java
+++ b/plugins/org.eclipse.jst.j2ee.ejb.annotations.ui/src/org/eclipse/jst/j2ee/ejb/annotation/ui/internal/wizards/NewEjbClassWizardPage.java
@@ -9,6 +9,8 @@
 
 package org.eclipse.jst.j2ee.ejb.annotation.ui.internal.wizards;
 
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jface.window.Window;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.jst.ejb.ui.project.facet.EjbProjectWizard;
@@ -20,8 +22,11 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
 import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
 import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
 import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
 
 
 public class NewEjbClassWizardPage extends NewJavaClassWizardPage {
@@ -49,4 +54,22 @@
 		}
 	}
 	
+	protected boolean isProjectValid(IProject project) {
+		boolean result = super.isProjectValid(project);
+		if (result) {
+			// check additionally if the project has the jst.ejb.xdoclet facet
+			result = false;
+			IFacetedProject faceted = null;
+			try {
+				faceted = ProjectFacetsManager.create(project);
+				if (faceted != null && 
+					(faceted.hasProjectFacet(ProjectFacetsManager.getProjectFacet("jst.ejb.xdoclet")))) {
+					result = true;
+				}
+			} catch (CoreException e) {
+			}
+		}
+		return result;
+	}
+	
 }