Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » definecustomoperations in UMLEnvironment
definecustomoperations in UMLEnvironment [message #476753] Thu, 13 December 2007 08:33 Go to next message
charfi asma is currently offline charfi asmaFriend
Messages: 78
Registered: July 2009
Member
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
Re: definecustomoperations in UMLEnvironment [message #476754 is a reply to message #476753] Wed, 12 December 2007 23:48 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
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 #476756 is a reply to message #476754] Thu, 13 December 2007 19:39 Go to previous message
charfi asma is currently offline charfi asmaFriend
Messages: 78
Registered: July 2009
Member
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!



"Ed Merks" <merks@ca.ibm.com> a
Re: definecustomoperations in UMLEnvironment [message #476757 is a reply to message #476756] Thu, 13 December 2007 14:32 Go to previous message
Eclipse UserFriend
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 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
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 #625728 is a reply to message #476754] Thu, 13 December 2007 19:39 Go to previous message
charfi asma is currently offline charfi asmaFriend
Messages: 78
Registered: July 2009
Member
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!



"Ed Merks" <merks@ca.ibm.com> a
Re: definecustomoperations in UMLEnvironment [message #625729 is a reply to message #476756] Thu, 13 December 2007 14:32 Go to previous message
Eclipse UserFriend
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<-----
Previous Topic:definecustomoperations in UMLEnvironment
Next Topic:A question about the code
Goto Forum:
  


Current Time: Tue Apr 23 06:52:21 GMT 2024

Powered by FUDForum. Page generated in 0.04537 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top