With uml2 tools I select a port and an interface and I want to stereotype
them.

I have the object, when I debug I see that I have the relevant element
selected. Next I want to look up the relevant stereotypes using (got this
from the class diagram example, I'm doing it in the component diagram):

EList<Stereotype> stereotypes = element.getApplicableStereotypes();

My element is an instance of port and I want to retrieve any relevant
stereotypes that exist. By relevant stereotypes I mean stereotypes that
extend UML:port in my uml definition.

However when I do this I get an empty list.

One other thing. When I have retrieved a relevant sterotype and want to
apply it. I can do this with applyStereotype?

If you've defined your profile and stereotypes correctly and you've applied
your profile to your model correctly, then getApplicableStereotypes() should
return all stereotypes that you could apply to your port. If you send your
profile I could have a look at it to double check it.

And yes, applyStereotype() should apply your stereotype.

- James.

"Nick Kirtley" <nickkirtley@gmail.com> wrote in message
news:f2a67332a35c6d66b5e524235968c723$1@www.eclipse.org...
> hi,
>
> With uml2 tools I select a port and an interface and I want to stereotype
> them.
>
> I have the object, when I debug I see that I have the relevant element
> selected. Next I want to look up the relevant stereotypes using (got this
> from the class diagram example, I'm doing it in the component diagram):
>
> EList<Stereotype> stereotypes = element.getApplicableStereotypes();
>
> My element is an instance of port and I want to retrieve any relevant
> stereotypes that exist. By relevant stereotypes I mean stereotypes that
> extend UML:port in my uml definition.
>
> However when I do this I get an empty list.
>
> One other thing. When I have retrieved a relevant sterotype and want to
> apply it. I can do this with applyStereotype?
>
> thx in advance for any help,
>
> regards,
> Nick
>

My model is very simple, I have a stereotype, a metaclass reference and an
extension that links stereotype to the reference class. I then define it.
I did this in the new->other uml diagrams->component. The component
diagram is then linked to the uml meta model right?

So really the only thing i'm not sure about is:
and you've applied
your profile to your model correctly,

Do I have to apply the uml stereotype definitions to my component diagram,
in code or in the ui?

That sounds like a UMLTools usability issue. You might want to ask this
question there.

- James.

"Nick Kirtley" <nickkirtley@gmail.com> wrote in message
news:32b4dfad46f9f1752100445a138a6c75$1@www.eclipse.org...
> hi,
>
> I just noticed something.
>
> If I create a class diagram. In the UML diagram I create a profile, name
> the profile something, then go to umleditor->profile->define. This works
>
> If I create a component diagram. In the UML diagram I create a profile,
> name the profile something, then go to umleditor->profile->define. This
> does NOT work.
>
> If I can't define it then I can't use any stereotypes in the component
> diagram.
>
> regards,
> Nick
>

The getting started articles in UML2 explain how to work programatically
with profiles. Everything you need to work with profiles should be
outlined there, ie. adding stereotypes programatically, defining your
profile etc.

Whether the UML2Tools Component diagram can use that information is a
question I can't answer. Also, I don't know if they provide a convenient
means to "define" your profile, from your previous post it sounds like it
works with Class diagrams but not Component diagrams?

If you follow the instructions in the getting started article regarding
profiles, then getApplicableStereotypes should work. If it doesn't then
you can post your profile with model and I can have a look at it, or you can
step into the getApplicableStereotypes() method and determine why it is
failing.

- James.

"Nick Kirtley" <nickkirtley@gmail.com> wrote in message
news:d690cfc48f64c04f41ee55a02e9e3c63$1@www.eclipse.org...
> hi,
>
> The uml2tools newsgroup seems to be dead. I've seen some questions posted
> but no answers from anyone who really knows anything.
>
> What I want to do is this:
> define stereotypes in the uml diagram
> use the stereotypes to stereotype components in comp. diagram.
>
> As a quick fix I could programmatically add stereotypes so that when I
> right click a component it gets the stereotypes from there.
>
> My question really is can you explain how I can access/modify the profile
> with code so that the comp. diagram can use it, or is this too uml2tools
> specific?
>
> At the moment getApplicableStereotypes returns nothing. I'd like it to
> return some stereotypes that I can use.
>
> regards,
> Nick
>

If you've defined your profile and stereotypes correctly and you've applied
your profile to your model correctly, then getApplicableStereotypes() should
return all stereotypes that you could apply to your port. If you send your
profile I could have a look at it to double check it.

And yes, applyStereotype() should apply your stereotype.

- James.

"Nick Kirtley" <nickkirtley@gmail.com> wrote in message
news:f2a67332a35c6d66b5e524235968c723$1@www.eclipse.org...
> hi,
>
> With uml2 tools I select a port and an interface and I want to stereotype
> them.
>
> I have the object, when I debug I see that I have the relevant element
> selected. Next I want to look up the relevant stereotypes using (got this
> from the class diagram example, I'm doing it in the component diagram):
>
> EList<Stereotype> stereotypes = element.getApplicableStereotypes();
>
> My element is an instance of port and I want to retrieve any relevant
> stereotypes that exist. By relevant stereotypes I mean stereotypes that
> extend UML:port in my uml definition.
>
> However when I do this I get an empty list.
>
> One other thing. When I have retrieved a relevant sterotype and want to
> apply it. I can do this with applyStereotype?
>
> thx in advance for any help,
>
> regards,
> Nick
>

My model is very simple, I have a stereotype, a metaclass reference and an
extension that links stereotype to the reference class. I then define it.
I did this in the new->other uml diagrams->component. The component
diagram is then linked to the uml meta model right?

So really the only thing i'm not sure about is:
and you've applied
your profile to your model correctly,

Do I have to apply the uml stereotype definitions to my component diagram,
in code or in the ui?

That sounds like a UMLTools usability issue. You might want to ask this
question there.

- James.

"Nick Kirtley" <nickkirtley@gmail.com> wrote in message
news:32b4dfad46f9f1752100445a138a6c75$1@www.eclipse.org...
> hi,
>
> I just noticed something.
>
> If I create a class diagram. In the UML diagram I create a profile, name
> the profile something, then go to umleditor->profile->define. This works
>
> If I create a component diagram. In the UML diagram I create a profile,
> name the profile something, then go to umleditor->profile->define. This
> does NOT work.
>
> If I can't define it then I can't use any stereotypes in the component
> diagram.
>
> regards,
> Nick
>

The getting started articles in UML2 explain how to work programatically
with profiles. Everything you need to work with profiles should be
outlined there, ie. adding stereotypes programatically, defining your
profile etc.

Whether the UML2Tools Component diagram can use that information is a
question I can't answer. Also, I don't know if they provide a convenient
means to "define" your profile, from your previous post it sounds like it
works with Class diagrams but not Component diagrams?

If you follow the instructions in the getting started article regarding
profiles, then getApplicableStereotypes should work. If it doesn't then
you can post your profile with model and I can have a look at it, or you can
step into the getApplicableStereotypes() method and determine why it is
failing.

- James.

"Nick Kirtley" <nickkirtley@gmail.com> wrote in message
news:d690cfc48f64c04f41ee55a02e9e3c63$1@www.eclipse.org...
> hi,
>
> The uml2tools newsgroup seems to be dead. I've seen some questions posted
> but no answers from anyone who really knows anything.
>
> What I want to do is this:
> define stereotypes in the uml diagram
> use the stereotypes to stereotype components in comp. diagram.
>
> As a quick fix I could programmatically add stereotypes so that when I
> right click a component it gets the stereotypes from there.
>
> My question really is can you explain how I can access/modify the profile
> with code so that the comp. diagram can use it, or is this too uml2tools
> specific?
>
> At the moment getApplicableStereotypes returns nothing. I'd like it to
> return some stereotypes that I can use.
>
> regards,
> Nick
>