Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Problem applying stereotype
icon9.gif  Problem applying stereotype [message #556478] Wed, 01 September 2010 14:03 Go to next message
123star  is currently offline 123star Friend
Messages: 70
Registered: June 2010
Member
Hi,

I have a problem applying a stereotype to a Port, here's my code:

// port is the original Port
// portCopy is the copy of port

Profile prof = port.getModel().getAppliedProfile("MARTE::MARTE_DesignModel::HLAM ");

Stereotype stereo = prof.createOwnedStereotype("RtFeature", true);

portCopy.applyStereotype(prof.createOwnedStereotype("RtFeature ", true));

applyStereotype throws an IllegalArgument exception, what I'm doing wrong?

Thanks in advance
Re: Problem applying stereotype [message #556541 is a reply to message #556478] Wed, 01 September 2010 16:34 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, 123star,

You are attempting to (repeatedly) create the RtFeature stereotype in
the HLAM profile. This has several problems:

- profiles are read-only from the perspective of the models that
apply them
- you wouldn't want to define the same stereotype multiple times,
anyways
- your new RtFeature stereotypes have no attributes and extend
no metaclasses, so you can't apply them to any elements
- you aren't creating a new Ecore definition of the profile that
would allow you to apply the newly-created RtFeature stereotypes

If the HLAM profile already has an RtFeature stereotype and it has an
Ecore definition, then you need only to accessing the existing
stereotype using the Profile::getOwnedStereotype(String) API instead of
createOwnedStereotype.

HTH,

Christian


On 01/09/10 10:03 AM, 123star wrote:
> Hi,
>
> I have a problem applying a stereotype to a Port, here's my code:
>
> // port is the original Port
> // portCopy is the copy of port
>
> Profile prof =
> port.getModel().getAppliedProfile("MARTE::MARTE_DesignModel::HLAM ");
>
> Stereotype stereo = prof.createOwnedStereotype("RtFeature", true);
>
> portCopy.applyStereotype(prof.createOwnedStereotype("RtFeature ", true));
>
> applyStereotype throws an IllegalArgument exception, what I'm doing wrong?
>
> Thanks in advance
Previous Topic:how to create object diagram using UML 2 eclipse tool
Next Topic:Problem applying stereotype
Goto Forum:
  


Current Time: Thu Mar 28 11:30:59 GMT 2024

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

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

Back to the top