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

Collapse All | Expand All

(-)ejb/org/eclipse/jst/j2ee/ejb/internal/operations/NewMessageDrivenBeanClassDataModelProvider.java (-24 / +60 lines)
Lines 12-17 Link Here
12
12
13
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.DESTINATION_TYPE;
13
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.DESTINATION_TYPE;
14
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.JMS;
14
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.JMS;
15
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.MESSAGE_LISTENER_INTERFACE;
15
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
16
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
16
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS;
17
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS;
17
18
Lines 19-29 Link Here
19
import java.util.List;
20
import java.util.List;
20
import java.util.Set;
21
import java.util.Set;
21
22
23
import org.eclipse.core.runtime.IStatus;
22
import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
24
import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
23
import org.eclipse.jst.j2ee.internal.ejb.project.operations.EJBCreationResourceHandler;
25
import org.eclipse.jst.j2ee.internal.ejb.project.operations.EJBCreationResourceHandler;
24
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
26
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
25
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
27
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
26
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
28
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
29
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
27
30
28
public class NewMessageDrivenBeanClassDataModelProvider extends NewEnterpriseBeanClassDataModelProvider {
31
public class NewMessageDrivenBeanClassDataModelProvider extends NewEnterpriseBeanClassDataModelProvider {
29
32
Lines 45-50 Link Here
45
48
46
		propertyNames.add(DESTINATION_TYPE);
49
		propertyNames.add(DESTINATION_TYPE);
47
		propertyNames.add(JMS);
50
		propertyNames.add(JMS);
51
		propertyNames.add(MESSAGE_LISTENER_INTERFACE);
48
52
49
		return propertyNames;
53
		return propertyNames;
50
	}
54
	}
Lines 71-77 Link Here
71
		else if (propertyName.equals(DESTINATION_TYPE)) {
75
		else if (propertyName.equals(DESTINATION_TYPE)) {
72
			return DestinationType.QUEUE.toString();
76
			return DestinationType.QUEUE.toString();
73
		}
77
		}
74
75
		// Otherwise check super for default value for property
78
		// Otherwise check super for default value for property
76
		return super.getDefaultProperty(propertyName);
79
		return super.getDefaultProperty(propertyName);
77
	}
80
	}
Lines 92-116 Link Here
92
	 * @return boolean was property set?
95
	 * @return boolean was property set?
93
	 */
96
	 */
94
	public boolean propertySet(String propertyName, Object propertyValue) {
97
	public boolean propertySet(String propertyName, Object propertyValue) {
95
98
		boolean result = false;
96
		// Call super to set the property on the data model
97
		boolean result = super.propertySet(propertyName, propertyValue);
98
		
99
		
99
		if (propertyName.equals(JMS)){
100
		if (propertyName.equals(JMS)) {
100
			updateInterfaces(JMS, (Boolean) propertyValue);
101
			updateInterfaces();
102
			updateMessageListenerInterfaces();
103
			result = true;
101
		}
104
		}
102
		if (propertyName.equals(INTERFACES)){
105
		
103
			boolean isAlreadyExist = ((List<String>) propertyValue).contains(QUALIFIED_JMS_MESSAGELISTENER);
106
		if (propertyName.equals(INTERFACES)) {
104
			if (isAlreadyExist && !getBooleanProperty(JMS)){
107
			updateMessageListenerInterfaces();
105
				getDataModel().setProperty(JMS, true);
106
				return true;
107
			}
108
			if (!isAlreadyExist && getBooleanProperty(JMS))
109
				getDataModel().setProperty(JMS, false);
110
		}
108
		}
111
		return result;
109
		
110
		if (propertyName.equals(MESSAGE_LISTENER_INTERFACE)) {
111
			boolean needSetJMS = QUALIFIED_JMS_MESSAGELISTENER.equals(propertyValue);
112
			if (getDataModel().getBooleanProperty(JMS) != needSetJMS)
113
				getDataModel().setProperty(JMS, needSetJMS);
114
			result = true;
115
		}
116
		
117
		return result || super.propertySet(propertyName, propertyValue);
112
	}
118
	}
113
	
119
114
	@Override
120
	@Override
115
	public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
121
	public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
116
		if (propertyName.equals(DESTINATION_TYPE)) {
122
		if (propertyName.equals(DESTINATION_TYPE)) {
Lines 124-142 Link Here
124
							EJBCreationResourceHandler.DESTINATION_TYPE_TOPIC
130
							EJBCreationResourceHandler.DESTINATION_TYPE_TOPIC
125
					});
131
					});
126
		} 
132
		} 
127
		
133
128
		return super.getValidPropertyDescriptors(propertyName);
134
		return super.getValidPropertyDescriptors(propertyName);
129
	}
135
	}
130
136
131
	private void updateInterfaces(String property, Boolean propertyValue) {
137
	@Override
138
	public IStatus validate(String propertyName) {
139
		if (propertyName.equals(MESSAGE_LISTENER_INTERFACE)) {
140
			String value = (String) getProperty(MESSAGE_LISTENER_INTERFACE);
141
			if (value == null || value.trim().length() == 0){
142
				List<String> interfaces = (List<String>) getProperty(INTERFACES);
143
				return WTPCommonPlugin.createErrorStatus(EJBCreationResourceHandler.ERR_NO_MESSAGE_LISTENER_INTERFACE);
144
			}
145
		}
146
		return super.validate(propertyName);
147
	}
148
149
	private void updateInterfaces() {
132
		List<String> interfacesList = (List<String>) getDataModel().getProperty(INTERFACES);
150
		List<String> interfacesList = (List<String>) getDataModel().getProperty(INTERFACES);
133
		boolean isAlreadyExist = interfacesList.contains(QUALIFIED_JMS_MESSAGELISTENER);
151
		boolean isJMS = getDataModel().getBooleanProperty(JMS);
134
		if (propertyValue){
152
		if (isJMS) {
135
			if (!isAlreadyExist)
153
			if (!interfacesList.contains(QUALIFIED_JMS_MESSAGELISTENER))
136
				interfacesList.add(QUALIFIED_JMS_MESSAGELISTENER);
154
				interfacesList.add(QUALIFIED_JMS_MESSAGELISTENER);
137
		}else
155
		} else {
138
			if (isAlreadyExist)
156
			interfacesList.remove(QUALIFIED_JMS_MESSAGELISTENER);
139
				interfacesList.remove(QUALIFIED_JMS_MESSAGELISTENER);
157
		}
140
		getDataModel().setProperty(INTERFACES, interfacesList);
158
		getDataModel().setProperty(INTERFACES, interfacesList);
141
	}
159
	}
160
161
	private void updateMessageListenerInterfaces() {
162
		boolean isJMS = getDataModel().getBooleanProperty(JMS);
163
		if (isJMS){
164
			getDataModel().setProperty(MESSAGE_LISTENER_INTERFACE, QUALIFIED_JMS_MESSAGELISTENER);
165
		} else {
166
			String value = getStringProperty(MESSAGE_LISTENER_INTERFACE);
167
			if (value == null || value.length() == 0 || QUALIFIED_JMS_MESSAGELISTENER.equals(value)) {
168
				List<String> interfaces = (List<String>) getProperty(INTERFACES);
169
				String messageListenerInterface = null;
170
				if (interfaces.size() > 0) {
171
					messageListenerInterface = interfaces.get(0);
172
				}
173
				getDataModel().setProperty(MESSAGE_LISTENER_INTERFACE, messageListenerInterface);
174
			}
175
		}
176
	}
177
142
}
178
}
(-)ejb/org/eclipse/jst/j2ee/ejb/internal/operations/CreateMessageDrivenBeanTemplateModel.java (+16 lines)
Lines 14-25 Link Here
14
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewEnterpriseBeanClassDataModelProperties.MAPPED_NAME;
14
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewEnterpriseBeanClassDataModelProperties.MAPPED_NAME;
15
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.DESTINATION_TYPE;
15
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.DESTINATION_TYPE;
16
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.JMS;
16
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.JMS;
17
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.MESSAGE_LISTENER_INTERFACE;
17
18
18
import java.util.Collection;
19
import java.util.Collection;
19
import java.util.Hashtable;
20
import java.util.Hashtable;
20
import java.util.Iterator;
21
import java.util.Iterator;
22
import java.util.List;
21
import java.util.Map;
23
import java.util.Map;
22
24
25
import org.eclipse.jdt.core.Signature;
23
import org.eclipse.jst.j2ee.internal.common.operations.Method;
26
import org.eclipse.jst.j2ee.internal.common.operations.Method;
24
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
27
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
25
28
Lines 32-40 Link Here
32
	public static final String QUALIFIED_JSM_MESSAGE = "javax.jms.Message"; //$NON-NLS-1$
35
	public static final String QUALIFIED_JSM_MESSAGE = "javax.jms.Message"; //$NON-NLS-1$
33
	public static final String QUALIFIED_MESSAGE_DRIVEN = "javax.ejb.MessageDriven"; //$NON-NLS-1$
36
	public static final String QUALIFIED_MESSAGE_DRIVEN = "javax.ejb.MessageDriven"; //$NON-NLS-1$
34
	public static final String ATT_ACTIVATION_CONFIG = "activationConfig"; //$NON-NLS-1$
37
	public static final String ATT_ACTIVATION_CONFIG = "activationConfig"; //$NON-NLS-1$
38
	public static final String ATT_MESSAGE_LISTENER_INTERFACE = "messageListenerInterface"; //$NON-NLS-1$
35
	public static final String ON_MESSAGE = "onMessage"; //$NON-NLS-1$
39
	public static final String ON_MESSAGE = "onMessage"; //$NON-NLS-1$
36
	public static final String ON_MESSAGE_SIGNATURE = "(Ljavax/jms/Message;)V"; //$NON-NLS-1$
40
	public static final String ON_MESSAGE_SIGNATURE = "(Ljavax/jms/Message;)V"; //$NON-NLS-1$
37
41
42
	private static final String CLASS_SUFFIX = ".class"; //$NON-NLS-1$
43
	
38
	public CreateMessageDrivenBeanTemplateModel(IDataModel dataModel) {
44
	public CreateMessageDrivenBeanTemplateModel(IDataModel dataModel) {
39
		super(dataModel);
45
		super(dataModel);
40
	}
46
	}
Lines 53-58 Link Here
53
			collection.add(QUALIFIED_TRANSACTION_MANAGEMENT);
59
			collection.add(QUALIFIED_TRANSACTION_MANAGEMENT);
54
			collection.add(QUALIFIED_TRANSACTION_MANAGEMENT_TYPE);
60
			collection.add(QUALIFIED_TRANSACTION_MANAGEMENT_TYPE);
55
		}
61
		}
62
		
63
		collection.add(dataModel.getStringProperty(MESSAGE_LISTENER_INTERFACE));
56
64
57
		return collection;
65
		return collection;
58
	}
66
	}
Lines 75-80 Link Here
75
		if (mappedName != null && mappedName.length() > 0) {
83
		if (mappedName != null && mappedName.length() > 0) {
76
			result.put(ATT_MAPPED_NAME, QUOTATION_STRING + mappedName + QUOTATION_STRING);
84
			result.put(ATT_MAPPED_NAME, QUOTATION_STRING + mappedName + QUOTATION_STRING);
77
		}
85
		}
86
		String messageListenerInterface = getProperty(MESSAGE_LISTENER_INTERFACE);
87
		
88
		List<String> interfaces = getQualifiedInterfaces();
89
		if (interfaces.size() != 1 || !interfaces.contains(messageListenerInterface)) {
90
			result.put(ATT_MESSAGE_LISTENER_INTERFACE, 
91
					Signature.getSimpleName(messageListenerInterface) + CLASS_SUFFIX);
92
		}
93
			
78
		return result;
94
		return result;
79
	}
95
	}
80
96
(-)ejb/org/eclipse/jst/j2ee/ejb/internal/operations/INewMessageDrivenBeanClassDataModelProperties.java (-5 / +18 lines)
Lines 10-23 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jst.j2ee.ejb.internal.operations;
11
package org.eclipse.jst.j2ee.ejb.internal.operations;
12
12
13
public interface INewMessageDrivenBeanClassDataModelProperties extends INewEnterpriseBeanClassDataModelProperties {
13
public interface INewMessageDrivenBeanClassDataModelProperties extends
14
		INewEnterpriseBeanClassDataModelProperties {
14
15
15
	/**
16
	/**
16
	 * Optional, boolean property used to specify whether to generate a
17
	 * Optional, boolean property used to specify whether to generate a JMS
17
	 * JMS interface. The default is false.
18
	 * interface. The default is false.
18
	 */
19
	 */
19
	public static final String JMS = "INewMessageDrivenBeanClassDataModelProperties.JMS"; //$NON-NLS-1$
20
	public static final String JMS = "INewMessageDrivenBeanClassDataModelProperties.JMS"; //$NON-NLS-1$
20
	
21
21
	/**
22
	/**
22
	 * Required, <code>DestinationType</code> enumeration property that
23
	 * Required, <code>DestinationType</code> enumeration property that
23
	 * determines the destination type of the message-driven bean. The default
24
	 * determines the destination type of the message-driven bean. The default
Lines 26-30 Link Here
26
	 * @see DestinationType
27
	 * @see DestinationType
27
	 */
28
	 */
28
	public static final String DESTINATION_TYPE = "INewMessageDrivenBeanClassDataModelProperties.DESTINATION_TYPE"; //$NON-NLS-1$
29
	public static final String DESTINATION_TYPE = "INewMessageDrivenBeanClassDataModelProperties.DESTINATION_TYPE"; //$NON-NLS-1$
29
	
30
31
	/**
32
	 * Required, String property used to specify the fully qualified name of the
33
	 * message listener interface of the message-driven bean.
34
	 * 
35
	 * <p>
36
	 * There is no default value. If the JMS property is set to
37
	 * <code>true</code>, then this property is automatically set to
38
	 * <code>javax.jms.MessageListener</code>. 
39
	 * </p>
40
	 */
41
	public static final String MESSAGE_LISTENER_INTERFACE = "INewMessageDrivenBeanClassDataModelProperties.MESSAGE_LISTENER_INTERFACE"; //$NON-NLS-1$
42
30
}
43
}
(-)property_files/ejbcreation.properties (+1 lines)
Lines 135-140 Link Here
135
DESTINATION_TYPE_QUEUE=Queue
135
DESTINATION_TYPE_QUEUE=Queue
136
DESTINATION_TYPE_TOPIC=Topic
136
DESTINATION_TYPE_TOPIC=Topic
137
137
138
ERR_NO_MESSAGE_LISTENER_INTERFACE=You must specify a message listener interface. 
138
ERR_COULD_NOT_RESOLVE_INTERFACE = Could not resolve interface.
139
ERR_COULD_NOT_RESOLVE_INTERFACE = Could not resolve interface.
139
ERR_LOCAL_HOME_MISSING_CREATE_METHOD=The specified Local Home interface has not valid create() method.
140
ERR_LOCAL_HOME_MISSING_CREATE_METHOD=The specified Local Home interface has not valid create() method.
140
ERR_REMOTE_HOME_MISSING_CREATE_METHOD=The specified Remote Home interface has not valid create() method.
141
ERR_REMOTE_HOME_MISSING_CREATE_METHOD=The specified Remote Home interface has not valid create() method.
(-)ejbcreation/org/eclipse/jst/j2ee/internal/ejb/project/operations/EJBCreationResourceHandler.java (+1 lines)
Lines 160-165 Link Here
160
	public static String ERR_LOCAL_HOME_NOT_INTERFACE;
160
	public static String ERR_LOCAL_HOME_NOT_INTERFACE;
161
	public static String ERR_REMOTE_COMPONENT_NOT_INTERFACE;
161
	public static String ERR_REMOTE_COMPONENT_NOT_INTERFACE;
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
164
164
165
165
	static {
166
	static {
(-)ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/NewMessageDrivenBeanClassWizardPage.java (+9 lines)
Lines 90-95 Link Here
90
	}
90
	}
91
	
91
	
92
	@Override
92
	@Override
93
	protected String[] getValidationPropertyNames() {
94
		String[] base = super.getValidationPropertyNames();
95
		String[] result = new String[base.length + 1];
96
		System.arraycopy(base, 0, result, 0, base.length);
97
		result[base.length] = JMS;
98
		return result;
99
	}
100
	
101
	@Override
93
	protected void updateControls() {
102
	protected void updateControls() {
94
		super.updateControls();
103
		super.updateControls();
95
		destinationTypeCombo.setEnabled(jmsCheckbox.getSelection());
104
		destinationTypeCombo.setEnabled(jmsCheckbox.getSelection());
(-)ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/AddMessageDrivenBeanWizardPage.java (-9 / +124 lines)
Lines 12-58 Link Here
12
12
13
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewEnterpriseBeanClassDataModelProperties.EJB_NAME;
13
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewEnterpriseBeanClassDataModelProperties.EJB_NAME;
14
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewEnterpriseBeanClassDataModelProperties.TRANSACTION_TYPE;
14
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewEnterpriseBeanClassDataModelProperties.TRANSACTION_TYPE;
15
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.MESSAGE_LISTENER_INTERFACE;
15
16
17
import org.eclipse.core.resources.IProject;
18
import org.eclipse.jdt.core.IJavaProject;
19
import org.eclipse.jdt.core.IType;
20
import org.eclipse.jdt.core.search.IJavaSearchConstants;
21
import org.eclipse.jdt.core.search.IJavaSearchScope;
22
import org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog;
23
import org.eclipse.jem.workbench.utility.JemProjectUtilities;
24
import org.eclipse.jface.operation.IRunnableContext;
25
import org.eclipse.jface.window.Window;
16
import org.eclipse.jst.ejb.ui.internal.util.EJBUIMessages;
26
import org.eclipse.jst.ejb.ui.internal.util.EJBUIMessages;
27
import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties;
28
import org.eclipse.jst.j2ee.internal.dialogs.TypeSearchEngine;
29
import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
30
import org.eclipse.osgi.util.NLS;
17
import org.eclipse.swt.SWT;
31
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.layout.GridData;
32
import org.eclipse.swt.layout.GridData;
19
import org.eclipse.swt.layout.GridLayout;
33
import org.eclipse.swt.layout.GridLayout;
20
import org.eclipse.swt.widgets.Combo;
34
import org.eclipse.swt.widgets.Combo;
21
import org.eclipse.swt.widgets.Composite;
35
import org.eclipse.swt.widgets.Composite;
36
import org.eclipse.swt.widgets.Control;
37
import org.eclipse.swt.widgets.Display;
22
import org.eclipse.swt.widgets.Label;
38
import org.eclipse.swt.widgets.Label;
23
import org.eclipse.swt.widgets.Text;
39
import org.eclipse.swt.widgets.Text;
40
import org.eclipse.ui.PlatformUI;
41
import org.eclipse.ui.forms.HyperlinkGroup;
42
import org.eclipse.ui.forms.events.HyperlinkAdapter;
43
import org.eclipse.ui.forms.events.HyperlinkEvent;
44
import org.eclipse.ui.forms.widgets.Hyperlink;
24
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
45
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
25
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
46
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
47
import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper;
26
48
27
public class AddMessageDrivenBeanWizardPage extends
49
public class AddMessageDrivenBeanWizardPage extends
28
		AddEnterpriseBeanWizardPage {
50
		AddEnterpriseBeanWizardPage {
29
51
52
	private class HyperlinkDataModelSynchHelper extends DataModelSynchHelper {
53
54
		public HyperlinkDataModelSynchHelper(IDataModel model) {
55
			super(model);
56
		}
57
		
58
		public void synchHyperlink(Hyperlink hyperlink, String propertyName, Control[] dependentControls) {
59
			synchComposite(hyperlink, propertyName, dependentControls);
60
		}
61
		
62
		@Override
63
		public void synchUIWithModel(final String propertyName, final int flag) {
64
			if (MESSAGE_LISTENER_INTERFACE.equals(propertyName)) {
65
				if(Thread.currentThread() == Display.getDefault().getThread()) {
66
					setHyperlinkText();
67
				} else {
68
					Display.getDefault().asyncExec(new Runnable() {
69
						public void run() {
70
							setHyperlinkText();
71
						}
72
					});
73
				}
74
			}
75
			
76
			super.synchUIWithModel(propertyName, flag);
77
		}
78
		
79
		public void setHyperlinkText() {
80
			if (null != messageListenerInterfaceHyperlink) {
81
				String value = getDataModel().getStringProperty(MESSAGE_LISTENER_INTERFACE);
82
				if (value == null || value.trim().length() == 0) {
83
					value = IEjbWizardConstants.CLICK_TO_SELECT;
84
				}
85
				messageListenerInterfaceHyperlink.setText(NLS.bind(
86
						IEjbWizardConstants.MESSAGE_LISTENER_INTERFACE_HYPERLINK,
87
						value));
88
			}
89
		}
90
		
91
	}
92
30
	private Text ejbNameText;
93
	private Text ejbNameText;
31
	private Combo transactionTypeCombo;
94
	private Combo transactionTypeCombo;
32
95
96
	private Hyperlink messageListenerInterfaceHyperlink;
97
33
	public AddMessageDrivenBeanWizardPage(IDataModel model, String pageName) {
98
	public AddMessageDrivenBeanWizardPage(IDataModel model, String pageName) {
34
		super(model, pageName,
99
		super(model, pageName,
35
				IEjbWizardConstants.ADD_MESSAGE_DRIVEN_BEAN_WIZARD_PAGE_DESC,
100
				IEjbWizardConstants.ADD_MESSAGE_DRIVEN_BEAN_WIZARD_PAGE_DESC,
36
				IEjbWizardConstants.ADD_MESSAGE_DRIVEN_BEANS_WIZARD_PAGE_TITLE);
101
				IEjbWizardConstants.ADD_MESSAGE_DRIVEN_BEANS_WIZARD_PAGE_TITLE);
37
	}
102
	}
103
	
104
	@Override
105
	public DataModelSynchHelper initializeSynchHelper(IDataModel dm) {
106
		return new HyperlinkDataModelSynchHelper(dm);
107
	}
38
108
39
	protected Composite createTopLevelComposite(Composite parent) {
109
	protected Composite createTopLevelComposite(Composite parent) {
40
41
		Composite composite = new Composite(parent, SWT.NULL);
110
		Composite composite = new Composite(parent, SWT.NULL);
42
		composite.setLayout(new GridLayout(3, false));
111
		composite.setLayout(new GridLayout(2, false));
112
		GridData data = new GridData(GridData.FILL_BOTH);
113
		data.widthHint = 300;
114
		composite.setLayoutData(data);
115
		
116
		createBeanNameTransactionType(composite);
117
		addSeperator(composite, 2);
118
		createInterfaceControls(composite);
119
		createMessageListenerInterfaceControl(composite);
120
		addSeperator(composite, 2);
121
		createStubsComposite(composite);
43
122
123
		return composite;
124
	}
125
	
126
	private void createBeanNameTransactionType(Composite composite) {
127
		// bean name
44
		Label ejbNameLabel = new Label(composite, SWT.LEFT);
128
		Label ejbNameLabel = new Label(composite, SWT.LEFT);
45
		ejbNameLabel.setText(IEjbWizardConstants.EJB_NAME);
129
		ejbNameLabel.setText(IEjbWizardConstants.EJB_NAME);
46
130
47
		GridData data = new GridData ();
131
		GridData data = new GridData();
48
		data.horizontalAlignment = GridData.FILL;
132
		data.horizontalAlignment = GridData.FILL;
49
		data.horizontalSpan = 2;
50
		data.grabExcessHorizontalSpace = true;
133
		data.grabExcessHorizontalSpace = true;
51
134
52
		ejbNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
135
		ejbNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
53
		ejbNameText.setLayoutData(data);
136
		ejbNameText.setLayoutData(data);
54
		synchHelper.synchText(ejbNameText, EJB_NAME, null);
137
		synchHelper.synchText(ejbNameText, EJB_NAME, null);
55
138
139
		// transaction type
56
		Label transactionTypeLabel = new Label(composite, SWT.LEFT);
140
		Label transactionTypeLabel = new Label(composite, SWT.LEFT);
57
		transactionTypeLabel.setText(EJBUIMessages.TRANSACTION_TYPE);
141
		transactionTypeLabel.setText(EJBUIMessages.TRANSACTION_TYPE);
58
		transactionTypeCombo = new Combo(composite, SWT.None | SWT.READ_ONLY);
142
		transactionTypeCombo = new Combo(composite, SWT.None | SWT.READ_ONLY);
Lines 63-76 Link Here
63
		}
147
		}
64
		transactionTypeCombo.select(0);
148
		transactionTypeCombo.select(0);
65
		synchHelper.synchCombo(transactionTypeCombo, TRANSACTION_TYPE, null);
149
		synchHelper.synchCombo(transactionTypeCombo, TRANSACTION_TYPE, null);
150
	}
66
151
67
		addSeperator(composite, 3);
152
	private void createMessageListenerInterfaceControl(Composite composite) {
68
153
		GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
69
		createInterfaceControls(composite);
154
		data.horizontalSpan = 2;
155
		messageListenerInterfaceHyperlink = new Hyperlink(composite, SWT.NULL);
156
		messageListenerInterfaceHyperlink.setLayoutData(data);
157
		String messageListenerInterface = getDataModel().getStringProperty(MESSAGE_LISTENER_INTERFACE);
158
		messageListenerInterfaceHyperlink.setToolTipText(IEjbWizardConstants.MESSAGE_LISTENER_INTERFACE_HYPERLINK_TOOLTIP);
159
		messageListenerInterfaceHyperlink.setVisible(true);
160
		messageListenerInterfaceHyperlink.setUnderlined(true);
161
		messageListenerInterfaceHyperlink.addHyperlinkListener(new HyperlinkAdapter() {
162
			public void linkActivated(HyperlinkEvent e){
163
				IProject project = (IProject) model.getProperty(INewJavaClassDataModelProperties.PROJECT);
164
				IRunnableContext context = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
165
				IJavaProject javaProject = JemProjectUtilities.getJavaProject(project);
166
				// this eliminates the non-exported classpath entries
167
				final IJavaSearchScope scope = TypeSearchEngine.createJavaSearchScopeForAProject(javaProject, true, true);
168
				FilteredTypesSelectionDialog dialog = new FilteredTypesSelectionDialog(getShell(), false, context, scope, IJavaSearchConstants.INTERFACE);
169
				dialog.setTitle(J2EEUIMessages.INTERFACE_SELECTION_DIALOG_TITLE);
170
				if (dialog.open() == Window.OK) {
171
					IType type = (IType) dialog.getFirstResult();
172
					String fullyQualifiedName = type.getFullyQualifiedName();
173
					getDataModel().setProperty(MESSAGE_LISTENER_INTERFACE, fullyQualifiedName);
174
				}
175
			}
176
		});
177
		new HyperlinkGroup(Display.getCurrent()).add(messageListenerInterfaceHyperlink);
178
		((HyperlinkDataModelSynchHelper) synchHelper).synchHyperlink(messageListenerInterfaceHyperlink, MESSAGE_LISTENER_INTERFACE, null);
179
	}
70
180
71
		createStubsComposite(composite);
181
	@Override
182
	protected boolean showValidationErrorsOnEnter() {
183
		return true;
184
	}
72
185
73
		return composite;
186
	@Override
187
	protected String[] getValidationPropertyNames() {
188
		return new String[] { MESSAGE_LISTENER_INTERFACE };
74
	}
189
	}
75
190
76
}
191
}
(-)ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/IEjbWizardConstants.java (+4 lines)
Lines 43-46 Link Here
43
	public static final String JMS = EJBUIMessages.JMS;
43
	public static final String JMS = EJBUIMessages.JMS;
44
	public static final String DESTINATION_NAME_LABEL = EJBUIMessages.DESTINATION_NAME_LABEL;
44
	public static final String DESTINATION_NAME_LABEL = EJBUIMessages.DESTINATION_NAME_LABEL;
45
	public static final String ADD_MESSAGE_DRIVEN_BEAN_WIZARD_PAGE_DESC = EJBUIMessages.ADD_MESSAGE_DRIVEN_BEAN_WIZARD_PAGE_DESC;
45
	public static final String ADD_MESSAGE_DRIVEN_BEAN_WIZARD_PAGE_DESC = EJBUIMessages.ADD_MESSAGE_DRIVEN_BEAN_WIZARD_PAGE_DESC;
46
	public static final String MESSAGE_LISTENER_INTERFACE_HYPERLINK = EJBUIMessages.MESSAGE_LISTENER_INTERFACE_HYPERLINK;
47
	public static final String MESSAGE_LISTENER_INTERFACE_HYPERLINK_TOOLTIP = EJBUIMessages.MESSAGE_LISTENER_INTERFACE_HYPERLINK_TOOLTIP;
48
	public static final String CLICK_TO_SELECT = EJBUIMessages.CLICK_TO_SELECT;
49
	
46
}
50
}
(-)property_files/ejb_ui.properties (-1 / +4 lines)
Lines 77-80 Link Here
77
DESTINATION_TYPE_QUEUE=Queue
77
DESTINATION_TYPE_QUEUE=Queue
78
DESTINATION_TYPE_TOPIC=Topic
78
DESTINATION_TYPE_TOPIC=Topic
79
JMS=JMS
79
JMS=JMS
80
DESTINATION_NAME_LABEL=Destination name:
80
DESTINATION_NAME_LABEL=Destination name:
81
MESSAGE_LISTENER_INTERFACE_HYPERLINK=Message listener interface: {0}
82
MESSAGE_LISTENER_INTERFACE_HYPERLINK_TOOLTIP=Set message listener interface
83
CLICK_TO_SELECT=<click to select>
(-)ejb_ui/org/eclipse/jst/ejb/ui/internal/util/EJBUIMessages.java (+3 lines)
Lines 93-98 Link Here
93
	public static String JMS;
93
	public static String JMS;
94
	public static String DESTINATION_NAME_LABEL;
94
	public static String DESTINATION_NAME_LABEL;
95
	public static String ADD_MESSAGE_DRIVEN_BEAN_WIZARD_PAGE_DESC;
95
	public static String ADD_MESSAGE_DRIVEN_BEAN_WIZARD_PAGE_DESC;
96
	public static String MESSAGE_LISTENER_INTERFACE_HYPERLINK;
97
	public static String MESSAGE_LISTENER_INTERFACE_HYPERLINK_TOOLTIP;
98
	public static String CLICK_TO_SELECT;
96
	
99
	
97
100
98
	static {
101
	static {

Return to bug 231926