|
|
|
Re: definecustomoperations in UMLEnvironment [message #476757 is a reply to message #476756] |
Thu, 13 December 2007 14:32  |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Asma,
Yes, you can use the EcoreFactory to create an annotation, but the UML2 API
also provides a factory method on its elements. See
Element::createAnnotation(source : String) : EAnnotation
Cheers,
Christian
charfi asma wrote:
> Hi,
>
> when I write EAnnotation annotation =
> UMLFactory.eINSTANCE.createEAnnotation();
> it did not work. there is no createEAnnotation() methode in UMLFactory.
> did you mean I should import org.eclipse.emf.ecore.EcoreFactory;and use it
> instead of UMLFactory in all my classes?
> If yes, I write EAnnotation annotation =
> EcoreFactory.eINSTANCE.createEAnnotation(); but I still have problem in
> callOperation.
> this method is not executed.
> before, I have this error "Cannot call operation (regexMatch) because it
> is not a query" and Christian Damus sugest to add
> Operation::setIsQuery(true) and it reseolved the first problem (operation
> is not a query).
>
> thank you!
>
-----8<-----
|
|
|
Re: definecustomoperations in UMLEnvironment [message #625727 is a reply to message #476753] |
Wed, 12 December 2007 23:48  |
Ed Merks Messages: 33007 Registered: July 2009 |
Senior Member |
|
|
Charfi,
UML's Element extends EModelElement, so I think you can annotate it
exactly the same way.
charfi asma wrote:
> Hi,
> I have this code to define neuw EOperation (the class extend
> EcoreEnvironment) and I want to do the same but to define a new Operation
> (org.eclipse.uml2.uml.Operation), so my class extend UMLEnvironment instead
>
> the code referred to the class that extend EcoreEnvironment
> private void defineCustomOperations() {
>
> EOperation nbligne;
>
> nbligne = EcoreFactory.eINSTANCE.createEOperation();
>
> nbligne.setName("nbligne");
>
> nbligne.setEType(getOCLStandardLibrary().getString());
>
> EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation();
>
> annotation.setSource("MyEnvironment");
>
> nbligne.getEAnnotations().add(annotation);
>
>
> addOperation(getOCLStandardLibrary().getString(), nbligne);
>
> when I try to define a new UML operation I write this:(I chaged to UML but I
> can not find UMLFactory.eINSTANCE.createAnnotation())
>
> private void defineCustomOperations() {
>
> Operation nbligne;
>
> nbligne= UMLFactory.eINSTANCE.createOperation();
>
> nbligne.setName("nbligne");
>
> nbligne.setType(getOCLStandardLibrary().getString());
>
> nbligne.setIsQuery(true);
>
> addOperation(getOCLStandardLibrary().getString(), regexMatch); }
>
> The question is, what is the equivalent of EAnnotation in UML, how to
> annotate operation using UML?
>
> thank you very much.
>
> asma
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: definecustomoperations in UMLEnvironment [message #625729 is a reply to message #476756] |
Thu, 13 December 2007 14:32  |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Asma,
Yes, you can use the EcoreFactory to create an annotation, but the UML2 API
also provides a factory method on its elements. See
Element::createAnnotation(source : String) : EAnnotation
Cheers,
Christian
charfi asma wrote:
> Hi,
>
> when I write EAnnotation annotation =
> UMLFactory.eINSTANCE.createEAnnotation();
> it did not work. there is no createEAnnotation() methode in UMLFactory.
> did you mean I should import org.eclipse.emf.ecore.EcoreFactory;and use it
> instead of UMLFactory in all my classes?
> If yes, I write EAnnotation annotation =
> EcoreFactory.eINSTANCE.createEAnnotation(); but I still have problem in
> callOperation.
> this method is not executed.
> before, I have this error "Cannot call operation (regexMatch) because it
> is not a query" and Christian Damus sugest to add
> Operation::setIsQuery(true) and it reseolved the first problem (operation
> is not a query).
>
> thank you!
>
-----8<-----
|
|
|
Powered by
FUDForum. Page generated in 0.02139 seconds