View | Details | Raw Unified | Return to bug 241667 | Differences between
and this patch

Collapse All | Expand All

(-)ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/NewSessionBeanClassWizardPage.java (-4 / +6 lines)
Lines 15-20 Link Here
15
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewSessionBeanClassDataModelProperties.REMOTE;
15
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewSessionBeanClassDataModelProperties.REMOTE;
16
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewSessionBeanClassDataModelProperties.REMOTE_BUSINESS_INTERFACE;
16
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewSessionBeanClassDataModelProperties.REMOTE_BUSINESS_INTERFACE;
17
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewSessionBeanClassDataModelProperties.STATE_TYPE;
17
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewSessionBeanClassDataModelProperties.STATE_TYPE;
18
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
18
19
19
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.layout.GridData;
21
import org.eclipse.swt.layout.GridData;
Lines 102-114 Link Here
102
	protected String[] getValidationPropertyNames() {
103
	protected String[] getValidationPropertyNames() {
103
		String[] retVal = null;
104
		String[] retVal = null;
104
		String[] baseVals = super.getValidationPropertyNames();
105
		String[] baseVals = super.getValidationPropertyNames();
105
		retVal = new String[baseVals.length+2];
106
		retVal = new String[baseVals.length + 2];
106
		for (int cnt=0; cnt < baseVals.length; cnt++)
107
		for (int i = 0; i < baseVals.length; i++)
107
		{
108
		{
108
			retVal[cnt] = baseVals[cnt];
109
			retVal[i] = baseVals[i];
109
		}
110
		}
110
		retVal[baseVals.length] = LOCAL_BUSINESS_INTERFACE;
111
		retVal[baseVals.length] = LOCAL_BUSINESS_INTERFACE;
111
		retVal[baseVals.length+1] = REMOTE_BUSINESS_INTERFACE;
112
		retVal[baseVals.length + 1] = REMOTE_BUSINESS_INTERFACE;
113
		retVal[baseVals.length + 1] = INTERFACES;
112
		return retVal;
114
		return retVal;
113
	}
115
	}
114
}
116
}
(-)ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/AddSessionBeanWizardPage.java (-3 / +3 lines)
Lines 231-241 Link Here
231
	}
231
	}
232
232
233
	private void removeInterfaceFromModel(BusinessInterface element) {
233
	private void removeInterfaceFromModel(BusinessInterface element) {
234
		Collection<BusinessInterface> biList = (Collection<BusinessInterface>) model
234
		Collection<BusinessInterface> biList = (Collection<BusinessInterface>) model.getProperty(INTERFACES);
235
				.getProperty(INTERFACES);
236
		biList.remove(element);
235
		biList.remove(element);
237
		model.setProperty(INTERFACES, biList);
236
		model.setProperty(INTERFACES, biList);
238
		model.setProperty(BUSINESS_INTERFACES, biList);
237
		model.setProperty(BUSINESS_INTERFACES, biList);
238
		model.notifyPropertyChange(INTERFACES, IDataModel.VALUE_CHG);
239
	}
239
	}
240
240
241
	public void updateBusinessInterfacesList() {
241
	public void updateBusinessInterfacesList() {
Lines 303-309 Link Here
303
	@Override
303
	@Override
304
	protected String[] getValidationPropertyNames() {
304
	protected String[] getValidationPropertyNames() {
305
		return new String[] { LOCAL_HOME_INTERFACE, REMOTE_HOME_INTERFACE, LOCAL_COMPONENT_INTERFACE,
305
		return new String[] { LOCAL_HOME_INTERFACE, REMOTE_HOME_INTERFACE, LOCAL_COMPONENT_INTERFACE,
306
				REMOTE_COMPONENT_INTERFACE, EJB_NAME };
306
				REMOTE_COMPONENT_INTERFACE, EJB_NAME, INTERFACES };
307
	}
307
	}
308
308
309
	@Override
309
	@Override
(-)ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/AddButtonListener.java (+1 lines)
Lines 64-69 Link Here
64
					biList.add(iface);
64
					biList.add(iface);
65
					model.setProperty(INTERFACES, biList);
65
					model.setProperty(INTERFACES, biList);
66
					model.setProperty(BUSINESS_INTERFACES, biList);
66
					model.setProperty(BUSINESS_INTERFACES, biList);
67
					model.notifyPropertyChange(INTERFACES, IDataModel.VALUE_CHG);
67
					page.updateBusinessInterfacesList();
68
					page.updateBusinessInterfacesList();
68
				}
69
				}
69
			}
70
			}
(-)property_files/ejbcreation.properties (+1 lines)
Lines 147-149 Link Here
147
ERR_REMOTE_HOME_NOT_INTERFACE=The specified Remote Home interface is not valid.
147
ERR_REMOTE_HOME_NOT_INTERFACE=The specified Remote Home interface is not valid.
148
ERR_BEAN_ALREADY_EXISTS=Enterprise bean with the same Ejb Name already exists.
148
ERR_BEAN_ALREADY_EXISTS=Enterprise bean with the same Ejb Name already exists.
149
WRN_BEAN_NAME_IS_EMPTY=Bean name is empty, the containter will use the name of the bean class.
149
WRN_BEAN_NAME_IS_EMPTY=Bean name is empty, the containter will use the name of the bean class.
150
WRN_NO_BUSINESS_INTERFACE=No business interface configured. Clients will not be able to access this bean. 
(-)ejbcreation/org/eclipse/jst/j2ee/internal/ejb/project/operations/EJBCreationResourceHandler.java (+1 lines)
Lines 162-167 Link Here
162
	public static String ERR_REMOTE_HOME_NOT_INTERFACE;
162
	public static String ERR_REMOTE_HOME_NOT_INTERFACE;
163
	public static String ERR_NO_MESSAGE_LISTENER_INTERFACE;
163
	public static String ERR_NO_MESSAGE_LISTENER_INTERFACE;
164
	public static String WRN_BEAN_NAME_IS_EMPTY;
164
	public static String WRN_BEAN_NAME_IS_EMPTY;
165
	public static String WRN_NO_BUSINESS_INTERFACE;
165
166
166
167
167
	static {
168
	static {
(-)ejb/org/eclipse/jst/j2ee/ejb/internal/operations/NewSessionBeanClassDataModelProvider.java (-3 / +24 lines)
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
}

Return to bug 241667