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

Collapse All | Expand All

(-)plugin.properties (+23 lines)
Lines 128-133 Link Here
128
128
129
_UI_Package_ElementsPublicOrPrivate_diagnostic = Element ''{0}'', owned by package ''{1}'', has visibility that is neither public nor private.
129
_UI_Package_ElementsPublicOrPrivate_diagnostic = Element ''{0}'', owned by package ''{1}'', has visibility that is neither public nor private.
130
130
131
131
_UI_Property_SubsettingContextConforms_diagnostic = The context of the subsetting property ''{0}'' does not conform to the context of subsetted property ''{1}''.
132
_UI_Property_SubsettingContextConforms_diagnostic = The context of the subsetting property ''{0}'' does not conform to the context of subsetted property ''{1}''.
132
_UI_Property_NavigableReadOnly_diagnostic = Non-navigable property ''{0}'' is marked as read-only.
133
_UI_Property_NavigableReadOnly_diagnostic = Non-navigable property ''{0}'' is marked as read-only.
133
_UI_Property_DerivedUnionIsDerived_diagnostic = Derived union ''{0}'' is not derived.
134
_UI_Property_DerivedUnionIsDerived_diagnostic = Derived union ''{0}'' is not derived.
Lines 140-146 Link Here
140
_UI_RedefinableElement_RedefinitionConsistent_diagnostic = Redefining element ''{0}'' is not consistent with redefined element ''{1}''.
141
_UI_RedefinableElement_RedefinitionConsistent_diagnostic = Redefining element ''{0}'' is not consistent with redefined element ''{1}''.
141
_UI_RedefinableElement_RedefinitionContextValid_diagnostic = None of the redefinition contexts of redefining element ''{0}'' is a specialization of at least one of the redefinition contexts for redefined element ''{1}''.
142
_UI_RedefinableElement_RedefinitionContextValid_diagnostic = None of the redefinition contexts of redefining element ''{0}'' is a specialization of at least one of the redefinition contexts for redefined element ''{1}''.
142
143
144
_UI_Interface_Visibility_diagnostic = The interface ''{0}''has at least one feature which is not public.
145
		
143
_UI_UseCase_MustHaveName_diagnostic = Use case ''{0}'' must have a name.
146
_UI_UseCase_MustHaveName_diagnostic = Use case ''{0}'' must have a name.
144
_UI_UseCase_BinaryAssociations_diagnostic = Use case ''{0}'' can only be involved in binary associations.
147
_UI_UseCase_BinaryAssociations_diagnostic = Use case ''{0}'' can only be involved in binary associations.
145
_UI_UseCase_NoAssociationToUseCase_diagnostic = Use case ''{0}'' is involved in an association with another use case ''{1}'' having the same subject.
148
_UI_UseCase_NoAssociationToUseCase_diagnostic = Use case ''{0}'' is involved in an association with another use case ''{1}'' having the same subject.
146
_UI_UseCase_CannotIncludeSelf_diagnostic = Use case ''{0}'' cannot include itself.
149
_UI_UseCase_CannotIncludeSelf_diagnostic = Use case ''{0}'' cannot include itself.
150
151
  
152
_UI_Behavior_ParametersMatch_diagnostic = One or more parameters of the behavior ''{0}'' do not match.
153
_UI_Behavior_FeatureOfContextClassifier_diagnostic = The behavioral feature ''{0}'' must be a feature of the context classifier of the behavior.
154
 
155
_UI_Port_PortAggregation_diagnostic = Port ''{0}'' must have composite aggregation kind.
156
_UI_Port_DefaultValue_diagnostic = Port ''{0}'' must not have a default value if it is typed by an interface.
157
158
_UI_Profile_MetaclassReferenceNotSpecialized_diagnostic = An element imported as a metaclass reference is not specialized or generalized in profile ''{0}''.
159
_UI_Profile_ReferencesSameMetamodel_diagnostic =  All elements imported either as metaclass references or through metamodel references owned by profile ''{0}'' must be members of the same base reference metamodel.
160
	
161
_UI_CombinedFragment_OptLoopBreakNeg_diagnostic =  The combined fragment ''{0}'' has an interactionOperator of either opt, loop, break, or neg but does not have exactly one operand.
162
_UI_ExecutionSpecification_SameLifeline_diagnostic = Execution specification ''{0}'' must have start event and finish event on the same lifeline.
163
164
165
_UI_Message_SignatureIsOperation_diagnostic =  The message signature of message ''{0}'' is an Operation but the arguments of the Message do not correspond to the parameters of the Operation. 
166
	
167
_UI_Message_SignatureIsSignal_diagnostic = The message signature of message ''{0}'' is a Signature but the arguments of the Message do not correspond to the attributes of the Signal. 
168
169
 
(-)src/org/eclipse/uml2/uml/internal/operations/MessageOperations.java (-39 / +99 lines)
Lines 12-39 Link Here
12
 */
12
 */
13
package org.eclipse.uml2.uml.internal.operations;
13
package org.eclipse.uml2.uml.internal.operations;
14
14
15
import java.util.ArrayList;
16
import java.util.Collections;
17
import java.util.Iterator;
18
import java.util.List;
19
import java.util.ListIterator;
15
import java.util.Map;
20
import java.util.Map;
16
21
17
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
18
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
19
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
20
21
import org.eclipse.uml2.uml.Message;
22
23
import org.eclipse.uml2.uml.CallEvent;
25
import org.eclipse.uml2.uml.CallEvent;
24
import org.eclipse.uml2.uml.Event;
26
import org.eclipse.uml2.uml.Event;
27
import org.eclipse.uml2.uml.Message;
25
import org.eclipse.uml2.uml.MessageEnd;
28
import org.eclipse.uml2.uml.MessageEnd;
26
import org.eclipse.uml2.uml.MessageEvent;
29
import org.eclipse.uml2.uml.MessageEvent;
27
import org.eclipse.uml2.uml.MessageKind;
30
import org.eclipse.uml2.uml.MessageKind;
28
import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
31
import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
32
import org.eclipse.uml2.uml.MessageSort;
29
import org.eclipse.uml2.uml.NamedElement;
33
import org.eclipse.uml2.uml.NamedElement;
34
import org.eclipse.uml2.uml.Operation;
35
import org.eclipse.uml2.uml.Parameter;
36
import org.eclipse.uml2.uml.ParameterDirectionKind;
30
import org.eclipse.uml2.uml.ReceiveOperationEvent;
37
import org.eclipse.uml2.uml.ReceiveOperationEvent;
31
import org.eclipse.uml2.uml.ReceiveSignalEvent;
38
import org.eclipse.uml2.uml.ReceiveSignalEvent;
32
import org.eclipse.uml2.uml.SendOperationEvent;
39
import org.eclipse.uml2.uml.SendOperationEvent;
33
import org.eclipse.uml2.uml.SendSignalEvent;
40
import org.eclipse.uml2.uml.SendSignalEvent;
41
import org.eclipse.uml2.uml.Signal;
34
import org.eclipse.uml2.uml.SignalEvent;
42
import org.eclipse.uml2.uml.SignalEvent;
43
import org.eclipse.uml2.uml.Type;
44
import org.eclipse.uml2.uml.TypedElement;
35
import org.eclipse.uml2.uml.UMLPackage;
45
import org.eclipse.uml2.uml.UMLPackage;
36
46
import org.eclipse.uml2.uml.UMLPlugin;
37
import org.eclipse.uml2.uml.util.UMLSwitch;
47
import org.eclipse.uml2.uml.util.UMLSwitch;
38
import org.eclipse.uml2.uml.util.UMLValidator;
48
import org.eclipse.uml2.uml.util.UMLValidator;
39
49
Lines 142-172 Link Here
142
	 * In the case when the Message signature is an Operation, the arguments of the Message must correspond to the parameters of the Operation. A Parameter corresponds to an Argument if the Argument is of the same Class or a specialization of that of the Parameter.
152
	 * In the case when the Message signature is an Operation, the arguments of the Message must correspond to the parameters of the Operation. A Parameter corresponds to an Argument if the Argument is of the same Class or a specialization of that of the Parameter.
143
	 * true
153
	 * true
144
	 * <!-- end-model-doc -->
154
	 * <!-- end-model-doc -->
145
	 * @generated
155
	 * @generated NOT
146
	 */
156
	 */
147
	public static boolean validateSignatureIsOperation(Message message,
157
	public static boolean validateSignatureIsOperation(Message message,
148
			DiagnosticChain diagnostics, Map context) {
158
			DiagnosticChain diagnostics, Map context) {
149
		// TODO: implement this method
159
		boolean result = true;
150
		// -> specify the condition that violates the invariant
160
		NamedElement signature = message.getSignature();
151
		// -> verify the details of the diagnostic, including severity and message
161
		if (signature instanceof Operation) {
152
		// Ensure that you remove @generated or mark it @generated NOT
162
			if (!message.getArguments().isEmpty()) {
153
		if (false) {
163
				List args = message.getArguments();
164
				List params = Collections.EMPTY_LIST;
165
				if (message != null
166
					&& message.getMessageSort() == MessageSort.REPLY_LITERAL) {
167
					params = new ArrayList(((Operation) signature)
168
						.getOwnedParameters());
169
					for (ListIterator it = params.listIterator(); it.hasNext();) {
170
						Parameter param = (Parameter) it.next();
171
						if (param.getDirection() == ParameterDirectionKind.IN_LITERAL) {
172
							it.remove();
173
						}
174
					}
175
				} else {
176
					params = ((Operation) signature).getOwnedParameters();
177
				}
178
				if (args.size() != params.size()) {
179
					result = false;
180
				}
181
				for (Iterator arg = args.iterator(), typed = params.iterator(); arg
182
					.hasNext() && result;) {
183
					TypedElement nextArg = (TypedElement) arg.next();
184
					TypedElement nextTyped = (TypedElement) typed.next();
185
					Type nextArgType = nextArg.getType();
186
					Type nextTypedType = nextTyped.getType();
187
					if (nextArgType != null && nextTypedType != null) {
188
						if (!nextArgType.conformsTo(nextTypedType)) {
189
							result = false;
190
						}
191
					}
192
				}
193
			}
194
		}
195
		if (!result) {
154
			if (diagnostics != null) {
196
			if (diagnostics != null) {
155
				diagnostics
197
				diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
156
					.add(new BasicDiagnostic(
198
					UMLValidator.DIAGNOSTIC_SOURCE,
157
						Diagnostic.ERROR,
199
					UMLValidator.MESSAGE__SIGNATURE_IS_OPERATION,
158
						UMLValidator.DIAGNOSTIC_SOURCE,
200
					UMLPlugin.INSTANCE.getString(
159
						UMLValidator.MESSAGE__SIGNATURE_IS_OPERATION,
201
						"_UI_Message_SignatureIsOperation_diagnostic", //$NON-NLS-1$
160
						org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE
202
						getMessageSubstitutions(context, message)),
161
							.getString(
203
					new Object[]{message}));
162
								"_UI_GenericInvariant_diagnostic", new Object[]{"validateSignatureIsOperation", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(message, context)}), //$NON-NLS-1$ //$NON-NLS-2$
163
						new Object[]{message}));
164
			}
204
			}
165
			return false;
166
		}
205
		}
167
		return true;
206
		return result;
168
	}
207
	}
169
208
	
209
	
210
	
211
	
212
	
170
	/**
213
	/**
171
	 * <!-- begin-user-doc -->
214
	 * <!-- begin-user-doc -->
172
	 * <!-- end-user-doc -->
215
	 * <!-- end-user-doc -->
Lines 174-202 Link Here
174
	 * In the case when the Message signature is a Signal, the arguments of the Message must correspond to the attributes of the Signal. A Message Argument corresponds to a Signal Attribute if the Arguement is of the same Class or a specialization of that of the Attribute.
217
	 * In the case when the Message signature is a Signal, the arguments of the Message must correspond to the attributes of the Signal. A Message Argument corresponds to a Signal Attribute if the Arguement is of the same Class or a specialization of that of the Attribute.
175
	 * true
218
	 * true
176
	 * <!-- end-model-doc -->
219
	 * <!-- end-model-doc -->
177
	 * @generated
220
	 * @generated NOT
178
	 */
221
	 */
179
	public static boolean validateSignatureIsSignal(Message message,
222
	public static boolean validateSignatureIsSignal(Message message,
180
			DiagnosticChain diagnostics, Map context) {
223
			DiagnosticChain diagnostics, Map context) {
181
		// TODO: implement this method
224
182
		// -> specify the condition that violates the invariant
225
		boolean result = true;
183
		// -> verify the details of the diagnostic, including severity and message
226
		NamedElement signature = message.getSignature();
184
		// Ensure that you remove @generated or mark it @generated NOT
227
		if (signature instanceof Signal) {
185
		if (false) {
228
			if (!message.getArguments().isEmpty()) {
229
				List messageArguments = message.getArguments();
230
				List signalAttributes = ((Signal) signature).getAttributes();
231
				if (messageArguments.size() != signalAttributes.size()) {
232
					result = false;
233
				}
234
				for (Iterator arg = messageArguments.iterator(), typed = signalAttributes
235
					.iterator(); arg.hasNext() && result;) {
236
					TypedElement nextArg = (TypedElement) arg.next();
237
					TypedElement nextTyped = (TypedElement) typed.next();
238
					Type nextArgType = nextArg.getType();
239
					Type nextTypedType = nextTyped.getType();
240
					if (nextArgType != null && nextTypedType != null) {
241
						if (!nextArgType.conformsTo(nextTypedType)) {
242
							result = false;
243
						}
244
					}
245
				}
246
			}
247
		}
248
		if (!result) {
186
			if (diagnostics != null) {
249
			if (diagnostics != null) {
187
				diagnostics
250
				diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
188
					.add(new BasicDiagnostic(
251
					UMLValidator.DIAGNOSTIC_SOURCE,
189
						Diagnostic.ERROR,
252
					UMLValidator.MESSAGE__SIGNATURE_IS_SIGNAL,
190
						UMLValidator.DIAGNOSTIC_SOURCE,
253
					UMLPlugin.INSTANCE.getString(
191
						UMLValidator.MESSAGE__SIGNATURE_IS_SIGNAL,
254
						"_UI_Message_SignatureIsSignal_diagnostic", //$NON-NLS-1$
192
						org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE
255
						getMessageSubstitutions(context, message)),
193
							.getString(
256
					new Object[]{message}));
194
								"_UI_GenericInvariant_diagnostic", new Object[]{"validateSignatureIsSignal", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(message, context)}), //$NON-NLS-1$ //$NON-NLS-2$
195
						new Object[]{message}));
196
			}
257
			}
197
			return false;
198
		}
258
		}
199
		return true;
259
		return result;
200
	}
260
	}
201
261
202
	/**
262
	/**

Return to bug 80307