Skip to main content



      Home
Home » Modeling » UML2 » set feature of stereotype
set feature of stereotype [message #477098] Fri, 14 March 2008 07:14 Go to next message
Eclipse UserFriend
Originally posted by: David.Ouagne.spim.jussieu.fr

Hi,

I need to copy the content of stereotype to new stereotype.

I have a static method which get a good result if I apply the profile.
However if the profile has already been applied, my fonction return a
Exception.

My question is: what is the difference between applying a profile and a
profile that was applied on the profile?

copy:

EObject oldEObject = oldElement.getStereotypeApplication(oldStereotype);
EObject newEObject = UMLUtil.safeApplyStereotype(newElement,
newStereotype);
for (EStructuralFeature eStructuralFeature : newEObject.eClass()
.getEAllStructuralFeatures()) {

if (!eStructuralFeature.getName()
.startsWith(Extension.METACLASS_ROLE_PREFIX)) {

if (eStructuralFeature.isChangeable())
newEObject.eSet(eStructuralFeature,
oldEObject.eGet(eStructuralFeature));
}
}
}

apply profile:

Profile profile = pck.getAppliedProfile(profileQualifiedName);
if (profile == null) {
profile = getProfile(profileURI);
pck.applyProfile(profile);
}
return profile;
Re: set feature of stereotype [message #477129 is a reply to message #477098] Tue, 25 March 2008 17:03 Go to previous message
Eclipse UserFriend
David,

It sounds like perhaps the reference to the profile from the exisiting
profile application isn't being successfully resolved. What kind of
exception are you seeing? Would it be possible to provide a stack trace?

Kenn

"DO" <David.Ouagne@spim.jussieu.fr> wrote in message
news:6a049b44e6677eee97f18c047203000f$1@www.eclipse.org...
> Hi,
>
> I need to copy the content of stereotype to new stereotype.
>
> I have a static method which get a good result if I apply the profile.
> However if the profile has already been applied, my fonction return a
> Exception.
>
> My question is: what is the difference between applying a profile and a
> profile that was applied on the profile?
>
> copy:
>
> EObject oldEObject = oldElement.getStereotypeApplication(oldStereotype);
> EObject newEObject = UMLUtil.safeApplyStereotype(newElement,
> newStereotype);
> for (EStructuralFeature eStructuralFeature : newEObject.eClass()
> .getEAllStructuralFeatures()) {
>
> if (!eStructuralFeature.getName()
> .startsWith(Extension.METACLASS_ROLE_PREFIX)) {
>
> if (eStructuralFeature.isChangeable())
> newEObject.eSet(eStructuralFeature,
> oldEObject.eGet(eStructuralFeature));
> }
> }
> }
>
> apply profile:
>
> Profile profile = pck.getAppliedProfile(profileQualifiedName);
> if (profile == null) {
> profile = getProfile(profileURI);
> pck.applyProfile(profile);
> } return profile;
>
>
Re: set feature of stereotype [message #626265 is a reply to message #477098] Tue, 25 March 2008 17:03 Go to previous message
Eclipse UserFriend
David,

It sounds like perhaps the reference to the profile from the exisiting
profile application isn't being successfully resolved. What kind of
exception are you seeing? Would it be possible to provide a stack trace?

Kenn

"DO" <David.Ouagne@spim.jussieu.fr> wrote in message
news:6a049b44e6677eee97f18c047203000f$1@www.eclipse.org...
> Hi,
>
> I need to copy the content of stereotype to new stereotype.
>
> I have a static method which get a good result if I apply the profile.
> However if the profile has already been applied, my fonction return a
> Exception.
>
> My question is: what is the difference between applying a profile and a
> profile that was applied on the profile?
>
> copy:
>
> EObject oldEObject = oldElement.getStereotypeApplication(oldStereotype);
> EObject newEObject = UMLUtil.safeApplyStereotype(newElement,
> newStereotype);
> for (EStructuralFeature eStructuralFeature : newEObject.eClass()
> .getEAllStructuralFeatures()) {
>
> if (!eStructuralFeature.getName()
> .startsWith(Extension.METACLASS_ROLE_PREFIX)) {
>
> if (eStructuralFeature.isChangeable())
> newEObject.eSet(eStructuralFeature,
> oldEObject.eGet(eStructuralFeature));
> }
> }
> }
>
> apply profile:
>
> Profile profile = pck.getAppliedProfile(profileQualifiedName);
> if (profile == null) {
> profile = getProfile(profileURI);
> pck.applyProfile(profile);
> } return profile;
>
>
Previous Topic:Re: UML to XMI export programmatically?
Next Topic:UML templates
Goto Forum:
  


Current Time: Sun Aug 31 01:15:34 EDT 2025

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

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

Back to the top