...
 
Commits (2)
......@@ -19,18 +19,19 @@
package fr.centralesupelec.edf.riseclipse.iec61850.scl.util;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl;
import org.eclipse.emf.ecore.xmi.XMLResource;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseResourceFactory;
/**
* <!-- begin-user-doc -->
* The <b>Resource Factory</b> associated with the package.
* <!-- end-user-doc -->
* @see fr.centralesupelec.edf.riseclipse.iec61850.scl.util.SclResourceImpl
* @generated
* @generated NOT
*/
public class SclResourceFactoryImpl extends ResourceFactoryImpl {
public class SclResourceFactoryImpl extends ResourceFactoryImpl implements IRiseClipseResourceFactory {
/**
* Creates an instance of the resource factory.
......@@ -46,20 +47,20 @@ public class SclResourceFactoryImpl extends ResourceFactoryImpl {
* Creates an instance of the resource.
* <!-- begin-user-doc --> <!--
* end-user-doc -->
* @generated
* @generated NOT
*/
@Override
public Resource createResource( URI uri ) {
XMLResource result = new SclResourceImpl(uri);
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
public SclResourceImpl createResource( URI uri ) {
SclResourceImpl result = new SclResourceImpl(uri);
result.getDefaultSaveOptions().put( XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE );
result.getDefaultLoadOptions().put( XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE );
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
result.getDefaultSaveOptions().put( XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE );
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultLoadOptions().put( XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE );
result.getDefaultSaveOptions().put( XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE );
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
result.getDefaultLoadOptions().put( XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE );
return result;
}
......
......@@ -22,20 +22,39 @@ package fr.centralesupelec.edf.riseclipse.iec61850.scl.util;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.SCL;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.SclPackage;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.impl.SclPackageImpl;
import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseConsole;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseResource;
import fr.centralesupelec.edf.riseclipse.util.RiseClipseMetamodel;
import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseResourceSet;
@SuppressWarnings( "unused" )
public class SclResourceSetImpl extends AbstractRiseClipseResourceSet {
private SclResourceFactoryImpl resourceFactory;
public SclResourceSetImpl( boolean strictContent, IRiseClipseConsole console ) {
super( strictContent, console );
resourceFactory = new SclResourceFactoryImpl();
}
@Override
protected SclResourceImpl createRiseClipseResource( URI uri, String contentType ) {
Optional< String > metamodel = RiseClipseMetamodel.findMetamodelFor( uri );
if( metamodel.isPresent() && SclPackage.eNS_URI.equals( metamodel.get() )) {
return resourceFactory.createResource( uri );
}
return null;
}
/* (non-Javadoc)
......