problem with IntroductionToUML2Profiles [message #1790789] |
Sun, 17 June 2018 19:17 |
gary s thompson Messages: 92 Registered: July 2009 |
Member |
|
|
I have been trying to get uml2 profiles to work programmatically and downloaded uml2.articles_200607181325.zip from https://www.eclipse.org/modeling/mdt/uml2/docs/articles/Introduction_to_UML2_Profiles/article.html
I made a project and ran the code but i am getting an exception
Exception in thread "main" java.lang.IllegalArgumentException: [email][email][email][email]org.eclipse.uml2.uml.internal.impl.ClassImpl@faa3fed[/email][/email][/email][/email] (name: Property, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false)
at org.eclipse.uml2.uml.internal.operations.StereotypeOperations.createExtension(StereotypeOperations.java:358)
at org.eclipse.uml2.uml.internal.impl.StereotypeImpl.createExtension(StereotypeImpl.java:270)
at org.eclipse.uml2.articles.IntroductionToUML2Profiles.createExtension(IntroductionToUML2Profiles.java:86)
at org.eclipse.uml2.articles.IntroductionToUML2Profiles.main(IntroductionToUML2Profiles.java:254)
when it calls Stereotype.createExtension
any help would be gratefully recieved
regards
gary
[Updated on: Sun, 17 June 2018 21:04] Report message to a moderator
|
|
|
|
|
|
|
Re: problem with IntroductionToUML2Profiles [message #1794537 is a reply to message #1790859] |
Sat, 01 September 2018 12:08 |
gary s thompson Messages: 92 Registered: July 2009 |
Member |
|
|
ok so i have now had time to come back to this. The failure is at the test
!metaclass.isMetaclass() in org.eclipse.uml2.uml.internal.operations.StereotypeOperations.createExtension(StereotypeOperations.java:358) which gives false to the metaclass being a metaclass
I have looked further back in the example code and found the metaclass referred to is created as follows
protected static org.eclipse.uml2.uml.Class referenceMetaclass(
Profile profile, String name) {
Model umlMetamodel = (Model) load(URI
.createURI(UMLResource.UML_METAMODEL_URI));
org.eclipse.uml2.uml.Class metaclass = (org.eclipse.uml2.uml.Class) umlMetamodel
.getOwnedType(name);
profile.createMetaclassReference(metaclass);
out("Metaclass '" + metaclass.getQualifiedName() + "' referenced.");
return metaclass;
}
which is called as follows
org.eclipse.uml2.uml.Class propertyMetaclass = referenceMetaclass(
ecoreProfile, UMLPackage.Literals.PROPERTY.getName());
at this point I am sorry I am stumped as I don't have enough understanding of the workings of uml2 to understand what is going wrong, the code appears to be exactly the same as that in the article....
if you have a working copy of the example code could you end me yours because the one I sent to you is what I am using. Otherwise it must be a misconfiguration in my uml2/eclipse installation which is even more of a nightmare
regards
Gary
[Updated on: Sat, 01 September 2018 12:09] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03664 seconds