Stereotypes are not applied to exported MD-xmi files [message #717387] |
Sat, 20 August 2011 06:30  |
Eclipse User |
|
|
|
Originally posted by: Philipp Kalb
Hi
I have a problem applying stereotypes to magic draw Eclipse UML2 v3.x
exported xmi files.
I create a class diagram with a profile in magic draw. The profile is
very simple and just adds a stereotype to one of the classes properties.
I export this file as an UML2 file and import it into my RCP
application. The general import works fine, I can go through all
information of the model and all elements of the profile. My problem is
that the stereotype is not applied to the property after the import.
If I use (a quit stupid) for-loop to manually apply the stereotype it
works fine. But of course this is a very static work around....
------------------------
for ( Stereotype st2:slot.getDefiningFeature().getApplicableStereotypes())
{
if (slot.getDefiningFeature().getName().equals("state") &&
st2.getName().contains("StateObject"))
{
slot.getDefiningFeature().applyStereotype(st2);
}
} //I hope the format is not too bad to read...
------------------------
So I guess the profile is properly loaded, since the information is
already stored in the ApplicableStereotypes list and applying the
stereotype with the loop works fine.
Without the previous loop I can not get any applied stereotypes but of
course there should be some. If I query the model for applied profiles I
get the right ones, so the profile itself should be correctly loaded and
applied.
From the previous posts about stereotypes in this newsgroup I learned
that I must use absolute URL for file loading etc. but nothing helps :-(
Since I spent some hours with that problem now, I dare to ask if you
have any ideas or hints?
best regards
Philipp
|
|
|
|
|
Re: Stereotypes are not applied to exported MD-xmi files [message #718764 is a reply to message #717802] |
Thu, 25 August 2011 05:18  |
Eclipse User |
|
|
|
On 08/22/2011 01:23 PM, Philipp Kalb wrote:
> Hi
>
> Thanks a lot for your answer.
> In the beginning I thought that this is not possible too but than I
> tried to open the models + profile with the Eclipse EMF UML editor and
> everything worked perfectly. The editor shows the model and all applied
> stereotypes without any problems and error. That's why I think that
> there is something wrong with my loading procedures but I could not
> solve the problem :(
>
> cheers
> Philipp
>
> Am 22.08.2011 10:36, schrieb Vlad Varnica:
>> Stereotypes are not exportable between tools.
>> You can export a model but can not export profiles between tools.
>>
>> What you need to do is to create a new profile inside Eclipse using a
>> compatible and compliant tool with the UM2 metamodel. Once the profile
>> is created you ned to load it and then launch your model.
>
>
hi philipp,
exporting models with stereotypes applied is definitely possible, as you
wrote. we were doing it the last years due to a missing useable
modelling tool in eclipse (now we use papyrus). Maybe take a closer look
at the implementation of the UMLEditor and check how they actually load
the model and build up the according resource set.
cheers,
philipp
|
|
|
Powered by
FUDForum. Page generated in 0.31397 seconds