Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Applying stereotypes to metaclass of UML meta model middleweight extension
Applying stereotypes to metaclass of UML meta model middleweight extension [message #647801] Sun, 09 January 2011 12:45 Go to next message
Kirsten M. Z. is currently offline Kirsten M. Z.
Messages: 131
Registered: July 2010
Senior Member
Hi @all,

maybe the title already explains what I am trying to do.

I have created an UML2 meta model extension. Please consider the following Ecore file for this:

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="MyModel"
    nsURI="http://my" nsPrefix="my">
  <eClassifiers xsi:type="ecore:EClass" name="ClassEx" eSuperTypes="platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Class">
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="ex" eType="ecore:EDataType platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Integer"/>
  </eClassifiers>
</ecore:EPackage>


For creating the profile, I decided to use static UML profiles, and I followed this approach:

http://nyssen.blogspot.com/2009/09/defining-static-profiles- with-eclipse.html

It works fine so far. Thanks to Alexander Ny├čen!

Now, I wanted to create a profile with two stereotypes (one for checking the concept only):

StereotypeBasic which extends <<metaclass>> uml::Class
StereotypeEx which shall extend <<metaclass>> my::ClassEx


The first problem I am facing: How can I get "<<metaclass>> ClassEx" into my profile? Of course, this not possible first. So I experimented "faking" another "http://my" meta model by creating an "my.metamodel.uml" which extends "UML.metamodel.uml". Of course, I am using the Ecore and Standard profile there for applying "<<ePackage>>", "<<metamodel>>" and "<<metaclass>>" stereotypes. I tried "copying" the style of the "UML.metamodel.uml". This way, I was able to use "<<metaclass>> my::ClassEx" in my profile.

Afterwards, I used the aprroach of static UML profiles, so I created a genmodel for my profile. However, I have edited the generated stuff in order to use my old "my.ecore" and "my.genmodel" (A new one is generated, because of "my.metamodel.uml", but this should not be used, right?)

Finally, I generate my model code, start a new Eclipse workbench with all plug-ins loaded. The problem: I can apply my stereotype "StereotypeBasic" to all "uml::Class" (also "my::ClassEx") of my model, but I am not able to apply "StereotypeEx" to "my::ClassEx".

Does anyone think/know if it is (im-)possible?

Thanks in advance!

[Updated on: Sun, 09 January 2011 12:48]

Report message to a moderator

Re: Applying stereotypes to metaclass of UML meta model middleweight extension [message #647837 is a reply to message #647801] Sun, 09 January 2011 19:11 Go to previous message
Rafael Chaves is currently offline Rafael Chaves
Messages: 161
Registered: July 2009
Senior Member
Quote:
but I am not able to apply "StereotypeEx" to "my::ClassEx


Could you be more clear about what mean by not being able?

Does applyStereotype return without failure but does not do what is expected? Does it fail with an exception? There are many reasons why applyStereotype can fail, and the reported error . In either case, I would debug into the applyStereotype code and determine where it is failing to do what you expect.

This is from ElementOperations.applyStereotype:

	
		EClass definition = getDefinition(element, stereotype);	
		if (definition == null || getExtension(element, stereotype) == null
			|| element.getStereotypeApplication(stereotype) != null) {
			throw new IllegalArgumentException(String.valueOf(stereotype));
		}


Right there there are possibilities for applyStereotypes to fail.

Cheers,

Rafael
Previous Topic:why during my unload crossreferencer resolve my already unloaded resources .... ?
Next Topic:*current* tutorial for UML2?
Goto Forum:
  


Current Time: Thu Oct 23 11:43:30 GMT 2014

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

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