[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.mdt] Re: [UML2] how to load UML_PRIMITIVE_TYPES_LIBRARY

Hi Kenn,

first, sorry for misplacing the message in the MDT group. Newbie!


I tried both the two approaches mentioned in the article, neither worked. the one as in the Profile-tutorial looks like this:

PrimitiveType primitiveType = importPrimitiveType( "Boolean");

protected static PrimitiveType importPrimitiveType(String name) {
Model umlLibrary = (Model)load(URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI));
PrimitiveType primitiveType = (PrimitiveType) umlLibrary.getOwnedType(name);
return primitiveType;
}

protected static org.eclipse.uml2.uml.Package load(URI uri) {
org.eclipse.uml2.uml.Package package_ = null;
try {
Resource resource = RESOURCE_SET.getResource(uri, true); (****) package_ =(org.eclipse.uml2.uml.Package)EcoreUtil.getObjectByType(
resource.getContents(), UMLPackage.Literals.PACKAGE); } catch (WrappedException we) {
}
return package_;
}




I got Exception at (****):
"Cannot create a resource for 'pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml'; a registered resource factory is needed"


I suspect the problem you are having relates to not registering the
pathmaps for the UML library resources

Can you give me more hints on this?

best Regards! Jinhui