Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 37419 Details for
Bug 80307
Validation Rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
MessageOperations
validationPatch_060331.txt (text/plain), 11.00 KB, created by
James Bruck
on 2006-03-31 10:35:45 EST
(
hide
)
Description:
MessageOperations
Filename:
MIME Type:
Creator:
James Bruck
Created:
2006-03-31 10:35:45 EST
Size:
11.00 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.uml2.uml >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/plugin.properties,v >retrieving revision 1.5 >diff -u -r1.5 plugin.properties >--- plugin.properties 28 Mar 2006 18:26:14 -0000 1.5 >+++ plugin.properties 31 Mar 2006 15:34:54 -0000 >@@ -128,6 +128,7 @@ > > _UI_Package_ElementsPublicOrPrivate_diagnostic = Element ''{0}'', owned by package ''{1}'', has visibility that is neither public nor private. > >+ > _UI_Property_SubsettingContextConforms_diagnostic = The context of the subsetting property ''{0}'' does not conform to the context of subsetted property ''{1}''. > _UI_Property_NavigableReadOnly_diagnostic = Non-navigable property ''{0}'' is marked as read-only. > _UI_Property_DerivedUnionIsDerived_diagnostic = Derived union ''{0}'' is not derived. >@@ -140,7 +141,29 @@ > _UI_RedefinableElement_RedefinitionConsistent_diagnostic = Redefining element ''{0}'' is not consistent with redefined element ''{1}''. > _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}''. > >+_UI_Interface_Visibility_diagnostic = The interface ''{0}''has at least one feature which is not public. >+ > _UI_UseCase_MustHaveName_diagnostic = Use case ''{0}'' must have a name. > _UI_UseCase_BinaryAssociations_diagnostic = Use case ''{0}'' can only be involved in binary associations. > _UI_UseCase_NoAssociationToUseCase_diagnostic = Use case ''{0}'' is involved in an association with another use case ''{1}'' having the same subject. > _UI_UseCase_CannotIncludeSelf_diagnostic = Use case ''{0}'' cannot include itself. >+ >+ >+_UI_Behavior_ParametersMatch_diagnostic = One or more parameters of the behavior ''{0}'' do not match. >+_UI_Behavior_FeatureOfContextClassifier_diagnostic = The behavioral feature ''{0}'' must be a feature of the context classifier of the behavior. >+ >+_UI_Port_PortAggregation_diagnostic = Port ''{0}'' must have composite aggregation kind. >+_UI_Port_DefaultValue_diagnostic = Port ''{0}'' must not have a default value if it is typed by an interface. >+ >+_UI_Profile_MetaclassReferenceNotSpecialized_diagnostic = An element imported as a metaclass reference is not specialized or generalized in profile ''{0}''. >+_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. >+ >+_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. >+_UI_ExecutionSpecification_SameLifeline_diagnostic = Execution specification ''{0}'' must have start event and finish event on the same lifeline. >+ >+ >+_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. >+ >+_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. >+ >+ >\ No newline at end of file >Index: src/org/eclipse/uml2/uml/internal/operations/MessageOperations.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/MessageOperations.java,v >retrieving revision 1.8 >diff -u -r1.8 MessageOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/MessageOperations.java 31 Jan 2006 23:00:04 -0000 1.8 >+++ src/org/eclipse/uml2/uml/internal/operations/MessageOperations.java 31 Mar 2006 15:34:55 -0000 >@@ -12,28 +12,38 @@ > */ > package org.eclipse.uml2.uml.internal.operations; > >+import java.util.ArrayList; >+import java.util.Collections; >+import java.util.Iterator; >+import java.util.List; >+import java.util.ListIterator; > import java.util.Map; > > import org.eclipse.emf.common.util.BasicDiagnostic; > import org.eclipse.emf.common.util.Diagnostic; > import org.eclipse.emf.common.util.DiagnosticChain; >- >-import org.eclipse.uml2.uml.Message; >- > import org.eclipse.uml2.uml.CallEvent; > import org.eclipse.uml2.uml.Event; >+import org.eclipse.uml2.uml.Message; > import org.eclipse.uml2.uml.MessageEnd; > import org.eclipse.uml2.uml.MessageEvent; > import org.eclipse.uml2.uml.MessageKind; > import org.eclipse.uml2.uml.MessageOccurrenceSpecification; >+import org.eclipse.uml2.uml.MessageSort; > import org.eclipse.uml2.uml.NamedElement; >+import org.eclipse.uml2.uml.Operation; >+import org.eclipse.uml2.uml.Parameter; >+import org.eclipse.uml2.uml.ParameterDirectionKind; > import org.eclipse.uml2.uml.ReceiveOperationEvent; > import org.eclipse.uml2.uml.ReceiveSignalEvent; > import org.eclipse.uml2.uml.SendOperationEvent; > import org.eclipse.uml2.uml.SendSignalEvent; >+import org.eclipse.uml2.uml.Signal; > import org.eclipse.uml2.uml.SignalEvent; >+import org.eclipse.uml2.uml.Type; >+import org.eclipse.uml2.uml.TypedElement; > import org.eclipse.uml2.uml.UMLPackage; >- >+import org.eclipse.uml2.uml.UMLPlugin; > import org.eclipse.uml2.uml.util.UMLSwitch; > import org.eclipse.uml2.uml.util.UMLValidator; > >@@ -142,31 +152,64 @@ > * 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. > * true > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateSignatureIsOperation(Message message, > DiagnosticChain diagnostics, Map context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ boolean result = true; >+ NamedElement signature = message.getSignature(); >+ if (signature instanceof Operation) { >+ if (!message.getArguments().isEmpty()) { >+ List args = message.getArguments(); >+ List params = Collections.EMPTY_LIST; >+ if (message != null >+ && message.getMessageSort() == MessageSort.REPLY_LITERAL) { >+ params = new ArrayList(((Operation) signature) >+ .getOwnedParameters()); >+ for (ListIterator it = params.listIterator(); it.hasNext();) { >+ Parameter param = (Parameter) it.next(); >+ if (param.getDirection() == ParameterDirectionKind.IN_LITERAL) { >+ it.remove(); >+ } >+ } >+ } else { >+ params = ((Operation) signature).getOwnedParameters(); >+ } >+ if (args.size() != params.size()) { >+ result = false; >+ } >+ for (Iterator arg = args.iterator(), typed = params.iterator(); arg >+ .hasNext() && result;) { >+ TypedElement nextArg = (TypedElement) arg.next(); >+ TypedElement nextTyped = (TypedElement) typed.next(); >+ Type nextArgType = nextArg.getType(); >+ Type nextTypedType = nextTyped.getType(); >+ if (nextArgType != null && nextTypedType != null) { >+ if (!nextArgType.conformsTo(nextTypedType)) { >+ result = false; >+ } >+ } >+ } >+ } >+ } >+ if (!result) { > if (diagnostics != null) { >- diagnostics >- .add(new BasicDiagnostic( >- Diagnostic.ERROR, >- UMLValidator.DIAGNOSTIC_SOURCE, >- UMLValidator.MESSAGE__SIGNATURE_IS_OPERATION, >- org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE >- .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateSignatureIsOperation", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(message, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >- new Object[]{message})); >+ diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING, >+ UMLValidator.DIAGNOSTIC_SOURCE, >+ UMLValidator.MESSAGE__SIGNATURE_IS_OPERATION, >+ UMLPlugin.INSTANCE.getString( >+ "_UI_Message_SignatureIsOperation_diagnostic", //$NON-NLS-1$ >+ getMessageSubstitutions(context, message)), >+ new Object[]{message})); > } >- return false; > } >- return true; >+ return result; > } >- >+ >+ >+ >+ >+ > /** > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >@@ -174,29 +217,46 @@ > * 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. > * true > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateSignatureIsSignal(Message message, > DiagnosticChain diagnostics, Map context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean result = true; >+ NamedElement signature = message.getSignature(); >+ if (signature instanceof Signal) { >+ if (!message.getArguments().isEmpty()) { >+ List messageArguments = message.getArguments(); >+ List signalAttributes = ((Signal) signature).getAttributes(); >+ if (messageArguments.size() != signalAttributes.size()) { >+ result = false; >+ } >+ for (Iterator arg = messageArguments.iterator(), typed = signalAttributes >+ .iterator(); arg.hasNext() && result;) { >+ TypedElement nextArg = (TypedElement) arg.next(); >+ TypedElement nextTyped = (TypedElement) typed.next(); >+ Type nextArgType = nextArg.getType(); >+ Type nextTypedType = nextTyped.getType(); >+ if (nextArgType != null && nextTypedType != null) { >+ if (!nextArgType.conformsTo(nextTypedType)) { >+ result = false; >+ } >+ } >+ } >+ } >+ } >+ if (!result) { > if (diagnostics != null) { >- diagnostics >- .add(new BasicDiagnostic( >- Diagnostic.ERROR, >- UMLValidator.DIAGNOSTIC_SOURCE, >- UMLValidator.MESSAGE__SIGNATURE_IS_SIGNAL, >- org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE >- .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateSignatureIsSignal", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(message, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >- new Object[]{message})); >+ diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING, >+ UMLValidator.DIAGNOSTIC_SOURCE, >+ UMLValidator.MESSAGE__SIGNATURE_IS_SIGNAL, >+ UMLPlugin.INSTANCE.getString( >+ "_UI_Message_SignatureIsSignal_diagnostic", //$NON-NLS-1$ >+ getMessageSubstitutions(context, message)), >+ new Object[]{message})); > } >- return false; > } >- return true; >+ return result; > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
Kenn.Hussey
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 80307
:
35921
|
36338
|
36914
|
37131
|
37153
|
37217
|
37236
| 37419 |
40586
|
41343
|
84050
|
85114
|
85115
|
85127
|
228168