Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Upgrade from UML2-2.2.1 to UML2-3.0.0
Upgrade from UML2-2.2.1 to UML2-3.0.0 [message #627917] Tue, 01 September 2009 12:40
Scott is currently offline ScottFriend
Messages: 33
Registered: July 2009
Member
Hi,
I’m new to this group and have the following question:
I have the following code working fine with Eclipse-3.4.1, EMF-2.4.1, and
UML2-2.2.1.

public static Model initResourceSet(String inputFile){
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);

resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
Map uriMap = resourceSet.getURIConverter().getURIMap();
URI uri =
URI.createURI(" jar:file:/C:/Eclipse-3.4.1/plugins/org.eclipse.uml2.uml.reso urces_2.2.0.v200805131030.jar!/ ");
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
uri.appendSegment("profiles").appendSegment(""));

Resource res = resourceSet.getResource(URI.createURI(inputFile), true);
return (Model) (res.getContents().get(0));
}

Then I upgraded to Eclipse-3.5, EMF-2.5, and UML2-3.0.0, and used new
jars, with only the following change:

URI uri =
URI.createURI(" jar:file:/C:/Eclipse-3.5/plugins/org.eclipse.uml2.uml.resour ces_3.0.0.v200906011111.jar!/ ");

Now, I’m getting the following error:

Exception in thread "main" java.lang.ClassCastException:
org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl cannot be cast to
org.eclipse.uml2.uml.Model

At this line: return (Model) (res.getContents().get(0));

Am I missing something?, Can anyone please help?


Thanks,

Scott
Previous Topic:UML2 Stereotypes missing when loading standalone; works correctly when running as plugin
Next Topic:UML element already stereotyped in the palette to drag and drop onto the editor
Goto Forum:
  


Current Time: Fri Sep 20 14:11:09 GMT 2024

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

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

Back to the top