|
|
Re: new Problem on applieng a StereoType [message #474276 is a reply to message #474274] |
Wed, 18 July 2007 11:58 |
Philippe Messages: 100 Registered: July 2009 |
Senior Member |
|
|
Hello Jan,
AFAIK stereotypes needs to be defined within a profile, and you have to
apply this profile to your package "classes" before you can apply
stereotypes to its classes.
You can still have a look at
http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html
There might have some changes since this article but the learning about
profile and stereotypes is still good
Regards,
Philippe
Jan Reimann wrote:
> Hello NG, hello James ;)
> at first I want to congratulate James for his "upgrade" ;)
> Well, here is my problem. I have two methods. One is creating a Package
> with some classes and the other creates a Package with some stereotypes.
> Now I want to apply a StereoType to a Class after creating both
> Packages. I tried it as follows:
>
>
> Package classes = createClassDiagramPackage();
> Class classA = getElementByName(Class.class, classes, CLASS_A_NAME);
> Package stereoTypes = createStereoTypePackage();
> Stereotype st = getElementByName(Stereotype.class, stereoTypes,
> STEREOTYPE_TEST);
> classA.applyStereotype(st);
>
>
>
> But all I get is IllegalArgumentException when applieng the StereoType.
> My method getElementByName looks like this:
>
>
> public static <T extends NamedElement> T getElementByName(
> java.lang.Class<T> klasse, Package owningPackage, String name) {
> EList<Element> elements = owningPackage.allOwnedElements();
> for (Element element : elements) {
> if (klasse.isInstance(element)) {
> String tempName = ((NamedElement)element).getName();
> if (tempName.equals(name)) {
> return klasse.cast(element);
> }
> }
> }
> return null;
> }
>
>
> This method works fine - that means I don't get null as result. So why
> can't I apply the StereoType?
>
>
> greets
> J.R.
|
|
|
|
|
|
Re: new Problem on applieng a StereoType [message #623753 is a reply to message #474274] |
Wed, 18 July 2007 11:58 |
Philippe Messages: 100 Registered: July 2009 |
Senior Member |
|
|
Hello Jan,
AFAIK stereotypes needs to be defined within a profile, and you have to
apply this profile to your package "classes" before you can apply
stereotypes to its classes.
You can still have a look at
http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html
There might have some changes since this article but the learning about
profile and stereotypes is still good
Regards,
Philippe
Jan Reimann wrote:
> Hello NG, hello James ;)
> at first I want to congratulate James for his "upgrade" ;)
> Well, here is my problem. I have two methods. One is creating a Package
> with some classes and the other creates a Package with some stereotypes.
> Now I want to apply a StereoType to a Class after creating both
> Packages. I tried it as follows:
>
>
> Package classes = createClassDiagramPackage();
> Class classA = getElementByName(Class.class, classes, CLASS_A_NAME);
> Package stereoTypes = createStereoTypePackage();
> Stereotype st = getElementByName(Stereotype.class, stereoTypes,
> STEREOTYPE_TEST);
> classA.applyStereotype(st);
>
>
>
> But all I get is IllegalArgumentException when applieng the StereoType.
> My method getElementByName looks like this:
>
>
> public static <T extends NamedElement> T getElementByName(
> java.lang.Class<T> klasse, Package owningPackage, String name) {
> EList<Element> elements = owningPackage.allOwnedElements();
> for (Element element : elements) {
> if (klasse.isInstance(element)) {
> String tempName = ((NamedElement)element).getName();
> if (tempName.equals(name)) {
> return klasse.cast(element);
> }
> }
> }
> return null;
> }
>
>
> This method works fine - that means I don't get null as result. So why
> can't I apply the StereoType?
>
>
> greets
> J.R.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03690 seconds