Commit b4f3998e authored by Dominique Marcadet's avatar Dominique Marcadet

Merge branch '50-update-to-resource-changes-in-main' into 'master'

Resolve "update to resource changes in Main"

Closes #50

See merge request RiseClipseGroup/RiseClipseMetamodel_SCL2003!45
parents c17b2412 2db872fe
...@@ -19,18 +19,19 @@ ...@@ -19,18 +19,19 @@
package fr.centralesupelec.edf.riseclipse.iec61850.scl.util; package fr.centralesupelec.edf.riseclipse.iec61850.scl.util;
import org.eclipse.emf.common.util.URI; 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.resource.impl.ResourceFactoryImpl;
import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.ecore.xmi.XMLResource;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseResourceFactory;
/** /**
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
* The <b>Resource Factory</b> associated with the package. * The <b>Resource Factory</b> associated with the package.
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @see fr.centralesupelec.edf.riseclipse.iec61850.scl.util.SclResourceImpl * @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. * Creates an instance of the resource factory.
...@@ -46,20 +47,20 @@ public class SclResourceFactoryImpl extends ResourceFactoryImpl { ...@@ -46,20 +47,20 @@ public class SclResourceFactoryImpl extends ResourceFactoryImpl {
* Creates an instance of the resource. * Creates an instance of the resource.
* <!-- begin-user-doc --> <!-- * <!-- begin-user-doc --> <!--
* end-user-doc --> * end-user-doc -->
* @generated * @generated NOT
*/ */
@Override @Override
public Resource createResource( URI uri ) { public SclResourceImpl createResource( URI uri ) {
XMLResource result = new SclResourceImpl(uri); SclResourceImpl result = new SclResourceImpl(uri);
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); result.getDefaultSaveOptions().put( XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE );
result.getDefaultLoadOptions().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.getDefaultLoadOptions().put( XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE );
result.getDefaultSaveOptions().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; return result;
} }
......
...@@ -22,20 +22,39 @@ package fr.centralesupelec.edf.riseclipse.iec61850.scl.util; ...@@ -22,20 +22,39 @@ package fr.centralesupelec.edf.riseclipse.iec61850.scl.util;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.Resource;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.SCL; 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.AbstractRiseClipseConsole;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole; 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; import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseResourceSet;
@SuppressWarnings( "unused" ) @SuppressWarnings( "unused" )
public class SclResourceSetImpl extends AbstractRiseClipseResourceSet { public class SclResourceSetImpl extends AbstractRiseClipseResourceSet {
private SclResourceFactoryImpl resourceFactory;
public SclResourceSetImpl( boolean strictContent, IRiseClipseConsole console ) { public SclResourceSetImpl( boolean strictContent, IRiseClipseConsole console ) {
super( strictContent, 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) /* (non-Javadoc)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment