1 7 package Olj.util; 8 9 import Olj.OljPackage; 10 11 import org.eclipse.emf.common.util.URI; 12 13 import org.eclipse.emf.ecore.EPackage; 14 15 import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; 16 17 import org.eclipse.emf.ecore.resource.Resource; 18 19 import org.eclipse.emf.ecore.util.BasicExtendedMetaData; 20 import org.eclipse.emf.ecore.util.ExtendedMetaData; 21 22 import org.eclipse.emf.ecore.xmi.XMLResource; 23 24 import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl; 25 26 33 public class OljResourceFactoryImpl extends XMLResourceFactoryImpl { 34 39 protected ExtendedMetaData extendedMetaData; 40 41 47 public OljResourceFactoryImpl() { 48 super(); 49 extendedMetaData = new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE)); 50 extendedMetaData.putPackage(null, OljPackage.eINSTANCE); 51 } 52 53 59 public Resource createResource(URI uri) { 60 XMLResource result = new OljResourceImpl(uri); 61 result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData); 62 result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData); 63 64 result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); 65 result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); 66 67 result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE); 68 return result; 69 } 70 71 } | Popular Tags |