Commit 9db9373a authored by Dominique Marcadet's avatar Dominique Marcadet

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

Resolve "update to resource changes in Main"

Closes #19

See merge request !18
parents 719231e5 05dc0b86
Pipeline #7631 passed with stages
in 29 seconds
......@@ -21,12 +21,12 @@ package fr.centralesupelec.edf.riseclipse.iec61850.nsd.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.
......@@ -34,7 +34,7 @@ import org.eclipse.emf.ecore.xmi.XMLResource;
* @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.util.NsdResourceImpl
* @generated
*/
public class NsdResourceFactoryImpl extends ResourceFactoryImpl {
public class NsdResourceFactoryImpl extends ResourceFactoryImpl implements IRiseClipseResourceFactory {
/**
* Creates an instance of the resource factory.
* <!-- begin-user-doc -->
......@@ -52,8 +52,8 @@ public class NsdResourceFactoryImpl extends ResourceFactoryImpl {
* @generated
*/
@Override
public Resource createResource( URI uri ) {
XMLResource result = new NsdResourceImpl( uri );
public NsdResourceImpl createResource( URI uri ) {
NsdResourceImpl result = new NsdResourceImpl( uri );
result.getDefaultSaveOptions().put( XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE );
result.getDefaultLoadOptions().put( XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE );
......
......@@ -26,6 +26,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import fr.centralesupelec.edf.riseclipse.iec61850.nsd.Doc;
......@@ -34,8 +35,10 @@ import fr.centralesupelec.edf.riseclipse.iec61850.nsd.LNClass;
import fr.centralesupelec.edf.riseclipse.iec61850.nsd.LNClasses;
import fr.centralesupelec.edf.riseclipse.iec61850.nsd.NS;
import fr.centralesupelec.edf.riseclipse.iec61850.nsd.NSDoc;
import fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage;
import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseConsole;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole;
import fr.centralesupelec.edf.riseclipse.util.RiseClipseMetamodel;
import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseResourceSet;
......@@ -43,12 +46,23 @@ public class NsdResourceSetImpl extends AbstractRiseClipseResourceSet {
private Map< String, NS > nsdResources;
private Map< String, NSDoc > nsdocResources;
private NsdResourceFactoryImpl resourceFactory;
public NsdResourceSetImpl( boolean strictContent, IRiseClipseConsole console ) {
super( strictContent, console );
nsdResources = new HashMap<>();
nsdocResources = new HashMap<>();
resourceFactory = new NsdResourceFactoryImpl();
}
@Override
protected NsdResourceImpl createRiseClipseResource( URI uri, String contentType ) {
Optional< String > metamodel = RiseClipseMetamodel.findMetamodelFor( uri );
if( metamodel.isPresent() && NsdPackage.eNS_URI.equals( metamodel.get() )) {
return resourceFactory.createResource( uri );
}
return null;
}
@Override
......
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