Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Change UMl model(How to connect artifact to device)
Change UMl model [message #1747924] Wed, 16 November 2016 20:30 Go to next message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 182
Registered: October 2014
Senior Member
Hi,
for (m in UML!Model) {
for (v in UML!Device.all){
var d = v.selectOne(a|a.name = "Device1");

var A : new UML!Artifact;
A.name="New-Artifact";
A.filename="New-Artifact.file";
d.deployment.deployedArtifact.add(A);

I am trying to add artifact to device but i couldnt find the name of the relationship that connect them together .The UML standard is so complex and confusing.Can you please help me.

Thanks,
Taghreed
Re: Change UMl model [message #1747928 is a reply to message #1747924] Wed, 16 November 2016 21:02 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1612
Registered: July 2009
Location: York, UK
Senior Member

Hi Taghreed,

The reference you're looking for seems to be "nestedClassifiers" i.e. the following should work:

var d : new Device;
var a : new Artifact;
d.nestedClassifiers.add(a);


The UML tree editor is very useful for finding valid ways in which UML elements can connect to each other.

Cheers,
Dimitris
Re: Change UMl model [message #1747932 is a reply to message #1747928] Wed, 16 November 2016 22:07 Go to previous messageGo to next message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 182
Registered: October 2014
Senior Member
i do really thank you because i didn't know how to read that tree .
Re: Change UMl model [message #1748284 is a reply to message #1747928] Mon, 21 November 2016 19:52 Go to previous messageGo to next message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 182
Registered: October 2014
Senior Member
Hi,

How can I use a stereotype from MARTE profile and apply it to new device or new artifact which I created using EOL :
var d : new Device;
var a : new Artifact;
d.nestedClassifiers.add(a);

I am using interactive EOL programme so I am wondering if I can browse MARTE stereotypes using EOL and then ask the user to choose one stereotype(using System.user.prompt) and the selected stereotype can be applied to to any UML element like device or artifact.

Thanks,
Taghreed.
Re: Change UMl model [message #1748299 is a reply to message #1748284] Mon, 21 November 2016 22:02 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1612
Registered: July 2009
Location: York, UK
Senior Member

Hi Taghreed,

Stereotype.all should return all available stereotypes. To apply a stereotype to a model element see http://download.eclipse.org/modeling/mdt/uml2/javadoc/3.0.0/org/eclipse/uml2/uml/Element.html#applyStereotype(org.eclipse.uml2.uml.Stereotype)

Cheers,
Dimitris
Re: Change UMl model [message #1748302 is a reply to message #1748299] Mon, 21 November 2016 23:10 Go to previous messageGo to next message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 182
Registered: October 2014
Senior Member
index.php/fa/27658/0/index.php/fa/27657/0/Hi Dimitris,
operation Model addDevice(E :UML!Model){
var d : new Device;
var deviceName :String;
E.packagedElement.add(d);
d.name= System.user.prompt("Give Name to the Device " +deviceName );
var St:Collection =Stereotype.all;
var deviceStereotype: Any;
deviceStereotype= System.user.prompt("choose stereotype for the new device " +St );
"deviceStereotype".print()+deviceStereotype.println();
d.applyStereotype(deviceStereotype);
}
I got the following error:
Method 'applyStereotype' not found for: Device [name=vv, qualifiedName=model::vv, visibility=public, isLeaf=false, isAbstract=false, isFinalSpecialization=false, isActive=false, ]
and also I wasn't able to see the collection in the user message ,it says too large collection has more than 100 elements.(see photo attached)
Can you please help me to view Stereotype.all collection and also tell me what is wrong in applyStereotype method.

Thanks,
Taghreed

[Updated on: Mon, 21 November 2016 23:25]

Report message to a moderator

Re: Change UMl model [message #1748376 is a reply to message #1748302] Tue, 22 November 2016 15:10 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1612
Registered: July 2009
Location: York, UK
Senior Member

Hi Taghreed,

System.user.prompt returns a string. What you need is System.user.choose (see the book for parameters). If the UI provided by System.user.choose is not sufficient for your needs, you'd need to implement an appropriate interface in Java [1].

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/call-java-from-epsilon/
Re: Change UMl model [message #1748384 is a reply to message #1748376] Tue, 22 November 2016 16:14 Go to previous message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 182
Registered: October 2014
Senior Member
Thanks for your help it is working fine now
Previous Topic:Where is the "Model" class come from in example "Modify a Tree model with EOL"
Next Topic:Error executing link validation between EMF models
Goto Forum:
  


Current Time: Sat Nov 17 10:55:26 GMT 2018

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

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

Back to the top