public static List<PrimitiveType> getXsdPrimitiveTypes() { ResourceSet rs = SingleGlobalResourceSet.get(); Resource primitiveTypesLibrary = null; // TODO Look up the primitive types library more graceful try { primitiveTypesLibrary = rs.getResource( URI.createURI("platform:/resource/edna/kernel/datamodel/XSDPrimitiveTypes.uml"), true); } catch (Exception e) { primitiveTypesLibrary = rs.getResource( URI.createURI("platform:/resource/kernel/datamodel/XSDPrimitiveTypes.uml"), true); } ArrayList<PrimitiveType> result = Lists.newArrayList(); Model m = (Model) primitiveTypesLibrary.getContents().get(0); for (EObject p : EcoreUtil2.findAllByType(m.eAllContents(), PrimitiveType.class)) { result.add((PrimitiveType) p); } return result; }
public static void attachToDummyResource(EObject model) { URI uri = URI.createURI("platform:/resource/dummy.xmi"); Resource r = SingleGlobalResourceSet.get().createResource(uri); r.getContents().add(model); }
public static void registerResource(Resource res) { if (res != null) { LOG.debug("Adding " + res.getURI() + " to resource set"); SingleGlobalResourceSet.get().getResources().add(res); } }