Lines 33-38
Link Here
|
33 |
|
33 |
|
34 |
import org.eclipse.core.resources.IProject; |
34 |
import org.eclipse.core.resources.IProject; |
35 |
import org.eclipse.core.resources.ResourcesPlugin; |
35 |
import org.eclipse.core.resources.ResourcesPlugin; |
|
|
36 |
import org.eclipse.core.runtime.CoreException; |
36 |
import org.eclipse.core.runtime.IStatus; |
37 |
import org.eclipse.core.runtime.IStatus; |
37 |
import org.eclipse.core.runtime.Status; |
38 |
import org.eclipse.core.runtime.Status; |
38 |
import org.eclipse.jdt.core.IJavaProject; |
39 |
import org.eclipse.jdt.core.IJavaProject; |
Lines 47-58
Link Here
|
47 |
import org.eclipse.jst.j2ee.internal.common.J2EECommonMessages; |
48 |
import org.eclipse.jst.j2ee.internal.common.J2EECommonMessages; |
48 |
import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider; |
49 |
import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider; |
49 |
import org.eclipse.jst.j2ee.internal.ejb.project.operations.EJBCreationResourceHandler; |
50 |
import org.eclipse.jst.j2ee.internal.ejb.project.operations.EJBCreationResourceHandler; |
|
|
51 |
import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants; |
50 |
import org.eclipse.osgi.util.NLS; |
52 |
import org.eclipse.osgi.util.NLS; |
51 |
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; |
53 |
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; |
52 |
import org.eclipse.wst.common.frameworks.datamodel.IDataModel; |
54 |
import org.eclipse.wst.common.frameworks.datamodel.IDataModel; |
53 |
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; |
55 |
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; |
54 |
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider; |
56 |
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider; |
55 |
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin; |
57 |
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin; |
|
|
58 |
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; |
56 |
|
59 |
|
57 |
public class NewSessionBeanClassDataModelProvider extends NewEnterpriseBeanClassDataModelProvider { |
60 |
public class NewSessionBeanClassDataModelProvider extends NewEnterpriseBeanClassDataModelProvider { |
58 |
|
61 |
|
Lines 302-312
Link Here
|
302 |
@Override |
305 |
@Override |
303 |
public IStatus validate(String propertyName) { |
306 |
public IStatus validate(String propertyName) { |
304 |
if (LOCAL_BUSINESS_INTERFACE.equals(propertyName)) { |
307 |
if (LOCAL_BUSINESS_INTERFACE.equals(propertyName)) { |
305 |
if (model.getBooleanProperty(LOCAL)) { |
308 |
if (getBooleanProperty(LOCAL)) { |
306 |
return validateEjbInterface(getStringProperty(propertyName)); |
309 |
return validateEjbInterface(getStringProperty(propertyName)); |
307 |
} |
310 |
} |
308 |
} else if (REMOTE_BUSINESS_INTERFACE.equals(propertyName)) { |
311 |
} else if (REMOTE_BUSINESS_INTERFACE.equals(propertyName)) { |
309 |
if (model.getBooleanProperty(REMOTE)) { |
312 |
if (getBooleanProperty(REMOTE)) { |
310 |
return validateEjbInterface(getStringProperty(propertyName)); |
313 |
return validateEjbInterface(getStringProperty(propertyName)); |
311 |
} |
314 |
} |
312 |
} else if (LOCAL_COMPONENT_INTERFACE.equals(propertyName) || |
315 |
} else if (LOCAL_COMPONENT_INTERFACE.equals(propertyName) || |
Lines 314-324
Link Here
|
314 |
LOCAL_HOME_INTERFACE.equals(propertyName) || |
317 |
LOCAL_HOME_INTERFACE.equals(propertyName) || |
315 |
REMOTE_HOME_INTERFACE.equals(propertyName)) { |
318 |
REMOTE_HOME_INTERFACE.equals(propertyName)) { |
316 |
return validateComponentHomeInterfaces(); |
319 |
return validateComponentHomeInterfaces(); |
|
|
320 |
} else if (INTERFACES.equals(propertyName)) { |
321 |
return validateInterfacesList(); |
317 |
} |
322 |
} |
318 |
|
323 |
|
319 |
return super.validate(propertyName); |
324 |
return super.validate(propertyName); |
320 |
} |
325 |
} |
321 |
|
326 |
|
322 |
protected IStatus validateEjbInterface(String fullyQualifiedName) { |
327 |
protected IStatus validateEjbInterface(String fullyQualifiedName) { |
323 |
IStatus status = validateJavaTypeName(fullyQualifiedName); |
328 |
IStatus status = validateJavaTypeName(fullyQualifiedName); |
324 |
if (status.getSeverity() != IStatus.ERROR) { |
329 |
if (status.getSeverity() != IStatus.ERROR) { |
Lines 423-428
Link Here
|
423 |
return Status.OK_STATUS; |
428 |
return Status.OK_STATUS; |
424 |
} |
429 |
} |
425 |
|
430 |
|
|
|
431 |
protected IStatus validateInterfacesList() { |
432 |
List<BusinessInterface> list = (List<BusinessInterface>) getProperty(INTERFACES); |
433 |
if (list.isEmpty() && isEJB30Project()) { |
434 |
return new Status(IStatus.WARNING, EjbPlugin.PLUGIN_ID, EJBCreationResourceHandler.WRN_NO_BUSINESS_INTERFACE); |
435 |
} |
436 |
return Status.OK_STATUS; |
437 |
} |
438 |
|
426 |
private boolean hasRequiredElementInSignature(String[] allElementNames, String[] wanted) { |
439 |
private boolean hasRequiredElementInSignature(String[] allElementNames, String[] wanted) { |
427 |
if (allElementNames == null || allElementNames.length == 0){ |
440 |
if (allElementNames == null || allElementNames.length == 0){ |
428 |
return false; |
441 |
return false; |
Lines 462-466
Link Here
|
462 |
} |
475 |
} |
463 |
return WTPCommonPlugin.OK_STATUS; |
476 |
return WTPCommonPlugin.OK_STATUS; |
464 |
} |
477 |
} |
|
|
478 |
|
479 |
private boolean isEJB30Project() { |
480 |
try { |
481 |
return ProjectFacetsManager.create(getTargetProject()).hasProjectFacet(IJ2EEFacetConstants.EJB_30); |
482 |
} catch (CoreException e) { |
483 |
return false; |
484 |
} |
485 |
} |
465 |
|
486 |
|
466 |
} |
487 |
} |